Created
November 22, 2017 18:49
-
-
Save haze/ecb99d617428057a20468c1491ecc6a9 to your computer and use it in GitHub Desktop.
Solution to Euler 1 in Pill.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+counter; | |
$nop() { } | |
$inc_counter() { | |
add x counter; | |
} | |
$mod5() { | |
mov 0 res; | |
mod x 5 a; | |
eq a 0 b; | |
mov b res; | |
del b; | |
del a; | |
} | |
$mod3() { | |
mov 0 res; | |
mod x 3 a; | |
eq a 0 b; | |
mov b res; | |
del b; | |
del a; | |
} | |
$5check() { | |
if mod5 inc_counter nop; | |
} | |
$3and5() { | |
if mod3 inc_counter 5check; | |
} | |
$$() { | |
for x 2 1000 1 3and5; | |
pt "result = "; | |
dsl counter; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment