>>> What expression allows a function to recieve an argument 'y' as a
literal
>>> without using quotes?
None.
BTW, do not rely on the output of ": (default format) to determine the
type, because it uses a default format with a default precision. Use
datatype instead.
datatype 180548043269214561950911457875657
floating
datatype 180548043269214561950911457875657x
extended
34j0 ": 180548043269214561950911457875657
18054804326921457349416459226316 NB. loss of precision after 15 digits
34j0 ": 180548043269214561950911457875657x
180548043269214561950911457875657 NB. no loss of precision
~ Gilles
Le 2023-08-14 à 14:00, Ak O a écrit :
Unfortunately ": does not work in this case.
The length of the input causes the input to be treated as a float. The
result is:
": 180548043269214561950911457875657
1.80548e32
On Mon., Aug. 14, 2023, 11:16 'Skip Cave' via Programming, <
programm...@jsoftware.com> wrote:
":y converts an integer in y into a literal.
Skip Cave
Cave Consulting LLC
On Mon, Aug 14, 2023 at 11:58 AM Ak O <akin...@gmail.com> wrote:
What expression allows a function to recieve an argument 'y' as a literal
without using quotes?
Below are two deficient functions.
The size of the vector is given by 'x'. The permutation
index is meant to be given by 'y'.
My intention is treat 'y' as a literal, without needing to use quotes on
the input.
This first function works by escaping to the keyboard for input
I would like rather for the function to receive the input from the raw
argument and not have to escape to the keyboard.
Desired Input
30 extd 180548043269214561950911457875657
Rather than
30 extd '180548043269214561950911457875657'
This function is deficient by its operating sequence.
It escapes to keyboard, which preservs the literal type.
extd =: 4 : 0
n=. ((1!:1) 1
((".@,&'x' n)) A. i. x
)
30 extd 180548043269214561950911457875657
Keyboard input (if this approach makes sense, can the keyboard input be
simulated by using y as the feed?)
180548043269214561950911457875657
Result
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
Alternative deficient function by the input form.
Yields the correct result but uses quotes in the input.
extdquotes =: 4 : 0
((".@,&'x' n)) A. i. x
)
30 extdquotes '180548043269214561950911457875657'
Result
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
I am looking for the function that uses the input for extd that delivers
the result of extdquotes
Thank you for your help
Ak
...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm