Re: [Jprogramming] AOC 10 - explicit to tacit

2017-12-11 Thread Raul Miller
Your sentences here are built from conjunctions. If I add redundant parenthesis (to show parsing order), 3&{. ` , ` }. `: 0 a would become 3&{.) ` ,) ` }.) `: 0) a And, similarly, 3&{. ` , ` 3&}. `: 0 a would become (3&{.) ` ,) ` 3)&}.) `: 0) a The domain error is becau

Re: [Jprogramming] AOC 10 - explicit to tacit

2017-12-11 Thread Henry Rich
I would change your phrase "expects nouns to be gerunds" to "expects nouns to be boxed". u`v does not audit u and v to see if they are valid gerunds.  It just converts verb(s) to gerund(s) and then joins the two nouns into a list. If u/v are nouns they can be any compatible types.  The domain e

Re: [Jprogramming] AOC 10 - explicit to tacit

2017-12-11 Thread David Lambert
I took advantage of j's residue definition for negative values. My verb rewrites the list keeping the "current position pointer" at the head, thereby losing track of the front of the list. (list tally) | negative sum of all advancements computes the front of the list. parta=: $:&256 : (4 :0)

Re: [Jprogramming] AOC 10 - explicit to tacit

2017-12-11 Thread Raul Miller
Oh, yes, so did I: require'convert' knothash=:3 :0 (0,0,i.256) knothash y : pos=. 0{x skip=. 1{x list=. 2}.x for_len.y do. inds=.(#list)|pos+i.len list=. (|.inds{list) inds} list pos=. (#list)|pos+len+skip skip=. skip+1 end. pos,skip,list ) xor=:22 b. denseknot=:3

[Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Raul Miller
I've been struggling with AoC day 11 - either AoC's implementation is wrong, or mine is. Here's my implementation: nms=: ;:'n ne se s sw nw' dir=: ^j.2p1*(%~ i.)#nms delta=: dir {~ nms i. ] location=: +/@delta furthest=: [: ({~ (i. >./)@:|) +/\@delta path=:3 :0 nms {~(|: i."_1 <./)|dir -/ 2-/

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Jimmy Gauvin
Hi, I used axial coordinates from https://www.redblobgames.com/grids/hexagons/ to get thru part 1. Will do part 2 tonite. >./ | +/hxv {~ dbd i. <;._1 ',', dbi 675 where : dbi=: }: fread 'C:\Downloads\day11inp' dbd=: ;:'n s ne nw se sw' hxv =: 6 2 $ 0 _1 0 1 1 _1 _1 0 1 0 _1 1 dbd

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Jimmy Gauvin
I hadn't read part 2 All it needs is a slight modification: >./ , | +/\hxv {~ dbd i. <;._1 ',', dbi 1424 On Mon, Dec 11, 2017 at 3:54 PM, Jimmy Gauvin wrote: > Hi, > > I used axial coordinates from https://www.redblobgames.com/grids/hexagons/ > to get thru part 1. > Will do part 2 tonite. >

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Raul Miller
This can't be right. 10 s 4 se gets a distance of 10. But 10 se 4 ne gets a distance of 14. I suppose I should point out this issue about that algorithm, on that subreddit, but I guess that can wait until I get home (and maybe think about this some more). Thanks, -- Raul On Monday, December 1

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Jimmy Gauvin
Looks like a bug with the distance function. I had the same bug before.Uncorrected version: >./ | (,+/) +/hxv {~ dbd i. <;._1 ',', 's,s,s,s,s,s,s,s,s,s,se,se,se,se' 14 >./ | (,+/) +/hxv {~ dbd i. <;._1 ',', 'se,se,se,se,se,se,se,se,se,se,ne,ne,ne,ne' 14 Uncorrected version: >./ | +/hxv

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Jimmy Gauvin
Ignore preceding post. On Mon, Dec 11, 2017 at 6:38 PM, Jimmy Gauvin wrote: > Looks like a bug with the distance function. > I had the same bug before. > ​ C​ > orrect version: > >>./ | (,+/) +/hxv {~ dbd i. <;._1 ',', 's,s,s,s,s,s,s,s,s,s,se,se,se, > se' > 14 >>./ | (,+/) +/hxv {~ dbd i

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-11 Thread Raul Miller
So... I figured it out. 16#<'se' is 16 steps from the origin 10 8#<'se ne' is 18 steps from the origin but has a geometric distance of about 14.73 So, since I was looking at the straight line distance, I was not counting steps. And using manhattan distance is actually the right approach. In othe