mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-06 12:46:35 +02:00
Migrated more functions to util
This commit is contained in:
parent
0740f2da7a
commit
8c38845006
3 changed files with 15 additions and 12 deletions
5
Makefile
5
Makefile
|
@ -1,7 +1,10 @@
|
||||||
TESTSCM = unit-tests
|
TESTSCM = unit-tests
|
||||||
TESTFILES = $(addprefix tests/, $(addsuffix .scm, $(TESTSCM)))
|
TESTFILES = $(addprefix tests/, $(addsuffix .scm, $(TESTSCM)))
|
||||||
|
|
||||||
all: cyclone scheme/base.o scheme/read.o scheme/write.o scheme/char.o scheme/eval.o scheme/file.o icyc
|
all: cyclone scheme/base.o scheme/read.o scheme/write.o scheme/char.o scheme/eval.o scheme/file.o icyc scheme/cyclone/util.o
|
||||||
|
|
||||||
|
scheme/cyclone/util.o: cyclone scheme/cyclone/util.sld
|
||||||
|
./cyclone scheme/cyclone/util.sld
|
||||||
|
|
||||||
scheme/base.o: cyclone scheme/base.sld
|
scheme/base.o: cyclone scheme/base.sld
|
||||||
./cyclone scheme/base.sld
|
./cyclone scheme/base.sld
|
||||||
|
|
|
@ -190,17 +190,6 @@
|
||||||
(define (void) (if #f #t)))
|
(define (void) (if #f #t)))
|
||||||
(else #f))
|
(else #f))
|
||||||
|
|
||||||
; char->natural : char -> natural
|
|
||||||
(define (char->natural c)
|
|
||||||
(let ((i (char->integer c)))
|
|
||||||
(if (< i 0)
|
|
||||||
(* -2 i)
|
|
||||||
(+ (* 2 i) 1))))
|
|
||||||
|
|
||||||
; integer->char-list : integer -> string
|
|
||||||
(define (integer->char-list n)
|
|
||||||
(string->list (number->string n)))
|
|
||||||
|
|
||||||
; gensym-count : integer
|
; gensym-count : integer
|
||||||
(define gensym-count 0)
|
(define gensym-count 0)
|
||||||
|
|
||||||
|
|
11
util.scm
11
util.scm
|
@ -4,6 +4,17 @@
|
||||||
(equal? (car exp) tag)
|
(equal? (car exp) tag)
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
|
; char->natural : char -> natural
|
||||||
|
(define (char->natural c)
|
||||||
|
(let ((i (char->integer c)))
|
||||||
|
(if (< i 0)
|
||||||
|
(* -2 i)
|
||||||
|
(+ (* 2 i) 1))))
|
||||||
|
|
||||||
|
; integer->char-list : integer -> string
|
||||||
|
(define (integer->char-list n)
|
||||||
|
(string->list (number->string n)))
|
||||||
|
|
||||||
;; Name-mangling.
|
;; Name-mangling.
|
||||||
|
|
||||||
;; We have to "mangle" Scheme identifiers into
|
;; We have to "mangle" Scheme identifiers into
|
||||||
|
|
Loading…
Add table
Reference in a new issue