> 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.

rpl2 =: ] - (0 ,~ -/)@[ {~ ] i.~ [EMAIL PROTECTED]
rpl2a=: ] - (-/ , 0:)@[ {~ [EMAIL PROTECTED] i. ]

Two tokens:

   # ;: 5!:5 <'rpl2'
19
   # ;: 5!:5 <'rpl2a'
17



----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Thursday, July 5, 2007 12:14
Subject: Re: [Jprogramming] Re: Replacement
To: Programming forum <[email protected]>

> On 7/5/07, david alis <[EMAIL PROTECTED]> wrote:
> > Raul's method of reducing the replacement problem
> > into simple arithmetic is a classic.
> >
> > rpl2=: ] - (0 ,~ -/)@[ {~ ] i.~ [EMAIL PROTECTED]
> >
> > 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.


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to