31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
; the name bindings are ephemeral; they do not survive the immediate
; context of the constructor.
(define-macro (interlace . body)
; given a list with both named and nameless members, identify
; which is which and instate the vector.
(define (name? term)
(define (coda str) (substring str
(- (string-length str) 1)
(string-length str)))
(if (not (symbol? term)) #f
(let* ([term-string (symbol->string term)]
[final-char (coda term-string)])
(print "TERMSTRING:" term-string)
(print "CHAR:" final-char)
(if (not (equal? final-char ".")) #f
(substring term-string 0 (- (string-length term-string) 1))))))
(define (divide-entries lst @named @nameless)
; given a list, return a pair [ x . y ] such that x is a list
; of named terms ( name . term ) and y is a list of nameless
; terms.
(if (eq? lst '()) (cons @named @nameless)
(let* ([head (car lst)]
|
|
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
|
; the name bindings are ephemeral; they do not survive the immediate
; context of the constructor.
(define-macro (interlace . body)
; given a list with both named and nameless members, identify
; which is which and instate the vector.
(define (name? term)
; given a symbol, determine wheter it is a name, and if so return
; that name as a string and without the name-marking suffix ‹.›
; otherwise, return #f
(define (coda str) (substring str
(- (string-length str) 1)
(string-length str)))
(if (not (symbol? term)) #f
(let* ([term-string (symbol->string term)]
[final-char (coda term-string)])
(if (not (equal? final-char ".")) #f
(string->symbol(substring term-string 0 (- (string-length term-string) 1)))))))
(define (divide-entries lst @named @nameless)
; given a list, return a pair [ x . y ] such that x is a list
; of named terms ( name . term ) and y is a list of nameless
; terms.
(if (eq? lst '()) (cons @named @nameless)
(let* ([head (car lst)]
|