First of all, your reported restults are not correct.
You would need a ] for showing what gets assigned to val.
If you do
] val =. 0 (1) { 'mevema'
you get the same kind of error.
You provide a left argument and then get
0 <result of 1 { 'mevema'>
that is two nouns in a row – what is J supposed to do here?
How to fix:
] val =. ((0), (1)) { 'mevema'
me
works, so
j=.2
] val=. ((2*j), (1+2*j)) { 'mevema'
ma
Of course, there are different ways to do it,
but this is the one closest to what you’ve been doing.
hth,
Hauke
Am 13.04.21 um 10:14 schrieb HH PackRat:
> Hello, all!
>
> I'm stumped and need to know why the following "from" problem occurs
> and how to do what I'd like to do:
>
> No problem when numeric values are used:
> val=. 0 1 { 'mevema'
> me
> val=. 2 3 { 'mevema'
> ve
>
> Problem when formulas are used instead of numeric values:
> j=. 0 [or 1 or 2]
> val=. (2*j) (1+2*j) { 'mevema'
> |syntax error
> | val=. (2*j)(1+(2*j)){'mevema'
>
> Why does "from" work with numeric values but not with formulaic
> versions of those same values for use inside a "for_j" loop to handle
> multiple cases?
>
> What I'm trying to do is to grab 2 letters at a time in sequence
> through the 6-character combined planetary abbreviations for 3
> planets. Is there another way? (Explicit code only, please, if you
> give any examples.)
>
> I just don't understand why one version works and the other doesn't.
> Any help appreciated!
>
> Harvey
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm