Hi Joe, > Hi Alex, I revisited my code based on your reply. I like the con/cons > approach and developed a small helper class. I'm sharing here in case > others find it helpful:
Nice! > (class +AppendList) > > (dm T () (=: L (cons))) > > (dm append> (Node Parent) > (let L (or Parent (: L)) > (ifn (car L) > (prog (set L Node) L) > (let (Len (length L) O (cons)) > (con (nth L Len) O) > (set (nth L (inc Len)) Node) > O ) ) ) ) > > (dm append-list> (Parent) > (car (append> This (cons) Parent))) > > (dm list> () (: L) ) I see. OOP (i.e. the dynamic message passing, and the space for the object itself) has some overhead, though. You could consider using 'fifo': (off L) (fifo 'L 'Mother 'Father) ... (fifo 'L ..) and in the end cut it off to get a normal list: (prog1 (cdr L) (con L)) Another possibility might be to use 'make' and 'link' etc., but use 'made' to dynamically switch between different make-environments. 'made' is in fact not very expensive. But 'fifo' is probably the most efficient way. ♪♫ - Alex -- UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
