
Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don't know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don't really like the name, but haven't found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:. maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian

[:year :month :day | Date newDay: day month: month year: year] valueWithPossibleArguments: (($- split: '2020-03-28') collect: #asNumber) Norbert
Am 28.03.2020 um 13:42 schrieb Christian Haider <Christian.Haider@smalltalked-visuals.com>:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: I am sure that others came up with this. Anybody knows? What are you using for this pattern? I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>

Pressed send to fast. Just wanted to add that this is how it works in pharo but no collection selector. Norbert
Am 28.03.2020 um 14:06 schrieb Norbert Hartl <norbert@hartl.name>:
[:year :month :day | Date newDay: day month: month year: year] valueWithPossibleArguments: (($- split: '2020-03-28') collect: #asNumber)
Norbert
Am 28.03.2020 um 13:42 schrieb Christian Haider <Christian.Haider@smalltalked-visuals.com <mailto:Christian.Haider@smalltalked-visuals.com>>:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: I am sure that others came up with this. Anybody knows? What are you using for this pattern? I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>
Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hello Christian, " I don't really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | ...] Mark Mark Plas Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv [cid:logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png] <http://www.mediagenix.tv/en/cabsat2018/> Nieuwe Gentsesteenweg 21/1<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> <https://nl.linkedin.com/company/mediagenix-ng><https://nl.linkedin.com/company/mediagenix-ng> [cid:linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png] <https://nl.linkedin.com/company/mediagenix-ng> [cid:twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png] <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/> [cid:Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png] <https://www.facebook.com/MEDIAGENIX/> www.mediagenix.tv<http://www.mediagenix.tv> Directions to MEDIAGENIX<http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don't know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don't really like the name, but haven't found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:... maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian

I think the name destructDo: comes from destructuring assignment. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/... <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/...> Norbert
Am 28.03.2020 um 14:15 schrieb Mark Plas <mark.plas@mediagenix.tv>:
Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv>
<logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png> <http://www.mediagenix.tv/en/cabsat2018/>
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> <https://nl.linkedin.com/company/mediagenix-ng> <https://nl.linkedin.com/company/mediagenix-ng> <linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png> <https://nl.linkedin.com/company/mediagenix-ng> <twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png> <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/><Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png> <https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv <http://www.mediagenix.tv/> Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org <mailto:esug-list-bounces@lists.esug.org>> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu <mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org <mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com <mailto:amber-lang@googlegroups.com> Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: I am sure that others came up with this. Anybody knows? What are you using for this pattern? I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>

How about #consume: ? Il giorno sab 28 mar 2020 alle ore 13:20 Norbert Hartl <norbert@hartl.name> ha scritto:
I think the name destructDo: comes from destructuring assignment.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/...
Norbert
Am 28.03.2020 um 14:15 schrieb Mark Plas <mark.plas@mediagenix.tv>:
Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
*Mark Plas* Software Engineer T +32 2 467 34 30
mark.plas@mediagenix.tv
<logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png>
<http://www.mediagenix.tv/en/cabsat2018/> Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://nl.linkedin.com/company/mediagenix-ng> <linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png> <https://nl.linkedin.com/company/mediagenix-ng> <twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png> <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/> <Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png> <https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
*This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.*
*From:* Esug-list <esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
- I am sure that others came up with this. Anybody knows? - What are you using for this pattern? - I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? - What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

How about: #mapTo: Graham
Giovanni Corriga <mailto:giovanni@corriga.net> 28 March 2020 at 15:35 How about #consume: ?
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org Norbert Hartl <mailto:norbert@hartl.name> 28 March 2020 at 15:19 I think the name destructDo: comes from destructuring assignment.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/...
Norbert
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org Mark Plas <mailto:mark.plas@mediagenix.tv> 28 March 2020 at 15:15
Hello Christian,
"I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
**
*Mark Plas*
Software Engineer T +32 2 467 34 30
mark.plas@mediagenix.tv
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv <http://www.mediagenix.tv>
Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
/This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately./
*From:*Esug-list <esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org Christian Haider <mailto:christian.haider@smalltalked-visuals.com> 28 March 2020 at 14:42
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

It reminds me of Javascript there you have similar constructs via apply() and i tend to think that the name is not too bad either. #(1 2 3) apply:[:a :b :c | ] I am a bit sceptic about the idea though. Given the examples you provided i do think it’s a neat solution but when i consider: (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I’m sure that the input string is not a literal because then this whole code doesn’t make much sense at all. But when the string is not literal, no-one can guarantee the correctness of the string. I’ve seen you use #cull: in the implementation so at least there’s no error if the number of arguments is smaller than the collection. But what happens the other way around? Maybe you should call #valueWithArguments: and ensure that the arguments are filled up with nil. Other than that i hope such a construct doesn’t lure people to use tupel-like arrays. That just produces the hardest-to-understand code ever. Kind Regards Karsten — Georg Heeg eK Wallstraße 22 06366 Köthen Tel.: 03496/214328 FAX: 03496/214712 Amtsgericht Dortmund HRA 12812 Am 28. März 2020 bei 14:36:11, Giovanni Corriga (giovanni@corriga.net<mailto:giovanni@corriga.net>) schrieb: How about #consume: ? Il giorno sab 28 mar 2020 alle ore 13:20 Norbert Hartl <norbert@hartl.name<mailto:norbert@hartl.name>> ha scritto: I think the name destructDo: comes from destructuring assignment. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/... Norbert Am 28.03.2020 um 14:15 schrieb Mark Plas <mark.plas@mediagenix.tv<mailto:mark.plas@mediagenix.tv>>: Hello Christian, " I don’t really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | …] Mark Mark Plas Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv<mailto:mark.plas@mediagenix.tv> <logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png> <http://www.mediagenix.tv/en/cabsat2018/> Nieuwe Gentsesteenweg 21/1<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> <https://nl.linkedin.com/company/mediagenix-ng><https://nl.linkedin.com/company/mediagenix-ng> <linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png><https://nl.linkedin.com/company/mediagenix-ng> <twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png><https://twitter.com/mediagenix_tv><https://twitter.com/mediagenix_tv><https://twitter.com/mediagenix_tv><https://www.facebook.com/MEDIAGENIX/><Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv<http://www.mediagenix.tv/> Directions to MEDIAGENIX<http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list <esug-list-bounces@lists.esug.org<mailto:esug-list-bounces@lists.esug.org>> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu<mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org<mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com<mailto:amber-lang@googlegroups.com> Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don’t know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org<mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org<mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

I chose the name because of the old Lisp “destructuring-bind”. But this is more powerful, because it does tree matching. This is just shallow. I am not sure where the concept was invented first. It may have been Lisp. Von: Norbert Hartl <norbert@hartl.name> Gesendet: Samstag, 28. März 2020 14:20 An: Mark Plas <mark.plas@mediagenix.tv> Cc: Christian Haider <christian.haider@smalltalked-visuals.com>; vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Betreff: Re: [Esug-list] destructDo: I think the name destructDo: comes from destructuring assignment. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/... Norbert Am 28.03.2020 um 14:15 schrieb Mark Plas <mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv> >: Hello Christian, " I don’t really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | …] Mark Mark Plas Software Engineer T +32 2 467 34 30 <mailto:mark.plas@mediagenix.tv> mark.plas@mediagenix.tv <logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png> <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium <https://nl.linkedin.com/company/mediagenix-ng> <linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png> <https://twitter.com/mediagenix_tv> <twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png> <https://www.facebook.com/MEDIAGENIX/> <Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png> <http://www.mediagenix.tv/> www.mediagenix.tv <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> Directions to MEDIAGENIX This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list < <mailto:esug-list-bounces@lists.esug.org> esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: <mailto:vwnc@cs.uiuc.edu> vwnc@cs.uiuc.edu; <mailto:esug-list@lists.esug.org> esug-list@lists.esug.org; <mailto:amber-lang@googlegroups.com> amber-lang@googlegroups.com Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don’t know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian _______________________________________________ Esug-list mailing list <mailto:Esug-list@lists.esug.org> Esug-list@lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hello Christian, the hint to Lisp is obvious. In Clojure (a modern Lisp-Dialect) destructuring (https://clojure.org/guides/destructuring) is used a lot. Johannes Am 28.03.2020 um 15:23 schrieb Christian Haider <christian.haider@smalltalked-visuals.com<mailto:christian.haider@smalltalked-visuals.com>>: I chose the name because of the old Lisp “destructuring-bind”. But this is more powerful, because it does tree matching. This is just shallow. I am not sure where the concept was invented first. It may have been Lisp. Von: Norbert Hartl <norbert@hartl.name<mailto:norbert@hartl.name>> Gesendet: Samstag, 28. März 2020 14:20 An: Mark Plas <mark.plas@mediagenix.tv<mailto:mark.plas@mediagenix.tv>> Cc: Christian Haider <christian.haider@smalltalked-visuals.com<mailto:christian.haider@smalltalked-visuals.com>>; vwnc@cs.uiuc.edu<mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org<mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com<mailto:amber-lang@googlegroups.com> Betreff: Re: [Esug-list] destructDo: I think the name destructDo: comes from destructuring assignment. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/... Norbert Am 28.03.2020 um 14:15 schrieb Mark Plas <mark.plas@mediagenix.tv<mailto:mark.plas@mediagenix.tv>>: Hello Christian, " I don’t really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | …] Mark Mark Plas Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv<mailto:mark.plas@mediagenix.tv> <logomgxnew_3d44337b-2535-4d6a-9f5f-3fdd565513ca.png> Nieuwe Gentsesteenweg 21/1<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium<https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> <linkedin_75b9c4f1-6a2b-497c-aab8-df56fe16b8e3.png><https://nl.linkedin.com/company/mediagenix-ng> <twitter_de4c3300-c6ab-4898-a962-b33ff662a322.png><https://twitter.com/mediagenix_tv><Facebook-icon_6bef7545-f54e-4548-bfc4-1f07407f2642.png><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv<http://www.mediagenix.tv/> Directions to MEDIAGENIX<http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list <esug-list-bounces@lists.esug.org<mailto:esug-list-bounces@lists.esug.org>> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu<mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org<mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com<mailto:amber-lang@googlegroups.com> Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don’t know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org<mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org<mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hi. I like tupleDo: or matchDo: and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html #(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7) may be it already exist? if not, would really be a + Christophe Le 28/03/2020 à 14:15, Mark Plas a écrit :
Hello Christian,
"I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
**
*Mark Plas*
Software Engineer T +32 2 467 34 30
mark.plas@mediagenix.tv
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv <http://www.mediagenix.tv>
Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
/This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately./
*From:*Esug-list <esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Yes, that would be nice. Unfortunately a bit more involved than this 1-liner Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: Hi. I like tupleDo: or matchDo: and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html #(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | ] here c would be #(3 6 7) may be it already exist? if not, would really be a + Christophe Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian, " I dont really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | ] Mark Mark Plas Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv> <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium <https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/> <http://www.mediagenix.tv> www.mediagenix.tv <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> Directions to MEDIAGENIX This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list <mailto:esug-list-bounces@lists.esug.org> <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu <mailto:vwnc@cs.uiuc.edu> ; esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> ; amber-lang@googlegroups.com <mailto:amber-lang@googlegroups.com> Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I dont know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I dont really like the name, but havent found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo: maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hi Christian and all, #destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better. #tupleDo: feels better. But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with #(1 2 3 4) tupleDo: [:a :b: | a + b] that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on. #mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency. Hope this helps. Regards, -Martin On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
*Von:*Esug-list <esug-list-bounces@lists.esug.org> *Im Auftrag von *Christophe Dony *Gesendet:* Samstag, 28. März 2020 15:17 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit :
Hello Christian,
"I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
*Mark Plas*
Software Engineer
T +32 2 467 34 30
mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv>
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv <http://www.mediagenix.tv>
Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
/This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately./
*From:*Esug-list <esug-list-bounces@lists.esug.org> <mailto:esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu <mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org <mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com <mailto:amber-lang@googlegroups.com> *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
_______________________________________________
Esug-list mailing list
Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org>
http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

I agree with Martin. The default connotation of 'destruct' in English is to destroy. I would suggest either #destructuredDo: or #tuppleDo: to avoid confusion. Norm On 3/28/2020 8:13 AM, Martin McClure wrote:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
*Von:*Esug-list <esug-list-bounces@lists.esug.org> *Im Auftrag von *Christophe Dony *Gesendet:* Samstag, 28. März 2020 15:17 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit :
Hello Christian,
"I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
*Mark Plas*
Software Engineer
T +32 2 467 34 30
mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv>
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv><https://www.facebook.com/MEDIAGENIX/>www.mediagenix.tv <http://www.mediagenix.tv>
Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
/This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately./
*From:*Esug-list <esug-list-bounces@lists.esug.org> <mailto:esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu <mailto:vwnc@cs.uiuc.edu>; esug-list@lists.esug.org <mailto:esug-list@lists.esug.org>; amber-lang@googlegroups.com <mailto:amber-lang@googlegroups.com> *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
_______________________________________________
Esug-list mailing list
Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org>
http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

On Sat, 28 Mar 2020 at 5:00 pm, Norm Green <norm.green@gemtalksystems.com> wrote:
I agree with Martin. The default connotation of 'destruct' in English is to destroy. I would suggest either #destructuredDo: or #tuppleDo: to avoid confusion.
I agree. How about this: #(1 2 3 4) feedInto: [:a :b: | a + b] Cheers, Fabio
Norm
On 3/28/2020 8:13 AM, Martin McClure wrote:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
*Von:* Esug-list <esug-list-bounces@lists.esug.org> <esug-list-bounces@lists.esug.org> *Im Auftrag von *Christophe Dony *Gesendet:* Samstag, 28. März 2020 15:17 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit :
Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
*Mark Plas*
Software Engineer
T +32 2 467 34 30
mark.plas@mediagenix.tv
Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
1702 Groot-Bijgaarden - Belgium <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429>
<https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/> www.mediagenix.tv
Directions to MEDIAGENIX <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf>
*This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.*
*From:* Esug-list <esug-list-bounces@lists.esug.org> <esug-list-bounces@lists.esug.org> *On Behalf Of *Christian Haider *Sent:* zaterdag 28 maart 2020 13:43 *To:* vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com *Subject:* [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
- I am sure that others came up with this. Anybody knows? - What are you using for this pattern? - I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? - What are you thinking about this?
Happy hacking,
Christian
_______________________________________________
Esug-list mailing list
Esug-list@lists.esug.org
http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing listEsug-list@lists.esug.orghttp://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing listEsug-list@lists.esug.orghttp://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

(somehow, I didn’t get Martins mail) Yes, Martin, I agree with the misleading xDo: connotation. Thanks for your nice deconstruction of what I wanted :). Cyril suggests #bind:, which does not feel fully right. How about #boundTo: ? #(1 2 3) boundTo: [:a :b :c | …] Happy hacking, Christian Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Fabio Niephaus Gesendet: Samstag, 28. März 2020 17:04 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: On Sat, 28 Mar 2020 at 5:00 pm, Norm Green <norm.green@gemtalksystems.com <mailto:norm.green@gemtalksystems.com> > wrote: I agree with Martin. The default connotation of 'destruct' in English is to destroy. I would suggest either #destructuredDo: or #tuppleDo: to avoid confusion. I agree. How about this: #(1 2 3 4) feedInto: [:a :b: | a + b] Cheers, Fabio Norm On 3/28/2020 8:13 AM, Martin McClure wrote: Hi Christian and all, #destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better. #tupleDo: feels better. But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with #(1 2 3 4) tupleDo: [:a :b: | a + b] that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on. #mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency. Hope this helps. Regards, -Martin On 3/28/20 7:24 AM, Christian Haider wrote: Yes, that would be nice. Unfortunately a bit more involved than this 1-liner… Von: Esug-list <mailto:esug-list-bounces@lists.esug.org> <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> Betreff: Re: [Esug-list] destructDo: Hi. I like tupleDo: or matchDo: and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html #(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7) may be it already exist? if not, would really be a + Christophe Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian, " I don’t really like the name," Maybe you could call it #tupleDo:? #(1 2 3) tupleDo: [:a :b :c | …] Mark Mark Plas Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv <mailto:mark.plas@mediagenix.tv> <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> Nieuwe Gentsesteenweg 21/1 <https://www.google.com/maps/dir/?api=1&destination=50.872900,4.286429> 1702 Groot-Bijgaarden - Belgium <https://nl.linkedin.com/company/mediagenix-ng> <https://twitter.com/mediagenix_tv> <https://www.facebook.com/MEDIAGENIX/> <http://www.mediagenix.tv> www.mediagenix.tv <http://www.mediagenix.tv/wp-content/uploads/2017/08/Directions.pdf> Directions to MEDIAGENIX This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately. From: Esug-list <mailto:esug-list-bounces@lists.esug.org> <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu <mailto:vwnc@cs.uiuc.edu> ; esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> ; amber-lang@googlegroups.com <mailto:amber-lang@googlegroups.com> Subject: [Esug-list] destructDo: Hi, I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self In Pharo and other dialects, I don’t know, but should be as easy. For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year] I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument. Now the questions: * I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this? Happy hacking, Christian _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

On 28.03.2020, at 17:04, Fabio Niephaus <lists@fniephaus.com> wrote:
On Sat, 28 Mar 2020 at 5:00 pm, Norm Green <norm.green@gemtalksystems.com> wrote: I agree with Martin. The default connotation of 'destruct' in English is to destroy. I would suggest either #destructuredDo: or #tuppleDo: to avoid confusion.
I agree. How about this:
#(1 2 3 4) feedInto: [:a :b: | a + b]
Or `#(1 2 3 4) partsIn: [:a :b | a + b]` Best regards -Tobias
Cheers, Fabio
Norm
On 3/28/2020 8:13 AM, Martin McClure wrote:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit :
Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer
T +32 2 467 34 30
mark.plas@mediagenix.tv
Nieuwe Gentsesteenweg 21/1
1702 Groot-Bijgaarden - Belgium
www.mediagenix.tv
Directions to MEDIAGENIX
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
• I am sure that others came up with this. Anybody knows? • What are you using for this pattern? • I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? • What are you thinking about this?
Happy hacking,
Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- Tobias Pape Software Architecture Group | http://www.hpi.uni-potsdam.de/swa/ Future SOC Lab | https://hpi.de/future-soc-lab Hasso-Plattner-Institut für Digital Engineering gGmbH | Universität Potsdam Prof.-Dr.-Helmert-Str. 2-3, D-14482 Potsdam, Germany Amtsgericht Potsdam, HRB 12184 | Geschäftsführung: Prof. Dr. Christoph Meinel

Hi everyone, I find Martin's arguments regarding "destruct" and "do" rather convincing. Which brings me to: #(1 2 3) destructured: [:a :b :c | a + b + c] Christian, have you ever used this method in a case in which the number of block arguments was smaller than the receiver collection's size? Bernhard
Am 28.03.2020 um 16:13 schrieb Martin McClure <martin.mcclure@gemtalksystems.com>:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv
<image001.png>
Nieuwe Gentsesteenweg 21/1
1702 Groot-Bijgaarden - Belgium
<image002.png> <image003.png><image004.png>www.mediagenix.tv
Directions to MEDIAGENIX
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: • I am sure that others came up with this. Anybody knows? • What are you using for this pattern? • I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? • What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hi Bernhard, yes, it is very handy for csv tables. I deal a lot with them lately (budgets, CoViD19). I read a line, separate the fields and use that list for #destructDo: . Now I can just pick the first n columns I am interested in. (Mostly, identifying information is in the first columns.) Real world example: ^stringsOfLine destructDo: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] I think that the code becomes much more readable. Except the name ... :-) Stay healthy, Christian -----Ursprüngliche Nachricht----- Von: Bernhard Pieber <bernhard@pieber.com> Gesendet: Samstag, 28. März 2020 18:53 An: Martin McClure <martin.mcclure@gemtalksystems.com> Cc: Christian Haider <christian.haider@smalltalked-visuals.com>; Christophe Dony <dony@lirmm.fr>; esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: Hi everyone, I find Martin's arguments regarding "destruct" and "do" rather convincing. Which brings me to: #(1 2 3) destructured: [:a :b :c | a + b + c] Christian, have you ever used this method in a case in which the number of block arguments was smaller than the receiver collection's size? Bernhard
Am 28.03.2020 um 16:13 schrieb Martin McClure <martin.mcclure@gemtalksystems.com>:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv
<image001.png>
Nieuwe Gentsesteenweg 21/1
1702 Groot-Bijgaarden - Belgium
<image002.png> <image003.png><image004.png>www.mediagenix.tv
Directions to MEDIAGENIX
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: • I am sure that others came up with this. Anybody knows? • What are you using for this pattern? • I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? • What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

On 28.03.2020, at 19:20, Christian Haider <christian.haider@smalltalked-visuals.com> wrote:
Hi Bernhard,
yes, it is very handy for csv tables. I deal a lot with them lately (budgets, CoViD19). I read a line, separate the fields and use that list for #destructDo: . Now I can just pick the first n columns I am interested in. (Mostly, identifying information is in the first columns.)
Real world example: ^stringsOfLine destructDo: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
I think that the code becomes much more readable.
What about ^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] ? Best regards -Tobias
Except the name ... :-)
Stay healthy, Christian
-----Ursprüngliche Nachricht----- Von: Bernhard Pieber <bernhard@pieber.com> Gesendet: Samstag, 28. März 2020 18:53 An: Martin McClure <martin.mcclure@gemtalksystems.com> Cc: Christian Haider <christian.haider@smalltalked-visuals.com>; Christophe Dony <dony@lirmm.fr>; esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi everyone,
I find Martin's arguments regarding "destruct" and "do" rather convincing. Which brings me to:
#(1 2 3) destructured: [:a :b :c | a + b + c]
Christian, have you ever used this method in a case in which the number of block arguments was smaller than the receiver collection's size?
Bernhard
Am 28.03.2020 um 16:13 schrieb Martin McClure <martin.mcclure@gemtalksystems.com>:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv
<image001.png>
Nieuwe Gentsesteenweg 21/1
1702 Groot-Bijgaarden - Belgium
<image002.png> <image003.png><image004.png>www.mediagenix.tv
Directions to MEDIAGENIX
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: • I am sure that others came up with this. Anybody knows? • What are you using for this pattern? • I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? • What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- Tobias Pape Software Architecture Group | http://www.hpi.uni-potsdam.de/swa/ Future SOC Lab | https://hpi.de/future-soc-lab Hasso-Plattner-Institut für Digital Engineering gGmbH | Universität Potsdam Prof.-Dr.-Helmert-Str. 2-3, D-14482 Potsdam, Germany Amtsgericht Potsdam, HRB 12184 | Geschäftsführung: Prof. Dr. Christoph Meinel

