Ah, good point.

Using the definition of a2 from earlier in this thread:

   a2=. (`(<(":0);_)) (`:6)
   rscan=. 1 : '((>: - m |&# y) |. m)/y'
   (+`%`*   rscan\. ,:  +`%`*   a2\.)  1 2 3 4 5 6 7
|domain error
|   (+`%`*rscan\.,:    +`%`*a2\.)1 2 3 4 5 6 7

Hmm... probably not what you meant.

Reading your original email again, it looks like you meant this:

   rscan=. 1 : '((>: - m |&# y) |. m)/y'
   a2=.rscan
   (+`%`*   rscan\. ,:  +`%`*   a2\.)  1 2 3 4 5 6 7
1.16185 0.16185 12.3571 4.11905 0.119048 42 7
1.16185 0.16185 12.3571 4.11905 0.119048 42 7

I hope you'll forgive the sloppiness in my attempts.

Thanks,

-- 
Raul


On Sun, Apr 24, 2016 at 7:57 PM, Jose Mario Quintana
<[email protected]> wrote:
> Apparently that is a peculiar difficulty.  I have no issues when I plug my
> solution in for a2.   One would get a syntax error if a2 were left
> undefined but you tried to plug a potential solution in...  Did you not?
>
>
> On Sat, Apr 23, 2016 at 3:13 AM, Raul Miller <[email protected]> wrote:
>
>> Another difficulty, however, is stuff like this:
>>
>>    rscan=. 1 : '((>: - m |&# y) |. m)/y'
>>    (+`%`*   rscan\. ,:  +`%`*   a2\.)  1 2 3 4 5 6 7
>> |syntax error
>> |   (    +`%`*rscan\.,:+`%`*a2\.)1 2 3 4 5 6 7
>>
>> --
>> Raul
>>
>>
>> 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
>> >
>> >
>> >
>> > 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.
>> >>
>> >> Instructors will describe an exercise and, unless otherwise specified in
>> >> advance, will be prepared to show at least one way to perform it if
>> patrons
>> >> (including other instructors) have not performed the exercise after a
>> >> reasonable time; alright, they have bragging rights either way ;)  The
>> >> exercises would typically involve producing adverbs with bonus points
>> for
>> >> producing fixed versions of the adverbs and their products.  Exercises
>> are
>> >> not required to be brand new.  Given credit to the originators of
>> certain
>> >> techniques is not necessary (but you know who you are and bragging is
>> >> allowed).  Spoiler alerts by instructors and patrons will be
>> appreciated.
>> >>
>> >> Instructors (Dan, Thomas et al. are you listening?), not to mention
>> >> patrons (including beginners), are all very welcome here.  How long will
>> >> the Jym remain open?  Indefinitely, as long as there enough patrons and
>> >> instructors or we are kicked out of here.
>> >>
>> >> Let us start with a few exercises with different degrees of difficulty
>> >> (feel free to ask any questions just be patient with me, sometimes I
>> >> disappear for a few days):
>> >>
>> >>
>> >> - Exercise 0.  Rank infinity
>> >>
>> >> Produce a (tacit, of course) adverb  a0  such that  u a0  produces  u"_
>> >>  where u is a noun or a verb, for example,
>> >>
>> >>    u a0
>> >> u"_
>> >>
>> >>    *:@:(+/) a0
>> >> *:@:(+/)"_
>> >>
>> >>    u=. 1 2 3
>> >>
>> >>    u a0
>> >> 1 2 3"_
>> >>
>> >>    1 2 3 a0
>> >> 1 2 3"_
>> >>
>> >>
>> >> - Exercise 1.  Operating on the first and last items
>> >>
>> >> Produce an adverb a1 such that  u a1 produces  {. u {:  where u is a
>> verb,
>> >> for example,
>> >>
>> >>    erase'u'
>> >> 1
>> >>
>> >>    u a1
>> >> {. u {:
>> >>
>> >>    * a1
>> >> {. * {:
>> >>
>> >>    * a1 2 3 5 7
>> >> 14
>> >>
>> >>
>> >> - Exercise 2. Back insert
>> >>
>> >> Produce an adverb a2 which is a tacit counterpart of the explicit adverb
>> >> rscan, see [1],
>> >>
>> >>    rscan=. 1 : '((>: - m |&# y) |. m)/y'
>> >>
>> >> for example,
>> >>
>> >>    (+`%`*   rscan\. ,:  +`%`*   a2\.)  1 2 3 4 5 6 7
>> >> 1.16184971 0.161849711 12.3571429 4.11904762 0.119047619 42 7
>> >> 1.16184971 0.161849711 12.3571429 4.11904762 0.119047619 42 7
>> >>
>> >>    (+`-`*`% rscan\. ,:  +`-`*`% a2\.)  1 2 3 4 5 6 7 8
>> >> _0.6 1.6 0.8 3.75 _0.25 5.25 0.875 8
>> >> _0.6 1.6 0.8 3.75 _0.25 5.25 0.875 8
>> >>
>> >>
>> >> - Exercise 3.  Replace items
>> >>
>> >> Produce an adverb a3 which is a tacit counterpart of the explicit adverb
>> >> ritem, see [2],
>> >>
>> >> ritem =: 1 : (':' ; 'x (I.m-:"_1 _ y) } m')
>> >>
>> >> for example,
>> >>
>> >> C=. 3 4$i.8
>> >> A=. i.3 2 4
>> >>
>> >> assert 9 8 7 6 (C ritem -: C a3) 0 1 2 3
>> >> assert (100%i.2 4) (A ritem -: A a3) 16+i.2 4
>> >>
>> >>
>> >> References
>> >>
>> >> [0] [Jprogramming] Tacit Toolkit (was dyadic J)
>> >>
>> >>
>> http://www.jsoftware.com/pipermail/programming/2015-December/043757.html
>> >>
>> >> [1] [Jprogramming] Am I understanding m/y ?
>> >>
>> >>
>> http://www.jsoftware.com/pipermail/programming/2016-February/044483.html
>> >>
>> >> [2] [Jprogramming] Replace Items
>> >>
>> http://www.jsoftware.com/pipermail/programming/2016-March/044625.html
>> >>
>> > ----------------------------------------------------------------------
>> > 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to