On 7/5/14, 'Pascal Jasmin' via Programming <[email protected]> wrote:
> Its not quite the case that it has to be a constant, but it does have to be
> a noun.
>
> this conjunction is useful for tacit code and dyadic adverbs that take noun
> arguments:
>
> eval =: 1 : ' a: 1 :  m'
> advswap =: 2 : (':';'u x v eval y')
>
>    1 2 3 ([ 13 advswap '}' ]) i.10
> 0 13 13 13 4 5 6 7 8 9
>
> does constant replacement instead of constant index
>
>
> ----- Original Message -----
> From: Erling Hellenäs <[email protected]>
> To: [email protected]
> Cc:
> Sent: Saturday, July 5, 2014 3:59:22 PM
> Subject: [Jprogramming] Tacit J and indexed replacement
>
> Hi all !
>
> When you write tacit code, the index m used by Amend, syntax
> description  x m} y, is a constant?
> Normally you have a variable you want to use for indexing? This means
> Amend is seldom useful for indexed replacement when you write tacit J?
> Are there any descriptions of nice ways to do indexed replacement in
> tacit J?
> As with Amend, the result has to be a new variable, of course.
>
> Cheers,
>
> Erling Hellenäs

(I'm not top-posting because that is too laborious with my current
machine setup - apologies to any that prefer top posting.)

Note however, that the noun m in the phrase x m} y can be a gerund. If
you want to use a verb to compute the indices being updated, you might
use a gerund of the form [`v`] (which leaves x and y their typical
roles -- x is new values, y is the array being amended).

For example, let's say that you wanted to amend some random part of
the array. Then v might be ?&# which leaves you with a phrase like x
[`(?&#)`]} y

But I'm not sure why anyone would want that, which is why I asked what
problem he wanted to solve.

Thanks,

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

Reply via email to