Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-09 Thread 'Pascal Jasmin' via Programming
<"_1"_1 i.2 3 gets parsed as (<"_1"_1) (i.2 3) - Original Message - From: Linda Alvord To: programm...@jsoftware.com Cc: Sent: Friday, May 8, 2015 11:54 PM Subject: Re: [Jprogramming] Puzzle: nontransitive rank Pascal, You show: <"

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-08 Thread Linda Alvord
7, 2015 6:48 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Puzzle: nontransitive rank an example of your 2nd and 3rd reason <"_1 i.2 3 ┌─┬─┐ │0 1 2│3 4 5│ └─┴─┘ <"_1"_1 i.2 3 ┌─┬─┬─┐ │0│1│2│ ├─┼─┼─┤ │3│4│5│ └─┴─┴─┘ - Original Message --

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread 'Pascal Jasmin' via Programming
min' via Programming wrote: > is there a reason to call > > (+" 0 _1) b. 0 > _ 0 _ > > a feature? > > why should it not be > > _ 0 _1 > > ? > > > > - Original Message - > From: Marc Simpson > To: Programming forum > Cc: >

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Raul Miller
a reason to call > > (+" 0 _1) b. 0 > _ 0 _ > > a feature? > > why should it not be > > _ 0 _1 > > ? > > > > - Original Message - > From: Marc Simpson > To: Programming forum > Cc: > Sent: Thursday, May 7, 2015 4:33 PM > Sub

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Marshall Lochbaum
rogramming wrote: > is there a reason to call > > (+" 0 _1) b. 0 > _ 0 _ > > a feature? > > why should it not be > > _ 0 _1 > > ? > > > > - Original Message - > From: Marc Simpson > To: Programming forum > Cc: > Se

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread 'Pascal Jasmin' via Programming
is there a reason to call (+" 0 _1) b. 0 _ 0 _ a feature? why should it not be _ 0 _1 ? - Original Message - From: Marc Simpson To: Programming forum Cc: Sent: Thursday, May 7, 2015 4:33 PM Subject: Re: [Jprogramming] Puzzle: nontransitive rank Or indeed enigma=. +

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Brian Schott
com/help/dictionary/d600xv.htm > >> > >> the property of enigma is that when operated at its "native rank" it > >> returns the first result, but > >> > >> enigma"enigma applies enigma at enigma's rank, and so how could this be

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Marc Simpson
esult, but >> >> enigma"enigma applies enigma at enigma's rank, and so how could this be >> different? >> >> >> ----- Original Message - >> From: Henry Rich >> To: Programming forum >> Cc: >> Sent: Thursday, May 7, 2015 3:25 PM >&

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Marc Simpson
: Henry Rich > To: Programming forum > Cc: > Sent: Thursday, May 7, 2015 3:25 PM > Subject: [Jprogramming] Puzzle: nontransitive rank > > 1 2 enigma 1 2 > 2 4 > 1 2 enigma"enigma 1 2 > 2 3 > 3 4 > > enigma is a short verb. What might it be? > &

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Roger Hui
t? > > > - Original Message - > From: Henry Rich > To: Programming forum > Cc: > Sent: Thursday, May 7, 2015 3:25 PM > Subject: [Jprogramming] Puzzle: nontransitive rank > > 1 2 enigma 1 2 &g

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread 'Pascal Jasmin' via Programming
nt? - Original Message - From: Henry Rich To: Programming forum Cc: Sent: Thursday, May 7, 2015 3:25 PM Subject: [Jprogramming] Puzzle: nontransitive rank 1 2 enigma 1 2 2 4 1 2 enigma"enigma 1 2 2 3 3 4 enigma is a short verb. What

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Kenneth Lettow
oops..overlooked that. On Thu, May 7, 2015 at 3:40 PM, Henry Rich wrote: > That doesn't explain the first line: > > 1 2 enigma 1 2 > 2 4 > > Henry Rich > > On 5/7/2015 3:34 PM, Kenneth Lettow wrote: > >> enigma=: +/ >> >> 1 2 enigma"enigma 1 2 >> >> 2 3 >> >> 3 4 >> >> >> >> >> On Thu, M

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Henry Rich
That doesn't explain the first line: 1 2 enigma 1 2 2 4 Henry Rich On 5/7/2015 3:34 PM, Kenneth Lettow wrote: enigma=: +/ 1 2 enigma"enigma 1 2 2 3 3 4 On Thu, May 7, 2015 at 3:25 PM, Henry Rich wrote: 1 2 enigma 1 2 2 4 1 2 enigma"enigma 1 2 2 3 3 4 enigma is a shor

Re: [Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Kenneth Lettow
enigma=: +/ 1 2 enigma"enigma 1 2 2 3 3 4 On Thu, May 7, 2015 at 3:25 PM, Henry Rich wrote: >1 2 enigma 1 2 > 2 4 >1 2 enigma"enigma 1 2 > 2 3 > 3 4 > > enigma is a short verb. What might it be? > > Henry Rich > --

[Jprogramming] Puzzle: nontransitive rank

2015-05-07 Thread Henry Rich
1 2 enigma 1 2 2 4 1 2 enigma"enigma 1 2 2 3 3 4 enigma is a short verb. What might it be? Henry Rich -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] :. puzzle (bug?)

2015-04-21 Thread 'Pascal Jasmin' via Programming
) (L:0)) :. brxinv - Original Message - From: 'Pascal Jasmin' via Programming To: Programming forum Cc: Sent: Tuesday, April 21, 2015 4:16 PM Subject: [Jprogramming] :. puzzle (bug?) brxinv =: ([: (x: inv :: ] (L:0)^:IF64) (3!:2)) brx =: 1 (3!:1) x: :: ] (L:0) :. brxinv

[Jprogramming] :. puzzle (bug?)

2015-04-21 Thread 'Pascal Jasmin' via Programming
brxinv =: ([: (x: inv :: ] (L:0)^:IF64) (3!:2)) brx =: 1 (3!:1) x: :: ] (L:0) :. brxinv intent is to get portable 32bit representation of non-extended data on 64 bit machine, brx looks right (ie :. rightside looks the same) brx (1) 3!:1 x: ::]L:0 :.([: (x:^:_1 ::]L:0^:1) 3!:2) brxinv [:

Re: [Jprogramming] Puzzle

2013-12-07 Thread Dan Bron
You and I have different definitions of cheesy. Anyway, I wrote: > Here's a silly variation. >3 ([ p:^:_1&|: p:\) i.7 > BTW, if the bug in [1] were fixed, we could've written: >3 ([ p:^:_1 p:\) i.7 And if we fixed the bug and further extended the definition of p: in a consistent and com

Re: [Jprogramming] Puzzle

2013-12-07 Thread Raul Miller
If you want cheesier, you might try: ps3p=: 30 105 385 1001 2431 4199 7429"1 -- Raul On Sat, Dec 7, 2013 at 5:22 PM, Dan Bron wrote: > I wrote: >> Here's a silly variation. >> 3 ([ p:^:_1&|: p:\) i.7 > > BTW, if the bug in [1] were fixed, we could've written: > >3 ([ p:^:_1 p:\) i.7 > >

Re: [Jprogramming] Puzzle

2013-12-07 Thread Dan Bron
I wrote: > Here's a silly variation. > 3 ([ p:^:_1&|: p:\) i.7 BTW, if the bug in [1] were fixed, we could've written: 3 ([ p:^:_1 p:\) i.7 Is there any nobler reason to improve the language than to make jokes even cheesier? -Dan [1] http://jsoftware.com/jwiki/System/Interpreter/Requests#r

Re: [Jprogramming] Puzzle

2013-12-07 Thread Dan Bron
Here's a silly variation. 3 ([ p:^:_1&|: p:\) i.7 30 105 385 1001 2431 [Hint: the middle tine can be greatly simplified :] -Dan PS: I'll gladly cede the title of Stupidest J Pun to anyone who can say it cleverly using &. . Not sure it'll improve your resume, but you can always break it out

Re: [Jprogramming] Puzzle

2013-12-07 Thread Raul Miller
Nice! Here's a minor variation: */@:p:@(0 1 2 +/ ]) i.7 30 105 385 1001 2431 4199 7429 :) -- Raul On Sat, Dec 7, 2013 at 2:03 PM, Sebastiano Tronto wrote: > Hi, I'm new to the forums. > I love this kind of puzzles (in fact, that's kind of why I learnt J) :-) > > Solution: > p3sp =: */@:p

Re: [Jprogramming] Puzzle

2013-12-07 Thread Sebastiano Tronto
Hi, I'm new to the forums. I love this kind of puzzles (in fact, that's kind of why I learnt J) :-) Solution: p3sp =: */@:p:@(],>:,2&+)"0 Didn't use oeis :-) Inviato con AquaMail per Android http://www.aqua-mail.com Il 07 Dicembre 2013 19:36:49 km ha scritto: Figure out what verb p3sp does a

[Jprogramming] Puzzle

2013-12-07 Thread km
Figure out what verb p3sp does and write it. The name is a hint. Extra credit for not using https://oeis.org/ --Kip Murray p3sp i. 7 30 105 385 1001 2431 4199 7429 Sent from my iPad -- For information about J forums see ht

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread Raul Miller
Note that ?. might give different results in different versions of J. It's designed to be a convenience, nothing more. Thanks, -- Raul On Sat, Feb 16, 2013 at 12:06 PM, Mike Day wrote: > Yes! Similar results here, though I'm a bit puzzled that graph3 doesn't > seem to yield quite the same co

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread Raul Miller
55.3 GB sounds like disk space I am not even certain that memory pages have a fixed size in iOS, so I cannot interpret the numbers about pages. I often use the 6!: foreigns to deal with memory issues. But I'm comfortable at this point, with the idea that I have overreached myself with t his proj

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread Mike Day
Yes! Similar results here, though I'm a bit puzzled that graph3 doesn't seem to yield quite the same counts: graph3=:0=?.2000 2000$1000 NB. try to reproduce Raul's latest graph, but with results inconsistent with his!? timer'(,:#@(] graph3 wrap & 0)"0) ]>:i.6'NB. using Raul's wrap.

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread km
Raul, There is a time and space report below for "four moves", failure came on "five moves". My iPad reports 55.3 GB available memory. A crash report for the "five moves" failure says reserved pages for the J process were 73234, "recent max" was 73253. There may have been an interruption fro

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread Raul Miller
Actually, thinking about this, a path length of 100 is probably unreasonable to measure precisely. Here's an example case: graph=: 0=?.2000 2000$1000 $I.1 graph wrap 0 1 1 $I.2 graph wrap 0 4 2 I'm being experimental here, reissuing lines, and it's inconvenient to edit in the middle of the

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-16 Thread Raul Miller
It's hard for me to understand this "out of memory" state without knowing how much memory your machine has, or how much gets used in the successful cases. Thanks, -- Raul On Sat, Feb 16, 2013 at 1:03 AM, km wrote: > iPad time and space results for Kip's code. Brian Schott tells me correctly

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread km
iPad time and space results for Kip's code. Brian Schott tells me correctly that verb open can be replaced by verb Raze ; ones =: ; pairs 1 = ?. 200 200 $ 100 NB. paths with one move # ones 390 5 {. ones NB. each pair represents one move 1 8 1 9 2 41 2 44 2 84 ts ';@:next^:3 one

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread km
OK, I think I've got it, thanks. I was using -- for a bidirectional connection. --Kip Sent from my iPad On Feb 15, 2013, at 7:47 PM, Raul Miller wrote: > On Fri, Feb 15, 2013 at 7:23 PM, km wrote: >> My code is for directed graphs as defined in Graphs in Computer Science: >> >> http://w

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
On Fri, Feb 15, 2013 at 7:23 PM, km wrote: > My code is for directed graphs as defined in Graphs in Computer Science: > > http://web.cecs.pdx.edu/~sheard/course/Cs163/Doc/Graphs.html This is consistent with my intent when I used the phrase. > However, suppose our undirected graph is > > 0--1--2-

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread km
My code is for directed graphs as defined in Graphs in Computer Science: http://web.cecs.pdx.edu/~sheard/course/Cs163/Doc/Graphs.html However, suppose our undirected graph is 0--1--2--3 (the only edges are those shown). Am I right that every set of two nodes is visitable from node 2? These ar

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
wrapc does look plausible - to avoid memory problems we could break the processing of the problematic line so it chews on smaller chunks of data. And, I am expecting that one step of iteration have a computational cost which is a multiple of the square of the number of distinct nodes reached so fa

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
Yes: for me, since I was just interested in knowing the unique sets of visitable nodes with a population of N, I would treat 1 8 6 and 1 6 8 as equivalent (or, more precisely, in the context of your code: interchangeable), and I would treat a 7 7 path as visiting only a single node. How does your

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread km
Raul, I have carefully ignored your later posts and may be on a different track than you intended. Here is where I am. Path 1 8 6 means there is a directed edge from 1 to 8 and a directed edge from 8 to 6 and is different from path 1 6 8 if such a path exists. You can even have a one edge

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Mike Day
Yes, "tree" is not the best word, though it does hint at the existence of branches - however its structure doesn't reveal the links. Each row is a sorted list, I suppose. Whatever we call it, I think you've got a big problem in finding all such "things" each with 100 unique members, in a 2

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
Thank you, again. I have not yet had time to read through wrapb, but a quick glance suggests that the "too many paths (or 'trees', maybe )" issue could probably be resolved by sorting each "path" before determining uniqueness. That said, I am more uncomfortable labelling these "visitable sets" wi

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Mike Day
Thanks. I think my verb "wrapb" _is_ doing what you want, even though it doesn't get your answer of 5945 tree-paths for 10 graph2 wrap 0 I've just seen your later posting. Sorry about 1 1$y - I agree, but had thought you only wanted a single starting node. You then say " But this is a prob

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
After reading this code, I see two issues. First, this line: p=. 1 1 $ y should be p=. ,. y The original supported multiple start nodes, and I do not yet see any simplicity advantages to considering only a single starting node. We already need to deal with multiple paths, so why not allow

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-15 Thread Raul Miller
I'll have to take some time to read your code (there's a lot of it). But perhaps this can illustrate why I initially called them "paths" (though they can branch): Here's a numeric representation of the connection graph. First column is index, second column represents what that node connects to:

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-14 Thread Mike Day
Not very sophisticated, and the first verb (wrapa) below doesn't even reproduce your answer for N=6 , but it might be a starting point for further work. The second verb (wrapb) does work for N=6, but apparently greatly overestimates the number for your larger 2000 node graph! wrapa=: 1 : 0

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-13 Thread Raul Miller
Since I messed up the description, I'll just pose an example solution and ask for improvements. graph=: 1= ?.20 20$10 start=: ,:0=i.#graph gather=: 1 :'[: ~.@; <@u' wrap=: 1 :0 : graph=. m start=. ,:(i.#graph) e. y N=. x paths=. (+./ .* # (+."1 =@i.@#))&graph"1 gather^:(N-1) start (N=

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-13 Thread Raul Miller
I described this poorly: A "path" implies a linear sequence, but all that's really required here is that the nodes be connected. So for any one path, there's a frontier which is all of the nodes adjacent to any node in that path which has not yet been visited on that path. This frontier is depen

Re: [Jprogramming] puzzle: paths in cyclic graphs

2013-02-13 Thread Devon McCormick
Is there anything wrong with just walking the graph and setting each node visited to 0 while keeping track of where we've been? Once our walk ends, start again on any remaining node until they're all gone. On Wed, Feb 13, 2013 at 8:29 AM, Raul Miller wrote: > Let's say that we have a directed,