[comp.lang.scheme] flattening lists

gyro@cymbal.reasoning.COM (Scott Layson Burson) (03/04/91)

   Date: 1 Mar 91 15:30:24 GMT
   From: munawar@vaxb.acs.unt.edu

   Hello,
     My problem is to flatten
     '((a b)(c d)(e f)) in to '(a b c d e f)
   I am not sure how to tackle this problem specifically in TI PCSCHEME

Here we see the problem with specifying programs by examples.  Two solutions
have appeared, both of which return this output when given this input, but they
are otherwise very different.  Call them the ACCUMULATE solution and the
FLATTEN solution:

Input			ACCUMULATE		FLATTEN
-----			----------		-------
'(a (b c))		<error>			'(a b c)
'(((a) (b)) (c d))	'((a) (b) c d)		'(a b c d)

Now it is up to you to figure out 1) why they do what they do and 2) which, if
either, you really want for your program.

-- Scott