unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* passing an alist to a procedure without making a copy?
@ 2009-04-18 22:57 Mark Polesky
  2009-04-19  1:20 ` Linas Vepstas
  2009-04-19 17:35 ` Clinton Ebadi
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Polesky @ 2009-04-18 22:57 UTC (permalink / raw)
  To: guile-user


(define my-alist
  '((a . 1)
    ))
    
(set! my-alist (acons 'b 2 my-alist))

my-alist ==> ((b . 2) (a . 1))

(define (alist-prepend alist key value)
  (set! alist (acons key value alist)))

(alist-prepend my-alist 'c 3)

my-alist ==> ((b . 2) (a . 1))

________________________________

How can I get (alist-prepend) to operate
on the original alist?

Thanks,
Mark



      




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-20 23:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-18 22:57 passing an alist to a procedure without making a copy? Mark Polesky
2009-04-19  1:20 ` Linas Vepstas
2009-04-19  7:30   ` r6rsguy
2009-04-19 17:35 ` Clinton Ebadi
2009-04-20 23:36   ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).