2014-06-27 22:32:23 -04:00
|
|
|
(define-library (picrin control list)
|
|
|
|
(import (scheme base)
|
2014-07-17 03:17:47 -04:00
|
|
|
(picrin control))
|
2014-06-27 22:32:23 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(define unit list)
|
|
|
|
|
|
|
|
(define (bind m f)
|
|
|
|
(apply append (map f m)))
|
|
|
|
|
|
|
|
(define-syntax reify
|
2014-06-27 22:32:23 -04:00
|
|
|
(syntax-rules ()
|
2015-07-19 02:13:17 -04:00
|
|
|
((_ expr)
|
|
|
|
(reset (unit expr)))))
|
2014-06-27 22:32:23 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(define (reflect m)
|
|
|
|
(shift k (bind m k)))
|
2014-06-27 22:32:23 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(define zero '())
|
2014-06-27 22:32:23 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(define plus append)
|
2014-06-27 23:07:56 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(export unit
|
|
|
|
bind
|
|
|
|
zero
|
|
|
|
plus
|
|
|
|
reify
|
|
|
|
reflect
|
|
|
|
(rename reify for)
|
|
|
|
(rename reflect in)
|
|
|
|
(rename unit yield)))
|