[Pharo-users] Re: Intended behaviour of flatten and flatCollect:

2022-04-13 Thread Richard O'Keefe
PS: *Neither* #flattened nor #flatCollect: can be blamed on 40 years of history. #flatten(ed) arrived in Squeak back in 2015, at which time #flatCollect: did not exist. In fact there is *still* no #flatCollect: in Squeak, although Squeak does have #gather:, since 2002. #flatCollect: was added to

[Pharo-users] Re: Intended behaviour of flatten and flatCollect:

2022-04-13 Thread Richard O'Keefe
It would help to know which version of Pharo you are using. #(1 2 3) flatten raises an exception in Pharo 9 because there is no #flatten in Array's protocol. Collection has #flatCollect: -- #gather: was not a terribly helpful name, -- but #flatCollect: is horribly misleading. #flatCollect:a

[Pharo-users] Re: Intended behaviour of flatten and flatCollect:

2022-04-13 Thread Richard O'Keefe
"Flattening" is problematic in every programming language I know that has something like it in its library. It was born problematic in Lisp and it has continued problematic ever since. (I am aware of several Smalltalk systems offering it. With the exception of Squeak and Pharo, no two of them agr

[Pharo-users] Re: Intended behaviour of flatten and flatCollect:

2022-04-12 Thread Konrad Hinsen
Hi Kasper, Thanks for your reply! > Sorry, but which version of Pharo are we talking about. Sorry, I forgot to say that I am still using Pharo 9. > I just tried with Pharo 10, which has no flatten method for arrays at Interesting. So I double-checked - and found that the "flatten" in my image

[Pharo-users] Re: Intended behaviour of flatten and flatCollect:

2022-04-12 Thread Kasper Osterbye
Hi Konrad Sorry, but which version of Pharo are we talking about. I just tried with Pharo 10, which has no flatten method for arrays at all, somewhere along the version I believe the method was renamed to flattened. #(1 #(2 #(a b) 3) 4) flattened >>> #(1 2 #a #b 3 4) as one would expect. flat