One of these languages is F#, a functional language created by Don Syme and team and based on Ocaml. Because it runs on the .NET framework (or Mono) F# has the great advantage over many interesting functional languages in being of immediate practical use! It also lends itself to polyglot programming - algorithms and problems particularly suited to being solved in a functional language can easily be mixed with code written in C# or IronPython. F# is already beloved by statisticians who where previously working in C#. Like Python it has a powerful interactive shell.
Luis Diego Fallas has a blog entry on using F# code from IronPython:
F# has its own built-in types like lists and tuples. Although Python has similarly named types they have different implementations. Luis shows adding references to F# assemblies and using F# types, functions and operators.
We can call F# functions to process values generated by fibo. For example the following IronPython code prints the first 15 squared Fibonacci numbers.
for n in Seq.map[int,int]( FuncConvert.ToFastFunc[int,int](lambda x: x*x) , Seq.take[int](15,fibo())):
print n
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.