sick of spoiler rules,
double verb as dyad solution:
dv =: 1 : (':';'u x y')
1 2 3 ('@:(o.@:(%&3))'Cloak@:('/.'Cloak@:(('''''`'Cloak@('&o.'Cloak)each ))))dv
0.25 0.5 0.75
0.258819
0.866025
1
----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Tuesday, August 2, 2016 11:25 AM
Subject: Re: [Jprogramming] Adverbial Tacit Jym
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