flat vs flatter

Started by newdep, August 19, 2005, 03:17:25 PM

Previous topic - Next topic

newdep

Hi Lutz,



Following the logic on 'flat making a nested list flat a simple list could

become even flatter... i.e.



(flat '( (1 2 3 4 5) ))  will always become ( 1 2 3 4 5 )



where a (flat (1 2 3 4 5)) will always return ( 1 2 3 4 5 )



what about making flat fatting? a single list?



(flat '( 1 2 3 4 5) ) would then return 1 2 3 4 5 or



(flat (flat ' ( (1234) '(5) ))) would be 1 2 3 4 5

-- or just 12345 --



It would make life earier mixing Atoms with lists...



how about it ?



Regards, Norman
-- (define? (Cornflakes))

Dmi

#1
Quote(flat (flat ' ( (1234) '(5) )))

 would be 1 2 3 4 5

nice, but, imho, that is not job of "flat"-function either: to have one function that does two different jobs is quite terrible ;-)
Quote-- or just 12345 --

(join (flat '( (1234) '(5) )))
does that?
WBR, Dmi

newdep

#2
Hi Dmi,



Yes i know that Join does the convertion well, thought its more about

"the way of expectation" from a function.. A function have a name and

the name indicates a behavior.. and when your programming you are

expecting sertain function to behave like they sound.. :-) Its not a must

ofcause but its more elegant and even more easier..



Regards, Norman.
-- (define? (Cornflakes))

Dmi

#3
Oh! In this point of view, probably you're right...

English is not my native, so I'm not always feel exact sense of words.

But... in other side, flat's operation area is a lists, so flat is to do flat lists...
WBR, Dmi