On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention) And since block arguments are called "arguments" how about aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ] - Bert - PS: Happy Covid Bike Shedding ;)

Not bad! Captures the semantics nicely. Just a bit long Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Bert Freudenberg Gesendet: Sonntag, 29. März 2020 00:12 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de <mailto:Tobias.Pape@hpi.de> > wrote: What about ^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] ? Best regards -Tobias Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention) And since block arguments are called "arguments" how about aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ] - Bert - PS: Happy Covid Bike Shedding ;)

intention revealing trumps brevity Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com> Folgendes geschrieben: Not bad! Captures the semantics nicely. Just a bit long Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Bert Freudenberg Gesendet: Sonntag, 29. März 2020 00:12 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote: What about ^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] ? Best regards -Tobias Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention) And since block arguments are called "arguments" how about aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ] - Bert - PS: Happy Covid Bike Shedding ;) _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise. Like this proposal though. Tim On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote:
intention revealing trumps brevity
Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com> Folgendes geschrieben:
Not bad! Captures the semantics nicely.
Just a bit long
*Von:* Esug-list <esug-list-bounces@lists.esug.org> *Im Auftrag von *Bert Freudenberg *Gesendet:* Sonntag, 29. März 2020 00:12 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;)
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

We write code once, but read it many times. Given the relatively few times I would be using this (rather nice) thing, I'd be happy to type the full: asArgumentsIn: Christian, congratulations on coming up with something to get us all thinking and talking. Good timing too :-/ Very best wishes, Bruce On Sun, 29 Mar 2020 at 15:24, Tim Mackinnon <tim@testit.works> wrote:
Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise.
Like this proposal though.
Tim
On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote:
intention revealing trumps brevity
Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider < christian.haider@smalltalked-visuals.com> Folgendes geschrieben:
Not bad! Captures the semantics nicely.
Just a bit long
*Von:* Esug-list <esug-list-bounces@lists.esug.org> *Im Auftrag von *Bert Freudenberg *Gesendet:* Sonntag, 29. März 2020 00:12 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;) _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

