My advice: learn to live with the quotes.

You need a way to write a string that represents a long value.  In J, that's 'longvaluex'.

Henry Rich

On 8/14/2023 10:57 PM, Ak O wrote:
Hi Henry,

Yes actually all I want is a verb that stting encloses an argument.
After that I can attach ('.@,&'x') and have my extended type object.

The difference between the two functions is that the second functions
requires quotes about the 'y' to runs correctly.
The first function does not require quotes as it looks for keyboard input
to complete the execution correctly.


Ak

On Mon., Aug. 14, 2023, 20:01 Henry Rich, <henryhr...@gmail.com> wrote:

". string

executes the string.  But it is a string, i. e. a literal.  If you want
that literal to contain a character string for execution, you must
enclose that string in quotes.  You can write a verb to do it.

Henry Rich


On 8/14/2023 9:14 PM, Ak O wrote:
Is there a more simple way of feeding the interpreter?

Meaning, is there some invisible trigger like a CR or a LF (unprintable
characters)
that is recognized by the interpreter as coming from the
keyboard?

There must be since, typing numbers only, physically on the keyboard and
hitting enter runs the program correctly.


Ak



On Mon., Aug. 14, 2023, 17:43 Raul Miller, <rauldmil...@gmail.com>
wrote:
There's two ways of accomplishing what I think you are asking for.

(1) Modify the J interpreter, or

(2) Modify the J IDE.

You could modify the interpreter such that large integers are treated
as extended integers. (This might be a worthwhile change at some point
in the future. The reasoning here would be that if the user has typed
in all those digits, presumably they are significant.)

You could modify the J IDE (to automatically add the trailing 'x' on
long sequences of digits followed by a space). This would be
considerably less desirable (since it could mess up literal text).

The remaining option is to hit that 'x' key, yourself.

I hope this makes sense,

--
Raul

On Mon, Aug 14, 2023 at 4:43 PM Ak O <akin...@gmail.com> wrote:
Hi Raul,

Yes I think I understood Henry's message. This why my thought is to
simulte
the keyboard input. Since typing the raw input into the first function
works exactly as desired. I want rather to substitute escaping to the
keyboard for  feeding the input as keystrokes.

I don't know enough about stdin and keyboard reads to know the
different
triggers.

Are there some bytes that the keyboard triggers that
interpreter recognizes?

If the analogy is writing/reading a file, can i get the bytes of each
digit
and go from there?

Is there better was for me to think about this? Probably.
But, I know that if a keyboard can do it, I can simulate a keyboard
doing
it.

I must be able to run that track without needing to escape the
function.

:)

Ak



On Mon., Aug. 14, 2023, 13:30 Raul Miller, <rauldmil...@gmail.com>
wrote:
I think you should re-read Henry's message that you were responding to
here.

By the time any J function can run, it's already too late.

--
Raul

On Mon, Aug 14, 2023 at 12:58 PM 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


On Sat., Aug. 12, 2023, 13:43 Henry Rich, <henryhr...@gmail.com>
wrote:
It's like this:

/long-number/ is a single word.  If the length is <19 digits, it
is an
integer, otherwise a float (which necessarily has only 16 digits of
precision).

/long-number/x is a single word, but it is always an extended
integer,
and every digit of /long-number/ is preserved.

x: /number/ is two words.  /number/ is evaluated first, and then
x: is
applied to its value to give an extended integer.

In that last case, if /number/ has more than 19 digits, it will
have
been represented as a float, and the extended integer will have
only 16
digits of precision.

Henry Rich

On 8/12/2023 3:25 PM, Ak O wrote:
My thought was that 'x' must always be  extended by definition.

I was trying to think what cases this operator's 'x' argument
would
not
be
strictly extended.

Chris demonstrated that the input 'x' in my example is float by
construction.

Raul explained that the  parser treats the number before it
treats
the
operator  ( if I have understood his message correctly).

So if I have understood all of this correctly. As a raw input,
it is
the
extended representation of the float input 'x' that is actually
what
is
being operated on by A. to yield the result.



Ak


On Sat., Aug. 12, 2023, 11:34 Henry Rich, <henryhr...@gmail.com>
wrote:
I misunderstood your question.

(x A. y) starts by verifying that (*./ (|x) < !.#y) and then
converts x
to a permutation with
(i.@-&.<: y) #: x
(all in extended precision if x is extended), followed by a
number
of
rotations within an index vector.  It is much less work to start
with
the permutation vector rather than the anagram index.

Henry Rich

On 8/11/2023 8:29 PM, Ak O wrote:
For me,
(x: y)
does not preserve the input.

The result I get is not the same.


              ( x:180548043269214561950911457875657 )
     180548043269214573494164592263168
This does not work.



              180548043269214561950911457875657x
180548043269214561950911457875657
This does work.





On Fri., Aug. 11, 2023, 13:01 Henry Rich, <
henryhr...@gmail.com>
wrote:
(x: value) produces extended version of value.

Henry Rich

On Fri, Aug 11, 2023, 2:44 PM Ak O <akin...@gmail.com> wrote:

Hi everybody, I hope you are all well.

I have a question about the Anagram ( A. ) operator.

In a defined function, how do I designate that an input 'x'
is
treatment
as  extended datatype rather than float?

Where being defined:
         13 : ' x A. i.y'
[ A. [: i. ]

     is to be taken as,
         13 : 'X_INPUTx A. y'     NB. 12345672345467x A. i.y

How do I get the affect of catenating an 'x' to the end of a
number
in
a
defined function?

If you understand my question ignore below, otherwise I give
an
example.
Thank you for your thoughts.

Ak


My understanding of the Anagram operator (A.).
The vocabulary reference page (acapdot) gives the product of
the
Anagram
index function
        A. y
as datatype extended.


The Anagram function
        x A. y
applies the permutation map (x) on  ordered vector sequence
(y)
as
below.
]    vector_sequence =:      ?~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


]    vector_anagram =:     A. vector_sequence
180548043269214561950911457875657

The Noun, vector_anagram will have datatype extended, given
by:
        datatype vector_anagram
extended

Applying the vector_anagram on a vector using the command:
         vector_anagram 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

The expected result.

In a case where the digits are input on there own, the
following
fails
with
'domain error, executing dyad A.'

         180548043269214561950911457875657 A. i.30

One approach is to place 'x:' before the input.
         ( x:180548043269214561950911457875657 )A. i.30
20 12 4 29 7 17 22 11 2 27 28 25 1 8 0 15 16 14 3 5 19 26 18
6
21 23
13
24
9 10

This is not the expected result.

The input is treated as 180548043269214573494164592263168.

         ( x:180548043269214561950911457875657 )
180548043269214573494164592263168

Not the input I thought I was applying.

An alternative is to postfix an 'x' to the end of the input.
         180548043269214561950911457875657x 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

The expected result. But how do I achieve this for a defined
function.
Does not work either.
".@((":vector_anagram),x')"_     NB. same as x:


Maybe there is a symbol that 13 : can be recognize to
trigger the
extended
datatype.



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
----------------------------------------------------------------------
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
----------------------------------------------------------------------
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

----------------------------------------------------------------------
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