Re: [Jprogramming] Iteration

2020-03-29 Thread Joachim Hoffmann
Hello to All, CORRECTION to my previous post: I produced a horrible bug in the display of time/space measurements at the end of the script. With the bugfix, the time/space display, the use of ^: does not appear very fast any more. Please accept my apologies, JoHo /

Re: [Jprogramming] Iteration

2020-03-26 Thread Joachim Hoffmann
Hello to All, NB. ... using Function Power for the iteration ... J807 JoHo niter=: 4 (]([,<@])6&?@:>@:{.)^:niter[,<55 NB. deal 6 out of 55 in boxes +--+-+-+-+-+ |55|19 46 33 41 43 15|53 18 16 15 20 54|41 15 24 23 36 3

Re: [Jprogramming] Iteration

2020-03-25 Thread Skip Cave
All, I'm sorry my description of my problem wasn't very clear. I actually wasn't worried about the exact number of generations of 6 random numbers. I just wanted to understand how I could generate multiple sets of 6 random integers without having to type them all out one at a time, as I had done in

Re: [Jprogramming] Iteration

2020-03-25 Thread Hauke Rehr
That’s what ;/6 (? $~) 55 (amoung others) does. We wondered mainly how many repetitions you actually wanted to get. There were 5 in your example and you wanted something extended 50 times. None knew what it was you wanted extended and if it was to be counted. Did you intend to get • 50 • 51 • 55

Re: [Jprogramming] Iteration

2020-03-24 Thread Skip Cave
The original requirement was to have the integers in each set of 6 be unique in that set. Zeros are OK. Skip > > -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Iteration

2020-03-24 Thread Don Kelly
I see your point.  actually x?y  (deal as in the vocabulary) doesn't allow repetitions. An analogy is dealing a hand of cards where you will never (legally) have 2 aces of spades . hence, with 2 cards 1 and 0, you can't get 1 1 . If you have 2 cards each having a 1  and 0 you can get  your resu

Re: [Jprogramming] Iteration

2020-03-24 Thread Julian Fondren
5 6 ?@$ 55 52 3 9 16 4 3 26 30 24 34 30 50 46 51 16 19 26 26 20 46 12 50 39 27 3 39 45 46 46 33 :) This actually isn't the same result as your code, though. (4#2) ? 2 0 1 0 1 0 1 1 0 1 1 i.~ (1e6#2) ? 2 100 0 0 i.~ (1e6#2) ? 2 100 There are never any 1 1 or 0 0 results

Re: [Jprogramming] Iteration

