Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Linda A Alvord
Henry, Your explanation of how the conjunctions are parsed helped make the tree diagrams make more sense. I gave up my idea. f=: 13 :'(%@(%:@(-@(+@*:y' 5!:4 <'f' ┌─ % ── @ ─┤ ┌─ %: └─ @ ─┤ ┌─ - └─ @ ─┤ ┌─

Re: [Jprogramming] Blonde Code Golf - January Challenge - Alphabet Swap

2016-01-22 Thread Raul Miller
Here's a 35 character J implementation: a.{~(a.j}~a.{~|.j=.65 97+/~i.26)&i. Example use: a.{~(a.j}~a.{~|.j=.65 97+/~i.26)&i. '019abcABC|xyzXYZ+=' 019zyxZYX|cbaCBA+= And, as it happens, it can also be used as a stand alone verb definition: F=: a.{~(a.j}~a.{~|.j=.65 97+/~i.26)&i. F '01

Re: [Jprogramming] Blonde Code Golf - January Challenge - Alphabet Swap

2016-01-22 Thread 'Pascal Jasmin' via Programming
Alpha_j_]`([{~26(([*<.@%~)+<:@[-|)i.)@.(e.~"1 0)'AbcazZ~! Hello, World!' ZyxzaA~! Svool, Dliow! - Original Message - From: Moon S To: programming Sent: Friday, January 22, 2016 8:33 PM Subject: [Jprogramming] Blonde Code Golf - January Challenge - Alphabet Swap Here's anoth

Re: [Jprogramming] Blonde Code Golf - January Challenge - Alphabet Swap

2016-01-22 Thread Roger Hui
S=: (a.,~,|.t) {~ (a.,~,t=.a.{~97 65+/~i.26)&i. S 'Hello, World!' Svool, Dliow! S 'A man, a plan, a canal, Panama!' Z nzm, z kozm, z xzmzo, Kzmznz! On Fri, Jan 22, 2016 at 5:33 PM, Moon S wrote: > Here's another code golf challenge I found: > > http://www.blonde.net/blog/2016/01/18/

[Jprogramming] Blonde Code Golf - January Challenge - Alphabet Swap

2016-01-22 Thread Moon S
Here's another code golf challenge I found: http://www.blonde.net/blog/2016/01/18/blonde-code-golf-january-16 In a string, swap a-z with z-a, A-Z with Z-A. Assume that you will always get a valid string and that spaces and special characters should remain unchanged. alphaSwap('abcxyz') // -> zyx

[Jprogramming] New dissect feature for large sentences

2016-01-22 Thread Henry Rich
If you click inside the sentence (at the top of the dissect display), dissect will scroll the screen so that the result of the clicked word is brought to a fixed point in the display, about midway left-to-right and three-quarters of the way down the screen. Useful if the display overflows the

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Brian Schott
Henry, I think I get it now. Thanks very much for that long detailed explanation of parsing vs execution. It helped a lot. Also, the examples you gave earlier of dissecting #@> 'a';1 2 and #@:> 'a';1 2 really helped. (Eventually I changed 1 2 to 20 30 so that the 1 and 2 did not get confused with t

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Henry Rich
Unfortunately I have to add another bit of complication, after which you will know everything. What does it mean to "execute a@b"? There are actually two things going on: the execution of the CONJUNCTION @ and the execution of the VERB (a@b). @ is a conjunction. It takes two operands, which

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Raul Miller
Hmm... In addition to dissect (which focuses on the details of execution), consider what trace (which focuses on the details of parsing) tells us about one of your examples: require'trace' trace_jtrace_ ' #@>@:;:''a man a plan a canal''' --- 4 Conj --- # @ > #@> --

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Brian Schott
The original message was correct, not this one. I am very sorry for the confusion. ​Henry and Raul, Thanks for your replies to the message. I am still trying to sort out the examples with the MIDDLE TINE and am optimistic with dissect and the detail Henry gave. However, it sounds like magic or do

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Henry Rich
# @ > @ ;: is parsed as (# @ >) @ ;: This is not obvious. It's buried in the details of the parsing table. The practical rule is that in a long sequence of modifiers, each conjunction operates between its single right operand and everything to its left, as if it were all parenthesized. T

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Raul Miller
(Actually, no - it has to do with execution order and, of course, rank - parsing is the first step of execution in J, but I didn't think that one through properly.) Thanks, -- Raul On Fri, Jan 22, 2016 at 11:03 AM, Raul Miller wrote: > Order is important. > > Do you see why? > > (Hint: it has

Re: [Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Raul Miller
Order is important. Do you see why? (Hint: it has to do with implicit parenthesis provided by parsing.) Thanks, -- Raul On Fri, Jan 22, 2016 at 10:55 AM, Brian Schott wrote: > [Sorry, that was a mistake. This is a resend] > >#@:>@:;:'a man a plan a canal' NB. 1 > 6 >#@:>@;:'a ma

[Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Brian Schott
[Sorry, that was a mistake. This is a resend] #@:>@:;:'a man a plan a canal' NB. 1 6 #@:>@;:'a man a plan a canal' NB. 2 6 #@>@;:'a man a plan a canal' NB. 3 1 3 1 4 1 5 #@>@:;:'a man a plan a canal' NB. 4 1 3 1 4 1 5 #@(>@:;:)'a man a plan a canal' NB. 5 6 #@

[Jprogramming] @ and @: (atop and at)

2016-01-22 Thread Brian Schott
#@:>@:;:'a man a plan a canal' NB. 1 6 #@:>@;:'a man a plan a canal' NB. 2 6 #@>@;:'a man a plan a canal' NB. 3 1 3 1 4 1 5 #@>@:;:'a man a plan a canal' NB. 4 1 3 1 4 1 5 #@(>@:;:)'a man a plan a canal' NB. 5 6 #@(>@;:)'a man a plan a canal' NB. 6 6 These

Re: [Jprogramming] A Different Less?

2016-01-22 Thread Linda A Alvord
I think I finally understand the difference! A=:'a man a plan a canal' ;:A ┌─┬───┬─┬┬─┬─┐ │a│man│a│plan│a│canal│ └─┴───┴─┴┴─┴─┘ f=: 13 :'#>;:y' g=: 13 :'#@>;:y' h=: 13 :'#@:>;:y' f A 6 g A 1 3 1 4 1 5 h A 6 f [: # [: > ;: g [: #@> ;: h [: #@:> ;: