nendo 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/emacs/nendo-mode.el +84 -0
- data/lib/init.nnd +339 -228
- data/lib/init.nndc +8676 -0
- data/lib/nendo.rb +372 -110
- data/sample/exit.nnd +2 -0
- data/sample/fact.nnd +15 -0
- data/sample/fizzbuzz1.nnd +23 -0
- data/sample/scratch.nnd +11 -0
- data/sample/tak.nnd +13 -0
- metadata +11 -6
data/lib/init.nnd
CHANGED
@@ -3,18 +3,25 @@
|
|
3
3
|
;; ----------------------------------------
|
4
4
|
;; define
|
5
5
|
;; ----------------------------------------
|
6
|
-
(
|
6
|
+
(define define
|
7
7
|
(macro (arg . body)
|
8
8
|
(if (not (pair? arg))
|
9
|
-
(
|
9
|
+
;; (define var body)
|
10
|
+
(cons 'define
|
10
11
|
(cons arg
|
11
12
|
body))
|
12
|
-
(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
;; (define (func arg...) body)
|
14
|
+
(begin
|
15
|
+
(if (pair? (cdr arg))
|
16
|
+
(if (pair? (car (cdr arg)))
|
17
|
+
(error "Error: define syntax error.")))
|
18
|
+
(cons 'define
|
19
|
+
(cons (car arg)
|
20
|
+
(list
|
21
|
+
(cons 'lambda
|
22
|
+
(cons (cdr arg)
|
23
|
+
body)))))))))
|
24
|
+
|
18
25
|
|
19
26
|
;; ----------------------------------------
|
20
27
|
;; car and cdr functions
|
@@ -55,15 +62,17 @@
|
|
55
62
|
(define iota range)
|
56
63
|
|
57
64
|
(define (append a b)
|
58
|
-
(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
65
|
+
(letrec ((append-reverse
|
66
|
+
(lambda (a b)
|
67
|
+
(if (pair? a)
|
68
|
+
(append-reverse (cdr a) (cons (car a) b))
|
69
|
+
b))))
|
70
|
+
(append-reverse (reverse a) b)))
|
63
71
|
|
64
72
|
;; ----------------------------------------
|
65
73
|
;; Utility functions
|
66
74
|
;; ----------------------------------------
|
75
|
+
(define list? pair?)
|
67
76
|
(define (even? n) (= (% n 2) 0))
|
68
77
|
(define (odd? n) (not (= (% n 2) 0)))
|
69
78
|
(define (zero? n) (= n 0))
|
@@ -77,15 +86,16 @@
|
|
77
86
|
(define (succ x) (+ x 1))
|
78
87
|
(define (pred x) (- x 1))
|
79
88
|
(define (nth n lst)
|
80
|
-
(
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
+
(letrec ((nth-iter
|
90
|
+
(lambda (n index lst)
|
91
|
+
(if (null? lst)
|
92
|
+
nil
|
93
|
+
(if (not (pair? lst))
|
94
|
+
(error "Error: nth got improper list.")
|
95
|
+
(if (eqv? n index)
|
96
|
+
(car lst)
|
97
|
+
(nth-iter n (+ index 1) (cdr lst))))))))
|
98
|
+
(nth-iter n 0 lst)))
|
89
99
|
(define (first lst) (nth 0 lst))
|
90
100
|
(define (second lst) (nth 1 lst))
|
91
101
|
(define (third lst) (nth 2 lst))
|
@@ -97,7 +107,6 @@
|
|
97
107
|
(define (ninth lst) (nth 8 lst))
|
98
108
|
(define (tenth lst) (nth 9 lst))
|
99
109
|
|
100
|
-
|
101
110
|
;; ----------------------------------------
|
102
111
|
;; basic forms
|
103
112
|
;; ----------------------------------------
|
@@ -112,38 +121,38 @@
|
|
112
121
|
|
113
122
|
(define cond
|
114
123
|
(macro lst
|
115
|
-
(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
124
|
+
(letrec ((case-block
|
125
|
+
(lambda (elem . elseblock)
|
126
|
+
(let ((condition (if (eq? 'else (car elem))
|
127
|
+
true
|
128
|
+
(car elem)))
|
129
|
+
(body (cdr elem))
|
130
|
+
(tmpsym (gensym)))
|
131
|
+
;;(display "CONDITION") (print condition)
|
132
|
+
;;(display "BODY") (print body)
|
133
|
+
;;(display "TMPSYM") (print tmpsym)
|
134
|
+
(append
|
135
|
+
(if (eq? 'feedto (car body))
|
136
|
+
(cons 'if
|
137
|
+
(list
|
138
|
+
(list 'set! tmpsym condition)
|
139
|
+
(list (cadr body) tmpsym)))
|
140
|
+
(cons 'if
|
141
|
+
(list
|
142
|
+
condition
|
143
|
+
(cons 'begin body))))
|
144
|
+
(if (< 0 (length elseblock))
|
145
|
+
elseblock
|
146
|
+
'())))))
|
147
|
+
(cond-iter
|
148
|
+
(lambda (lst)
|
149
|
+
(if (eq? 0 (length lst))
|
150
|
+
'()
|
151
|
+
(if (eq? 1 (length lst))
|
152
|
+
(case-block (car lst) '())
|
153
|
+
(case-block (car lst)
|
154
|
+
(cond-iter (cdr lst))))))))
|
155
|
+
(cond-iter lst))))
|
147
156
|
|
148
157
|
(define let1
|
149
158
|
(macro (var expr . body)
|
@@ -153,51 +162,43 @@
|
|
153
162
|
|
154
163
|
(define or
|
155
164
|
(macro lst
|
156
|
-
(
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
(list '
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
(list '
|
168
|
-
|
165
|
+
(letrec ((or-iter
|
166
|
+
(lambda (lst)
|
167
|
+
(cond
|
168
|
+
((eq? 0 (length lst))
|
169
|
+
false)
|
170
|
+
((eq? 1 (length lst))
|
171
|
+
(let1 sym (gensym)
|
172
|
+
(list 'let1 sym (car lst)
|
173
|
+
(list 'if sym sym false))))
|
174
|
+
(else
|
175
|
+
(let1 sym (gensym)
|
176
|
+
(list 'let1 sym (car lst)
|
177
|
+
(list 'if sym sym (or-iter (cdr lst))))))))))
|
178
|
+
(or-iter lst))))
|
169
179
|
|
170
180
|
(define and
|
171
181
|
(macro lst
|
172
|
-
(
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
((eq? 0 (length lst))
|
193
|
-
'())
|
194
|
-
((eq? 1 (length lst))
|
195
|
-
(if (pair? (car lst))
|
196
|
-
(strip-quote (car lst))
|
197
|
-
(error "not a proper list")))
|
198
|
-
(else
|
199
|
-
(append (list (car lst)) (apply-iter (cdr lst))))))
|
200
|
-
(append (list proc) (apply-iter args))))
|
182
|
+
(letrec ((and-iter
|
183
|
+
(lambda (lst)
|
184
|
+
(cond
|
185
|
+
((eq? 0 (length lst))
|
186
|
+
true)
|
187
|
+
((eq? 1 (length lst))
|
188
|
+
(car lst))
|
189
|
+
(else
|
190
|
+
(list 'if (list 'not (list 'eq? 'false (car lst)))
|
191
|
+
(and-iter (cdr lst))
|
192
|
+
'false))))))
|
193
|
+
(and-iter lst))))
|
194
|
+
|
195
|
+
|
196
|
+
(define (apply proc . args)
|
197
|
+
(if (null? args)
|
198
|
+
(proc)
|
199
|
+
((lambda (lol)
|
200
|
+
(apply1 proc (append (reverse (cdr lol)) (car lol))))
|
201
|
+
(reverse args))))
|
201
202
|
|
202
203
|
|
203
204
|
;; The following quasiquote macro is due to Eric S. Tiedemann. ( Imported from TinyScheme )
|
@@ -206,52 +207,56 @@
|
|
206
207
|
;; Subsequently modified for initialize library for nendo: Kiyoka Nishiyama
|
207
208
|
(define quasiquote
|
208
209
|
(macro (l)
|
209
|
-
(
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
)
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
(foo (- level 1)
|
252
|
-
|
253
|
-
|
254
|
-
|
210
|
+
(letrec ((mcons
|
211
|
+
(lambda (f l r)
|
212
|
+
(if (and (pair? r)
|
213
|
+
(eq? (car r) 'quote)
|
214
|
+
(eq? (car (cdr r)) (cdr f))
|
215
|
+
(pair? l)
|
216
|
+
(eq? (car l) 'quote)
|
217
|
+
(eq? (car (cdr l)) (car f)))
|
218
|
+
(if (or (procedure? f) (number? f) (string? f))
|
219
|
+
f
|
220
|
+
(list 'quote f))
|
221
|
+
(list 'cons l r))))
|
222
|
+
|
223
|
+
(mappend
|
224
|
+
(lambda (f l r)
|
225
|
+
(if (or (null? (cdr f))
|
226
|
+
(and (pair? r)
|
227
|
+
(eq? (car r) 'quote)
|
228
|
+
(eq? (car (cdr r)) '())))
|
229
|
+
l
|
230
|
+
(list 'append l r))))
|
231
|
+
(foo
|
232
|
+
(lambda (level form)
|
233
|
+
(cond ((not (pair? form))
|
234
|
+
(if (or (procedure? form) (number? form) (string? form))
|
235
|
+
form
|
236
|
+
(list 'quote form))
|
237
|
+
)
|
238
|
+
((eq? 'quasiquote (car form))
|
239
|
+
(mcons form ''quasiquote (foo (+ level 1) (cdr form))))
|
240
|
+
(else (if (zero? level)
|
241
|
+
(cond ((eq? (car form) 'unquote) (car (cdr form)))
|
242
|
+
((eq? (car form) 'unquote-splicing)
|
243
|
+
(error "Unquote-splicing wasn't in a list:"
|
244
|
+
form))
|
245
|
+
((and (pair? (car form))
|
246
|
+
(eq? (car (car form)) 'unquote-splicing))
|
247
|
+
(mappend form (car (cdr (car form)))
|
248
|
+
(foo level (cdr form))))
|
249
|
+
(else (mcons form (foo level (car form))
|
250
|
+
(foo level (cdr form)))))
|
251
|
+
(cond ((eq? (car form) 'unquote)
|
252
|
+
(mcons form ''unquote (foo (- level 1)
|
253
|
+
(cdr form))))
|
254
|
+
((eq? (car form) 'unquote-splicing)
|
255
|
+
(mcons form ''unquote-splicing
|
256
|
+
(foo (- level 1) (cdr form))))
|
257
|
+
(else (mcons form (foo level (car form))
|
258
|
+
(foo level (cdr form)))))))))))
|
259
|
+
(foo 0 l))))
|
255
260
|
|
256
261
|
(define unquote
|
257
262
|
(macro (lst)
|
@@ -286,6 +291,26 @@
|
|
286
291
|
`(while (not ,(car form))
|
287
292
|
,@(cdr form))))
|
288
293
|
|
294
|
+
;; named let supporting
|
295
|
+
(define let
|
296
|
+
(macro lst
|
297
|
+
(if (symbol? (car lst))
|
298
|
+
;; named let
|
299
|
+
`(letrec ((,(first lst)
|
300
|
+
(lambda ,(map
|
301
|
+
(lambda (x)
|
302
|
+
(first x))
|
303
|
+
(second lst))
|
304
|
+
,(third lst))))
|
305
|
+
(,(first lst)
|
306
|
+
,@(map
|
307
|
+
(lambda (x)
|
308
|
+
(second x))
|
309
|
+
(second lst))))
|
310
|
+
|
311
|
+
;; don't touch
|
312
|
+
`(let ,@lst))))
|
313
|
+
|
289
314
|
|
290
315
|
;; ----------------------------------------
|
291
316
|
;; List utilities imported from TinyScheme
|
@@ -345,21 +370,56 @@
|
|
345
370
|
(define (filter pred lst)
|
346
371
|
(if (null? lst)
|
347
372
|
'()
|
348
|
-
(
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
373
|
+
(if (pred (car lst))
|
374
|
+
(cons
|
375
|
+
(car lst)
|
376
|
+
(filter pred (cdr lst)))
|
377
|
+
(filter pred (cdr lst)))))
|
378
|
+
|
354
379
|
|
355
380
|
(define (filter-map pred lst)
|
356
381
|
(if (null? lst)
|
357
382
|
'()
|
358
|
-
(
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
383
|
+
(let1 result (pred (car lst))
|
384
|
+
(if result
|
385
|
+
(cons
|
386
|
+
result
|
387
|
+
(filter-map pred (cdr lst)))
|
388
|
+
(filter-map pred (cdr lst))))))
|
389
|
+
|
390
|
+
|
391
|
+
(define lambda
|
392
|
+
(macro src
|
393
|
+
(if (not (list? (cadr src)))
|
394
|
+
`(lambda ,@src)
|
395
|
+
(let1 body (cdr src)
|
396
|
+
(if (not (list? (car body)))
|
397
|
+
`(lambda ,@src)
|
398
|
+
(let ((defs
|
399
|
+
(filter
|
400
|
+
(lambda (x)
|
401
|
+
(and (eq? 'define (car x))
|
402
|
+
(symbol? (cadr x))))
|
403
|
+
body))
|
404
|
+
(rest
|
405
|
+
(filter
|
406
|
+
(lambda (x)
|
407
|
+
(not (and (eq? 'define (car x))
|
408
|
+
(symbol? (cadr x)))))
|
409
|
+
body)))
|
410
|
+
(if (< 0 (length defs))
|
411
|
+
`(lambda
|
412
|
+
,(car src)
|
413
|
+
(letrec
|
414
|
+
,(map
|
415
|
+
(lambda (x)
|
416
|
+
(list
|
417
|
+
(cadr x)
|
418
|
+
(caddr x)))
|
419
|
+
defs)
|
420
|
+
,@rest))
|
421
|
+
;; found no `internal-define' syntax
|
422
|
+
`(lambda ,@src))))))))
|
363
423
|
|
364
424
|
|
365
425
|
;; ----------------------------------------
|
@@ -367,51 +427,54 @@
|
|
367
427
|
;; ----------------------------------------
|
368
428
|
(define case
|
369
429
|
(macro (cond-exp . body)
|
370
|
-
(
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
430
|
+
(letrec ((case-block
|
431
|
+
(lambda (val . elem)
|
432
|
+
(let1 block (car elem)
|
433
|
+
(let ((cond-vals (car block))
|
434
|
+
(body (cdr block)))
|
435
|
+
(let1 v
|
436
|
+
(if (eq? 'else cond-vals)
|
437
|
+
cond-vals
|
438
|
+
(cons 'or
|
439
|
+
(map
|
440
|
+
(lambda (x)
|
441
|
+
`(eqv? ,x ,val))
|
442
|
+
cond-vals)))
|
443
|
+
`((,v
|
444
|
+
,@body)))))))
|
384
445
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
446
|
+
(case-iter
|
447
|
+
(lambda (val lst)
|
448
|
+
(cond
|
449
|
+
((eq? 0 (length lst))
|
450
|
+
'())
|
451
|
+
((eq? 1 (length lst))
|
452
|
+
(case-block val (car lst)))
|
453
|
+
(else
|
454
|
+
(append (case-block val (car lst))
|
455
|
+
(case-iter val (cdr lst))))))))
|
456
|
+
|
457
|
+
(let1 sym (gensym)
|
458
|
+
`(let1 ,sym ,cond-exp
|
459
|
+
(cond
|
460
|
+
,@(case-iter sym body)))))))
|
399
461
|
|
400
462
|
|
401
463
|
(define let*
|
402
464
|
(macro (exps . body)
|
403
|
-
(
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
465
|
+
(letrec ((let*-expand
|
466
|
+
(lambda (rest body)
|
467
|
+
(case (length rest)
|
468
|
+
((0)
|
469
|
+
'())
|
470
|
+
((1)
|
471
|
+
`(let (,(car rest))
|
472
|
+
,@body))
|
473
|
+
(else
|
474
|
+
`(let (,(car rest))
|
475
|
+
,(let*-expand (cdr rest) body)))))))
|
413
476
|
|
414
|
-
|
477
|
+
(let*-expand exps body))))
|
415
478
|
|
416
479
|
|
417
480
|
;; ----------------------------------------
|
@@ -420,36 +483,37 @@
|
|
420
483
|
;; dot_operator
|
421
484
|
(define dot-operator
|
422
485
|
(macro lst
|
423
|
-
(
|
486
|
+
(letrec ((dot-operator-iter
|
487
|
+
(lambda (lst)
|
488
|
+
(cond
|
489
|
+
((null? lst)
|
490
|
+
'())
|
491
|
+
((pair? lst)
|
492
|
+
(if (eq? 'dot-operator (car lst))
|
493
|
+
(intern
|
494
|
+
(string-join
|
495
|
+
(map
|
496
|
+
(lambda (x)
|
497
|
+
(if (pair? x)
|
498
|
+
(to-s (dot-operator-iter x))
|
499
|
+
(if (symbol? x)
|
500
|
+
(to-s x)
|
501
|
+
(error (sprintf "dot-operator requires symbol, but got %s" x)))))
|
502
|
+
(cdr lst))
|
503
|
+
"."))
|
504
|
+
(error "dot-operator requires symbol or (. symbol symbol) form.")))
|
505
|
+
(else
|
506
|
+
lst)))))
|
507
|
+
|
424
508
|
(cond
|
425
|
-
((
|
426
|
-
|
427
|
-
((
|
428
|
-
|
429
|
-
|
430
|
-
(string-join
|
431
|
-
(map
|
432
|
-
(lambda (x)
|
433
|
-
(if (pair? x)
|
434
|
-
(to-s (dot-operator-iter x))
|
435
|
-
(if (symbol? x)
|
436
|
-
(to-s x)
|
437
|
-
(error (sprintf "dot-operator requires symbol, but got %s" x)))))
|
438
|
-
(cdr lst))
|
439
|
-
"."))
|
440
|
-
(error "dot-operator requires symbol or (. symbol symbol) form.")))
|
509
|
+
((eq? 0 (length lst))
|
510
|
+
(error ". operator requires argument"))
|
511
|
+
((and (eq? 1 (length lst))
|
512
|
+
(symbol? (car lst)))
|
513
|
+
(intern (+ "." (to-s (car lst)))))
|
441
514
|
(else
|
442
|
-
|
443
|
-
|
444
|
-
(cond
|
445
|
-
((eq? 0 (length lst))
|
446
|
-
(error ". operator requires argument"))
|
447
|
-
((and (eq? 1 (length lst))
|
448
|
-
(symbol? (car lst)))
|
449
|
-
(intern (+ "." (to-s (car lst)))))
|
450
|
-
(else
|
451
|
-
((dot-operator-iter
|
452
|
-
(cons 'dot-operator lst)))))))
|
515
|
+
((dot-operator-iter
|
516
|
+
(cons 'dot-operator lst))))))))
|
453
517
|
|
454
518
|
(define (with-open filename pred . lst)
|
455
519
|
(let1 len (length lst)
|
@@ -475,12 +539,59 @@
|
|
475
539
|
|
476
540
|
|
477
541
|
;; ----------------------------------------
|
478
|
-
;; Utility function for testing
|
542
|
+
;; Utility function for testing and debugging
|
479
543
|
;; ----------------------------------------
|
480
|
-
;;
|
481
|
-
(define
|
544
|
+
;; Gauche's #?= like debug print function
|
545
|
+
(define debug-print-length 63)
|
546
|
+
(define (debug-print-output-func str) ;; default output func
|
547
|
+
(STDERR.print str))
|
548
|
+
(define (debug-limit-length x)
|
549
|
+
(+
|
550
|
+
(if (< debug-print-length x.length)
|
551
|
+
(let1 n debug-print-length.to_s
|
552
|
+
(sprintf (+ "%" n "." n "s ...") x))
|
553
|
+
x)
|
554
|
+
"\n"))
|
555
|
+
|
556
|
+
(define debug-print
|
557
|
+
(macro (_form sourcefile lineno sourcesexp)
|
558
|
+
(let1 val (gensym)
|
559
|
+
`(let ((,val nil))
|
560
|
+
(debug-print-output-func (debug-limit-length (sprintf "#?=\"%s\":%s:%s" ,sourcefile ,lineno (write-to-string ,sourcesexp))))
|
561
|
+
(set! ,val ,_form)
|
562
|
+
(debug-print-output-func (debug-limit-length (+ "#?- " (write-to-string ,val))))
|
563
|
+
,val))))
|
564
|
+
|
482
565
|
|
483
|
-
;;
|
484
|
-
|
485
|
-
|
486
|
-
|
566
|
+
;;
|
567
|
+
;; imported from this URL ( written by bizen )
|
568
|
+
;; http://practical-scheme.net/wiliki/wiliki.cgi?Gauche%3APrettyPrint
|
569
|
+
;;
|
570
|
+
;; Subsequently modified for initialize library for nendo: Kiyoka Nishiyama
|
571
|
+
(define (pretty-print s)
|
572
|
+
(define (do-indent level)
|
573
|
+
(for-each (lambda (x) (display " ")) (range level)))
|
574
|
+
(define (pp-parenl)
|
575
|
+
(display "("))
|
576
|
+
(define (pp-parenr)
|
577
|
+
(display ")"))
|
578
|
+
(define (pp-atom e prefix)
|
579
|
+
(when prefix (display " "))
|
580
|
+
(write e))
|
581
|
+
(define (pp-list s level prefix)
|
582
|
+
(and prefix (do-indent level))
|
583
|
+
(pp-parenl)
|
584
|
+
(let loop ((s s)
|
585
|
+
(prefix #f))
|
586
|
+
(if (null? s)
|
587
|
+
(pp-parenr)
|
588
|
+
(let1 e (car s)
|
589
|
+
(if (list? e)
|
590
|
+
(begin (and prefix (newline))
|
591
|
+
(pp-list e (+ level 1) prefix))
|
592
|
+
(pp-atom e prefix))
|
593
|
+
(loop (cdr s) #t)))))
|
594
|
+
(if (list? s)
|
595
|
+
(pp-list s 0 #f)
|
596
|
+
(write s))
|
597
|
+
(newline))
|