Use '->' in names of functions that convert values.
This commit is contained in:
parent
1bad1508f1
commit
19777a86ae
|
|
@ -64,22 +64,22 @@
|
||||||
|
|
||||||
(define (parse tokens) (parse0 tokens '()))
|
(define (parse tokens) (parse0 tokens '()))
|
||||||
|
|
||||||
(define (text-to-expression text) (parse (tokenize text)))
|
(define (text->expression text) (parse (tokenize text)))
|
||||||
|
|
||||||
|
|
||||||
(define (joy-term-to-string term)
|
(define (joy-term->string term)
|
||||||
(cond ((boolean? term) (if term "true" "false"))
|
(cond ((boolean? term) (if term "true" "false"))
|
||||||
((number? term) (->string term))
|
((number? term) (->string term))
|
||||||
((list? term) (conc "[" (joy-expression-to-string term) "]"))
|
((list? term) (conc "[" (joy-expression->string term) "]"))
|
||||||
(else term)))
|
(else term)))
|
||||||
|
|
||||||
(define (joy-expression-to-string expr)
|
(define (joy-expression->string expr)
|
||||||
(string-intersperse (map joy-term-to-string expr) " "))
|
(string-intersperse (map joy-term->string expr) " "))
|
||||||
|
|
||||||
(define (doit text)
|
(define (doit text)
|
||||||
(receive (stack dict)
|
(receive (stack dict)
|
||||||
(joy '() (text-to-expression text) '())
|
(joy '() (text->expression text) '())
|
||||||
(joy-expression-to-string stack)))
|
(joy-expression->string stack)))
|
||||||
|
|
||||||
(display (doit "ab cd [[ ]] 23 4 - [true] false"))
|
(display (doit "ab cd [[ ]] 23 4 - [true] false"))
|
||||||
(newline)
|
(newline)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue