1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 01:57:09 +03:00
mal/pil/readline.l
2016-09-30 10:39:42 +02:00

20 lines
513 B
Plaintext

(de load-history (File)
(when (info File)
(in File
(until (eof)
(native "libreadline.so" "add_history" NIL (line T)) ) ) ) )
(de save-to-history (Input)
(when Input
(native "libreadline.so" "add_history" NIL Input)
(out "+.mal_history"
(prinl Input) ) ) )
(de readline (Prompt)
(let Input (native "libreadline.so" "readline" 'N Prompt)
(if (=0 Input)
0
(prog1
(struct Input 'S)
(save-to-history @) ) ) ) )