Solutions to Exercises 2 and 3 (see the reference [0]) follow after the
warning...
___ _ _
/ __| _ __ ___ (_) | | ___ _ _ ___
\__ \ | '_ \ / _ \ | | | | / -_) | '_| (_-< _ _ _
|___/ | .__/ \___/ |_| |_| \___| |_| /__/ (_) (_) (_)
|_|
Using the Tacit Toolkit (see the reference [1])...
Exercise 2. Filling the blanks in the hint sentence (see the trailing post
below), with wicked verbs, one can get,
slash=. ver o train <'/'
a2=. &(train o (slash o ([ |.~ >: o - o (|&#)) ; an y)f.)
How does a2 work? Let us see it operating in slow motion...
+`-`*`% &( ( ([ |.~ >: o - o (|&#)) ; an y))\. 1 2 3 4 5
6 7 8
┌─────────┬───────────────────┐
│┌─┬─┬─┬─┐│┌─┬───────────────┐│
││-│*│%│+│││0│1 2 3 4 5 6 7 8││
│└─┴─┴─┴─┘│└─┴───────────────┘│
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬─────────────┐ │
││*│%│+│-│││0│2 3 4 5 6 7 8│ │
│└─┴─┴─┴─┘│└─┴─────────────┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬───────────┐ │
││%│+│-│*│││0│3 4 5 6 7 8│ │
│└─┴─┴─┴─┘│└─┴───────────┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬─────────┐ │
││+│-│*│%│││0│4 5 6 7 8│ │
│└─┴─┴─┴─┘│└─┴─────────┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬───────┐ │
││-│*│%│+│││0│5 6 7 8│ │
│└─┴─┴─┴─┘│└─┴───────┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬─────┐ │
││*│%│+│-│││0│6 7 8│ │
│└─┴─┴─┴─┘│└─┴─────┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬───┐ │
││%│+│-│*│││0│7 8│ │
│└─┴─┴─┴─┘│└─┴───┘ │
├─────────┼───────────────────┤
│┌─┬─┬─┬─┐│┌─┬─┐ │
││+│-│*│%│││0│8│ │
│└─┴─┴─┴─┘│└─┴─┘ │
└─────────┴───────────────────┘
+`-`*`% &( (slash o ([ |.~ >: o - o (|&#)) ; an y))\. 1 2 3 4 5
6 7 8
┌──────────┬───────────────────┐
│-`*`%`+`:3│┌─┬───────────────┐│
│ ││0│1 2 3 4 5 6 7 8││
│ │└─┴───────────────┘│
├──────────┼───────────────────┤
│*`%`+`-`:3│┌─┬─────────────┐ │
│ ││0│2 3 4 5 6 7 8│ │
│ │└─┴─────────────┘ │
├──────────┼───────────────────┤
│%`+`-`*`:3│┌─┬───────────┐ │
│ ││0│3 4 5 6 7 8│ │
│ │└─┴───────────┘ │
├──────────┼───────────────────┤
│+`-`*`%`:3│┌─┬─────────┐ │
│ ││0│4 5 6 7 8│ │
│ │└─┴─────────┘ │
├──────────┼───────────────────┤
│-`*`%`+`:3│┌─┬───────┐ │
│ ││0│5 6 7 8│ │
│ │└─┴───────┘ │
├──────────┼───────────────────┤
│*`%`+`-`:3│┌─┬─────┐ │
│ ││0│6 7 8│ │
│ │└─┴─────┘ │
├──────────┼───────────────────┤
│%`+`-`*`:3│┌─┬───┐ │
│ ││0│7 8│ │
│ │└─┴───┘ │
├──────────┼───────────────────┤
│+`-`*`%`:3│┌─┬─┐ │
│ ││0│8│ │
│ │└─┴─┘ │
└──────────┴───────────────────┘
+`-`*`% &(train o (slash o ([ |.~ >: o - o (|&#)) ; an y))\. 1 2 3 4 5
6 7 8
_0.6 1.6 0.8 3.75 _0.25 5.25 0.875 8
+`-`*`% a2\. 1 2 3 4 5 6 7 8
_0.6 1.6 0.8 3.75 _0.25 5.25 0.875 8
Exercise 3.
First, Let us define the testing nouns:
C=:3 4$i.8
A=:i.3 2 4
Following the hint 1 (see the trailing post below),
ru=. [^:((,'u') -: ])L:_ 0
a3=. train o (an ru (([`([:I. u -:"_1 _ ])`(u"_)}) (tie&''adv))c) f.adv
9 8 7 6 C a3 0 1 2 3
9 8 7 6
4 5 6 7
9 8 7 6
(100%i.2 4) A a3 16+i.2 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
_ 100 50 33.3333
25 20 16.6667 14.2857
Following the hint 2 (see the trailing post below),
q=. @:(,&:<)
a3=. ("_)((&>)/)( : ( [`([:I. $:q"_ -:"_1 _ ])`($:q"_)}))
9 8 7 6 C a3 0 1 2 3
9 8 7 6
4 5 6 7
9 8 7 6
(100%i.2 4) A a3 16+i.2 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
_ 100 50 33.3333
25 20 16.6667 14.2857
References
[0] [Jprogramming] Adverbial Tacit Jym
http://www.jsoftware.com/pipermail/programming/2016-March/044692.html
[1] [Jprogramming] Adverbial Tacit Jym
http://www.jsoftware.com/pipermail/programming/2016-March/044692.html
On Fri, Apr 22, 2016 at 8:42 PM, Jose Mario Quintana <
[email protected]> wrote:
>
> There is a reason why the exercises 2 and 3 (described in [0]) are
> difficult. The Toolkit adverbs , hg and adv, facilitate the production of
> adverbs which are capable to render whatever explicit adverbs can; however,
> when the explicit adverbs produce verbs (e.g., u rscan) and the arguments
> of these verbs (e.g., y) are also referred within the definition of the
> explicit adverbs (e.g., 1 : '((>: - m |&# y) |. m)/y') then the
> straightforward way to produce tacit adverbs via hg or adv is not
> satisfactory because the products (e.g., u (1 : '((>: - m |&# y) |. m)/y'))
> involve unresolved explicit definitions.
>
> The following are hints to find (fully tacit) solutions for these
> particular exercises; however, they can be applied to similar tasks.
> Moreover, general solutions for this kind of situation are possible using a
> tool that will be shown in the near future (stay tuned).
>
> H
> i
> n
> t
> s
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
>
>
>
>
>
> Exercise 2. Notice that:
>
> +`-`*`% &( ( ([ |.~ >: o - o (|&#)) ; an y))\. 1 2 3 4 5
> 6 7 8
> ┌─────────┬───────────────────┐
> │┌─┬─┬─┬─┐│┌─┬───────────────┐│
> ││-│*│%│+│││0│1 2 3 4 5 6 7 8││
> │└─┴─┴─┴─┘│└─┴───────────────┘│
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬─────────────┐ │
> ││*│%│+│-│││0│2 3 4 5 6 7 8│ │
> │└─┴─┴─┴─┘│└─┴─────────────┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬───────────┐ │
> ││%│+│-│*│││0│3 4 5 6 7 8│ │
> │└─┴─┴─┴─┘│└─┴───────────┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬─────────┐ │
> ││+│-│*│%│││0│4 5 6 7 8│ │
> │└─┴─┴─┴─┘│└─┴─────────┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬───────┐ │
> ││-│*│%│+│││0│5 6 7 8│ │
> │└─┴─┴─┴─┘│└─┴───────┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬─────┐ │
> ││*│%│+│-│││0│6 7 8│ │
> │└─┴─┴─┴─┘│└─┴─────┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬───┐ │
> ││%│+│-│*│││0│7 8│ │
> │└─┴─┴─┴─┘│└─┴───┘ │
> ├─────────┼───────────────────┤
> │┌─┬─┬─┬─┐│┌─┬─┐ │
> ││+│-│*│%│││0│8│ │
> │└─┴─┴─┴─┘│└─┴─┘ │
> └─────────┴───────────────────┘
>
> (Incidentally, this suggests a potential alternative sequential approach
> that one could follow if the verbs within the gerund were very expensive to
> compute.)
>
>
> Exercise 3.
>
> These are some hints for some solutions:
>
> 0. Use hg or adv to produce directly the form
> [`([: I. u -:"_1 _ ])`(u"_)} (see Raul's ritemT adverb [1])
>
> 1. Notice that ([`([:I. u -:"_1 _ ])`(u"_)}) (tie&''adv) is a
> gerund associated to the verb [`([: I. u -:"_1 _ ])`(u"_)} .
> What remains to be accomplished is to replace the instances of
> u in the gerund by the argument of the adverb.
>
> 2. Use one the the combinations mentioned in [2]
>
> 3. There is, at least, another approach.
>
>
> References
>
> [0] [Jprogramming] Adverbial Tacit Jym
> http://www.jsoftware.com/pipermail/programming/2016-March/044692.html
>
> [1] [Jprogramming] Replace Items
> http://www.jsoftware.com/pipermail/programming/2016-March/044625.html
>
> [2] [Jprogramming] Adverbial Tacit Jym -spoilered
> http://www.jsoftware.com/pipermail/programming/2016-April/045003.html
>
>
>>
>>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm