print "abcd12
make "a 16
print :a
make "b "a
print thing :b
make "c mul add :a 13 :a
print sub :c "6
print div 12 5
print mod 12 5
make "d read
1234dd
make "e print :d
print :e

make "l []
make "q join :l "[
print :q[0]
print eq "] "\]

make "t print [ \[1\]\\\] [1]]
print islist :t[0]
print islist :t[1]
make "x "t
make "y "x
print :::y

make "rev_func [
  [f]
  [
    [
      [a b]
      [f :b :a]
    ]
  ]
]
make "rev_sub rev_func [[x y] [sub :x :y]]
print rev_sub 2 5
print rev_sub 26.5 10.3
make "rev_ge rev_func [[x y] [or gt :x :y eq :x :y]]
print rev_ge 3 7
print rev_ge "abc "aBc
print rev_ge 8 8
make "rev_imply rev_func [[x y] [or not :x :y]]
print rev_imply false false
print rev_imply false true
print rev_imply true false
print rev_imply true true

make "arr [ [ a b ] c ]
print :arr[0]
print :arr[1]
print :arr[0][0]
print :arr[0][1]
make "arr[0][1] "d
print :arr[0]
print :arr[0][1]
make "arr[1] [ add :a :d ]
print :arr
print arr 2 3
make "arr[0][1] [ e [ f ] ]
make "arr join :arr [ g [ h i ] ]
print :arr[0][1]
print :arr[0][1][0]
print :arr[0][1][1][0]
make "x 1
print :arr[x:]

print word "hello "world
print word "hello TRUE
print word "hello -134.5

print sentence 483 "dba
print sentence sentence [ [ a b ] c ] [ d [ e f ] ] [ g ]

print list 483 "dba
print list list [ [ a b ] c ] [ d [ e f ] ] [ g ]

print join [ 483 ] "dba
print join join [ [ a b ] c ] [ d [ e f ] ] [ g ]

print first "hello
print first butlast list list [ [ a b ] c ] [ d [ e f ] ] [ g ]

make "pow [[a b] [
  if lt :b 1 [
    return 1
  ] [
    make "r pow :a div sub :b mod :b 2 2
    make "r mul :r :r
    if mod :b 2 [
      return mul :r :a
    ] [
      return :r
    ]
    print :r
  ]
]]

print pow 2 18

print readlist
a b c 1 2 3

make "reverse_list [
  [list]
  [if isempty :list [] [join reverse_list butfirst :list first :list]]
]
print reverse_list []
print reverse_list [x y z]
print reverse_list [12 345 6 78 9 0]
print reverse_list [a b c d [e f] g]
print reverse_list [h [i [j k]] l m n]

make "fib_wrap [
  [x]
  [
    make "fib [
      [x]
      [
        if lt :x 2 [return 1] []
        return add fib sub :x 1 fib sub :x 2
      ]
    ]
    fib :x
  ]
]

print fib_wrap 0
print fib_wrap 1
print fib_wrap 2
print fib_wrap 3
print fib_wrap 4
print fib_wrap 5
print fib_wrap 6
print fib_wrap 7
print fib_wrap 8
print fib_wrap 9

make "f [[x] [
  make "g [[y] [return add :x :y]]
  return g 42
]]
print f 233

make "f1 [[x] [
  make "g1 [[y] [return add :x :y]]
  return :g1
]]
make "c1 f1 42
make "c2 f1 24
print c1 1
print c2 2

make "curry_two [[f x] [
  return [[y] [return f :x :y]]
]]
make "f2 [[x y] [
  return add :x :y
]]
make "f3 curry_two :f2 42
print f3 233

make "fun [
  [x]
  [[[y] [make "x add :x :y]]]
]
make "adder fun 5
print adder 1
print adder 2
print adder 3

make "prt [
  [a]
  [
    make "b [
      []
      [print :a]
    ]
    return :b
  ]
]
make "c prt "hello
c

make "x 2
print :x
make "test [
  []
  [
    make "x 1
    export "x
    print :x
  ]
]
test
print :x

print poall

make "fun1 [
  [x]
  [add :x 10]
]
print fun1 5
make "fun2 [
  []
  [
    print fun1 5
    make "fun1 [
      [x]
      [add :x 100]
    ]
    print fun1 5
    export "fun1
    make "fun1 [
      [x]
      [add :x 1000]
    ]
    print fun1 5
    if eq fun1 5 1005 [return 0] []
    make "fun1 [
      [x]
      [add :x 10000]
    ]
    export "fun1
    print fun1 5
    return 1
  ]
]
print fun2
print fun1 5
