chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] do* implementation


From: Kon Lovett
Subject: Re: [Chicken-users] do* implementation
Date: Tue, 28 Apr 2015 11:55:42 -0700

> On Apr 28, 2015, at 11:35 AM, Alexej Magura <address@hidden> wrote:
> 
> 
> Message: 5
> Date: Tue, 28 Apr 2015 10:15:28 +0200
> From: Christian Kellermann 
> <address@hidden>
>> 
>> Message: 5
>> Date: Tue, 28 Apr 2015 10:15:28 +0200
>> From: Christian Kellermann 
>> <address@hidden>
>> 
>> To: 
>> address@hidden
>> 
>> Subject: Re: [Chicken-users] do* implementation
>> Message-ID: 
>> <address@hidden>
>> 
>> Content-Type: text/plain
>> 
>> Alexej Magura 
>> <address@hidden>
>>  writes:
>> 
>>> I thought about writing my own, but I'm a bit rusty with scheme atm
>>> and I couldn't figure out where 
>>> /do/
>>>  is defined in Chicken's source
>>> code, so I don't think I'd be able to implement it efficiently.
>>> 
>> It's defined in expand.scm:1261 in CHICKEN core, as it's syntax. 
>> 

Suspect you will need to write your own. The definition at expand.scm:1261 is 
for the ‘do’ form:

(do ((a '(1 2 3 4 5) (cdr a))
      (b (car a) (car a)))
     ((eq '() a))
     (print b))

=>

(##core#app
  (##core#letrec*
    ((doloop
       (##core#loop-lambda
         (a b)
         (##core#if
           (eq (##core#quote ()) a)
           (##core#undefined)
           (##core#begin
             (##core#let () (print b))
             (##core#app doloop (cdr a) (car a)))))))
    doloop)
  (##core#quote (1 2 3 4 5))
  (car a))

>> 
>> HTH,
>> 
>> Christian
>> 
>> 
>> -- 
>> May you be peaceful, may you live in safety, may you be free from
>> suffering, and may you live with ease.
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> _______________________________________________
>> Chicken-users mailing list
>> 
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/chicken-users
> 
> Oh, guess grep must have missed it somehow... anyway, thanks, Christian.
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]