[plt-scheme] Re: list output

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Wed Apr 29 19:00:03 EDT 2009

Documentation for "append" is at:
http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_idx_420

Start up DrScheme, set the Language to Module, paste all of the code 
shown below into the top window, and hit the Run toolbar button.  I've 
added comments to this code to show the values that are displayed in the 
bottom window when you hit Run.

You can use DrScheme in this manner to test out what code does, whenever 
the documentation is unclear.

If this is frustrating, I think it's time to switch tracks to HtDP.  
HtDP is not intended to teach Scheme, but it happens to teach Scheme 
incidentally, and in a gentler way than skimming the R5RS document can.  
http://www.htdp.org/

;;; ---- begin ----

#lang scheme/base

(define list1 '(a b c))
(define list2 '(x y z))

list1
;; ==> (a b c)

list2
;; ==> (x y z)

(append list1 list2)
;; ==> (a b c x y z)

list1
;; ==> (a b c)

(set! list1 (append list1 list2))

list1
;; ==> (a b c x y z)

;;; ---- end ----


-- 
http://www.neilvandyke.org/


Posted on the users mailing list.