Re: [Jprogramming] Generating code from templates

2014-03-06 Thread Pascal Jasmin
@:' addconjar)/ |. , (]`>vvtie"1 0]9 12 2) stitchtrains~ ]`+vvtie"1 0]5+i.3) `:6 ] 3 10 - Original Message - From: Pascal Jasmin To: "programm...@jsoftware.com" Cc: Sent: Thursday, March 6, 2014 7:37:32 PM Subject: Re: [Jprogramming] Generating code f

Re: [Jprogramming] Generating code from templates

2014-03-06 Thread Pascal Jasmin
ot;_))) 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 To: Programming forum Cc: Sent: Thursday, March 6, 2014 7:11:58 PM Subject: Re: [Jprogramming] Generating cod

Re: [Jprogramming] Generating code from templates

2014-03-06 Thread Jose Mario Quintana
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

Re: [Jprogramming] Generating code from templates

2014-03-06 Thread Jose Mario Quintana
A lean version: train=. evoke&6 ( shortcircuit=.(power&:train~)`(at&:train~)/ o |. ) v0`t0`v1`t1`v2`t2 v0^:t0@:v1^:t1@:v2^:t2 ShortCircuit=. shortcircuit f. sv [: v0 t0 v1 t1 v2 t2 v3 t3 v4 t4 ShortCircuit v0^:t0@:v1^:t1@:v2^:t2@:v3^:t3@:v4^:t4 On Wed, Mar 5, 2014 at 2:08 PM, Jos

Re: [Jprogramming] Generating code from templates

2014-03-05 Thread Raul Miller
> 9"_)) [:^:((] + 6"_) (] > 12"_))^:((] + 7"_) (] > 2"_)) > > the above is not a useless pattern, but it would still be nice to have a > real short circuit. > > the pattern: doN^:testN...@:do2^:test2@:do1^:test1 > > might be implementable using cl

Re: [Jprogramming] Generating code from templates

2014-03-05 Thread Pascal Jasmin
9│5 6│4 4│ └─┴───┴───┘ train0 is a bit less useful, but still    (<"1  2:`+`] ,: 3:`+`]) train0 each"0 1 ]  1 2 ┌─┬─┐ │2 1 1│2 2 2│ ├─┼─┤ │3 1 1│3 2 2│ └─┴─┘    2:`+`] `:0 ] 1 2 1 1 can do train of trains:    (  ( [ , +`'' ,])/ <"1  2:`+

Re: [Jprogramming] Generating code from templates

2014-03-05 Thread Jose Mario Quintana
Yes, the old forms (c0 a1) and (a0 c1 a2) are back, lev and dex are are not provided but they can defined easily as, lev=. [ conj dex=. ] conj * lev + * * dex + + See http://journalofj.com/index.php/vol-2-no-2-october-2013 for more details (only the definition of the new conjunction kn

Re: [Jprogramming] Generating code from templates

2014-03-05 Thread Brian Schott
Will these train extensions reenable some of the trains involving adverbs and conjunctions, that were de-committed in J several years ago? Or will the newer such trains behave differently from or independently of those gone? (And what about the conjunctions dex and lev?) -- (B=)

Re: [Jprogramming] Generating code from templates

