Fellow Squeaker with project you might find interesting
Brian Rice
water at tunes.org
Sat Jun 16 20:51:03 UTC 2001
Hi Roel and Squeakers,
I've played around with QSOUL a little and considered your ideas. I
am heavily involved in my own somewhat similar but less orthodox (not
that yours is orthodox in most senses ;) project, and I thought I'd
share what I'd developed.
The source code is at http://www.tunes.org/~water/arrow and most of
it is not relevant to your average Smalltalker. However, I managed to
create a really neat little utility that others interesting in
functional/logic ideas would find possibly useful to look at. (Please
ignore the project file which contains out-of-date code.)
I have these lazy (immutable but often infinite) collections with
caches which can be made either Weak or regular Sets for the various
purposes these collections play. Because they contain arrows (this is
the part most irrelevant to Smalltalkers), I call them graphs, but
otherwise your average Smalltalker should not find them too difficult.
Anyway, part of the protocol is that I can take lazy collections of
objects and filter them with a block as a one-item predicate query.
ArrowGraph class>>top returns basically the top collection type
instance that contains everything when queried. The filter operator
is >> and can be sequentially-applied quite safely.
So basically I can enter:
f _ ArrowWorld objects. "Due to the current arrow architecture."
g _ f >> [:value | value isKindOf: Number].
g includes: (Arrow wrapping: 3/4 in: f). "A membership test."
and g will contain all the numbers. g can accept further filters
itself. You can force addition of elements to the cache of a filter
using +. Filtered lazy collections can also be lazily combined with
set operations | and &. The existential quantification feature
requires a pattern-matcher which is integral to Arrow so it's not
likely your average Smalltalker would want to put up with the whole
Arrow environment overhead to get the benefit (at least until I
mature the architecture and manage to fork a Smalltalk utility
sub-package for the matcher).
Anyway, what do you think?
~
More information about the Squeak-dev
mailing list
|