Sha256: 0657fcb057b05c097dfa67d5248834eb44b8d67d7d4414625dc5e5e0ce83fc9b

Contents?: true

Size: 604 Bytes

Versions: 10

Compression:

Stored size: 604 Bytes

Contents

ML/I will read two integers from 'standard input' or similar, 
and then output the results to 'standard output' or similar.

<syntaxhighlight lang="ml/i">MCSKIP "WITH" NL
"" Arithmetic/Integer
"" assumes macros on input stream 1, terminal on stream 2
MCSKIP MT,<>
MCINS %.
MCDEF SL SPACES NL AS <MCSET T1=%A1.
MCSET T2=%A2.
a + b   = %%T1.+%T2..
a - b   = %%T1.-%T2..
a * b   = %%T1.*%T2..
a / b   = %%T1./%T2..
a rem b = %%T1.-%%%T1./%T2..*%T2...
Division is truncated to the greatest integer
that does not exceed the exact result. Remainder matches
the sign of the second operand, if the signs differ.

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/ml-i.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/ml-i.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/ml-i.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/ml-i.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/ml-i.txt