[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
heup
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 30
Thread images: 3
File: haskell_logo1.png (30 KB, 647x599) Image search: [Google]
haskell_logo1.png
30 KB, 647x599
Does anyone know haskell ?
Im studying software engineering and they gave us haskell as a project to learn. I tried to do it but i just dont get it. especially because all it is is mathematical problems. Which are very simple to do even on paper, but i just dont know how to make it work on haskell. I could provide you with the code

for example i have to check if two sets are equal . but Prof. Hitler gave us this :

multiEqual :: (Eq a) => [a] -> [a] -> Bool

meaning I have to stick to the Eq type and cant just compare.


Help me g, youre my only hope
>>
>>53641027
1. those are lists, not sets
2. Eq is a typeclass, not a type
3. the whole point about Eq a is it says that a is a type that can be compared

So, given the structure of a list and the fact you can just compare it's elements, does that give you any idea of what you should be doing? If it helps, given the amount you seem to know already, you'll want to use a recursive solution.
>>
>>53641027
>I tried to do it but i just dont get it

Have you tried not being both lazy and retarded?

xoxoxoxo - Prof. Hitler
>>
Read learn you a Haskell. Its kinda short in like 2 weeks with each day reading it 30 minutes you should easily get this.

Your prof wants you to implement this compare yourself so you learn how to use Haskell.
>>
File: gotta_go_constipated.png (185 KB, 320x280) Image search: [Google]
gotta_go_constipated.png
185 KB, 320x280
>>53641027
multiEqual = and .: zipWith (==)
>>
multiEqual alst blst = alst == [ i | i<-alst, j<-blst, i == j]

now let the thread die pls
>>
>>53642020
Generalize.
multiEqual = foldr (&&) True .: liftA2 (==)
>>
You should probably stop doing CS...
You will be better of if you actually do something in your life that you are good at..
>>
Since this is a shitty thread may as well ask it here. I did a Haskell course last semester, loved the language but didn't get too far into it.

What's all these :
.:             -- This operator
foldr -- Or foldl
zipWith -- and this function.


I loved Haskell but all we did was write a shitty interpreter for a shitty "language".
>>
What is haskell actually for?
>>
>>53646316
CS papers about Haskell. It's circular reasoning: the language.
>>
>>53646316
Haskell is used for the excitement of getting around arbitrary restrictions imposed by the language itself.
>>
>>53641027
>i just dont get it
A monad is just a monoid in the category of endofunctors, what's the problem?
>>
>>53647085
Right. Could you, for instance, actually develop anything usefule with it, though?
>>
>>53646316
https://en.wikipedia.org/wiki/Haskell_(programming_language)#Applications

Haskell is Turing complete and you could use it for any purpose. It, like many functional languages, has a very good level of expressiveness and you can write a lot of applications in it using a small fraction of the code that would be required to do it more traditionally, so it's great for getting something useful out in a short amount of time.
>>
>>53648790
Yes. It's used by Goldman Sachs and Facebook for instance.
The restrictions are there to ensure that there won't be compile time errors.

Haskell annoys some people because it requires more design before implementing but it will make the code more maintainable which has been shown by Microsoft research.
>>
>>53648883
Thanks, anon. Im doing my a levels right now and next term is Haskek. Ive already been through that page that shows you haskell's arithmetic functions. But i wouldn't know how to fizzbuzz in it, for instance. But i can easily in python.
>>
File: eddie.jpg (39 KB, 500x350) Image search: [Google]
eddie.jpg
39 KB, 500x350
>>53641027
>Does anyone know haskell ?
>>
>>53648952
It's also a completely different paradigm.
In Haskell you would probably do a list comprehension and create an infinite list of all the fizzbuzz results and then print the ones from 1 to 100 for instance.
>>
>>53649000
>>Does anyone know haskell ?
Yes, he used to live 2 doors down the street.
I used to fuck his Mom.
>>
>>53649004
That *sounds* inefficient. What are the benefits of doing it that way?
>>
>>53649110
Smugness and euphoria. *tips fedora*
>>
>>53649110
Abstraction, let the compiler optimize for you.
It's not like Python is the epitome of efficiency.

The infinite lists aren't ineffective since GHC is a lazily evaluated implementation of Haskell.

You can't generate all the results with a list comprehension straight out, you would probably use a function with each fizzbuzz case and then just make a list comprehension instead that takes the result of the function for the numbers 1 to 100.
>>
>>53649195
Right, that makes more sense.
>>
>>53649215
The lazily evaluation can be a bother when doing parallel programming but GHC 8 introduces a compile flag which can make a program do strict evaluation instead.
>>
>>53649297
Nice
>>
>>53641027
i took a module on parallelism in my final year
every lecture the guy just kept saying how similar it was to scheme or something that the cs guys did last year but i didn't do that module.
i just didn't really get it so i did my coursework in C instead which was an option.
there are plenty other things i want to learn before this because its practically useless
>>
>>53649410
Haskell is based on typed lambda calculus like Standard ML while Scheme is based on untyped lambda calculus.
They are very different since Scheme is more multi-paradigm rather than functional.
>>
>>53649449
Everything in Scheme is tagged. There are no raw lambdas. It's not like untyped lambda calculus at all.
>>
>>53644703
They are doing Software Engineering though
Thread replies: 30
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.