\version "2.15.36"
#(define-public lst `())
#(define (set-new-alist! ls-1 ls-2 proc)
(for-each (lambda (x) (set! ls-1 (acons x proc ls-1))) ls-2)
ls-1)
#(set-new-alist! lst '(1 2 3) "X")
#(display lst)
returns: ()
What am I missing?
%%
Well, if you change
#(set-new-alist! lst '(1 2 3)
Thomas Morley writes:
> Hi,
>
> the following code gives me the expected output in guile:
>
> (define-public lst `())
> (define (set-new-alist! ls-1 ls-2 proc)
> (for-each (lambda (x) (set! ls-1 (acons x proc ls-1))) ls-2)
> ls-1)
> (set-new-alist! lst '(1 2 3) "X")
>
> ==> ((3 . "X") (2 . "X
Hi,
the following code gives me the expected output in guile:
(define-public lst `())
(define (set-new-alist! ls-1 ls-2 proc)
(for-each (lambda (x) (set! ls-1 (acons x proc ls-1))) ls-2)
ls-1)
(set-new-alist! lst '(1 2 3) "X")
==> ((3 . "X") (2 . "X") (1 . "X"))
trying similiar in lily:
\v