Hi Rene Paul -I hope my reply wasn’t condescending. That wasn’t the intent, but we sometimes find that students are asking you to do their homework and rather than a directly answering, it’s more instructive to try and help them reason on the code - particularly as Smalltalk is a language where you can reason on the code.
Anyway, I hope the concept of how a BlockClosure works has got you hooked (it was the light bulb moment for me, many years ago - and I still marvel at it today - it’s so elegant). Tim > On 19 Sep 2025, at 19:43, stephane ducasse <[email protected]> wrote: > > Hi tim > > Rene Paul is long time follower of Pharo. He is now a retired mathematician > and this is nice to see > him coding in Pharo :) > > S > >> On 18 Sep 2025, at 09:49, Tim Mackinnon via Pharo-users >> <[email protected]> wrote: >> >> Hi - is this a homework question? While anyone here can tell you what it >> does - its probably more helpful to you to work through it and properly >> understand it. >> >> You haven't shown what the output is when you try it - which will give you a >> clue. Equally - in Smalltalk, the names of selectors like: #do:separatedBy: >> convey meaning (which is why we like to use good names, that hint at what >> parameters do). Finally - have you looked at the implementation of the >> method? The nice thing about Smalltalk is that there is very little magic - >> you can see the code that runs for operations - including things like >> #ifTrue: . Why don't you position your cursor on #do: and press ctrl-m (or >> cmd-m - for show iMplementors - its also in the context menu). This will let >> you see the code and you should be able to work it out. For fun - try doing >> the same for: 3 = 3 ifTrue: [ 1 + 1]. Finally - its also worth >> understanding [1+1] + 1 (and why it gives an error) whereas: [1+1] value + 1 >> dosn't. >> >> Hope this helps. >> >> Tim >> >>> On Thu, 18 Sep 2025, at 12:35 AM, Rene Paul Mages (ramix) via Pharo-users >>> wrote: >>> Hello, >>> >>> Please give me a hint to understand the "do: separatedBy:" keyword >>> message used in ProfStef tutorial : >>> >>> i) in Pharo version 12 : >>> >>> https://ramix.org/pharo/ProfStef/iterators23.png >>> >>> ii) in Pharo version 13 : >>> >>> https://ramix.org/pharo/ProfStef/iterators25.png >>> >>> -- >>> Thanks for your help. >>> Rene Paul Mages (ramix) GnuPG key : 0x9840A6F7 >>> https://sites.google.com/view/les-logiciels-libres/pharo >>> https://twitter.com/RenePaulMages > > Stéphane Ducasse > http://stephane.ducasse.free.fr > 06 30 93 66 73 > > "If you knew today was your last day on earth, what would you do differently? > ....ESPECIALLY if, by doing something different, today might not be your last > day on earth.” Calvin & Hobbes > > > > >
