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
____ _ _ _
/ ___| ___ | |_ _| |_(_) ___ _ __ ___
\___ \ / _ \| | | | | __| |/ _ \| '_ \/ __|
___) | (_) | | |_| | |_| | (_) | | | \__ \_ _ _
|____/ \___/|_|\__,_|\__|_|\___/|_| |_|___(_|_|_)
As far as I know, there is no way to solve these exercises explicitly;
however, one could use instead the related forms '`sin cos tan'=. etc. The
tacit solutions, after running the Tacit Toolkit [0], are straightforward:
9.0 Solution
bdot=. b.
bdot=. Ver'bdot' NB. Verbing the adverb b.
Map=. (<@:)("_1)f. NB. Boxing items and fixing (adv)
boolean=. bdot Map adv NB. (fixed)
A direct simple alternative is to use the higher-order verb produced by
bdot Map ,
'and or rotate shift signedshift'=. bdot Map 17 23 32 33 34
Likewise,
9.1 Solution
ampercircle=. &o.
ampercircle=. Ver'ampercircle' NB. Verbing the adverb &o.
circle=. ampercircle Map adv NB. (fixed)
Again, a higher-order verb is a direct simple alternative, for example,
'sinh cosh tanh asinh acosh atanh'=. ampercircle Map (, -) 5 6 7
assert (,. -: (asinh`acosh`atanh/.) @: (sinh`cosh`tanh/.)) o. 3 %~ 0.25
0.5 0.75
Note
[0] [Jprogramming] Tacit Toolkit (was dyadic J)
[email protected] Sat, 19 Dec 2015
http://www.jsoftware.com/pipermail/programming/2015-December/043757.html
On Sun, Mar 13, 2016 at 10:59 PM, Jose Mario Quintana <
[email protected]> wrote:
> Welcome to the Adverbial (and Conjunctional) Tacit Jymnasium :)
>
> Orthodox and wicked routines will be practiced here for those interested
> in developing adverbial (and conjunctional) tacit muscles. Official
> interpreters will be the standard equipment; however, Unbox, Jx, and other
> J interpreters (including Golden Age J interpreters), as well as Toolkits ,
> see for example [0], and alike (e.g., the tacit translator), are in general
> more than acceptable although occasionally some restrictions might be
> imposed aiming to develop certain muscles. Since adverbial (and
> conjunctional) tacit writing can (following two closely related approaches)
> be reduced to verbal tacit writing, this is also a place to exercise verbal
> tacit muscles. In addition, some adverbs (and conjunctions) which will be
> eventually shown here can provide general support for producing tacit
> verbs, adverbs and conjunctions.
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm