Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
As you noted, wrapping going forward: seq at: index \\ seq size + 1 Wrapping going backward is nearly as easy: seq at: (index - 2) \\ seq size + 1 This would not work with #rem: On Fri, 29 Mar 2019 at 04:13, Tim Mackinnon wrote: > Hey guys - I’m wondering if someone might have a nice way of se

Re: [Pharo-users] How to generically find methods in class hierarchies? (Aka narrow spotter?)

2019-03-30 Thread Tim Mackinnon
Hi Ben - yes you are right that in this case that tool would work (and it’s magical when it does). While I sometimes use it - it is a bit buried away and rather clunky to specify things (it really could use some Spotter treatment and get plugged into Spotter ). However the biggest issue with i

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
This loop is a special case. size := 10. prevIndex := size. prevValue := seq at: prevIndex. thisIndex := 1.thisValue := seq at: thisIndex. nextIndex := 2.nextIndex := seq at: nextIndex. [thisIndex <= size] whileTrue: [ ... prevIndex := thisIndex. prevValue := thisValue. thisIndex := n

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
If a Smalltalk system did have a "cyclic" indexing method that did "self at: (index - 1) \\ self size + 1", where would it be? Since it makes sense for all and only sequences, we'd expect it to be in SequenceableCollection. Since it is like #at:, and #at: is an 'accessing' method, we'd expect to fi

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Peter Kenny
Ben Thanks for pointing this out - I was not aware of it. At first sight the notation is completely opaque - I had no idea what the query in you post meant until I read through the instructions in Finder. Now I have tried it, it looks quite handy. Minor nit-pick: The instructions say the componen

Re: [Pharo-users] How to generically find methods in class hierarchies? (Aka narrow spotter?)

2019-03-30 Thread Tim Mackinnon
You - know, this has made me realise that I don’t understand the difference between #messages and #implementors in Spotter? In my haste I’ve always jumped on the latter (as its first in the spotter list) - and implementors has much more methods. So thats a good tip. In realising this now, I’m w

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Tim Mackinnon
I actually keep meaning to try and plug this in to spotter so we get all of this stuff in one easy place (I think its pretty simple, just haven’t had a chance to try it yet). Tim > On 30 Mar 2019, at 09:26, Peter Kenny wrote: > > Ben > > Thanks for pointing this out - I was not aware of it.

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Sven Van Caekenberghe
Note that 'find by example' seems magical, but it isn't, really. The set of discoverable selectors is limited. See MethodFinder > On 30 Mar 2019, at 13:26, Tim Mackinnon wrote: > > I actually keep meaning to try and plug this in to spotter so we get all of > this stuff in one easy place (I thi

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Peter Kenny
Sven - Thanks for mentioning this - it's fascinating to see how it works. Even though it's only (!) 900+ selectors, it must have been a nightmare to construct - the layout of the source code suggests there was a lot of manual effort. Peter Sven Van Caekenberghe-2 wrote > Note that 'find by exampl

[Pharo-users] why is asDictonary a class method

2019-03-30 Thread Roelof Wobben
Hello, Im busy with a new challenge from exercism. Where I have to keep track of a robot , where it facing and on that coordinate the robot is. so I made this function what the test wanted createDirection: aString position: aCollection     self robot: (Robot directionLooking: aString) yoursel

Re: [Pharo-users] why is asDictonary a class method

2019-03-30 Thread Dennis Schetinin
Didn't you forget to return (^) an instance from #directionLooking:? And why do you need to send #yourself? сб, 30 марта 2019 г. в 21:19, Roelof Wobben : > Hello, > > Im busy with a new challenge from exercism. > Where I have to keep track of a robot , where it facing and on that > coordinate t

Re: [Pharo-users] How to generically find methods in class hierarchies? (Aka narrow spotter?)

2019-03-30 Thread Ben Coman
On Sat, 30 Mar 2019 at 20:25, Tim Mackinnon wrote: > You - know, this has made me realise that I don’t understand the > difference between #messages and #implementors in Spotter? In my haste I’ve > always jumped on the latter (as its first in the spotter list) - and > implementors has much more m

Re: [Pharo-users] why is asDictonary a class method

2019-03-30 Thread Richard O'Keefe
Question 1. Should that be #asDictionary? Question 2. If not, what's a Dictonary? Question 3. I see you are using self-encapsulation, with a getter 'self robot' and a setter 'self robot: something'. Of course that means that outside code can fr

Re: [Pharo-users] why is asDictonary a class method

2019-03-30 Thread Roelof Wobben
Op 31-3-2019 om 03:47 schreef Richard O'Keefe: Question 1.  Should that be #asDictionary? yes, it does. Question 2.  If not, what's a Dictonary? Question 3.  I see you