Saturday, March 12, 2011

Now I'm safe.

I'm in Tokyo. I'm installing openSUSE 11.4

Thursday, March 10, 2011

Calling IronRuby in F# on Mono

This is just a hobby, but wonderful. Mono 2.10 only can do it as out-of-the-box!
Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.dll";;

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.dll'

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll";;

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll'

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/Microsoft.Scripting.dll";;   

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/Microsoft.Scripting.dll'

> open IronRuby;;
> let runtime = IronRuby.Ruby.CreateRuntime();;          

val runtime : Microsoft.Scripting.Hosting.ScriptRuntime

> let engine = runtime.GetEngine("Ruby");;
Binding session to '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll'...
val engine : Microsoft.Scripting.Hosting.ScriptEngine

> engine.Execute("class Hello;def world;'Hello World';end;end");;
val it : obj = null
> engine.Execute("puts Hello.new.world");;
Hello World
val it : obj = null

Monday, March 7, 2011

Studying F# : Constructor

In any other object-oriented languages, "This class has one constructor" means there is only one definition. But, F# is not. F# distinguishes primary constructor from non-primary constructor.

Friday, March 4, 2011

Qt 4.7.2 has been released and more

At the first day of this month, Qt Framework 4.7.2 and Qt Creator 2.1 have been released. If you are using these on Linux or on Mac OS X, you just download and install straightforward. But if you are using on Windows, it is slightly complicated.

Tuesday, March 1, 2011

Euler's formula in F# : #2

In last year, I wrote Euler's formula in F#. In this article, I used C# classes in System.Numerics namespace. At this time, i write again, with using F# PowerPack.
Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "FSharp.PowerPack";;

--> Referenced 'C:\Program Files\FSharpPowerPack-2.0.0.0\bin\FSharp.PowerPack.dll'

> open Microsoft.FSharp.Math;;
> let euler_formula = complex 0.0 -Complex.pi.RealPart |> Complex.exp;;

val euler_formula : Complex = -1r-1.22460635382238e-16i
But this also becomes inexact result of floating-point.