<div dir="ltr">I see that <font face="monospace">methodsFor:</font> is a method in <font face="monospace">ClassDescription</font>, not in <font face="monospace">MethodFinder</font>. You want <font face="monospace">methodFor:</font>.<div>It's an unfortunate name similarity, but I just chose the same method name that the Squeak implementation uses.</div><div><br></div><div>The result I get for <font face="monospace">#(1 2)</font> is the <font face="monospace">Integer</font> method <font face="monospace">nextPrime</font>.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jan 27, 2025 at 1:16 PM Boris Shingarov via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">This is very intriguing, and I am suspected may be related to an issue<br>
I've been chasing for a while.<br>
<br>
So I loaded the latest commit (e7b89a6) of MethodFinder into today's<br>
fresh Cuis, and stepped through the code in the Debugger, but how do<br>
I reproduce your surprising result?  There is no #methodsByExample:.<br>
IIUC we are just looking for methods that match on *all* members of<br>
the given collection?  So with just one element, this would be<br>
equivalent to<br>
<br>
MethodFinder methodsFor: #(1 2).<br>
<br>
Where does the "double" Block enter this picture?  I don't think there<br>
is a method #double in Cuis, is there?<br>
<br>
On Sun, Jan 05, 2025 at 05:26:20PM -0600, Mark Volkmann via Cuis-dev wrote:<br>
> This revealed something that surprised me. I expected this to tell me that<br>
> an answer is the collect: method.<br>
> <br>
> double := [:x | x * 2].<br>
> Finder methodsByExample: { #(1 2 3). double. #(2 4 6) }.<br>
> <br>
> But I didn't know it would tell me that these methods also return the same<br>
> result:<br>
> <br>
> ifNotEmpty:<br>
> ifNotNil:<br>
> replace:<br>
> stonProcessSubObjects:<br>
> <br>
> On Sun, Jan 5, 2025 at 2:50 PM Mark Volkmann <<a href="mailto:r.mark.volkmann@gmail.com" target="_blank">r.mark.volkmann@gmail.com</a>><br>
> wrote:<br>
> <br>
> > I understand that the Squeak development environment provides a way to<br>
> > find methods by example. As a fun exercise I wanted to see if I could<br>
> > implement that in Cuis, minus the GUI. I created a Finder class with a<br>
> > single class method methodsByExample that does this. It's amazing how<br>
> > fast it is!<br>
> ><br>
> > For example, evaluating the following in a Workspace:<br>
> ><br>
> > Finder methodsByExample: #(#(1 2 3 4) 2.5)<br>
> ><br>
> > prints the following in the Transcript:<br>
> ><br>
> > The following methods on #(1 2 3 4) with no arguments return 2.5:<br>
> > - average<br>
> > - mean<br>
> ><br>
> > The hardest part was discovering all the methods that have side effects<br>
> > which should not be attempted. Perhaps I haven't found all of them yet.<br>
> ><br>
> > My code is in a package at<br>
> > <a href="https://github.com/mvolkmann/Cuis-Smalltalk-FindByExample" rel="noreferrer" target="_blank">https://github.com/mvolkmann/Cuis-Smalltalk-FindByExample</a>. There are more<br>
> > examples in the README. I welcome feedback on ways this can be improved.<br>
> ><br>
> > --<br>
> > R. Mark Volkmann<br>
> > Object Computing, Inc.<br>
> ><br>
> <br>
> <br>
> -- <br>
> R. Mark Volkmann<br>
> Object Computing, Inc.<br>
<br>
> -- <br>
> Cuis-dev mailing list<br>
> <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
> <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div>