Modulinos: Difference between revisions
Content added Content deleted
(→{{header|Rust}}: disclaimer) |
m (Fix naming convention to be more standard, avoid java's jconsole, simplify code) |
||
Line 638: | Line 638: | ||
=={{header|J}}== |
=={{header|J}}== |
||
modulinos.ijs: |
|||
scriptedmain.j: |
|||
⚫ | |||
load 'regex' |
|||
⚫ | |||
meaningOfLife =: 42 |
meaningOfLife =: 42 |
||
main =: monad |
main =: monad define |
||
echo 'Main: The meaning of life is ', |
echo 'Main: The meaning of life is ',": meaningOfLife |
||
exit '' |
exit '' |
||
) |
) |
||
shouldrun =: monad define |
|||
if. |
if. 1 e. 'modulinos.ijs' E. ;ARGV do. |
||
> 1 { ARGV |
|||
else. |
|||
'Interpreted' |
|||
end. |
|||
) |
|||
shouldrun =: monad : 0 |
|||
if. '.*scriptedmain.*' rxeq program 0 do. |
|||
main 0 |
main 0 |
||
end. |
end. |
||
) |
) |
||
shouldrun 0</lang> |
shouldrun 0</lang> |
||
Line 671: | Line 661: | ||
<lang j>#!/usr/bin/env jconsole |
<lang j>#!/usr/bin/env jconsole |
||
load ' |
load 'modulinos.ijs' |
||
echo 'Test: The meaning of life is ', |
echo 'Test: The meaning of life is ',": meaningOfLife |
||
exit ''</lang> |
exit ''</lang> |
||
Line 679: | Line 669: | ||
Example: |
Example: |
||
<lang sh>$ ./ |
<lang sh>$ ./modulinos.ijs |
||
Main: The meaning of life is 42 |
Main: The meaning of life is 42 |
||
$ ./test.j |
$ ./test.j |