Page 1 of 1

flat vs flatter

Posted: Fri Aug 19, 2005 10:17 pm
by 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

Posted: Fri Aug 19, 2005 11:26 pm
by Dmi
(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 ;-)
-- or just 12345 --

Code: Select all

(join (flat '( (1234) '(5) )))
does that?

Posted: Sat Aug 20, 2005 7:30 am
by newdep
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.

Posted: Sat Aug 20, 2005 5:14 pm
by Dmi
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...