Modulinos: Difference between revisions

Added F#
(added interpreted mode for both files)
(Added F#)
Line 421:
main(_) ->
io:format("Test: The meaning of life is ~w~n", [meaning_of_life()]).</lang>
 
=={{header|F#}}==
 
Note 1: F# supports the scriptedmain behavior, but F# does not support hybrid script-compiled code files. The following programs work provided that they are compiled and then run, not interpreted or dotslashed.
 
Note 2: fsharpc has a backwards file ordering: Specify any dependencies BEFORE the code that depends on them.
 
Note 3: fsharpc also has that wacky DOS command line flag syntax, so --out requires a colon between it and its value.
 
Note 4: In Unix, mono is required to run F# executables. In Windows, mono is not required for execution.
 
Example:
 
<lang sh>$ make
fsharpc --out:scriptedmain.exe ScriptedMain.fs
fsharpc --out:test.exe ScriptedMain.fs Test.fs
$ mono scriptedmain.exe
Main: The meaning of life is 42
$ mono test.exe
Test: The meaning of life is 42</lang>
 
Makefile:
 
<lang make>all: scriptedmain.exe test.exe
 
scriptedmain.exe: ScriptedMain.fs
fsharpc --nologo --out:scriptedmain.exe ScriptedMain.fs
 
test.exe: Test.fs ScriptedMain.fs
fsharpc --nologo --out:test.exe ScriptedMain.fs Test.fs
 
clean:
-rm *.exe</lang>
 
ScriptedMain.fs:
 
<lang fsharp>namespace ScriptedMain
 
module ScriptedMain =
let meaningOfLife = 42
 
let main =
printfn "Main: The meaning of life is %d" meaningOfLife</lang>
 
Test.fs:
 
<lang fsharp>module Test =
open ScriptedMain
 
let main =
printfn "Test: The meaning of life is %d" ScriptedMain.meaningOfLife</lang>
 
=={{header|Factor}}==
Anonymous user