[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] tinyclos - how to copy an object?
From: |
Alex Queiroz |
Subject: |
Re: [Chicken-users] tinyclos - how to copy an object? |
Date: |
Fri, 21 Sep 2007 08:35:22 -0300 |
Hallo,
On 9/21/07, Shawn Rutledge <address@hidden> wrote:
>
> Yeah I wrote one too:
>
> (define (copy o)
> (let*
> (
> [class (class-of o)]
> [slots (class-slots class)]
> [thevoid (void)]
> )
> ; (printf "copying object of ~s~%" class)
> (apply make (cons class
> (let loop ([args '()][rem slots])
> (if (null? rem)
> (reverse args)
> (let*
> (
> [slot-name (caar rem)]
> [val (-> o slot-name)]
> )
> (if (eq? thevoid val)
> (loop args (cdr rem))
> (loop (cons val (cons
> (caar rem) args)) (cdr rem) )))))))))
>
What an uncanny formatting! :-)
Cheers,
--
-alex
http://www.ventonegro.org/