Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

learning haskell

Name: Anonymous 2011-12-03 19:29

hm so i can use () to make infix things as prefix functions


1 + 2
=> 3

(+) 1 2
=> 3


and backticks to make functions infix


take 2 [1,2,3,4,5]
=> [1,2]

2 `take` [1,2,3,4,5]
=> [1,2]


but then...



1 `(+)` 2
<hint>:1:4: parse error on input `('

Name: Anonymous 2011-12-03 19:40

As I understand it, infix or prefix depends on the symbol - the backticks make the symbol infix. (+) is an expression that curries the + operator, just like e.g. (1 +).

Don't change these.
Name: Email:
Entire Thread Thread List