mersenneforum.org ¿Learning how to learn…
 Register FAQ Search Today's Posts Mark Forums Read

 2018-06-09, 23:52 #1 jvang veganjoy     "Joey" Nov 2015 Middle of Nowhere,AR 44910 Posts ¿Learning how to learn… I'm learning to program in Haskell over this summer. My dad wants me to teach him from our book, Haskell Programming from first principles by Christopher Allen and Julie Moronuki, so that I learn to take good notes. It approaches the language from purely a beginner's standpoint, instead of trying to relate functional languages to other languages. I'll be posting what I learn here in some sort of structured format that he can learn from, but I'm not sure how to do that. Any help with how to do that would be neat! Last fiddled with by jvang on 2018-06-09 at 23:52 Reason: typing is hard
2018-06-10, 07:13   #2
ET_
Banned

"Luigi"
Aug 2002
Team Italia

7×691 Posts

Quote:
 Originally Posted by jvang I'm learning to program in Haskell over this summer. My dad wants me to teach him from our book, Haskell Programming from first principles by Christopher Allen and Julie Moronuki, so that I learn to take good notes. It approaches the language from purely a beginner's standpoint, instead of trying to relate functional languages to other languages. I'll be posting what I learn here in some sort of structured format that he can learn from, but I'm not sure how to do that. Any help with how to do that would be neat!
I don't know Haskell (I don't even know what a functional language is! ) so I will carefully follow your posts.

If I were you, I would read a chapter and its paragraphs, then
1 - I would make a short summary of each paragraph to explain (and remember!) its meaning, and
2 - I would stop reading and start thinking what I just read: does it make sense to me? Am I able to explain it to another person giving the correct information? Are there elements still not clear to me? If so, write them down as well, and let's discuss...

Luigi

2018-06-10, 08:10   #3
xilman
Bamboozled!

"𒉺𒌌𒇷𒆷𒀭"
May 2003
Down not across

2·5,557 Posts

Quote:
 Originally Posted by ET_ I don't know Haskell (I don't even know what a functional language is! ) so I will carefully follow your posts.
I don't know Haskell either, though I think I know what a functional language is, so I'll also be following.

Paul

 2018-06-10, 15:20 #4 jvang veganjoy     "Joey" Nov 2015 Middle of Nowhere,AR 449 Posts Cool enough! The first chapter has to do with the lambda calculus. From what I can tell it's the basis of functional programming, kind of like truth tables for procedural programming. For all I know I'm incorrect in that comparison though... The content of the chapter doesn't cover the entire lambda calculus; for Haskell all that you need to be able to work with are the basic terms and beta/eta reduction. Terms are created from variables, abstractions, and applications; for me the hardest part is figuring out the proper syntax. The beta/eta reduction seem to be ways of applying functions to the terms, reducing the terms to what is called "beta normal form." This can be related to normal arithmetic, where 2 would be the beta normal form of 1 + 1. If I can figure out the proper syntax of lambda terms I'll be set for the first chapter
 2018-06-10, 22:45 #5 Xyzzy     Aug 2002 840310 Posts Why are we learning Haskell rather than a different programming language? Is it faster? Easier to read? Easier to debug? Are there things that can only be done in Haskell?
2018-06-10, 23:15   #6
chalsall
If I May

"Chris Halsall"
Sep 2002

33×13×29 Posts

Quote:
 Originally Posted by Xyzzy Why are we learning Haskell rather than a different programming language?
Indeed. One might as well teach oneself Pascal. Or Cobol. Or Fortran.

A better choice might be Go. Or Python (shudder). Or Perl. Or C. Or R.

 2018-06-11, 01:44 #7 Batalov     "Serge" Mar 2008 Phi(4,2^7658614+1)/2 3×7×461 Posts R
 2018-06-11, 03:58 #8 paulunderwood     Sep 2002 Database er0rr 2×5×397 Posts Functional, procedural, declarative and object-oriented, I love Ruby
2018-06-11, 12:53   #9
Nick

Dec 2012
The Netherlands

3×587 Posts

Quote:
 Originally Posted by Batalov R
And I thought that C was an extension of R...

2018-06-11, 14:16   #10
jvang
veganjoy

"Joey"
Nov 2015
Middle of Nowhere,AR

44910 Posts

Quote:
 Originally Posted by Xyzzy Why are we learning Haskell rather than a different programming language? Is it faster? Easier to read? Easier to debug? Are there things that can only be done in Haskell?
As far as I can tell Haskell is pretty general. It can be used to program a solution to most problems where a program could be used. Since my only programming background is a couple of hours in Python, Haskell is pretty much going to be my first language; since it is purely functional, it'll be good for mastering functional programming as a whole. And despite having a reputation for being hard to learn, it seems that other purely functional languages are more difficult to learn. I don't think speed is relevant to a beginner, since Python is a good starting language. Reading Haskell seems simple enough, and debugging isn't too hard compared to some other languages. Not sure about Haskell-specific actions.

I might be getting a hang of the syntax for the lambda calculus. As an example from the Wikipedia page for the lambda calculus:

Quote:
 ...$$\lambda x . x^2 + 2$$ is a lambda abstraction for the function $$f(x) = x^2 + 2$$ using the term $$x^2 + 2$$ for $$t$$.
A lambda abstraction has the form $$\lambda x . t$$ where $$x$$ is a normal variable and $$t$$ is a lambda term. A lambda term is either a variable, an abstraction, or an application. I haven't figured out applications yet, but I'm working on it.

When you have multiple lambda abstractions nested in each other, like $$\lambda x . \lambda y . x^2 + y^2$$, you declare each variable one-at-a-time, a method called currying. I'm guessing it's easier for a computer to solve multiple, smaller steps than less, but more complex steps.

Quote:
 Originally Posted by ET_ I don't know Haskell (I don't even know what a functional language is! )
My rudimentary understanding of functional programming is that normal programming involves Boolean algebra and changing states, whereas functional programming is based upon evaluating mathematical functions. Functional code is supposed to be predictable in its output instead of relying on different states, which allows programmers to more easily understand raw code. I'm probably incorrect on this, so maybe someone can clear up that definition?

Last fiddled with by jvang on 2018-06-11 at 15:15 Reason: typing is hard

 2018-06-12, 12:25 #11 Nick     Dec 2012 The Netherlands 3·587 Posts It's a fascinating story going back 82 years to Alonzo Church in the US and Alan Turing in the UK in 1936. Both discovered a way to formalize decidability and algorithms but Church did it using the abstract lambda calculus while Turing was thinking in terms of machines. As their research papers solved the same problem in such very different ways, both were published. Today we still refer to the Church-Turing thesis Last fiddled with by Nick on 2018-06-12 at 12:26 Reason: Yes, typing IS hard!

 Similar Threads Thread Thread Starter Forum Replies Last Post airsquirrels Math 20 2018-12-29 18:15 kladner Lounge 8 2013-04-18 03:08 Jeff Gilchrist Programming 3 2012-01-15 00:29 jasong jasong 6 2007-12-07 14:06 Longshot Hardware 5 2005-05-21 16:40

All times are UTC. The time now is 23:07.

Sun Jan 16 23:07:33 UTC 2022 up 177 days, 17:36, 0 users, load averages: 0.99, 0.99, 0.99