val sum : int = 8 > printf "%d" sum;; 8val it : unit = ()
And now, we want to do Currying for this function. How should we do?
val sum : int = 8 > printf "%d" sum;; 8val it : unit = ()
A list in F# is an ordered, immutable series of elements of the same type.Each elements are separated by semicolons.
> let integer_list = [1; 2; 3];; val integer_list : int list = [1; 2; 3] > let string_list = ["a"; "b"; "c"];; val string_list : string list = ["a"; "b"; "c"]
> let rec fibonacci n = if n=0 then 0 elif n=1 then 1 else fibonacci(n-2) + fibonacci(n-1);; > for i in [0..10] do - let fibn = fibonacci i - printfn "%d" fibn - done;; 0 1 1 2 3 5 8 13 21 34 55 val it : unit = ()
execution environment | object-oriented language | object-oriented functional language | |
---|---|---|---|
Java technologies | JVM | Java | Scala |
.NET technologies | CLR | C# | F# |
irb(main):001:0> s = 'hello world' => "hello world" irb(main):002:0> irb s irb#1(hello world):001:0> upcase => "HELLO WORLD" irb#1(hello world):002:0> exit => #<IRB::Irb: @context=#<IRB::Context:0x00000100849a30>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x000001008454f8>> irb(main):003:0> exitI did not know at all until reading this book.
$ git clone http://github.com/nicksieger/activerecord-jdbc-adapter.git