The only advantage that is obvious to me for Cloak as a verb is that it allows
ranked/each application.
The key addition to my adverb version is aar which allows adverb trains in
"simple" linear format.
'&o./\' Cloak each 1 2 3
┌──────┬──────┬──────┐
│1&o./\│2&o./\│3&o./\│
└──────┴──────┴──────┘
can still make a verb version
CloakV =: 'Cloak' Cloak
seems easier to make multiple 'adverbs' with it
CloakV each cut '&o./\ &.' ┌───────────────────┬──────────┐
│,^:(0:`(((&o.)/)\))│,^:(0:`&.)│
└───────────────────┴──────────┘
another cool thing that Cloak solves elegantly is the "I want
to "reduce with adverb" after a verb has applied tacitly", which is not really
possible conventionally.
at =: 1 : 'u 1 :''2 : ''''u (v@:) '''' u''' NB. double adverb o (inverted)
oa =: Cloak at NB. apply adverb after its argument executed.
cl2ar =: '`'''''oa NB. convert "cloak format" to ar
dv=: 1 : (':'; 'u y x')
0.25 0.5 0.75 '&o.' Cloak cl2ar each '/.'oa '@:(o.@:(%&3))'oa dv 1 2 3 0.258819
0.866025
1
a better cl2ar, is one that isn't named
ar =: 1 : '5!:1 <''u'''
'&o.' Cloak 'ar'oa each '/.'oa '@:(o.@:(%&3))'oa 1 2 3
1&o.`(2&o.)`(3&o.)/.@:(o.@:(%&3))
I like the fact that the Cloak construction reads almost identically to the
manual adverb construction, and the advantage of the oa use is that another
name that would confuse someone who didn't remember creating or seeing the name
is not being used.
----- Original Message -----
From: Jose Mario Quintana <[email protected]>
To: Programming forum <[email protected]>
Sent: Tuesday, August 2, 2016 6:23 PM
Subject: Re: [Jprogramming] Adverbial Tacit Jym
Pascal wrote:
"
an improvement over your/Dan's original Cloak is that you can Cloak an
adverb train, and its clean enough to use anonymously. IMO, its easier to
read
"
However, "my" Cloak is verbed; facilitating the production of higher-order
verbs which, in turn, allow any kind of words (nouns, verbs, adverbs and
conjunctions) to flow tacitly. See the first few lines of the toolkit as
an example. Your results can be reproduce easily with those tools but it
is not difficult to to start from scratch. A self-contained script follows
(there is no need to run the toolkit),
Cloak=. (0:`)(,^:)
Cloak=. ((5!:1)@:<'Cloak')Cloak NB. Cloak verbing itself! (monadic ver)
o=. @:
e=. &.>
'bdot amper slash back evoke'=. Cloak o < e o ;: 'b.&/\`:' NB. Verbing
&, b., /, \ and `:
back o slash o bdot e f. 17 23 32 33 34
┌───────┬───────┬───────┬───────┬───────┐
│17 b./\│23 b./\│32 b./\│33 b./\│34 b./\│
└───────┴───────┴───────┴───────┴───────┘
an=. < o ((,'0') ,&< ]) NB. Atomizing words (monadic verb)
train=.(evoke f.&6) :. an f. NB. Verbing `:6 with an obverse
slash o (Cloak ]&.:train ;:'&o.') e f. 1 2 3
┌─────┬─────┬─────┐
│1&o./│2&o./│3&o./│
└─────┴─────┴─────┘
Neatness is in the eye of the beholder (what is it not?).
More another time, I have to run.
On Tue, Aug 2, 2016 at 11:25 AM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> text at bottom for spoilers
>
>
>
>
> ----- Original Message -----
> From: 'Pascal Jasmin' via Programming <[email protected]>
> To: "[email protected]" <[email protected]>
> Sent: Tuesday, August 2, 2016 10:21 AM
> Subject: Re: [Jprogramming] Adverbial Tacit Jym
>
> Spoiler
>
> a
> s
>
> a
>
> v
> e
> r
> b
>
> eval =: 1 : ' a: 1 : m'
>
> aar =: 1 : 'if. (0=4!:0 ::0:)@:< ''u'' do. if. (2 = 3!:0) m do. q =. m
> eval else. q =. u end. else. q =. u end. 5!:1 < ''q'' '
>
>
> Cloak=: aar(0:`)(,^:)
>
> 'and or rotate shift signedshift'=. ('b.' Cloak each) 17 23 32 33 34
>
>
> A very cool thing about Cloak is that the "verbified modifiers" can return
> non nouns, and can box non-noun return values, and =:/=. works
> automagically. ("0 doesn't work though)
>
>
> Can even do this:
>
>
> '/'Cloak each ('b.' Cloak each) 17 23 32 33 34
> ┌──────┬──────┬──────┬──────┬──────┐
> │17 b./│23 b./│32 b./│33 b./│34 b./│
> └──────┴──────┴──────┴──────┴──────┘
>
> (alternate)
>
> '/'Cloak @('b.' Cloak) each 17 23 32 33 34
>
> That format is neither lr nor ar, but they are "real verbs"
>
> 0 {:: '/'Cloak @('b.' Cloak) each (17 23 32 33 34) 1 1
> 1
>
> an improvement over your/Dan's original Cloak is that you can Cloak an
> adverb train, and its clean enough to use anonymously. IMO, its easier to
> read if there
>
>
> ('/\'Cloak) @('b.' Cloak) each (17 23 32 33 34)
> ┌───────┬───────┬───────┬───────┬───────┐
> │17 b./\│23 b./\│32 b./\│33 b./\│34 b./\│
> └───────┴───────┴───────┴───────┴───────┘
> '&o.' Cloak each 1 2 3
> ┌────┬────┬────┐
> │1&o.│2&o.│3&o.│
> └────┴────┴────┘
>
> non cloacked verbs still work with "this data", and `:6 works but `:0
> doesn't.
>
> ar =: 1 : '5!:1 <''u'''
>
> insN =: }:@:,@:([`([ $~ <.&#)@.(>&#) ,.~&>/@:(,&< $~&.> >.&#) ])
>
> (, ar insN '/'Cloak @('b.' Cloak) each (17 23 32 33 34) )(`:6) 1 1
> 17 b./ , 23 b./ , 32 b./ , 33 b./ , 34 b./
>
>
> one way to turn the format into a gerund
>
>
> ('''''`'Cloak@('&o.'Cloak)each 1 2 3)`:0
> 1&o.`(2&o.)`(3&o.)`:0
>
> ('''''`'Cloak@('&o.'Cloak)each 1 2 3)/. o. 3 %~ 0.25 0.5 0.75
> 0.258819
> 0.866025
>
> ----- Original Message -----
> From: Jose Mario Quintana <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Monday, August 1, 2016 11:33 PM
> Subject: Re: [Jprogramming] Adverbial Tacit Jym
>
> Let us keep the adverbial writing challenges/exercises open (non-tacit
> solutions are also welcome). Why not? ;)
>
>
> Mapping nouns to proverbs...
>
>
> Exercise 9.0
>
> Produce an adverb boolean such that it maps the b. codes to their
> corresponding proverbs; thus,
>
> 'and or rotate shift signedshift'=. 17 23 32 33 34 boolean
>
> NB. Alternatively, (and`or`rotate`shift`signedshift)=. 17 23 32 33 34
> boolean if the names
> NB. and, or, rotate, shift and signedshift are undefined or
> predefined as verbs
>
> NB. 64-bit...
> assert 48 80187 -: 12345 (and , or) 67890
> assert 2468 -:1 rotate 1234
> assert 576460752303423102 _386 -: _5 (shift , signedshift) _12345
>
>
> Exercise 9.1
>
> Produce an adverb circle such that it maps the o. codes to their
> corresponding proverbs; thus,
>
> 'sin cos tan'=. 1 2 3 circle
> NB. Alternatively, (sin`cos`tan)=. 1 2 3 circle if
> NB. sin, cos and tan are undefined or predefined as verbs
>
> (sin`cos`tan)/. o. 3 %~ 0.25 0.5 0.75
> 0.258819
> 0.866025
> 1
>
> 'asin acos atan'=. (-1 2 3) circle
>
> assert (,. -: (asin`acos`atan/.) @: (sin`cos`tan/.)) o. 3 %~ 0.25 0.5
> 0.75
>
>
> ___________________
>
> create a tacit verb parameterized (a double verb)
>
>
> '@:(o.@:(%&3))'Cloak@:('/.'Cloak@:(('''''`'Cloak@('&o.'Cloak)each )))
> ,^:(0:`(@:(o.@:(%&3))))@:(,^:(0:`/.)@:(,^:(0:`''`)@(,^:(0:`(&o.)))&.>))
>
> '@:(o.@:(%&3))'Cloak@:('/.'Cloak@:(('''''`'Cloak@('&o.'Cloak)each ))) (1
> 2 3)
> 1&o.`(2&o.)`(3&o.)/.@:(o.@:(%&3))
>
> '@:(o.@:(%&3))'Cloak@:('/.'Cloak@:(('''''`'Cloak@('&o.'Cloak)each )))(1 2
> 3) 0.25 0.5 0.75
> 0.258819
> 0.866025
> 1
>
> is there a way to make this expression a dyad instead of a double verb?
> ie. use x for one parameter (1 2 3) and y for 0.25 0.5 0.75
> ----------------------------------------------------------------------
> 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