[Cuis-dev] finding methods by example

Mark Volkmann r.mark.volkmann at gmail.com
Sun Jan 5 12:50:01 PST 2025


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 Finder class with a single class
method methodsByExample that does this. It's amazing how fast it is!

For example, evaluating the following in a Workspace:

Finder methodsByExample: #(#(1 2 3 4) 2.5)

prints the following in the Transcript:

The following methods on #(1 2 3 4) with no arguments return 2.5:
- average
- mean

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.

My code is in a package at
https://github.com/mvolkmann/Cuis-Smalltalk-FindByExample. There are more
examples in the README. I welcome feedback on ways this can be improved.

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250105/79afba4a/attachment.htm>


More information about the Cuis-dev mailing list