[Jprogramming] Re: Replacement
Raul Miller
rauldmiller at gmail.com
Fri Jul 6 03:13:52 HKT 2007
On 7/5/07, david alis <david.alis at gmail.com> wrote:
> Raul's method of reducing the replacement problem
> into simple arithmetic is a classic.
>
> rpl2=: ] - (0 ,~ -/)@[ {~ ] i.~ {.@[
>
> It'd be nice to know when he first used it
First, I should note that (if you're going for conciseness) that
expression contains a token which can be eliminated with a fairly
obvious rephrasing.
Second, I used analogous mechanisms in APL back in the '90s
(but my memory is not good enough for me to say much more than
that).
Third, I have frequently wished for an operation analogous to
addition (1-to-1, with an identity element and an inverse operation)
which worked across the full domain of J's verbs. But I have never
been able to comfortably decide what other properties it should
have for literals and boxes. But, even without an inverse and support
for nothing beyond the identity operation, this could be useful
(for example, assembling data in a list using two different
mechanisms, using "zeros" (fills, presumably) as placeholders
for elements coming from the other mechanism -- this hypothetical
operation could then combine the two results.
--
Raul
More information about the Programming
mailing list