Let me try to explain it : The moment J parses a number that is not followed by an x, it will never be an extended integer. This is irrespective of whether the number is parsed on the command line (J's term), via ". from a string, or from a script. Loosely speaking, whenever you want a typed-in number to be extended, you have to explicitly tell J it is one, by following the number with an x. This is irrespective of the function that operates later on this number (like the ones you listed).
If a number *is* already extended (and stored in a variable, or passed from the function that created it to the next), operations performed on it will keep it extended. A. appears to be one of only a few verbs that creates an extended integer when not fed one (the only other one I can think of is x:). Another thing that could be of help is the linear representation (5!:5), which returns a string which, when parsed, returns the exact value of the variable passed as it's argument. A short recording of my session: r=:A. p=:?~ 30 NB. a permutation number and vector datatype r NB. returned datatype is: extended r NB. simple display representation 162474627391890403202250095642096 5!:5 <'r' NB. linear representation that can be used to get the exact value of the variable r, which includes indeed an x 162474627391890403202250095642096x datatype 162474627391890403202250095642096 NB. copied and pasted in the J term, results in a float, loosing precision because the number is too large. floating r-:!.0]162474627391890403202250095642096 NB. indeed the number is not the same as r 0 datatype ".'162474627391890403202250095642096' NB. the same when parsed using ". floating datatype ". 5!:5<'r' NB. do linear representation does maintain precision. extended r=!. 0 ". 5!:5<'r' NB. indeed the same number. 1 Long story short: if you want precise numbers, append an x or store an already precise number in a variable. Don't rely on copy-pasting J's output, because it is not meant for being interpretable by J like it is in some other languages. Extended numbers aren't the only instance: arrays > rank 1 cannot be parsed directly in their display form either. The same for strings (litterals in J's parlance), as the ticks (') are omitted for display. I hope this helps. Jan-Pieter On Mon, 14 Aug 2023, 22:19 Ak O, <akin...@gmail.com> wrote: > Thank you for this idea but it does not cover this case. Your input is not > long enough. > t=:{{":y}} > t 180548043269214561950911457875657 > 1.80548e32 > > The object is to achieve 180548043269214561950911457875657x > in a defined function, so that the input 180548043269214561950911457875657 > is treated as 180548043269214561950911457875657x. > > > If you run each function that I gave below with the inputs I have given you > will see what I mean. > > This where the numbers come from. > ] permuted_vector. =: ?.~30 > 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 > > ] A. permuted_vector > 180548043269214561950911457875657 > > > > Now we need to go back. > > ] (A. permuted_vector) A. i. 30 > 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 > > (A. permuted_vector) is extended by output construction of (A.). > So it feeds naturally to the dyadic (A.) operator. This always produces the > same permuted_vector. > > The challenge is feeding an extended input to the dyad. > After a length of 19 digits, the type degrades to a float. > > > So please try your own permuted_vector of length minimum 30 with these > functions below. Their behavior mightshow where my ideas are misplaced. > > > Function 1 > > Step 1. Run > > extd =: 4 : 0 > n=. ((1!:1) 1 > ((".@,&'x' n)) A. i. x > ) > > Step 2. Run > 30 extd 180548043269214561950911457875657 > > > Step 3. Input and enter. > 180548043269214561950911457875657 > > Complete. > > > > Function 2 > > Step 1. Run > > extdquotes =: 4 : 0 > ((".@,&'x' n)) A. i. x > ) > > Step 2. Run. > 30 extdquotes '180548043269214561950911457875657' > > > Complete. > > > I might not be explaining as clearly as possible, I appreciate your > patience. > > > > Ak. > > > > > > On Mon., Aug. 14, 2023, 12:34 'Skip Cave' via Programming, < > programm...@jsoftware.com> wrote: > > > t=.{{":y}} > > > > t 12345678987654321 > > > > 12345678987654321 > > > > > > datatype t 12345678987654321 > > > > literal > > > > > > Skip Cave > > Cave Consulting LLC > > > > > > On Mon, Aug 14, 2023 at 1:29 PM Gilles Kirouac <g1...@myriade.ca> wrote: > > > > > >>> 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 18054843269214561950911457875657x > > > extended > > > 34j0 ": 1805480403269214561950911457875657 > > > 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 > > > > > ---------------------------------------------------------------------- > > 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