[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Aspect Oriented Programming in context of lightweight languages.



Now do functions. You get let/cc (call/cc followed immediately by a
lambda, but packaged as a binding form) and continuation applications
and let. You have to make lambda, and application.

:)

Robby

At Fri, 21 Mar 2003 11:57:28 -0500, "Anton van Straaten" wrote:
> John Clements wrote:
> 
> > WANTED: certified call/cc operator.  experience a plus.
> > 
> > 
> > john "interested parties please submit continuation to..." clements
> 
> (define (make-box val)
>   (letrec ((slot (call/cc (lambda (k) k))))
>     (if (pair? slot)
>         ((cdr slot))
>         (let* ((setter slot)
>                (box (lambda new-val
>                       (if (null? new-val)
>                           (if (pair? slot) 
>                               (car slot))
>                           (call/cc
>                            (lambda (k)
>                              (setter (cons (car new-val) k))))))))
>           (box val)
>           box))))
> 
> (define (box-ref b) (b))
> (define (box-set! b x) (b x))
> 
> 
> Do I get the job?
> 
>