Best language for starting out in functional programming? (22)

1 Name: #!/usr/bin/anonymous : 2011-01-16 01:16 ID:MSrpsEZ8 This thread was merged from the former /code/ board. You can view the archive here.

I've seen great web tutorials for Haskell, but is there any better entry-level language that teaches me to no longer think like a computer?

2 Name: #!/usr/bin/anonymous : 2011-01-16 15:16 ID:Na6H161a

Lisp.

3 Name: #!/usr/bin/anonymous : 2011-01-16 17:42 ID:uZO0TBVy

If you have little experience in functional programming, I'd start out with Racket, which comes with an IDE (used to be called PLT-Scheme).

Use the SICP book/lectures to actually learn how to think and write code like a lisp programmer.

4 Name: #!/usr/bin/anonymous : 2011-01-20 02:18 ID:m02hN6zZ

I'm not sure what you mean when you say that Haskell teaches you to think like a computer. Could you provide an example? The thing that you are trying to avoid might be unavoidable in any practical sense.

5 Name: #!/usr/bin/anonymous : 2011-01-25 14:37 ID:il88PKdL

hxxp://en.wikipedia.org/wiki/Curry_(programming_language)

Curry is also a good idea especially because it includes logic programming as well as functional programming.

6 Name: #!/usr/bin/anonymous : 2011-02-06 00:19 ID:3NVXjjtC

Racket

7 Name: #!/usr/bin/anonymous : 2011-02-07 19:04 ID:Heaven

I learned on Python

8 Name: #!/usr/bin/anonymous : 2011-03-19 21:44 ID:1fB35oVr

I would follow >>3's advice. Learn actual programming from a book instead of just learning a language. And SICP is a good book. Also recommending Intro. to Algorithms by Manber.

9 Name: #!/usr/bin/anonymous : 2011-04-01 15:03 ID:RY2DkG9Y

Erlang it's simple and cute.

10 Name: #!/usr/bin/anonymous : 2011-04-03 20:48 ID:zsE0Fk7Y

11 Name: #!/usr/bin/anonymous : 2011-05-04 18:51 ID:Heaven

>>10
this

12 Name: #!/usr/bin/anonymous : 2011-06-21 20:59 ID:rFlW1GZm

>>4
I suspect "thinking like a computer" would mean thinking in concepts of having to do stuff in a predefined algorithm sequence, which functional programming (according to my very limited knowledge of the field) appears to avoid.

13 Name: #!/usr/bin/anonymous : 2011-06-23 10:54 ID:kxTuZB/4

>>12

No. Functional programming also works in a "predefined algorithm sequence" (that's the whole point of programming, innit).

What it does, it tries to get rid of this idea, which is brittle (i.e. difficult to get right):

You have a state (a bunch of variables with their values at some time t) that you manipulate with procedures so that at time t+1, the values of those variables has changed and the set of variables has changed.

Instead the approach is:

You have functions (machines that transform input values into output values, where the input values and output values can themselves be functions) that you apply on values to get a result (and any state is temporary and just an artifice of expressing how your function works).

14 Name: #!/usr/bin/anonymous : 2011-08-27 01:10 ID:kESQsA7D

I think "a computer" >>1 means is so-called Von Neumann-type computer.

Procedural programming needs global states, variables and substitutions like current computer architectures.

Functional programming also has values but they never change once they have been defined, and yet it works because of λ-calculus like >>13 said. 

I recommend Haskell for Functional programming novices too.
Haskell is a bit idealistic language, but people can learn a lot for it.

15 Name: #!/usr/bin/anonymous : 2011-08-28 20:33 ID:DxVyW/QZ

Ruby. The Best of All EVER.

Simple. Beauty. Force.

Just Works.

require 'sinatra'
get '/' do
"Hello World!"
end

Web-server with hello-world-main-page. 4 lines. :)

p Array.new(gets.to_i){gets.to_i}.sort

Input (any size), sorting and output array. 38 symbols.

Functional programming in the box with OO together.

Sorry for bad English. :) I'm from Russia, and I speak in Ruby.

16 Name: #!/usr/bin/anonymous : 2011-08-29 01:37 ID:Na6H161a

>>15
I want to punch you in the throat.

17 Name: #!/usr/bin/anonymous : 2011-09-10 03:13 ID:Heaven

>>15
I can do that with Node.js, or any other framework out there. That is still stupid. If you don't understand why "my_whole_web_site_just_work();" is lame, please stop programming.

I know, I've been trolled once again :(

18 Name: #!/usr/bin/anonymous : 2013-06-25 22:22 ID:KBxwh9MV

Such baseless novelties, try Nimrod, son.

19 Name: #!/usr/bin/anonymous : 2013-08-03 10:32 ID:L2Ej6CUp

>>13

State is easily reintroduced into functional programming with f-coalgebras. Then you model your computation as a function working on a state space S and several outcomes (bottom = no terminating or undefined), just the next state or an exception and the next state. This model also apply on java. From this model, functional languages are rather explicit with their state passing.

S[sub]t[/sub] -> bottom + S[sub]t+1[/sub] + S[sub]t+1[/sub] x E

20 Name: #!/usr/bin/anonymous : 2013-10-16 12:53 ID:PjA6aMEM

Learn brainfuck, trust me. Its a great language and will teach you the fundamentals of a language like Assembly, but in a more complicated way, which is definitely better.

21 Name: sage : 2015-03-28 07:16 ID:W6w5g3LX

>>13
You have a memory (a bunch of memory locations with their values at some time t) that you manipulate with functions so that at time t+1, the values of those memory locations has changed and the set of stack memory locations has changed.

Instead the approach is:

You have procedures (machines that transform input values into output values, where the input values and output values can themselves be procedures) that you apply on values to get a result (and any memory is temporary and just an artifice of expressing how your procedure works).

Also you have unsafe IO procedures to call some devil functions because von neumann or something. It's not like someone forgot computer functions were jumps in the instruction pointer and not actual mathematical functions..

22 Name: #!/usr/bin/anonymous : 2015-04-08 15:57 ID:Ape0/d52

I would say Ruby. The Russian guy is kind of dumb though. Ruby has what you want plus there is a great community and Ruby Gems are pretty great as well.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: