mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
Added call-with-values back
This commit is contained in:
parent
a1898f20ab
commit
e7c050ef2c
5 changed files with 18 additions and 17 deletions
|
@ -131,8 +131,8 @@
|
|||
input-program)))
|
||||
(cond
|
||||
((and library? (equal? lib-name '(scheme base)))
|
||||
(set! globals (cons 'call/cc globals))
|
||||
(set! module-globals (cons 'call/cc module-globals))
|
||||
(set! globals (append '(call-with-values call/cc) globals))
|
||||
(set! module-globals (append '(call-with-values call/cc) module-globals))
|
||||
(set! input-program
|
||||
(cons
|
||||
;; Experimental version of call-with-values,
|
||||
|
|
1
eval.scm
1
eval.scm
|
@ -188,6 +188,7 @@
|
|||
(define primitive-procedures
|
||||
(list
|
||||
(list 'call/cc call/cc)
|
||||
(list 'call-with-values call-with-values)
|
||||
(list 'Cyc-global-vars Cyc-global-vars)
|
||||
(list 'Cyc-get-cvar Cyc-get-cvar)
|
||||
(list 'Cyc-set-cvar! Cyc-set-cvar!)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
;delete-duplicates
|
||||
call-with-current-continuation
|
||||
call/cc
|
||||
;call-with-values
|
||||
;dynamic-wind
|
||||
;values
|
||||
call-with-values
|
||||
dynamic-wind
|
||||
values
|
||||
;(Cyc-bin-op cmp x lst)
|
||||
;(Cyc-bin-op-char cmp c cs)
|
||||
char=?
|
||||
|
@ -74,14 +74,14 @@
|
|||
(lambda (cont) (apply cont things))))
|
||||
;; TODO: just need something good enough for bootstrapping (for now)
|
||||
;; does not have to be perfect (this is not, does not handle call/cc or exceptions)
|
||||
;(define (dynamic-wind before thunk after)
|
||||
; (before)
|
||||
; (call-with-values
|
||||
; thunk
|
||||
; (lambda (result) ;results
|
||||
; (after)
|
||||
; result)))
|
||||
; ;(apply values results))))
|
||||
(define (dynamic-wind before thunk after)
|
||||
(before)
|
||||
(call-with-values
|
||||
thunk
|
||||
(lambda (result) ;results
|
||||
(after)
|
||||
result)))
|
||||
;(apply values results))))
|
||||
(define (Cyc-bin-op cmp x lst)
|
||||
(cond
|
||||
((null? lst) #t)
|
||||
|
|
6
test.scm
6
test.scm
|
@ -20,7 +20,7 @@
|
|||
(define b (vector 10 20 30 40 50))
|
||||
(vector-copy! b 1 a 0 2)
|
||||
(write (equal? b #(10 1 2 40 50)))
|
||||
;(call-with-values
|
||||
; (lambda () (values 1 1))
|
||||
; (lambda (a) (write a)))
|
||||
(call-with-values
|
||||
(lambda () (values 1 1))
|
||||
(lambda (a) (write a)))
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
|
||||
|
||||
(define (built-in-syms)
|
||||
'(call/cc define))
|
||||
'(call-with-values call/cc define))
|
||||
|
||||
;; Tuning
|
||||
(define *do-code-gen* #t) ; Generate C code?
|
||||
|
|
Loading…
Add table
Reference in a new issue