[Jprogramming] Adverbial Tacit Jym
Jose Mario Quintana
jose.mario.quintana at gmail.com
Mon Aug 8 03:21:29 UTC 2016
"That format is neither lr nor ar, but they are 'real verbs'"
You got it! The format is a list of boxed verbs which one can easily
produce, from a common gerund form (encoding a list of verbs), for example,
G=. (17 b.)`(23 b.)`(32 b.)`(33 b.)`(34 b.)
using the toolkit's box verb,
box=. (< o train "0) f.
One can produce,
( V=. box G )
┌─────┬─────┬─────┬─────┬─────┐
│17 b.│23 b.│32 b.│33 b.│34 b.│
└─────┴─────┴─────┴─────┴─────┘
One can reproduce G back from V as follows,
tie=. Cloak;:'`'
unbox=. , o (tie f.&''&>)
unbox V
┌─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐
│┌──┬────────┐│┌──┬────────┐│┌──┬────────┐│┌──┬────────┐│┌──┬────────┐│
││b.│┌──────┐│││b.│┌──────┐│││b.│┌──────┐│││b.│┌──────┐│││b.│┌──────┐││
││ ││┌─┬──┐││││ ││┌─┬──┐││││ ││┌─┬──┐││││ ││┌─┬──┐││││ ││┌─┬──┐│││
││ │││0│17│││││ │││0│23│││││ │││0│32│││││ │││0│33│││││ │││0│34││││
││ ││└─┴──┘││││ ││└─┴──┘││││ ││└─┴──┘││││ ││└─┴──┘││││ ││└─┴──┘│││
││ │└──────┘│││ │└──────┘│││ │└──────┘│││ │└──────┘│││ │└──────┘││
│└──┴────────┘│└──┴────────┘│└──┴────────┘│└──┴────────┘│└──┴────────┘│
└─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
assert G -: unbox V
The adverb `:6 and its dual verb train can deal, as you noticed, with a
list of boxed verbs,
assert ((V`:6)`'' -: ((G`:6)`'')) *. ((train V)`'' -: ((G`:6)`''))
This is quite useful for tacit adverbial programming; see, for example, the
definition of adv in the toolkit (adv=. ...).
In contrast, as you also noticed, `:0, `:3 (and other constructions) which
expect a common gerund cannot deal with a list of boxed verbs directly;
naturally, one can use unbox indirectly, for example,
(unbox V)`:3
17 b.`(23 b.)`(32 b.)`(33 b.)`(34 b.)`:3
or, box inv V
1 ((box inv V)`:0) _1234
0 _1233 _2467 _2468 _2468
1 (G `:0) _1234
0 _1233 _2467 _2468 _2468
The noun produced by (box inv V) is not a genuine gerund but it is
disguised as one; check it out with the isgerund verb. Producing a
disguised common gerund from a gerund is straightforward,
(]&.:box) G
┌─────────┬─────────┬─────────┬─────────┬─────────┐
│┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│
││0│17 b.│││0│23 b.│││0│32 b.│││0│33 b.│││0│34 b.││
│└─┴─────┘│└─┴─────┘│└─┴─────┘│└─┴─────┘│└─┴─────┘│
└─────────┴─────────┴─────────┴─────────┴─────────┘
On Tue, Aug 2, 2016 at 10:21 AM, 'Pascal Jasmin' via Programming <
programming at jsoftware.com> wrote:
> 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 <jose.mario.quintana at gmail.com>
> To: Programming forum <programming at jsoftware.com>
> 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
>
>
More information about the Programming
mailing list