Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Linda Alvord
You might enjoy one of the responses I got from Henry Rich in 2012. It was a question about dice. I remember I had no idea what the last line meant and never managed to go back an figure it out until I looked at it again today and I understood it. NB. Answer to a dice challenge from Henry Rich

Re: [Jprogramming] Beginner question

2014-09-25 Thread Tikkanz
I like 'rotate back' On Fri, Sep 26, 2014 at 10:24 AM, Don Guinn wrote: > Rotate (Left/Up) > > On Thu, Sep 25, 2014 at 4:21 PM, Henry Rich wrote: > > > Funny, but 'rotate up' feels like 'rotate toward higher numbers' to me, > i. > > e. rotate right. > > > > Henry Rich > > > > On 9/25/2014 6:16

Re: [Jprogramming] zlib addon thanks

2014-09-25 Thread Tikkanz
If you install zlib1.dll it will be much faster again. On Windows (Paraphrasing the readme.txt) Open a J session (run as Admin if need be) load 'arc/zlib' install_jzlib_'' load 'arc/zlib' On Thu, Sep 25, 2014 at 11:51 AM, Devon McCormick wrote: > It seems to work when I use a slightly

Re: [Jprogramming] Beginner question

2014-09-25 Thread Don Guinn
Rotate (Left/Up) On Thu, Sep 25, 2014 at 4:21 PM, Henry Rich wrote: > Funny, but 'rotate up' feels like 'rotate toward higher numbers' to me, i. > e. rotate right. > > Henry Rich > > On 9/25/2014 6:16 PM, Raul Miller wrote: > >> Would "Rotate Up" work for you? >> >> Thanks, >> >> --

Re: [Jprogramming] Beginner question

2014-09-25 Thread Henry Rich
Funny, but 'rotate up' feels like 'rotate toward higher numbers' to me, i. e. rotate right. Henry Rich On 9/25/2014 6:16 PM, Raul Miller wrote: Would "Rotate Up" work for you? Thanks, -- For information about J forums see h

Re: [Jprogramming] Beginner question

2014-09-25 Thread Raul Miller
Would "Rotate Up" work for you? Thanks, -- Raul On Thu, Sep 25, 2014 at 5:07 PM, Henry Rich wrote: > I'm glad to see NuVoc getting enough use to make it worth arguing over. > > But I know that for myself, when |. was called simply "Rotate", I had to > check the reference every time I used it

Re: [Jprogramming] Beginner question

2014-09-25 Thread PMA
FWTW, "left" would ring truest with me, as the graphics software I've encountered tends to rotate things Anticlockwise by default. (And I think of that as "left".) Pete Devon McCormick wrote: "Rotate back" ? On Thu, Sep 25, 2014 at 5:07 PM, Henry Rich wrote: I'm glad to see NuVoc getting e

Re: [Jprogramming] Beginner question

2014-09-25 Thread Henry Rich
IMO that's the best offered so far. Henry Rich On 9/25/2014 5:26 PM, Devon McCormick wrote: "Rotate back" ? On Thu, Sep 25, 2014 at 5:07 PM, Henry Rich wrote: I'm glad to see NuVoc getting enough use to make it worth arguing over. But I know that for myself, when |. was called simply "Rota

Re: [Jprogramming] Beginner question

2014-09-25 Thread Devon McCormick
"Rotate back" ? On Thu, Sep 25, 2014 at 5:07 PM, Henry Rich wrote: > I'm glad to see NuVoc getting enough use to make it worth arguing over. > > But I know that for myself, when |. was called simply "Rotate", I had to > check the reference every time I used it to make sure that I got the > direc

Re: [Jprogramming] Beginner question

2014-09-25 Thread Henry Rich
I'm glad to see NuVoc getting enough use to make it worth arguing over. But I know that for myself, when |. was called simply "Rotate", I had to check the reference every time I used it to make sure that I got the direction right. Once I learned it as "rotate left", that problem went away.

Re: [Jprogramming] Beginner question