2020-03-24 Thread Don Kelly
(5#6)?55 42 16 14 29 38 25 14 37 22 4 54 6 47 51 35 32 26 45 13 53 10 29 3 15 21 8 20 45 30 52 Don Kelly On 2020-03-23 5:47 p.m., 'Jim Russell' via Programming wrote: Who do I thank tor this? It is a particularly clear and helpful exclamation. Thank you! On Mar 13, 2020, at 3:56 AM,

Re: [Jprogramming] Iteration

2020-03-23 Thread ethiejiesa via Programming
This was me. Very nice to hear that someone found it helpful. Thanks for going out of your way to say thanks! Jim Russell wrote: > Who do I thank tor this? It is a particularly clear and helpful exclamation. > Thank you! > > > On Mar 13, 2020, at 3:56 AM, ethiejiesa via Programming > > wrote

Re: [Jprogramming] Iteration

2020-03-23 Thread 'Jim Russell' via Programming
Who do I thank tor this? It is a particularly clear and helpful exclamation. Thank you! > On Mar 13, 2020, at 3:56 AM, ethiejiesa via Programming > wrote: > > I'll contribute a little prose. Hopefully, it's helpful. > > In this particular case, notice that > transforms your list of boxes in

Re: [Jprogramming] Iteration

2020-03-13 Thread Hauke Rehr
If that’s what was intended, I’d rather write ;/6 (? $~) 55 (adhering to the DRY principle). Am 13.03.20 um 16:22 schrieb Raul Miller: Here's another approach: ;/6?255#55 Here, I decided that "extended fifty times" really meant that you wanted another 50 copies of that expression (extended

Re: [Jprogramming] Iteration

2020-03-13 Thread Raul Miller
Here's another approach: ;/6?255#55 Here, I decided that "extended fifty times" really meant that you wanted another 50 copies of that expression (extended linearly). But of course you can tweak the numbers. FYI, -- Raul On Fri, Mar 13, 2020 at 12:49 AM Skip Cave wrote: > > How can I gene

Re: [Jprogramming] Iteration

2020-03-13 Thread Roger Hui
0. It may be helpful to think of &.> as "each". In fact, "each" is defined as such by some J standard library somewhere. Enter "each" in your J session and see what you get. 1. See https://code.jsoftware.com/wiki/Essays/Under for examples of &. , including from daily life (e.g. "under anaestheti

Re: [Jprogramming] Iteration

2020-03-13 Thread ethiejiesa via Programming
Yes, those are not precise terms. I personally think of &. as embodying conjugation (from group theory). For monads, the analogy is often precise: u&.v y <-> v^:_1 u v y But you are right, the idea of conjugation is abstract enough that it is embodied by a dizzingly wide variety of applications: v

Re: [Jprogramming] Iteration

2020-03-13 Thread Hauke Rehr
In my opinion, “do” and “undo” is not the idea/concept of &. and doesn’t get across what it actually does. &. is very helpful in a plethora of use cases it is like transform, work in transformed space, transform back (like working with conjugate matrices or in fourier space, e.g.) From my person

Re: [Jprogramming] Iteration

2020-03-13 Thread ethiejiesa via Programming
I'll contribute a little prose. Hopefully, it's helpful. In this particular case, notice that > transforms your list of boxes into a 5x6 table: > (6?55);(6?55);(6?55);(6?55);(6?55) 13 4 19 43 3 52 10 1 4 46 52 11 38 12 48 50 54 45 36 54 39 35 53 50 44 1 7 54 11 41 So,

Re: [Jprogramming] Iteration

2020-03-12 Thread ethiejiesa via Programming
Won't that give a 6x5 table of ?55 instead? 6 5?@$55 <-> ? 6 5 $ 55 Devon McCormick wrote: >6 5?@$55 > Will give you a 6x5 table that is 6 independent rows of 5?55. > > > On Fri, Mar 13, 2020 at 12:52 AM Roger Hui > wrote: > > >6 ?&.> 5 $ 55 > > > > ┌┬

Re: [Jprogramming] Iteration

2020-03-12 Thread Skip Cave
Wow! Two completely different ways to generate multiple sets of random integers. Roger used &. which I haven't really ever used or understood. I will definitely need to understand &. for the future. Devon used @, which I also haven't used very much. I need to find some practice and training exampl

Re: [Jprogramming] Iteration

2020-03-12 Thread Devon McCormick
6 5?@$55 Will give you a 6x5 table that is 6 independent rows of 5?55. On Fri, Mar 13, 2020 at 12:52 AM Roger Hui wrote: >6 ?&.> 5 $ 55 > > ┌┬─┬───┬─┬───┐ > │47 28 45 25 8 36│22 40 23 20 11 49│15 16 42 38 4 5│50 45 3

Re: [Jprogramming] Iteration

2020-03-12 Thread Roger Hui
6 ?&.> 5 $ 55 ┌┬─┬───┬─┬───┐ │47 28 45 25 8 36│22 40 23 20 11 49│15 16 42 38 4 5│50 45 38 37 13 28│42 4 36 7 23 49│ └┴─┴───┴─┴───┘ 6 ?&.> 50 $ 55 ..

[Jprogramming] Iteration

2020-03-12 Thread Skip Cave
How can I generate the following result extended 50 times, without explicit looping? (6?55);(6?55);(6?55);(6?55);(6?55) ┌───┬───┬─┬─┬───┐ │13 4 19 43 3 52│10 1 4 46 52 11│38 12 48 50 54 45│36 54 39 35 53 50│44 1 7 54 11 41│ └──

Re: [Jprogramming] Iteration of Power

2013-03-26 Thread Linda Alvord
ramm...@jsoftware.com Subject: Re: [Jprogramming] Iteration of Power On 3/25/13, Raul Miller wrote: > Other people have already answered. But, curiously, I have not seen > any tacit implementations yet. Have I turned invisible or something? Ambrus -

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Raul Miller
On Mon, Mar 25, 2013 at 3:49 PM, Zsbán Ambrus wrote: > On 3/25/13, Raul Miller wrote: >> Other people have already answered. But, curiously, I have not seen >> any tacit implementations yet. > > Have I turned invisible or something? I saw a post from you, but it did not show how to take the exi

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Zsbán Ambrus
On 3/25/13, Raul Miller wrote: > Other people have already answered. But, curiously, I have not seen > any tacit implementations yet. Have I turned invisible or something? Ambrus -- For information about J forums see http://www

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Brian Schott
Maybe Raul did not see yours, like I did not see Fraser's. Could there be some latency in the email? On Mon, Mar 25, 2013 at 3:49 PM, Zsbán Ambrus wrote: > On 3/25/13, Raul Miller wrote: >> Other people have already answered. But, curiously, I have not seen >> any tacit implementations yet. > >

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Raul Miller
Other people have already answered. But, curiously, I have not seen any tacit implementations yet. Perhaps: gen=: life@]^:(i.@[) -- Raul -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Brian Schott
If you are willing to use explicit verbs, maybe this will do. gen1 =: 13 :'life^:(i.x)y' gen1 4 : 'life^:(i.x)y' (4 gen1 sbd) -:(i. 4) gen sbd 1 -- (B=) <-my sig Brian Schott -- For information about J forums see h

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Björn Helgason
take a look at the life demo On Mar 25, 2013 4:22 PM, "Jeremy Smith" wrote: > Hi everyone, > > I'm am amateur trying to learn J. Someday I hope to apply the language in > an actuarial context, but first I'm trying to get some chops. As a > challenge, I've been trying to program The Game of Life

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Fraser Jackson
Jeremy, Sometimes mixing tacit and explicit definitions gives very simple programs especially if you want to use a conjunction like power gen1 =: 4 : 'life^:(i.>:x)y' gen2 =: 4 : 'life ^:x y' if you only want the final result Fraser -

Re: [Jprogramming] Iteration of Power

2013-03-25 Thread Zsbán Ambrus
On Mon, Mar 25, 2013 at 5:22 PM, Jeremy Smith wrote: > life =: +./@((1 ,: [) (*."2) 3 4 e."0/ +/@(+/@(1 0 _1 |."0 2/ 1 0 _1 |."0 1/ > [))) > > And then (i.4) gen board indeed gives me what I want. But I cannot figure > out how to define "gen" so that the syntax "4 gen board" sbd =: ?10 10$2

[Jprogramming] Iteration of Power

2013-03-25 Thread Jeremy Smith
Hi everyone, I'm am amateur trying to learn J. Someday I hope to apply the language in an actuarial context, but first I'm trying to get some chops. As a challenge, I've been trying to program The Game of Life using J. I'm attempting to directly translate the APL version described here: http://