1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-26 22:28:26 +03:00
mal/impls/picolisp/readline.l

20 lines
513 B
Plaintext
Raw Permalink Normal View History

2016-09-30 11:05:43 +03:00
(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)
2016-09-30 11:39:42 +03:00
(let Input (native "libreadline.so" "readline" 'N Prompt)
(if (=0 Input)
0
(prog1
(struct Input 'S)
(save-to-history @) ) ) ) )