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
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon



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

Reply via email to