aboutsummaryrefslogtreecommitdiff
path: root/examples/stdlib.stem
blob: a063c9beb0337b377c062fd7603e9082e1c57cf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
evalstr [ strquote eval ] func
include [ fread evalstr ] func

# Author of loop function: Andrei S
loop [
  swap dup 0 > [
    swap
    dup eval
    swap 1 - swap loop
  ] [ dsc dsc ] if
] func

# Author: Matthew H
dupd [ [ dup ] keep ] func
over [ dupd swap ] func
dup2 [ over over ] func
dip2 [ swap [ dip ] dip ] func

loop-times [ dup2 [ swap [ ] if ] dip2
dup [ 1 - loop-times ] [ dsc dsc ] if ] func