@:' 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
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
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
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
> 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
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:`+
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
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=)
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
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 <
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
││ │└─┘││ │ │
│└─┴───┘│ │ │
└───┴─┴─┘
- 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
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
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
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
-
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
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
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
>
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
"
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
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
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'
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
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
24 matches
Mail list logo