After thinking about this message some more, it seemed to me that it was easier to come up with a good intention-revealing name if the block were the receiver and the array were the argument. It would be some kind of #valueWithArguments: selector. So I looked to see whether there was already such a thing, and sure enough, in Pharo there is #valueWithPossibleArgs:. #valueWithPossibleArgs: will accept arrays (and I hope any SequenceableCollection) of any size -- trimming the end off if too large, padding with nils if too short. On the principle of "if it's easy to come up with a good name, the design is probably pretty good" could this possibly be a better solution? Regards, -Martin On 3/29/20 7:50 AM, Bruce Badger wrote:
We write code once, but read it many times. Given the relatively few times I would be using this (rather nice) thing, I'd be happy to type the full:
asArgumentsIn:
Christian, congratulations on coming up with something to get us all thinking and talking. Good timing too :-/
Very best wishes, Bruce
On Sun, 29 Mar 2020 at 15:24, Tim Mackinnon <tim@testit.works> wrote:
Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise.
Like this proposal though.
Tim
On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote:
intention revealing trumps brevity
Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com>> Folgendes geschrieben:
Not bad! Captures the semantics nicely.
Just a bit long
*Von:* Esug-list <esug-list-bounces@lists.esug.org <mailto:esug-list-bounces@lists.esug.org>> *Im Auftrag von *Bert Freudenberg *Gesendet:* Sonntag, 29. März 2020 00:12 *An:* esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> *Betreff:* Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de <mailto:Tobias.Pape@hpi.de>> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;)
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hello Martin, You are right, but I disagree :). It started by using #valueWithArguments: more often. I find it very bulky, hard to format nicely and difficult to read. This is because the block is the receiver. As last argument, the world looks brighter, because at the end the block formats better. Compare: ^aList asArgumentsIn: [:a :b :c | | x y | x := a send: b with: c. y := ‘multiline block’. x printString, y] with: ^[:a :b :c | | x y | x := a send: b with: c. y := ‘multiline block’. x printString, y ] valueWithArguments: aList I see the second pattern used in two subsystems in VW, one also uses #cull… Maybe I find it more difficult to read the second pattern, because the argument list is very far away from the list it associates with. I think that I will settle with #asArgumentsIn: and see how it reads in real life. As a shortcut, I can imagine an operator… (too bad that VW doesn’t support Unicode for operators…) Thank you! Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Martin McClure Gesendet: Sonntag, 29. März 2020 17:50 An: Bruce Badger <bwbadger@gmail.com>; Tim Mackinnon <tim@testit.works> Cc: esug-list@lists.esug.org Members <esug-list@lists.esug.org> Betreff: Re: [Esug-list] destructDo: After thinking about this message some more, it seemed to me that it was easier to come up with a good intention-revealing name if the block were the receiver and the array were the argument. It would be some kind of #valueWithArguments: selector. So I looked to see whether there was already such a thing, and sure enough, in Pharo there is #valueWithPossibleArgs:. #valueWithPossibleArgs: will accept arrays (and I hope any SequenceableCollection) of any size -- trimming the end off if too large, padding with nils if too short. On the principle of "if it's easy to come up with a good name, the design is probably pretty good" could this possibly be a better solution? Regards, -Martin On 3/29/20 7:50 AM, Bruce Badger wrote: We write code once, but read it many times. Given the relatively few times I would be using this (rather nice) thing, I'd be happy to type the full: asArgumentsIn: Christian, congratulations on coming up with something to get us all thinking and talking. Good timing too :-/ Very best wishes, Bruce On Sun, 29 Mar 2020 at 15:24, Tim Mackinnon <mailto:tim@testit.works> <tim@testit.works> wrote: Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise. Like this proposal though. Tim On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote: intention revealing trumps brevity Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> > Folgendes geschrieben: Not bad! Captures the semantics nicely. Just a bit long Von: Esug-list <esug-list-bounces@lists.esug.org <mailto:esug-list-bounces@lists.esug.org> > Im Auftrag von Bert Freudenberg Gesendet: Sonntag, 29. März 2020 00:12 An: esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> Betreff: Re: [Esug-list] destructDo: On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de <mailto:Tobias.Pape@hpi.de> > wrote: What about ^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] ? Best regards -Tobias Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention) And since block arguments are called "arguments" how about aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ] - Bert - PS: Happy Covid Bike Shedding ;) _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Dear Christian and Martin et al., one can simply reverse-ordering valueWith{Possible}Arguments: into argumentsWithValue: - variants include asArgumentsEvaluating:, useAsArgumentsIn:, asPossibleArgumentsTo: and etc. Would it be too gross an abuse of the term to shorten 'possible' by using 'cull' instead - cullArgumentsIn:, asArgumentsCulledEvaluating: , ... ? (I'm ready to respect in advance any purist who would rather type the longer word. :-) ) If Christian finds it makes for cleaner code, then I'm all for it. And I endorse Tim's recommendation for clarity over brevity. Making it look something like a reversed valueWith{Possible}Arguments: is one form of clarity. Just my 0.02p Niall Ross Martin McClure wrote:
After thinking about this message some more, it seemed to me that it was easier to come up with a good intention-revealing name if the block were the receiver and the array were the argument. It would be some kind of #valueWithArguments: selector. So I looked to see whether there was already such a thing, and sure enough, in Pharo there is #valueWithPossibleArgs:.
#valueWithPossibleArgs: will accept arrays (and I hope any SequenceableCollection) of any size -- trimming the end off if too large, padding with nils if too short.
On the principle of "if it's easy to come up with a good name, the design is probably pretty good" could this possibly be a better solution?
Regards, -Martin
On 3/29/20 7:50 AM, Bruce Badger wrote:
We write code once, but read it many times. Given the relatively few times I would be using this (rather nice) thing, I'd be happy to type the full:
asArgumentsIn:
Christian, congratulations on coming up with something to get us all thinking and talking. Good timing too :-/
Very best wishes, Bruce
On Sun, 29 Mar 2020 at 15:24, Tim Mackinnon <tim@testit.works> wrote:
Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise.
Like this proposal though.
Tim
On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote:
intention revealing trumps brevity
Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com>> Folgendes geschrieben:
Not bad! Captures the semantics nicely.
Just a bit long
*Von:* Esug-list <esug-list-bounces@lists.esug.org <mailto:esug-list-bounces@lists.esug.org>> *Im Auftrag von *Bert Freudenberg *Gesendet:* Sonntag, 29. März 2020 00:12 *An:* esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> *Betreff:* Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de <mailto:Tobias.Pape@hpi.de>> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;)
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
------------------------------------------------------------------------
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Hi Tim, I think that the „as” is essential and asArgsIn: would read as nice… Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Tim Mackinnon Gesendet: Sonntag, 29. März 2020 16:24 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise. Like this proposal though. Tim On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote: intention revealing trumps brevity Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> > Folgendes geschrieben: Not bad! Captures the semantics nicely. Just a bit long Von: Esug-list <esug-list-bounces@lists.esug.org <mailto:esug-list-bounces@lists.esug.org> > Im Auftrag von Bert Freudenberg Gesendet: Sonntag, 29. März 2020 00:12 An: esug-list@lists.esug.org <mailto:esug-list@lists.esug.org> Betreff: Re: [Esug-list] destructDo: On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de <mailto:Tobias.Pape@hpi.de> > wrote: What about ^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4] ? Best regards -Tobias Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention) And since block arguments are called "arguments" how about aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ] - Bert - PS: Happy Covid Bike Shedding ;) _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org <mailto:Esug-list@lists.esug.org> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

