-
Notifications
You must be signed in to change notification settings - Fork 0
/
sapid.ini
63 lines (50 loc) · 1.37 KB
/
sapid.ini
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; sapid lisp
; startup file
; gilles.arcas@gmail.com, https://github.com/GillesArcas/sapid-lisp
; MIT license
; values from source code
(value (quote macro-char) 5)
(value (quote symbol-char) 7)
; define quote macro character
(typech (quote "'") macro-char)
(de |'| () (cons (quote quote) (cons (read) ())))
(de synonym (x y)
(fvalue x (fvalue y)) )
; load first modules
(load "backquote.l")
(load "describe.l")
; some helpers
(de reduce-macro (n-ary-op binary-op neutral l)
(ifn l
`(progn ,neutral)
(ifn (cdr l)
`(progn ,(car l))
`(,binary-op ,(car l) ,(optform n-ary-op (cdr l))) ) ) )
(de optform (s l)
"(optform '+ '(1)) --> 1"
"(optform '+ '(1 2)) --> (+ 1 2)"
(if (atom (cdr l))
(car l)
(cons s l) ) )
; load
(load "std.l")
(load "print.l")
; autoload
(autoload "pprint.l" pprint pp)
(autoload "trace.l" trace)
(autoload "try.l" try raise testtry)
; (autoload "testing.l" deftest)
; redefine toplevel to benefit of complete print
(de toplevel ()
(let ((r (eval (read))))
(print "= " r) ) )
; banner
(de banner ()
(cls)
(terpri)
(print "sapid lisp: lot of interesting and sapid parentheses")
(print "quit (end)")
(print "list of symbols (oblist)")
(print "description of symbol (help <sym>)")
(terpri) )
(banner)