#41 Messages chaining

Kapalı
nero tarafından 8 yıl önce kere açıldı · 0 yorum
Admin of lolg.it 8 yıl önce olarak yorumlandı

Originally at 2011-09-09T14:11:12Z by ???@github closed at 2011-09-13T12:39:58Z

by: message is missing for SequenceableCollection ; so I added it :

by: aStep

"collect only by step objects"

| collected |
collected := self class new.
self withIndexDo: [ :value :index | (index-1) % aStep = 0 ifTrue: [ collected add: value] ].
    ^collected

but when trying it, I got a "0 does not understand #to:by:do:".

But result of to: should receive by: message, and by: result sould receive do: message.

What about transitivity ?

Originally at 2011-09-09T14:11:12Z by ???@github closed at 2011-09-13T12:39:58Z by: message is missing for SequenceableCollection ; so I added it : by: aStep "collect only by step objects" | collected | collected := self class new. self withIndexDo: [ :value :index | (index-1) % aStep = 0 ifTrue: [ collected add: value] ]. ^collected but when trying it, I got a "0 does not understand #to:by:do:". But result of to: should receive by: message, and by: result sould receive do: message. What about transitivity ?
Giriş yap bu konuşmaya katılmak için.
Etiket Yok
Kilometre Taşı Yok
Atanan Kişi Yok
1 Katılımcı
Yükleniyor...
İptal
Kaydet
Henüz bir içerik yok.