On 29.03.2020, at 18:23, Christian Haider <christian.haider@smalltalked-visuals.com> wrote:
Hi Tim,
I think that the „as” is essential and asArgsIn: would read as nice…
But why contract the name? what would we gain? Best regards -Tobias
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Tim Mackinnon Gesendet: Sonntag, 29. März 2020 16:24 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Agree with intention revealing - #argumentsIn: would contract it a bit more (not sure the as strictly needed as we aren’t returning a result). And #argsIn: might be a bit too concise.
Like this proposal though.
Tim
On Sun, 29 Mar 2020, at 2:28 PM, Helge Nowak via Esug-list wrote:
intention revealing trumps brevity
Am Sonntag, 29. März 2020, 00:58:49 MEZ hat Christian Haider <christian.haider@smalltalked-visuals.com> Folgendes geschrieben:
Not bad! Captures the semantics nicely.
Just a bit long
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Bert Freudenberg Gesendet: Sonntag, 29. März 2020 00:12 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;)
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org _______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- Tobias Pape Software Architecture Group | http://www.hpi.uni-potsdam.de/swa/ Future SOC Lab | https://hpi.de/future-soc-lab Hasso-Plattner-Institut für Digital Engineering gGmbH | Universität Potsdam Prof.-Dr.-Helmert-Str. 2-3, D-14482 Potsdam, Germany Amtsgericht Potsdam, HRB 12184 | Geschäftsführung: Prof. Dr. Christoph Meinel

