mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 13:37:33 +02:00
WIP: call-with-values
This commit is contained in:
parent
5c82cd7aef
commit
ab48faaa5e
2 changed files with 12 additions and 6 deletions
17
cyclone.scm
17
cyclone.scm
|
@ -133,18 +133,23 @@
|
|||
(set! globals (cons 'call/cc globals))
|
||||
(set! module-globals (cons 'call/cc module-globals))
|
||||
(set! input-program
|
||||
;(cons
|
||||
; '(define call-with-values
|
||||
; (lambda (k producer consumer)
|
||||
; (producer
|
||||
; )
|
||||
(cons
|
||||
;; Experimental version of call-with-values, but this
|
||||
;; is not working yet!
|
||||
'(define call-with-values
|
||||
(lambda (k producer consumer)
|
||||
(producer
|
||||
(lambda (val)
|
||||
(consumer k val)))))
|
||||
;(lambda vals
|
||||
; (apply k consumer vals)))))
|
||||
(cons
|
||||
;; call/cc must be written in CPS form, so it is added here
|
||||
;; TODO: prevents this from being optimized-out
|
||||
;; TODO: will this cause issues if another var is assigned to call/cc?
|
||||
'(define call/cc
|
||||
(lambda (k f) (f k (lambda (_ result) (k result)))))
|
||||
cps)));)
|
||||
cps))))
|
||||
(else
|
||||
;; No need for call/cc yet
|
||||
(set! input-program cps))))
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
;delete-duplicates
|
||||
call-with-current-continuation
|
||||
call/cc
|
||||
call-with-values
|
||||
values
|
||||
;(Cyc-bin-op cmp x lst)
|
||||
;(Cyc-bin-op-char cmp c cs)
|
||||
|
|
Loading…
Add table
Reference in a new issue