[ENH] 'value:' raiseTo: 2 -> 'value:value:'
nygren at sics.se
Wed Sep 6 14:42:04 UTC 2000
merlyn at stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "Mats" == Mats Nygren <nygren at sics.se> writes:
> Mats> Hi,
> Mats> does this exist already, if so how would I have found it.
> Mats> Sending it again, attachments doesn't seem to work today, why should it,
> Mats> nothing else does.
> For me, #raiseTo: doesn't "say" "N copies of a string". Actually,
> in Perl, I'd think of the "x" operator, but that could be just me:
> 'hello' x: 3 "answers 'hellohellohello'"
Associating "N copies of a string" with multiplication as is done in Perl isn't
necessarily a good idea. If you want to stay on friendly terms
with mathematics that is. Note that in regular expressions juxtaposition
means append like it means multiplication with numbers. For both
numbers and strings (with the above definition)
xx = x raisedTo: 2.
and the law
(x raisedTo: (a + b)) = (x raisedTo: a) (x raisedTo: b)
is true for both.
This all fit together nicely if append is considered a form of
Note that (regular expressions again, | for union)
(x | y) z = xz | yz
(x+y)*z = (x*z + y*z)
(It is even possible to extend it to negative exponents creating antistrings
but I leave that for now)
That explains the choice of name. (It is possible to build in this direction
making regular expressions out of strings: ((('abc' + 'de') * 'xy') raisedTo: 2)
if one wanted such) For someone who likes algebra the above is natural
and leads the mind right.
However let's use #repeated:
> Maybe my next quick project will be diving into the Method Finder to
> understand why it won't resize under MVC. (snicker) I gotta get
> my name in those 2.9 credits somehow.
I would work a little with providing the functionality of Perl in a
Squeak shape if I were you ..
There is OSprocess and regular expression handling to begin with ..
A nice, portable package of that, ..
Organizing something similar to CPAN .. (speak with Hans-Martin Mosner
Making it easy to connect Perl with Squeak both ways
this list can be made longer ..
More information about the Squeak-dev