Jump to content

Modulinos: Difference between revisions

120 bytes removed ,  8 years ago
m
Fix naming convention to be more standard, avoid java's jconsole, simplify code
(→‎{{header|Rust}}: disclaimer)
m (Fix naming convention to be more standard, avoid java's jconsole, simplify code)
Line 638:
=={{header|J}}==
 
modulinos.ijs:
scriptedmain.j:
 
<lang j>#!/usr/bin/env jconsole
 
load 'regex'
 
<lang j>#!/usr/bin/env jconsoleijconsole
meaningOfLife =: 42
 
main =: monad : 0define
echo 'Main: The meaning of life is ', > 'd' (8!":0) meaningOfLife
exit ''
)
 
programshouldrun =: monad : 0define
if. (#ARGV)1 >e. 1'modulinos.ijs' E. ;ARGV do.
> 1 { ARGV
else.
'Interpreted'
end.
)
 
shouldrun =: monad : 0
if. '.*scriptedmain.*' rxeq program 0 do.
main 0
end.
)
 
shouldrun 0</lang>
 
Line 671 ⟶ 661:
<lang j>#!/usr/bin/env jconsole
 
load 'scriptedmainmodulinos.jijs'
 
echo 'Test: The meaning of life is ', > 'd' (8!":0) meaningOfLife
 
exit ''</lang>
Line 679 ⟶ 669:
Example:
 
<lang sh>$ ./scriptedmainmodulinos.jijs
Main: The meaning of life is 42
$ ./test.j
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.