<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Nice! :)<br>
<br>
Cheers,<br>
<br>
On 1/5/2025 8:26 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote
cite="mid:CAFfRWnUoPTv6DigBBZ5=9Ze9Bz1vDb5vPTUohTE1p=5Mtz2mQg@mail.gmail.com"
type="cite">
<div dir="ltr">This revealed something that surprised me. I
expected this to tell me that an answer is the <font
face="monospace">collect:</font> method.
<div><br>
</div>
<div><font face="monospace">double := [:x | x * 2].<br>
Finder methodsByExample: { #(1 2 3). double. #(2 4 6) }.</font><br>
</div>
<div><br>
</div>
<div>But I didn't know it would tell me that these methods also
return the same result:</div>
<div><br>
</div>
<div><font face="monospace">ifNotEmpty:</font></div>
<div><font face="monospace">ifNotNil:</font></div>
<div><font face="monospace">replace:</font></div>
<div><font face="monospace">stonProcessSubObjects:</font></div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Sun, Jan 5, 2025 at 2:50 PM
Mark Volkmann <<a moz-do-not-send="true"
href="mailto:r.mark.volkmann@gmail.com">r.mark.volkmann@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div dir="ltr">
<div>I understand that the Squeak development environment
provides a way to find methods by example. As a fun
exercise I wanted to see if I could implement that in
Cuis, minus the GUI. I created a <font face="monospace">Finder</font>
class with a single class method <font face="monospace">methodsByExample</font> that
does this. It's amazing how fast it is!</div>
<div>
<div><br>
</div>
<div>For example, evaluating the following in a Workspace:</div>
<div><br>
</div>
<div><font face="monospace">Finder methodsByExample: #(#(1
2 3 4) 2.5)</font></div>
<div><br>
</div>
<div>prints the following in the Transcript:</div>
<div><br>
</div>
<div><font face="monospace">The following methods on #(1 2
3 4) with no arguments return 2.5:<br>
- average<br>
- mean</font><br>
</div>
</div>
<div><br>
</div>
<div>The hardest part was discovering all the methods that
have side effects which should not be attempted. Perhaps I
haven't found all of them yet.</div>
<div><br>
</div>
<div>My code is in a package at <a moz-do-not-send="true"
href="https://github.com/mvolkmann/Cuis-Smalltalk-FindByExample"
target="_blank">https://github.com/mvolkmann/Cuis-Smalltalk-FindByExample</a>.
There are more examples in the README. I welcome feedback
on ways this can be improved.</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>
</div>
</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>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>