chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] General newbie query about tspl execise


From: Kon Lovett
Subject: Re: [Chicken-users] General newbie query about tspl execise
Date: Thu, 04 Nov 2010 11:19:10 -0700


On Nov 4, 2010, at 10:09 AM, Enwin Thun wrote:

Please redirect me if this is inappropriate for this forum.

The following code appears in the tspl book.
<http://www.scheme.com/tspl3/start.html#./start:s185>

It is an "implementation of a queue use[ing] a tconc structure".

To put new elements into the end of the list, it is required that the
2 'ignored atoms are really the same.

This makes me curious about how atoms and lists are stored.  I am
looking for a link that explains this in terms of memory addresses,
pointers, etc.  A link for general discussion about memory management
in scheme would also be nice.

Alan set you some general references but Chicken specific information can be found at http://wiki.call-cc.org/man/4/Data%20representation


Thanks.

(define make-queue
 (lambda ()
   (let ((end (cons 'ignored '())))
     (cons end end))))

(define putq!
 (lambda (q v)
   (let ((end (cons 'ignored '())))
     (set-car! (cdr q) v)
     (set-cdr! (cdr q) end)
     (set-cdr! q end))))

(define getq
 (lambda (q)
   (car (car q))))

(define delq!
 (lambda (q)
   (set-car! q (cdr (car q)))))

_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon





reply via email to

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