Re: [Jprogramming] Detecting special products

2015-08-09 Thread Roger Hui
An advantage of solutions based on taking cube roots, on the expression >.@%: in particular, is working correctly with large integers. For example: g=: = (^&3 - ])@:(3&(>.@%:)) n=: */ 0 1 2 + 11^20x n 304481639541418099575807073027324053193216441247734861355941206 g n 1 g n+1 0 I

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
Yes. In general, we want the gerund to apply to cells of specified rank, not just items. Henry Rich On 8/9/2015 9:01 PM, Jose Mario Quintana wrote: Rank=. ($~ #@]) invoke f."_1 ] (-:`+:) Rank i.3 4 0 0.5 1 1.5 8 10 12 14 4 4.5 5 5.5 (-:`+:`*:) Rank i.3 4 0 0.5 1 1.5

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Jose Mario Quintana
Rank=. ($~ #@]) invoke f."_1 ] (-:`+:) Rank i.3 4 0 0.5 1 1.5 8 10 12 14 4 4.5 5 5.5 (-:`+:`*:) Rank i.3 4 0 0.5 1 1.5 8 10 12 14 64 81 100 121 On Sun, Aug 9, 2015 at 7:58 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > The alternatives to m"n are

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread 'Pascal Jasmin' via Programming
The alternatives to m"n aren't terrible. We have all made sensible workarounds. Of those workarounds, I strongly prefer # to $ as the selector. posting new definitions that saddly won't work unless definitions from other thread are gattered, lvProcsRest =: (1 : '(> {: m) eval }: m') lvProcsS

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
1 _1 1 * i. 3 4 Calculate + 0 1 2 3 - 4 5 6 7 + 8 9 10 11 collect results. Why this is right: All partitioning modifiers allow gerund m to specify verbs that are cyclically selected to apply to the partitions. (m"n y) is simply another example (where the partitions are n-cells of y). H

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Don Guinn
J verbs a noun when rank is applied. I always like that expression "Any noun can be verbed". v=.2 1 3"_ v +-+-+-+ |2 1 3|"|_| +-+-+-+ v 1 2 2 1 3 v0=.2 1 3"0 v0 +-+-+-+ |2 1 3|"|0| +-+-+-+ v0 1 2 2 1 3 2 1 3 On Sun, Aug 9, 2015 at 5:08 PM, Raul Miller wrote: > I

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Raul Miller
I'm still not clear on what "apply the selected verb to each cell" means here. Which of these three cases should be the consequence of (+`-"1 i.3 4) and why is that the right choice? length error 1 _1 1*i.3 4 1 _1 1 _1*"1 i.3 4 Thanks, -- Raul -- Raul On Sun, Aug 9, 2015 at 6:52 PM, Henry

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
The rank of those verbs doesn't enter into it. +`-;.2 for example means 'partition y, then apply the selected verb to the partition'. Same with +`|."2 y for example. Break y into 2-cells, then apply the selected verb to each cell. Henry Rich On 8/9/2015 6:38 PM, Raul Miller wrote: Hmm...

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Raul Miller
Hmm... but what should the effect be when the verbs in the gerund are not rank zero? -- Raul On Sun, Aug 9, 2015 at 5:01 PM, Henry Rich wrote: > Yes, I've done that too. > > The point is that there are ways to get a constant verb (or one could be > defined), but no easy way to get the effect o

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
Indeed. I've been doing J almost 20 years now & it only recently occurred to me. Henry Rich On 8/9/2015 5:35 PM, Jose Mario Quintana wrote: That is right (of course, with the benefit of hindsight)! On Sun, Aug 9, 2015 at 5:01 PM, Henry Rich wrote: Yes, I've done that too. The point is th

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Jose Mario Quintana
That is right (of course, with the benefit of hindsight)! On Sun, Aug 9, 2015 at 5:01 PM, Henry Rich wrote: > Yes, I've done that too. > > The point is that there are ways to get a constant verb (or one could be > defined), but no easy way to get the effect of +`-"n . > > Henry Rich > > > On 8/9

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
Yes, I've done that too. The point is that there are ways to get a constant verb (or one could be defined), but no easy way to get the effect of +`-"n . Henry Rich On 8/9/2015 4:00 PM, Marshall Lochbaum wrote: I've used (0"0) a few times to make an empty array a given shape (usually followed

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Marshall Lochbaum
I've used (0"0) a few times to make an empty array a given shape (usually followed by an invocation of }). However, (0$~$) is not much longer and I find that it better explains what I am trying to do. Marshall On Sun, Aug 09, 2015 at 02:45:11PM -0400, Raul Miller wrote: > Conciseness? > > I gues

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Jose Mario Quintana
Perhaps, however, personally I do not remember ever having to write a constant verb with a rank other than _ On Sun, Aug 9, 2015 at 2:45 PM, Raul Miller wrote: > Conciseness? > > I guess it's debatable whether constants with non-infinite rank are > more or less common than gerunds which need to

Re: [Jprogramming] a trick for monadic gerund and /

2015-08-09 Thread Jose Mario Quintana
A fixed tacit Calvinian ( http://www.gocomics.com/calvinandhobbes/1993/01/25 ) version of monex follows :) NB. The usual suspects... an=.<@:((,'0') ,&< ]) evoke=. (<'`:')(0:`)(,^:) invoke=. <@:(evoke&0)@:[ (evoke&6)@:, an@:] monex =: ($~$) invoke f."0 ] +:`-: monex 4 2 1 6 8 1

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Raul Miller
Conciseness? I guess it's debatable whether constants with non-infinite rank are more or less common than gerunds which need to conform to the shape of their (eventual) verb argument. Perhaps it would be worthwhile collecting useful examples of each? I know I've used low-rank constants within the

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Jose Mario Quintana
A constant verb (with rank _) can be produced easily via &[. For example, (1 2 3 &[) _ 1 2 3 and it could be followed by a suitable rank (") form if necessary. Am I missing something? On Sun, Aug 9, 2015 at 9:20 AM, Henry Rich wrote: > All the partitioning modifiers (\ /. \. ;. etc) allo

Re: [Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Raul Miller
On Sun, Aug 9, 2015 at 9:20 AM, Henry Rich wrote: > If m"n had been defined consistently with the other partitioning modifiers, On a related note, no language can ever be completely consistent, because the human mind is always capable of finding new patterns. That said, the ;. family of verbs mi

[Jprogramming] MediaWiki

2015-08-09 Thread chris burke
(This is cross posted to general and programming - please send any comments to general.) We plan to migrate the wiki from MoinMoin to MediaWiki (the wiki engine used by Wikipedia), and clean up the pages at the same time. We also want to better organize the wiki for typical uses, e.g. installation

[Jprogramming] How m"n shoulda been defined

2015-08-09 Thread Henry Rich
All the partitioning modifiers (\ /. \. ;. etc) allow u to be a gerund that is applied cyclically to the partitions. Thus, +`-/. applies + and - alternately. All the modifiers, that is, except one. The simplest one. One that perhaps wasn't thought of as partitioning, though it clearly does.

Re: [Jprogramming] Detecting special products

2015-08-09 Thread 'Bo Jacoby' via Programming
NB. incorrect version using +/    test=.[: +/ [: (= <.) [: > [: {: [: p. 1 0 _1 ,~ ]    test"0] 3*/\i.20 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 NB. corrected version version using +./    test=.[: +./ [: (= <.) [: > [: {: [: p. 1 0 _1 ,~ ]    test"0] 3*/\i.20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Re: [Jprogramming] a trick for monadic gerund and /

2015-08-09 Thread Jan-Pieter Jacobs
Only an incremental improvement, but taking out the gerund from the train, one can use this as a general purpose tool, independent from the monads to execute and the data: invoke =: 4 :'x`:0 y' monex =: ($~$) invoke"0 ] +:`-: monex 4 2 1 6 8 1 2 3 *:`%: monex i. 5 0 1 4 1.73205 16 2