I like that!
Don Kelly
On 04/09/2014 5:32 PM, Linda Alvord wrote:
Nice!
10 #. inv 4365
4 3 6 5
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of 'Pascal
Jasmin' via Programming
Sent: Thursday, September 04, 2014 8:17 PM
To: [email protected]
Subject: Re: [Jprogramming] repeated applications of a verb
there is also
([: +/@:! 10 #. inv ]) 169
#. inv is like #: except you don't need to calculate the right number of
copies of x (10).
----- Original Message -----
From: Linda Alvord <[email protected]>
To: [email protected]
Cc:
Sent: Thursday, September 4, 2014 7:59:21 PM
Subject: Re: [Jprogramming] repeated applications of a verb
f=: 13 :'+/!(($":y)#10)#:y'
f 169
363601
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Thursday, September 04, 2014 5:39 PM
To: Programming forum
Subject: Re: [Jprogramming] repeated applications of a verb
Just so it's clear what has happened here:
;:'SumOfFact^:3 169'
+---------+--+-----+
|SumOfFact|^:|3 169|
+---------+--+-----+
In other words, 3 169 is a single word. It's a word that happens to have a
space in it, but that's actually not at all unusual. Here's another example
of a word with a space in it:
'this is a test'
Actually, that particular word has three spaces in it. But that counts,
right?
Note that some people prefer to call words "tokens" for various reasons.
Note also that we train our eyes to see these things. To someone who has
never studied computer programming languages, 'this is a test' might look
like four words where two of them contain apostrophes. But someone familiar
with quoting rules can see it as a single "thing" and - if they've played
with implementations of parsers or similar things - they'll have an idea
about why it's worth calling this thing a "word" or a "token".
Anyways, I have had this happen to me relatively often, so I am familiar
with its symptoms. I'll have a J sentence which uses a number and I will
add another number to it, and I will want it to be a different word, and I
have to remind myself to make it be one.
Meanwhile some other messages have provided some examples of how to break 3
169 into two separate words, so I'll skip that part. But I'll note that I
see four different ways of using a single pair of parenthesis to accomplish
this.
Thanks,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm