Lightning talks 1 - July 17, 2011 (Main Hall)
My LT title is Yet Another "ASP.NET MVC 3 vs. Ruby on Rails 3".
I will do my best!!
type Component<'a> =
| Composite of list<Component<'a>>
| Leaf of 'a
let compositeSample = Composite([ Leaf(2); Composite([ Leaf(1); Leaf(3) ]) ])
> let refCellInt = ref 10;;
val refCellInt : int ref = {contents = 10;}> refCellInt := 20;; val it : unit = () > System.Console.WriteLine(refCellInt.Value);; 20 val it : unit = ()
> let normallInt = !refCellInt;; val normallInt : int = 20
$ irb1.9
irb(main):001:0> one_to_ten = 1..10
=> 1..10
irb(main):002:0> one_to_ten.group_by {|i| i % 3}
=> {1=>[1, 4, 7, 10], 2=>[2, 5, 8], 0=>[3, 6, 9]}
$ csharp
Mono C# Shell, type "help;" for help
Enter statements below.
csharp> using System.Linq;
csharp> int[] oneToTen = new int[]{1,2,3,4,5,6,7,8,9,10};
csharp> oneToTen.GroupBy(i => i % 3).ToDictionary(g => g.Key, g => g.ToList());
{{ 1, { 1, 4, 7, 10 } }, { 2, { 2, 5, 8 } }, { 0, { 3, 6, 9 } }}
$ irb1.9
irb(main):001:0> one_to_ten = 1..10
=> 1..10
irb(main):002:0> one_to_ten.find_all {|i| i % 2 == 1 }.collect {|i| i**2}
=> [1, 9, 25, 49, 81]$ csharp
Mono C# Shell, type "help;" for help
Enter statements below.
csharp> using System.Linq;
csharp> int[] oneToTen = new int[]{1,2,3,4,5,6,7,8,9,10};
csharp> oneToTen.Where(i => i % 2 == 1).Select(i => Math.Pow(i, 2));
{ 1, 9, 25, 49, 81 }
> let useForRightSideOfIn arg = - System.Console.WriteLine(arg.ToString()) in List.iter useForRightSideOfIn [1;2;3];; 1 2 3 val it : unit = () > useForRightSideOfIn [1;2;3];; useForRightSideOfIn [1;2;3];; ^^^^^^^^^^^^^^^^^^^ stdin(3,1): error FS0039: The value or constructor 'useForRightSideOfIn' is not defined