2014-09-25 Thread Henry Rich
I guess my question is about the name "rotate left" - that's only the "visual result" if the right operand is a 1 cell - why not call it "rotate"? We chose "rotate left" as the mnemonic name for NuVoc so that you would remember that positive values of x cause a leftward rotation. Henry Rich

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Roger Hui
"This" is also an example where the problem statement, including the model and the display of its result, heavily influenced the solutions. To avoid this kind of bias in this case, perhaps you might say: Roll a dice. If you don't get a 6, stop; if you do get a 6, roll the dice again. Do m trial

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Raul Miller
That is very close to what I came up with, for the case where we want only a single value from our result: d6=:1 + ? bind 6 repd6=: [:+/(,d6)^:(6={:)@d6 Here's a variation on Roger Hui's approach, for the case where we want N values from our result: d6s=: 1 + [: ? #&6 bulk=:{.#&0(],~(+/;.1

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Roger Hui
Just makes sure that n is sufficiently large so that when you (}:1,6~:x) <;.1 x=: 1+n ?@$ 6 there are at least m complete sets (where a set can not end on a 6). On Thu, Sep 25, 2014 at 10:54 AM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > there's a small issue with it,

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Skip Cave
Great! now I understand about "frets" Skip On Thu, Sep 25, 2014 at 11:32 AM, Roger Hui wrote: > ​Compared to the other solutions posted so far, I believe it is more > straightforward to do a long sequence of dice rolls and then split it up > according to your specified criteria. The split poi

Re: [Jprogramming] Beginner question

2014-09-25 Thread Raul Miller
I'll do that, then. Thanks, -- Raul On Thu, Sep 25, 2014 at 10:38 AM, Michael Dykman wrote: > I second the suggestion that the nuvoc name be reverted to the original > 'rotate' > On 25 Sep 2014 09:00, "Devon McCormick" wrote: > > > Perhaps the relevant thing to understand here is that rotate

Re: [Jprogramming] Beginner question

2014-09-25 Thread Raul Miller
Rotate is like }. though in that it is not limited to the leading dimension, and in fact can ignore the leading dimension without using the rank conjunction. Consider, for example: 1 _1 |. i. 4 5 9 5 6 7 8 14 10 11 12 13 19 15 16 17 18 4 0 1 2 3 and 0 2 |. i. 4 4 2 3 0 1 6

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread 'Pascal Jasmin' via Programming
there's a small issue with it, (if last roll is a 6) (}:1,6~:x) <;.1 x=. 6 1 6 6 2 3 6 ┌───┬─┬─┬─┐ │6 1│6 6 2│3│6│ └───┴─┴─┴─┘ if you've never seen a use for i.15 0 before, ([: +/ (, >:@?@6:)^:((0=#) +. 6={:)^:_)"1 i.15 0 3 13 3 3 11 1 2 3 5 4 9 4 1 3 1 or (, >:@?@6:)^

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Devon McCormick
This looks like a good addition to my growing set of "array-thinking" examples. On Thu, Sep 25, 2014 at 12:32 PM, Roger Hui wrote: > ​Compared to the other solutions posted so far, I believe it is more > straightforward to do a long sequence of dice rolls and then split it up > according to your

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Roger Hui
​Compared to the other solutions posted so far, I believe it is more straightforward to do a long sequence of dice rolls and then split it up according to your specified criteria. The split point are where the _previous_ roll is _not_ a 6. Thus: ​ x=: 1+1e4 ?@$ 6 NB. long sequence of dice ro

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Aai
e.g. ]`(,$:) @. (=&6)@roll0&> 10$6 On 25-09-14 17:39, David Lambert wrote: Help! For you email skimmers please jump to the agenda version mystery. Control the RNG: Under system global parameters, you can choose the random number generator and state. http://www.jsoftware.com/docs/help701/d

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread 'Pascal Jasmin' via Programming
this works (, >:@?@6:)^:((0=#) +. 6={:)^:_ i.0 ([: +/ (, >:@?@6:)^:((0=#) +. 6={:)^:_) i.0 11 - Original Message - From: Johann Hibschman To: Programming forum Cc: Sent: Thursday, September 25, 2014 9:06 AM Subject: [Jprogramming] Repeated rolling dice Hi all, For fun, I've b

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread David Lambert
Help! For you email skimmers please jump to the agenda version mystery. Control the RNG: Under system global parameters, you can choose the random number generator and state. http://www.jsoftware.com/docs/help701/dictionary/dx009.htm starting from 9!:42 . Power version: Here's a working ta

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread robert therriault
Hi Linda, I run JHS in Safari and copy and paste into my Mac's Mail app. I don't run in rich text on my Mail app, but that is about the only difference I see in our workflow (other than our hardware) Also the results that I put into the Mail app don't look as good to me as they do in JHS (espec

Re: [Jprogramming] wd 'setlocale'

2014-09-25 Thread 'Pascal Jasmin' via Programming
thank you Bill. That is a good design. - Original Message - From: bill lam To: 'Pascal Jasmin' via Programming Cc: Sent: Thursday, September 25, 2014 1:00 AM Subject: Re: [Jprogramming] wd 'setlocale' form locale can be numbered locale since day 1. Specifically form locale is the cur

Re: [Jprogramming] Beginner question

2014-09-25 Thread Michael Dykman
I second the suggestion that the nuvoc name be reverted to the original 'rotate' On 25 Sep 2014 09:00, "Devon McCormick" wrote: > Perhaps the relevant thing to understand here is that rotate - like most > (all?) J primitives - applies to the leading axis of an array by default. > >+/i. 2 3 N

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread Kip Murray
"Is there a discussion of the quality of the RNG somewhere?" See http://en.m.wikipedia.org/wiki/Mersenne_twister which discusses J's default RNG. On Thursday, September 25, 2014, Johann Hibschman wrote: > Hi all, > > For fun, I've been running some statistics for a game with an unusual > rule

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Linda Alvord
< 1 2 +/ i. 4 ┐ │1 2 3 4│ │2 3 4 5│ L < 1 2 +/ i. 4 ┐ │1 2 3 4│ │2 3 4 5│ L $1 2 2 NB. Left argument has two items which is the number of rows $i.4 4 NB. Right argument determines the number of columns $8 2 9 4 -/ 3 5 2 9

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Linda Alvord
Your answer looks good. I run code I want to put in an email in a script and run it in JHS. Then I copy it in an Outlook email after I changed to rich text. In J802 boxes would display correctly. In J803 the boxes look good in the sent folder but appear in boxes with dashes. Also, not an

[Jprogramming] Repeated rolling dice

2014-09-25 Thread Johann Hibschman
Hi all, For fun, I've been running some statistics for a game with an unusual rule for rolling dice: if a 6 is rolled, roll again and add the result, repeating on any subsequent 6s. I wanted to implement this in J, collecting all the individual rolls (rather than just the sum.) It seems like ther

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Devon McCormick
For a scalar primitive like plus, the shape of the result of table is simply the concatenation of the shapes of the left and right arguments: (($a),$b) -: $ a +/ b $(i.2) +/ i.3 2 3 $(i.2 2) +/ i.3 2 2 3 $(i.2 2) +/ i.3 4 5 2 2 3 4 5 On Thu, Sep 25, 2014 at 5:05 AM, Tikkanz wrote: > T

Re: [Jprogramming] Beginner question

2014-09-25 Thread Devon McCormick
Perhaps the relevant thing to understand here is that rotate - like most (all?) J primitives - applies to the leading axis of an array by default. +/i. 2 3 NB. Reduce "2"->shape 3 result 3 5 7 +/i. 2 3 4 NB. Reduce "2"->shape 3 4 result 12 14 16 18 20 22 24 26 28 30 32 34 (|.+]) i. 2 1

Re: [Jprogramming] Beginner question

2014-09-25 Thread Raul Miller
I agree. I'm removing the 1 (it's just a wiki, so I can do that). But I think it needs further changes. Consider 2 _3 4 |. i. 8 8 8 The whole "left" concept, I'm not sure it makes sense as part of the name. Thanks, -- Raul On Thu, Sep 25, 2014 at 7:40 AM, Brian Schott wrote: > I believe

Re: [Jprogramming] Beginner question

2014-09-25 Thread Raul Miller
Note that the original dictionary calls |. "rotate" http://www.jsoftware.com/help/dictionary/d231.htm It's NuVoc which calls it "rotate left" http://www.jsoftware.com/jwiki/Vocabulary/bardot#dyadic I imagine the motivation here is that the rank 1 right argument case is the simplest case, and t

Re: [Jprogramming] Beginner question

2014-09-25 Thread Brian Schott
I believe there is a "typo" at the following link where the caption "Shift Left 1" should be "Shift Left x" or just "Shift Left". I suspect the latter because that agrees more with the reference link on the main NuVoc page. http://www.jsoftware.com/jwiki/Vocabulary/bardot#dyadic -- (B=) --

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Tikkanz
The shape is 2 4, not 2 2 ? If you look up the dyadic use of u/, then you should be able to predict the shape. >From the wiki page: "(x u/ y) returns a table having entries (a u b) for every a in x and b in y" http://www.jsoftware.com/jwiki/V

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Chris Wright
ah. dumb of me. lesson learnt. so now the question is could one predict 2 2 for the shape of the answer ? as opposed to say 14 thanks again! -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Predicting the shape of the result

2014-09-25 Thread Raul Miller
It is neither. $1 2 +/ i. 4 2 4 Which, perhaps would explain your dilemma? Thanks, -- Raul On Thu, Sep 25, 2014 at 2:09 AM, Chris Wright wrote: > thanks Robert! > > OK. boxes are atoms withb an empty shape. > > I've looked at the docs and can't see where I could read to understand why >