I would use the word "value" rather than "variable" here

A=: 1 2 3
A=: 1 3

References to A will pick up whichever value is current at the time of
reference. You make a new value and assign it to the same variable.

I understand that some languages do things a bit different, where
depending on the context you might have two A variables for this kind
of situation.

Basically, J provides immutable values and mutable variables. (I do
not think we would call them variables in J, if they could not vary.)

That said, most of the rest of your statements I agree with.

Thanks,

-- 
Raul


On Sun, Dec 3, 2017 at 2:06 PM, Erling Hellenäs
<[email protected]> wrote:
> Hi all!
>
> This touches one of the most interesting aspects of J.
> Variables in J are normally non-mutable in the sense that they can not be
> modified in-place.
> You can not set variable A to 1 2 3 and then change it to 1 3 without
> creating a new variable, but one which might have the same name.
> This means that the answer to question 1. is "There is no way to delete an
> item from a list.". What you do is assigning the items you want to remain in
> the list to a new variable.
> So, why is this interesting?
> In functional programming we usually work with non-mutable variables. This
> means we can not even reassign a loop variable. Usually this means we work
> recursively. There are also lots of other tricks we use to transform one
> variable into another without doing it in small increments. J is filled with
> such tricks. This means, as I see it, that J should be interesting for
> functional programmers since it shows many ways to transform a variable into
> another without changing the variable incrementally.
> Many APL/J tricks for this are now built into for example the array class in
> F#. There is scan, fold and map, for example. But as far as I know, many are
> still not widely used among other functional programmers. Agreement and Rank
> are some examples.
>
> PS. There are some exceptions when J variables are changed in-place. DS.
>
> Cheers,
> Erling Hellenäs
>
>
> On 2017-12-03 18:40, Andrew Dabrowski wrote:
>>
>> 1. What's the idiomatic way to delete an item from a list?  This doesn't
>> seem to come up in Learning J.  For that matter, what's a good reference for
>> list slicing ops in J?
>>
>> 2. Is anyone bothered by the lack of a built-in associative list
>> structure?  There are at least two different implementations in Rosetta
>> Code, but one is very bare-bones and the other uses classes, which I'd
>> prefer to avoid (I confess to having a bias against OO).  I guess J people
>> have found other substitutes for dicts/hashes/maps/associative arrays.
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to