2014-03-05 Thread Jose Mario Quintana
Pascal wrote: >the above is not a useless pattern, but it would still be nice to have a real short circuit. >the pattern: doN^:testN...@:do2^:test2@:do1^:test1 >might be implementable using clever `:3, and ^:`@: but its not >straightforawd to This is one way (using verbalized adverbs and conj

Re: [Jprogramming] Generating code from templates

2014-03-04 Thread Pascal Jasmin
loak adverbs and conjunctions as verbs Cloak=: (5!:1@<'Cloak1')Cloak1 NB. Cloaking Cloak vtie =: 2 : 'try. ((u"_)`(v"_)"_)^:(0=L.) (u`v) catch. try. u`(v"_) catch. (u"_)`(v"_) end. end.' vvtie =: Cloak <

Re: [Jprogramming] Generating code from templates

2014-03-03 Thread Pascal Jasmin
o a compose trains function, but its close.  one way to get compose is to use the [: form in trains: composetrains =: [:`'' , {:,~[: jointrains@:}:    (composetrains <"1 ]`+vvtie"1 0]2 3) train6 1 2 4 6 7 9    (composetrains <"1 ]`+vvtie"1 0]2 3 4) train6 1 2 4 10 1

Re: [Jprogramming] Generating code from templates

2014-02-21 Thread Pascal Jasmin
││ │└─┘││ │ │ │└─┴───┘│ │ │ └───┴─┴─┘ - Original Message - From: Pascal Jasmin To: "programm...@jsoftware.com" Cc: Sent: Friday, February 21, 2014 1:11:32 PM Subject: Re: [Jprogramming] Generating code from templates neat.    tie ,^:(0:``)    tie&'' f

Re: [Jprogramming] Generating code from templates

2014-02-21 Thread Jose Mario Quintana
assume that using an > adverb as v2 is impossible? > > The other peculiarity is that v1 is 0: which means that , never executes. > Is that right? > > > > - Original Message - > From: Jose Mario Quintana > To: Programming forum > Cc: > Sent: Friday, Febr

Re: [Jprogramming] Generating code from templates

2014-02-21 Thread Pascal Jasmin
means that , never executes.  Is that right? - Original Message - From: Jose Mario Quintana To: Programming forum Cc: Sent: Friday, February 21, 2014 11:31:56 AM Subject: Re: [Jprogramming] Generating code from templates The verbalized conjunctions tie and rank can be produced a

Re: [Jprogramming] Generating code from templates

2014-02-21 Thread Jose Mario Quintana
The verbalized conjunctions tie and rank can be produced as follows: 9!:14 '' j701/2011-01-10/11:25 Cloak=. (0:`)(,^:) NB. Conjunction to cloak adverbs and conjunctions as verbs Cloak=. (5!:1@<'Cloak')Cloak NB. Cloaking Cloak 'tie rank'=. (Cloak @: < each) @: ;: '` "' NB. Cloaking ti

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Pascal Jasmin
- From: Dan Bron To: "programm...@jsoftware.com" Cc: Sent: Thursday, February 20, 2014 8:20:55 PM Subject: Re: [Jprogramming] Generating code from templates Adverb and conjunction templates are straightforward. Multiple substitutions won't be difficult, but will inflate our codebas

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Raul Miller
This would be more fun if you provided definitions for tie and rank (and others you use) in an addon. Without that, it feels like deus ex machina (and does not execute for me like it does for you). Thanks, -- Raul On Thu, Feb 20, 2014 at 6:06 PM, Jose Mario Quintana < jose.mario.quint...@gmai

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Raul Miller
substit"0~ > 0.01 10 1x1 >round > (0.5 <.@:+ ])&.:(%&0.01) >digits > 10&#.^:_1 >log > 2.7182818284590451&^. > > > > > - Original Message --- > > Subject: Re: [Jprogramming] Generating code from templates >

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Dan Bron
s explicit code to run/string. y is miliseconds interval > if. y do. > callback =: (3 : x) > sys_timer_z_=: callback f. "_ > wd 'timer ',":y > else. > wd 'timer 0' > sys_timer_z_=: ] > end. > EMPTY > ) > add =: 4 : 0 > if. y do. > call

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Jose Mario Quintana
" Anyway, thought I'd share, and see if anyone else has useful tools for manipulating J code (metaprogramming). " Dan, I will try to show some meta-programming exercises soon. I am jumping into the darkness hoping that I will land well; so far, so good. In the meantime, the following is a F^4 un

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Pascal Jasmin
add =: 4 : 0 if. y do. callback =: (callback f.)`(3 : x) sys_timer_z_=: callback"_ `:0 wd 'timer ',":y else. wd 'timer 0' sys_timer_z_=: ] end. EMPTY ) ________ From: Dan Bron To: programm...@jsoftware.com Sent: Thursday, February 20, 2014 2:39:49 PM Subj

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Dan Bron
digits 10&#.^:_1 log 2.7182818284590451&^. - Original Message ------- Subject: Re: [Jprogramming] Generating code from templates From: Raul Miller Date: Thu, 20 Feb 2014 15:00:52 -0500 To: Programming forum This seems really simple, to me. Of course, it'

Re: [Jprogramming] Generating code from templates

2014-02-20 Thread Raul Miller
This seems really simple, to me. Of course, it's hard to tolerate simplicity - it's kind of boring, so we like to discard features of the language. I think of this urge as a social artifact of our need for J subset compilers. Still, even if we had compilers, it might still make sense to start wit

[Jprogramming] Generating code from templates

2014-02-20 Thread Dan Bron
There was a question on StackOverflow today on generating constant functions from the items of an array. As in, 100 200 300 <==> 100"_`(200"_)`(300"_) . As a more general question, how can we specify code templates and then use them to dynamically produce gerunds for later execution? * Here's on