[Jprogramming] Catalogue

2018-07-22 Thread Don Guinn
I stumbled onto this by accident, but I can't find it documented anywhere. {i.3 4 5 ┌──┬──┬──┬──┐ │0 1 2 3 4 │5 6 7 8 9 │10 11 12 13 14│15 16 17 18 19│ ├──┼──┼──┼──┤ │20 21 22 23 24│25 26 27 28 29│3

Re: [Jprogramming] Fifty Shades of J

2018-07-22 Thread Brian Schott
I'm having trouble with editing a "wikitable" because certain characters do not appear. Is there a reference for editing, especially the "wikitable"? In the first example the characters `n&|` do not appear even the characters `_n&|` DO. {| class="wikitable" |- | n&|. and _n&|. | (shift n left/ s

Re: [Jprogramming] Fifty Shades of J

2018-07-22 Thread Devon McCormick
Stile "|" is a special character so it has to be specified by number, i.e. a. i. '|' 124 So, {| class="wikitable" |- | n&|. and _n&|. | (shift n left/ shift n right) |} On Sun, Jul 22, 2018 at 2:56 PM Brian Schott wrote: > I'm having trouble with editing a "wikitable" because certain chara

Re: [Jprogramming] Fifty Shades of J

2018-07-22 Thread Devon McCormick
Question on a stylistic issue: I'm editing chapter 33 ("Perming and Combing") where "ptof" is used without first being defined. I can find its definition in the "code" section so it's not too much of a problem but it does mean that my initial copy and paste into a J session got a value error. Sho

Re: [Jprogramming] Catalogue

2018-07-22 Thread Devon McCormick
I think for catalog to do anything interesting, you need to provide it with boxed arguments. So, { i.3 +-+ |0 1 2| +-+ But { (i.3);i. 2 +---+---+ |0 0|0 1| +---+---+ |1 0|1 1| +---+---+ |2 0|2 1| +---+---+ It's providing all combinations of the items in boxes but, if there is no e

Re: [Jprogramming] Catalogue

2018-07-22 Thread Henry Rich
As I read Ye Dic, ({ i. 2 4) should give the same result as ({ <"1 i. 2 3).  Put it on the bug list. Henry Rich On 7/22/2018 4:55 PM, Devon McCormick wrote: I think for catalog to do anything interesting, you need to provide it with boxed arguments. So, { i.3 +-+ |0 1 2| +-+ But

[Jprogramming] 50 shades: chapter 33 version difference because of "A."?

2018-07-22 Thread Devon McCormick
When I run the example "|:rlist 4" from chapter 33 "Perming and Combing", I get two different results from what is shown in the text in v. 8.04 and v. 8.07; both differ from the text result which is: 2 3 3 2 0 0 3 2 0 0 2 3 0 0 2 3 3 2 1 1 1 1 1 1 3 2 0 0 2 3 0 0 2 3 3 2 1 1 1 1 1 1 2 3 3 2 0 0 0

Re: [Jprogramming] 50 shades: chapter 33 version difference because of "A."?

2018-07-22 Thread Henry Rich
What's rlist? Henry Rich On 7/22/2018 5:14 PM, Devon McCormick wrote: When I run the example "|:rlist 4" from chapter 33 "Perming and Combing", I get two different results from what is shown in the text in v. 8.04 and v. 8.07; both differ from the text result which is: 2 3 3 2 0 0 3 2 0 0 2 3

Re: [Jprogramming] 50 shades: chapter 33 version difference because of "A."?

2018-07-22 Thread Devon McCormick
rlist=: TPlist { ?@! { Llist TPlist=: 3 : 0 if.y>1 do. r=: ,/(i.y)|."1 every<(TPlist<:y),.<:y else. r=: 1 $0 end. ) Llist=: i.@! A. i. Where "every" is "&>". On Sun, Jul 22, 2018 at 5:18 PM Henry Rich wrote: > What's rlist? > > Henry Rich > > On 7/22/2018 5:14 PM, Devon McCormick wr

Re: [Jprogramming] Fifty Shades of J

2018-07-22 Thread Brian Schott
I had a similar omission and just inserted its definition in the text before it was used. Also, I defined a 3 by 3 array z using ]z=:3 3&$ (when z was just displayed in the original text). I hope that is acceptable. On Sun, Jul 22, 2018 at 4:35 PM, Devon McCormick wrote: > Question on a stylisti

Re: [Jprogramming] 50 shades: chapter 33 version difference because of "A."?

2018-07-22 Thread Henry Rich
The two versions should give the same results.  Can you isolate a single primitive that shows a difference between the versions? Henry Rich On 7/22/2018 5:21 PM, Devon McCormick wrote: rlist=: TPlist { ?@! { Llist TPlist=: 3 : 0 if.y>1 do. r=: ,/(i.y)|."1 every<(TPlist<:y),.<:y else

Re: [Jprogramming] 50 shades: chapter 33 version difference because of "A."?

2018-07-22 Thread Brian Schott
Devon, rlist uses ? which produces different random values. I think ?. may produce identical random values in different Js. On Sun, Jul 22, 2018 at 5:21 PM, Devon McCormick wrote: >rlist=: TPlist { ?@! { Llist >TPlist=: 3 : 0 > if.y>1 do. > r=: ,/(i.y)|."1 every<(TPlist<:y),.<:y > else

Re: [Jprogramming] Catalogue

2018-07-22 Thread chris burke
> I stumbled onto this by accident, but I can't find it documented anywhere. > > {i.3 4 5 You obviously know what i. does. For the definition of { , in Jqt put the cursor on it (immediately to the left or right as long as the selection is not ambiguous), then press Ctrl+F1 or Ctrl+Shift+F1 for th

Re: [Jprogramming] Fifty Shades of J

2018-07-22 Thread chris burke
A good starting point on the J wiki is https://code.jsoftware.com/wiki/About . This in turn points to the Wiki syntax page. A useful tag described there is , which is used quite a bit in the J wiki. Using allows us to include J code without it being treated as wiki markup. See https://en.wikipedi

Re: [Jprogramming] Catalogue

2018-07-22 Thread neitzel
Henry Rich wrote: > As I read Ye Dic, ({ i. 2 4) should give the same result as > ({ <"1 i. 2 3). I never thought I'd have to say this to *you* but: note that Catalogue { has rank 1. Hence there should not be any interaction between the colors in { 'black' ,: 'green' nor in the low / high ve

Re: [Jprogramming] Catalogue

2018-07-22 Thread Don Guinn
Yes. The documentation describes exactly what's happening. The rank 1 is the key making each number an item. In this case it is the equivalent to (<"1) by itself. So, is it a good idea to use ({) in place of (<"1) when wanting to box something rank 1? It's shorter and simpler to read. But what abou

Re: [Jprogramming] Catalogue

2018-07-22 Thread Henry Rich
oops. Henry Rich On 7/22/2018 6:42 PM, [email protected] wrote: Henry Rich wrote: As I read Ye Dic, ({ i. 2 4) should give the same result as ({ <"1 i. 2 3). I never thought I'd have to say this to *you* but: note that Catalogue { has rank 1. Hence there should not be any interaction betwe

Re: [Jprogramming] Catalogue

2018-07-22 Thread Henry Rich
I'll get the answer to this one right.  <"r is heavily optimized.  Don't try to replace it. Henry Rich On 7/22/2018 7:08 PM, Don Guinn wrote: Yes. The documentation describes exactly what's happening. The rank 1 is the key making each number an item. In this case it is the equivalent to (<"1)

Re: [Jprogramming] Catalogue

2018-07-22 Thread Don Guinn
Sounds good. On Sun, Jul 22, 2018, 5:46 PM Henry Rich wrote: > I'll get the answer to this one right. <"r is heavily optimized. Don't > try to replace it. > > Henry Rich > > On 7/22/2018 7:08 PM, Don Guinn wrote: > > Yes. The documentation describes exactly what's happening. The rank 1 is > >