aboutsummaryrefslogtreecommitdiff
path: root/examples/generated.csx
blob: 14943b2ce2b1db11e045b3117f3d461adc590a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[set no [fn [x] [same x []]]]
[set outint [fn [n] [if [< n 0]
  [do [out 45] [outint [neg n]]]
  [if [< n 10]
    [out [+ 48 n]]
    [do
      [outint [div n 10]]
      [out [+ 48 [mod n 10]]]
    ]
  ]
]]]
[set map [fn [f l] [if l [pair [f [head l]] [map f [tail l]]]]]]
[set id [fn args args]]
[set outstr [fn [str] [if str [do [out [head str]] [outstr [tail str]]]]]]
[set newline [fn [] [out 10]]]
[set instr [fn []
  [set c [in]]
  [if [no [same c 10]] [pair c [instr]]]
]]
[set outints [fn [l]
  [set outcontent [fn [l]
    [if l [do [outint [head l]] [out 32] [outcontent [tail l]]]]
  ]]
  [out 91] [outcontent l] [out 93]
]]
[set rappend [fn [a b] [if a [rappend [tail a] [pair [head a] b]] b]]]
[set rev [fn [l] [rappend l []]]]
[set append [fn [a b] [rappend [rev a] b]]]
[set backwards [sx body [pair 'do [rev body]]]]

[outstr "-= loaded =-"]
[newline]
[outstr "Hello, I am Casey Shawn Exton.  What is your name?"]
[newline]
[outstr "> "]
[set name [instr]]
[outstr "Nice to meet you, "]
[outstr name]
[outstr "."]
[newline]
[outstr "I have to go.  Goodbye!"]
[newline]

[backwards
  [outstr magic]
  [set magic [rev "magic"]]
]