If you’re looking for a short selector that doesn’t reveal meaning by using more words, I would borrow a term that is used elsewhere, like your “destructure”. Various programming language communities have terms like “expand”, “unpack”, “spread”, or “splat” for using a sequence as separate arguments. Maybe “spread” would work? - Bert - On Sat, Mar 28, 2020 at 16:58 Christian Haider < christian.haider@smalltalked-visuals.com> wrote:
Not bad! Captures the semantics nicely.
Just a bit long
*Von:* Esug-list <esug-list-bounces@lists.esug.org> *Im Auftrag von *Bert Freudenberg *Gesendet:* Sonntag, 29. März 2020 00:12 *An:* esug-list@lists.esug.org *Betreff:* Re: [Esug-list] destructDo:
On Sat, Mar 28, 2020 at 11:27 AM Pape, Tobias <Tobias.Pape@hpi.de> wrote:
What about
^stringsOfLine asComponentsIn: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
?
Best regards -Tobias
Agreed, "...In:" is better than "...Do" because the latter implies iteration in Smalltalk. (never mind ifNotNilDo: which broke the convention)
And since block arguments are called "arguments" how about
aCollection asArgumentsIn: [:arg1 :arg2 :arg3 | ... ]
- Bert -
PS: Happy Covid Bike Shedding ;)
-- -- Dr. Bert Freudenberg 7275 Franklin Avenue #210 Los Angeles CA 90046 +1 (818) 482-3991

