extd =: 4 : 0
n=. ((1!:1) 1)
((".@,&'x' n)) A. i. x
)
30 extd ''
180548043269214561950911457875657
20 12 4 29 7 17 22 11 2 27 28 23 6 21 9 3 24 10 26 13 15 1 18 8 25 19 0
5 16 14
180548043269214561950911457875657x A. i. 30 NB. to check
20 12 4 29 7 17 22 11 2 27 28 23 6 21 9 3 24 10 26 13 15 1 18 8 25 19 0
5 16 14
1. done
2. y is immaterial
3. n is set to a string
3a. string has 'x' appended, is convert to (extended integer) number,
used in A.
Henry Rich
On 8/16/2023 9:00 AM, Ak O wrote:
Hi guys,
I hope you are all well. Thank you for continuing to look at this.
Can you please explain through each step how this function is
parsed/processed?
Please run it. Give attention to your behavior through each step.
Step1. Function definition. Input the function
and hit crtl-Enter on the first line.
extd =: 4 : 0
n=. ((1!:1) 1)
((".@,&'x' n)) A. i. x
)
Step 2. Function execution with inputs. Input the value and hit ctrl-Enter.
30 extd 180548043269214561950911457875657
Step 3. The function escapes for an input. Keyboard input. Input the
characters and hit Enter.
180548043269214561950911457875657
Step 4. Result returned.
Thank you.
Ak
On Tue., Aug. 15, 2023, 08:02 Henry Rich, <henryhr...@gmail.com> wrote:
Yes, maybe that's where the wrongthink is.
In J terminology, the sentence is first converted to /words/ (most
languages call these 'tokens'), with the words /evaluated/ as far as
they can be in isolation. Anything that would be called a
/self-defining term/ is given a type at this stage. For example,
* is evaluated to be a primitive verb
& is evaluated to be a primitive conjunction
( is evaluated to (
'abc' is evaluated to a noun
123x is evaluated to an extended integer
5 12345678901234567890 (a single word) is evaluated to a list of 2
floating-point integers
non-self-defining words are given a special type:
foo is evaluated to a name
After the words have been given types and maybe values, they are
processed right to left according to the parsing rules. During the
parsing, a name is looked up and replaced by its stored type/value
(except when it is followed by an assignment copula =. or =:).
On 8/15/2023 9:51 AM, Raul Miller wr
Henry Rich
ote:
I think the inconsistency here is that you're thinking of a rather
elaborate parsing system used by some other language.
Brief overview of J's parser: A sentence is parsed first by tokenizing
it (left to right), then the resulting array of tokens is passed to a
shift/reduce parser (right to left). Conversion of numbers from
"sequence of characters" to "1 or more numbers" happens during
tokenization. Verbs execute during the shift/reduce stage.
See also https://www.jsoftware.com/help/dictionary/dicte.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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm