mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > jvang

Reply
 
Thread Tools
Old 2018-06-09, 23:52   #1
jvang
veganjoy
 
jvang's Avatar
 
"Joey"
Nov 2015
Middle of Nowhere,AR

1101111002 Posts
Default ¿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
jvang is offline   Reply With Quote
Old 2018-06-10, 07:13   #2
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

3·1,609 Posts
Default

Quote:
Originally Posted by jvang View Post
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
ET_ is offline   Reply With Quote
Old 2018-06-10, 08:10   #3
xilman
Bamboozled!
 
xilman's Avatar
 
"𒉺𒌌𒇷𒆷𒀭"
May 2003
Down not across

10,949 Posts
Default

Quote:
Originally Posted by ET_ View Post
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
xilman is offline   Reply With Quote
Old 2018-06-10, 15:20   #4
jvang
veganjoy
 
jvang's Avatar
 
"Joey"
Nov 2015
Middle of Nowhere,AR

22·3·37 Posts
Default

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
jvang is offline   Reply With Quote
Old 2018-06-10, 22:45   #5
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

201608 Posts
Default

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?

Xyzzy is offline   Reply With Quote
Old 2018-06-10, 23:15   #6
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

23·17·73 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
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.
chalsall is offline   Reply With Quote
Old 2018-06-11, 01:44   #7
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

225328 Posts
Default

R
Batalov is offline   Reply With Quote
Old 2018-06-11, 03:58   #8
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

F0D16 Posts
Default

Functional, procedural, declarative and object-oriented, I love Ruby
paulunderwood is offline   Reply With Quote
Old 2018-06-11, 12:53   #9
Nick
 
Nick's Avatar
 
Dec 2012
The Netherlands

22·3·5·29 Posts
Default

Quote:
Originally Posted by Batalov View Post
R
And I thought that C was an extension of R...
Nick is offline   Reply With Quote
Old 2018-06-11, 14:16   #10
jvang
veganjoy
 
jvang's Avatar
 
"Joey"
Nov 2015
Middle of Nowhere,AR

22×3×37 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
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_ View Post
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
jvang is offline   Reply With Quote
Old 2018-06-12, 12:25   #11
Nick
 
Nick's Avatar
 
Dec 2012
The Netherlands

174010 Posts
Default

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!
Nick is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Musings of someone learning airsquirrels Math 20 2018-12-29 18:15
Online language-learning course kladner Lounge 8 2013-04-18 03:08
Learning Python - Course from Google Jeff Gilchrist Programming 3 2012-01-15 00:29
flowcharts, self-learning jasong jasong 6 2007-12-07 14:06
Learning About RAM the Hard Way Longshot Hardware 5 2005-05-21 16:40

All times are UTC. The time now is 04:48.


Sun Oct 17 04:48:50 UTC 2021 up 85 days, 23:17, 0 users, load averages: 1.79, 1.36, 1.24

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.