mirror of
https://github.com/kanaka/mal.git
synced 2024-11-10 12:47:45 +03:00
4eb88ef295
Tested on UCBLogo 6.0 with some minor tweaks (for performance and adding a `timems` function). The tweaks are performed during Docker image creation (see Dockerfile). Tests of step 5 are skipped because UCBLogo is too slow. Interop is available via `(logo-eval "logo code to run")`. The `examples` directory contains a Mal example of drawing a tree using turtle graphics.
28 lines
616 B
Plaintext
28 lines
616 B
Plaintext
make "backspace_char char 8
|
|
make "space_char char 32
|
|
|
|
to readline :prompt
|
|
type :prompt
|
|
wait 0 ; flush standard output
|
|
localmake "line "
|
|
forever [
|
|
localmake "c readchar
|
|
ifelse emptyp :c [
|
|
output []
|
|
] [
|
|
localmake "ascii rawascii :c
|
|
case :ascii [
|
|
[[4] output []]
|
|
[[10] type :c
|
|
output :line]
|
|
[[127] if not emptyp :line [
|
|
type (word :backspace_char :space_char :backspace_char)
|
|
make "line butlast :line
|
|
]]
|
|
[else type :c
|
|
make "line word :line :c]
|
|
]
|
|
]
|
|
]
|
|
end
|