flat vs flatter

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

flat vs flatter

Post 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
-- (define? (Cornflakes))

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post 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?
WBR, Dmi

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post 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.
-- (define? (Cornflakes))

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post 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...
WBR, Dmi

Locked