Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Raul Miller
On Fri, Dec 11, 2015 at 10:49 PM, Geoff Canyon wrote: > On Fri, Dec 11, 2015 at 6:56 PM, Ryan Eckbo wrote: >> inc=: >:&.(26&#.)&.(alpha&i.) >> > > I get: >inc 'a' > b >inc 'z' > ba >inc 'y' > z > > And my grasp of J isn't strong enough to figure out why. Assuming u and v are verbs, a

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread 'Pascal Jasmin' via Programming
inc 'z' ba 1 0 base 26. for the problem, this isn't an issue as there is no wraparound to the first char of the input. - Original Message - From: Geoff Canyon To: programm...@jsoftware.com Sent: Friday, December 11, 2015 10:49 PM Subject: Re: [Jprogramming] adventofcode 11 On F

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Joe Bogner
nice! looks clean On Dec 11, 2015 6:56 PM, "Ryan Eckbo" wrote: > Here's my version (&. is one of my favourite J operators): > > pass=:'hxbxwxba' > alpha=: a.{~ 97+i.26 > inc=: >:&.(26&#.)&.(alpha&i.) > nobad=: -.@:(+./)@:('iol'&e.) > strt=: +./@:(3 (0 1 2 -: ([ - {.)@:(alpha&i.))\ ]) NB. this is

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Geoff Canyon
On Fri, Dec 11, 2015 at 6:56 PM, Ryan Eckbo wrote: > inc=: >:&.(26&#.)&.(alpha&i.) > ​I get: inc 'a' b inc 'z' ba inc 'y' z And my grasp of J isn't strong enough to figure out why. I came up with this alternative that seems to work: inc =: ((26&|)@>:)&.(alpha&i.) Perhaps that could

Re: [Jprogramming] 'Tis the Season...

2015-12-11 Thread neitzel
LAA> S=: ')()))(' LAA> f=: 13 :'(+/''(''=y)-+/'')''=y' LAA> f S LAA>_6 This is coming near the solution I like best: +/ ('('&= - =&')') S _6 Why do like this? (a) It is robust against any additional dirt characters, say, linebreaks in S. (Unlike the ').('&i. -

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Ryan Eckbo
Here's my version (&. is one of my favourite J operators): pass=:'hxbxwxba' alpha=: a.{~ 97+i.26 inc=: >:&.(26&#.)&.(alpha&i.) nobad=: -.@:(+./)@:('iol'&e.) strt=: +./@:(3 (0 1 2 -: ([ - {.)@:(alpha&i.))\ ]) NB. this is ugly pairs=:1&<@:#@:~.@:((#~ ,&0) (2 -:/\ ])) good=: pairs *. strt *. nobad s

Re: [Jprogramming] dyadic J

2015-12-11 Thread Jose Mario Quintana
This is a puzzle for adverbial tacit writing fans: Write a purist tacit adverb (sf1) such that, for example, JVERSION Installer: j602a_win.exe Engine: j803/2014-10-19-11:11:11 Library: 6.02.023 (v0 v1 v2)sf1 v0@[ v1 v2@] 3 4 (+: + -:)sf1 2 4 7 10 A solution based on a general approac

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Moon S
Such a pity J is not too popular on github. Anyway, here's my solution too. In general, I don't like to use tacit defs everywhere. Procedural logic is much more clear and easier to read and understand and not always slower. NB. next good password http://adventofcode.com/day/11 ilo =: (+./)@(8 11

Re: [Jprogramming] advent 7

2015-12-11 Thread Jan-Pieter Jacobs
Here goes my latest (this time correct) attempt. it parses input lines into executable J code, and checks which lines are fully determined. Those are executed, added to the valid list, and removed from the input to be executed. This continues until all input has been processed. Have fun! D =: 'C:

Re: [Jprogramming] advent of code - day 2

2015-12-11 Thread R.E. Boss
(<0 1)|: y Nuvoc is correct: http://www.jsoftware.com/jwiki/Vocabulary/Idioms#Extract_The_Diagonal_Of_A_Table and http://www.jsoftware.com/jwiki/Vocabulary/barco#More_Information R.E. Boss > -Original Message- > From: programming-boun...@forums.jsoftware.com [mailto:programming- > bo

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Joe Bogner
my solution for day 11: https://gist.github.com/joebo/49e9ac513c2dcac3b012 NB. creates and documents a function NB. could be improved to split out example NB. or automatically assert on the example NB. originally from http://www.jsoftware.com/pipermail/programming/2014-July/038316.html func=: 3

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread David Lambert
Because of this difficulty, I invented a new programming language. Puzzle solver may be found at http://forums.devshed.com/programming-languages-139/reversed-972280.html#post2963935 Date: Fri, 11 Dec 2015 02:48:25 -0500 From: David Lambert To: programming Subject: [Jprogramming] adventofcode 1

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread bill lam
I believe there a bug in special code for integer, this worked ok _1 _1 E. (2.1-2.1)+ ( (2 -/\ ])) a2v'abcdddoz' 1 1 0 0 0 0 0 Пт, 11 дек 2015, jprogramming написал(а): > its a weird hang, in that jqt is responsive (can use the editor) > > > can reproduce with: > > _1 _1 E. ( (2 -/\ ])) a2v'a

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread 'Pascal Jasmin' via Programming
another workaround (_1 _1 E.&,: (2 -/\ ])) a2v'abcdddoz' 1 1 0 0 0 0 0 - Original Message - From: 'Pascal Jasmin' via Programming To: "programm...@jsoftware.com" Sent: Friday, December 11, 2015 9:48 AM Subject: Re: [Jprogramming] adventofcode 11 its a weird hang, in that jqt

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread 'Pascal Jasmin' via Programming
its a weird hang, in that jqt is responsive (can use the editor) can reproduce with: _1 _1 E. ( (2 -/\ ])) a2v'abcdddoz' _1 _1 E."1 ( (2 -/\ ])) a2v'abcdddoz' _1 _1 E. 0 , ( (2 -/\ ])) a2v'abcdddoz' a workaround, +./@:(2 (=/ *. _1 = {.)\ ])@:(2 -/\ ]) a2v'abcdddoz' - Original Message

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Arie Groeneveld
Applying straight the following pattern is the killerwhen using _1 _1 E. y 2 -/\0 1 2 3 3 3 14 25 _1 _1 _1 0 0 _11 _11 There is a bug mentioned in nuvoc E. (so who knows). Op 11-12-2015 om 08:48 schreef David Lambert: In the session below, the final sentence valid A runs "forever". Wh

Re: [Jprogramming] advent 8

2015-12-11 Thread Ryan Eckbo
Much better than the one I came up with. I found removing the parentheses around (_0.1) made it even clearer. On 11 Dec 2015, at 2:55, Joe Bogner wrote: On Thu, Dec 10, 2015 at 3:52 AM, Ryan Eckbo wrote: Also someone could probably write a clever verb to generate the table. I don't know

Re: [Jprogramming] advent 8

2015-12-11 Thread Ryan Eckbo
Very nice, thank you for the improvements. I realised I don't need state 0 for this particular problem, but the '1+' solution is good to know. I'm also going to remember the '[X]' trick (crazy!). On 11 Dec 2015, at 2:19, Raul Miller wrote: I would be tempted to express your S like this: SM=

Re: [Jprogramming] advent of code - day 2

2015-12-11 Thread Linda A Alvord
That made my solution a lot nicer! f=: 13 :'(*/0 1{(/:y){y)+2*+/(E=:+/(=/~i.$y)*1|."1*/~(/:y){y) f 2 3 4 58 g=: 13 :'(*/0 1{(/:y){y)+2*+/((<0 1)|:1|."1*/~(/:y){y)' g 2 3 4 58 Thanks, Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-b