Hi Christian, Thank you for the example. I like it (except for the need of ignore maybe). So #bind: from Pharo 8 would not work in that case, right? I see three possible semantics: 1. block arguments size must match receiver collection's size: like Pharo 8's #bind or PetitParsers's #map:: 2. arguments size must be equal or less than receiver collection's size: like #destructDo: 3. Like 2 but with using rest of collection (like in Nobert's JavaScript example): could be #destructDo:rest: Bernhard
Am 28.03.2020 um 19:20 schrieb Christian Haider <christian.haider@smalltalked-visuals.com>:
Hi Bernhard,
yes, it is very handy for csv tables. I deal a lot with them lately (budgets, CoViD19). I read a line, separate the fields and use that list for #destructDo: . Now I can just pick the first n columns I am interested in. (Mostly, identifying information is in the first columns.)
Real world example: ^stringsOfLine destructDo: [:ignore :string2 :string3 :string4 | self produktbereich: string2 profitcenter: string3 bezeichnung: string4]
I think that the code becomes much more readable. Except the name ... :-)
Stay healthy, Christian
-----Ursprüngliche Nachricht----- Von: Bernhard Pieber <bernhard@pieber.com> Gesendet: Samstag, 28. März 2020 18:53 An: Martin McClure <martin.mcclure@gemtalksystems.com> Cc: Christian Haider <christian.haider@smalltalked-visuals.com>; Christophe Dony <dony@lirmm.fr>; esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi everyone,
I find Martin's arguments regarding "destruct" and "do" rather convincing. Which brings me to:
#(1 2 3) destructured: [:a :b :c | a + b + c]
Christian, have you ever used this method in a case in which the number of block arguments was smaller than the receiver collection's size?
Bernhard
Am 28.03.2020 um 16:13 schrieb Martin McClure <martin.mcclure@gemtalksystems.com>:
Hi Christian and all,
#destructDo: is probably not the best name. "Destruct" can be interpreted as either short for "destructured" (which is what you want) or more like "destroy" as in "self-destruct." I initially took "destruct" in the "destroy" sense and guessed that #destructDo: might remove each element from the collection as it iterated. You could lengthen it to #destructured: or #destructuredDo:, but if there's a good short name that would be better.
#tupleDo: feels better.
But both #tupleDo: and #destructDo: contain "do" which implies iteration. Unless I'm missing something, your #destructDo: does not iterate. I'd really expect a #tupleDo: to iterate -- I'd expect with
#(1 2 3 4) tupleDo: [:a :b: | a + b]
that the block would be evaluated twice, once with 1 and 2 and once with 3 and 4. This would be a nice pattern; you could also have a tupleCollect: a tupleDetect: and so on.
#mapTo: is quite similar to #map: in PetitParser, except IIRC PetitParser's #map: expects an exact match in argument count. But maybe #map: is a good name for consistency.
Hope this helps.
Regards, -Martin
On 3/28/20 7:24 AM, Christian Haider wrote:
Yes, that would be nice. Unfortunately a bit more involved than this 1-liner…
Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Christophe Dony Gesendet: Samstag, 28. März 2020 15:17 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo:
Hi. I like tupleDo:
or matchDo:
and what about installing a full pattern matching, as in many languages e.g. Scheme : https://docs.racket-lang.org/reference/match.html
#(1 #(2 3 6 7) 4) matchDo: [:a (:b :@c) :d] | …] here c would be #(3 6 7)
may be it already exist? if not, would really be a +
Christophe
Le 28/03/2020 à 14:15, Mark Plas a écrit : Hello Christian,
" I don’t really like the name,"
Maybe you could call it #tupleDo:?
#(1 2 3) tupleDo: [:a :b :c | …]
Mark
Mark Plas
Software Engineer T +32 2 467 34 30 mark.plas@mediagenix.tv
<image001.png>
Nieuwe Gentsesteenweg 21/1
1702 Groot-Bijgaarden - Belgium
<image002.png> <image003.png><image004.png>www.mediagenix.tv
Directions to MEDIAGENIX
This e-mail and any files attached to it are confidential and intended only for the use of the individuals or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately.
From: Esug-list <esug-list-bounces@lists.esug.org> On Behalf Of Christian Haider Sent: zaterdag 28 maart 2020 13:43 To: vwnc@cs.uiuc.edu; esug-list@lists.esug.org; amber-lang@googlegroups.com Subject: [Esug-list] destructDo:
Hi,
I am using a nice little method #destructDo: for a while now and it feels good. In VisualWorks: SequenceableCollection>>destructDo: aBlock "Evaluate aBlock with the receiver's elements as parameters. aBlock takes its arguments from the receiver. 'ok' #(1 2 3) destructDo: [:a :b :c | a + b + c] #(1 2 3) destructDo: [:a :b | a + b] #(1 2 3) destructDo: [:a | a] #(1 2 3) destructDo: [42] 'not ok' #(1 2 3) destructDo: [:a :b :c :d | a + b + c + d] " ^aBlock cullWithArguments: self asArray
In Amber: SequenceableCollection>>destructDo: aBlock ^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do (('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day | Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions: • I am sure that others came up with this. Anybody knows? • What are you using for this pattern? • I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? • What are you thinking about this?
Happy hacking, Christian
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
_______________________________________________ Esug-list mailing list
Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org

Le 28/03/2020 à 13:42, Christian Haider a écrit :
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I don’t know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I don’t really like the name, but haven’t found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo:… maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
Hi Christian, In Pharo 8 was introduced a #bind method that seems similar to what you do: SequenceableCollection>>bind: aBlock "Extract items from the receiver and use them as argumeents of aBlock. Signal an error (ArgumentsCountMismatch) when the arguments count of aBlock does not match the receiver size." "(#(1 2 3) bind: [ :first :second :third | first + second + third ]) >>> 6" ^ aBlock valueWithArguments: self The difference is that arguments are not optionals but I think it would be cool to make them optional in this #bind: method.
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- Cyril Ferlicot https://ferlicot.fr

Yes, exactly the same idea. Cool! -----Ursprüngliche Nachricht----- Von: Esug-list <esug-list-bounces@lists.esug.org> Im Auftrag von Cyril Ferlicot D. Gesendet: Samstag, 28. März 2020 17:02 An: esug-list@lists.esug.org Betreff: Re: [Esug-list] destructDo: Le 28/03/2020 à 13:42, Christian Haider a écrit :
Hi,
I am using a nice little method #destructDo: for a while now and it feels good.
In VisualWorks:
SequenceableCollection>>destructDo: aBlock
"Evaluate aBlock with the receiver's elements as parameters.
aBlock takes its arguments from the receiver.
'ok'
#(1 2 3) destructDo: [:a :b :c | a + b + c]
#(1 2 3) destructDo: [:a :b | a + b]
#(1 2 3) destructDo: [:a | a]
#(1 2 3) destructDo: [42]
'not ok'
#(1 2 3) destructDo: [:a :b :c :d | a + b + c + d]
"
^aBlock cullWithArguments: self asArray
In Amber:
SequenceableCollection>>destructDo: aBlock
^aBlock valueWithPossibleArguments: self
In Pharo and other dialects, I dont know, but should be as easy.
For example you can do
(('2020-03-28' tokensBasedOn: $-) collect: #asNumber) destructDo: [:year :month :day |
Date newDay: day monthNumber: month year: year]
I like that the block is not the receiver (like with #valueWithArguments or #cullWithArguments), but the last argument.
Now the questions:
* I am sure that others came up with this. Anybody knows? * What are you using for this pattern? * I dont really like the name, but havent found anything better yet. Maybe #destructedDo: or just #destructed: or: #withPartsDo: maybe something shorter? Ideas? * What are you thinking about this?
Happy hacking,
Christian
Hi Christian, In Pharo 8 was introduced a #bind method that seems similar to what you do: SequenceableCollection>>bind: aBlock "Extract items from the receiver and use them as argumeents of aBlock. Signal an error (ArgumentsCountMismatch) when the arguments count of aBlock does not match the receiver size." "(#(1 2 3) bind: [ :first :second :third | first + second + third ])
6"
^ aBlock valueWithArguments: self The difference is that arguments are not optionals but I think it would be cool to make them optional in this #bind: method.
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- Cyril Ferlicot https://ferlicot.fr

For stuffing stuff towards a block we can take inspiration from the #inject:into: selector. 'how did that go?' into: [:firstCharacter :secondCharacter| self halt ] R -
participants (20)
-
Bernhard Pieber
-
Bert Freudenberg
-
Bruce Badger
-
Christian Haider
-
Christophe Dony
-
Cyril Ferlicot D.
-
Fabio Niephaus
-
Giovanni Corriga
-
Graham McLeod
-
Helge Nowak
-
Johannes Brauer
-
Karsten Kusche
-
Mark Plas
-
Martin McClure
-
Niall Ross
-
Norbert Hartl
-
Norm Green
-
Pape, Tobias
-
Reinout Heeck
-
Tim Mackinnon