with an adverb variation to conjoin
conjoinA=: 1 : (':';' <(,u);<y ; x')
(('^:' conjoinA)`('@:' conjoinA)/ |. , (]`>vvtie"1 0]9 12 2) stitchtrains~
]`+vvtie"1 0]5+i.3) `:6
(] + 5"_)^:(] > 9"_)@:(] + 6"_)^:(] > 12"_)@:(] + 7"_)^:(] > 2"_)
(('^:' addconjar)`('@:' addconjar)/ |. , (]`>vvtie"1 0]9 12 2)
stitchtrains~ ]`+vvtie"1 0]5+i.3) `:6 ] 3
10
----- Original Message -----
From: Pascal Jasmin <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Thursday, March 6, 2014 7:37:32 PM
Subject: Re: [Jprogramming] Generating code from templates
Thanks for pointing this out. I wasn't building the code I thought I was.
(] + 5"_)^:(] > 9"_)@:(] + 6"_)^:(] > 12"_)@:(] + 7"_)^:(] > 2"_) 3
10
(] + 5"_)^:(] > 9"_)@:((] + 6"_)^:(] > 12"_)@:((] + 7"_)^:(] > 2"_))) 3
15
seems easier to build from strings than gerunds that way, though I'd hope to
get it with a little more thought.
----- Original Message -----
From: Jose Mario Quintana <[email protected]>
To: Programming forum <[email protected]>
Cc:
Sent: Thursday, March 6, 2014 7:11:58 PM
Subject: Re: [Jprogramming] Generating code from templates
Pascal wrote:
"
So, I'm no longer sure there is a way to tacitly break execution on the
first fail test. Or actually, I need to paren the whole left side of any
^: ... which was probably a needed manipulation function anyway.
"
Yet, your original pattern does that,
u=. v0^:t0@:v1^:t1@:v2^:t2@:v3^:t3@:v4^:t4
5!:6@<'u'
((((((((v0^:t0)@:v1)^:t1)@:v2)^:t2)@:v3)^:t3)@:v4)^:t4
Am I missing something?
On Wed, Mar 5, 2014 at 9:24 PM, Pascal Jasmin <[email protected]>wrote:
>
>
> Looks nice. Here is a continuation of my gerund manipulation approach:
>
> conjoin=: (,@:[ <@:; <@:])"1
>
> ('@' conjoin -.`*) `:6
> -.@*
>
> '@' conjoin (-.`'') ," 1 ,. *`-`+
> ┌──────────┬──────────┬──────────┐
> │┌─┬──────┐│┌─┬──────┐│┌─┬──────┐│
> ││@│┌──┬─┐│││@│┌──┬─┐│││@│┌──┬─┐││
> ││ ││-.│*││││ ││-.│-││││ ││-.│+│││
> ││ │└──┴─┘│││ │└──┴─┘│││ │└──┴─┘││
> │└─┴──────┘│└─┴──────┘│└─┴──────┘│
> └──────────┴──────────┴──────────┘
>
> stitchtrains =: ,.&(G2train@:(<"1))
>
> (-.`'') stitchtrains ,. *`-`+
> ┌──┬─┐
> │-.│*│
> ├──┼─┤
> │-.│-│
> ├──┼─┤
> │-.│+│
> └──┴─┘
>
> ('@' conjoin (-.`'') stitchtrains *`'') `:6
> -.@*
>
> G2train turns out to be a pretty good idea for working with informal lists
> of verbs and combining them into trains/tacit definitions. But working
> with tables of gerunds is a bad idea bc `:6 fails when a:/fills are present.
>
> To complete my last example:
>
> shortcircuits =: ((,'@:'); [<@:;])/ @:(_2&}. , (,'@:') <@:; _2&{ <@:, {:)
>
> (< shortcircuits '^:' conjoin (]`>vvtie"1 0]9 12 2) stitchtrains~
> ]`+vvtie"1 0]5+i.3) `:6
> (] + 5"_)^:(] > 9"_)@:((] + 6"_)^:(] > 12"_)@:((] + 7"_)^:(] > 2"_)))
>
>
> AndDoTrains =: ([: <@:shortcircuits '^:' conjoin [ stitchtrains ])
>
> ( (]`>vvtie"1 0]9 12 2) AndDoTrains~ ]`+vvtie"1 0]5+i.3)`:6
> (] + 5"_)^:(] > 9"_)@:((] + 6"_)^:(] > 12"_)@:((] + 7"_)^:(] > 2"_)))
>
> though it turns out this was the wrong spec, as it has the same result as
> the [: version (fails > 12, but still execs later >9)
>
> ( (]`>vvtie"1 0]9 12 2) AndDoTrains~ ]`+vvtie"1 0]5+i.3)`:6"0 ] 1 2 3
> 4 5 6
> 1 2 15 16 17 24
>
> So, I'm no longer sure there is a way to tacitly break execution on the
> first fail test. Or actually, I need to paren the whole left side of any
> ^: ... which was probably a needed manipulation function anyway.
>
>
>
>
>
>
>
> _____________________
> ( shortcircuit=.train o ((power&.:train ~)`(at&.:train ~)/) o |.)
> v0`t0`v1`t1`v2`t2
> v0^:t0@:v1^:t1@:v2^:t2
>
> ShortCircuit=. shortcircuit sv
>
> [: v0 t0 v1 t1 v2 t2 v3 t3 v4 t4 ShortCircuit
> v0^:t0@:v1^:t1@:v2^:t2@:v3^:t3@:v4^:t4
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm