One thing I do not like about explicit definitions is unexpected side effects:

   m=. +/ .*

   inc=: 1 :'&.(%&m)'

   3 inc NB. OK
&.(%&3)

   + inc NB. WHOA!
&.(%&(+/ .*))

   inc=. (%&) (<'&.'`) (`:6)

   3 inc
&.(%&3)

   + inc
&.(%&+)

Somebody said recently that J has no reserved words, of course, with
the exception of the most useful: m, n, u, v, x and y (if you are
programming explicitly).

I understand and share your frustration about the (`) related bug:

   inc
((%&)(&.`))(`:6)

 However, while I was preparing my presentation for the conference I
discovered that using a pro-conjunction for (`) alleviates the
problem:

   l=. `

   inc=. (%&) (<'&.'l) (`:6)
   inc
((%&)(<'&.'l))(`:6)




On Fri, Aug 24, 2012 at 5:53 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> Oh, hmm..
>
> But if I use
>
>    to =: [ + 1 i.@+ -~
>
> it seems to work:
>
>    5 10 to 15 20
>  5  6  7  8  9 10 11 12 13 14 15
> 10 11 12 13 14 15 16 17 18 19 20
>
> or maybe not:
>
>    5 10 to 12 20
>  5  6  7  8  9 10 11 12  5  5  5
> 10 11 12 13 14 15 16 17 18 19 20
>
> I probably want fill elements there?  If so, I should probably use to
> with an explicit rank.
>
> Anyways, for now anyways, I think that that |length error is a good thing.
>
> As for the |domain error, I think I'd prefer to fix that in inc:
>
>    inc=: 1 :'(&<.)(&.(%&m))'
>
> Finally, my problem with  ((<'&.'`)(`:6)) is not that I do not know
> what it is doing.  I know exactly what it is doing, in the sense that
> I can sit down and walk through the creation of intermediate results,
> building up the gerund that will be interpreted as a train.  And, I
> know why (<'&.'`) is equivalent to ((<'&.')`) and I know why this
> construct, when it is used, swaps the verb derived from (%&) off to
> the right of &. when the gerund being built is interpreted as a train.
>
> My problem is that I do not have good mental labels to use when I
> think about it those elements.  I think that I'm lacking abstractions,
> for reasoning about that kind of expression.  I do not have good
> words, either, for talking about expressions built into gerunds which
> are auto-interpreted as trains.  And, I suppose, a part of my problem
> is that J has problems displaying some of these intermediate results.
> I dislike working in a way that's likely to trigger interpreter bugs.
>
> --
> Raul
>
> On Fri, Aug 24, 2012 at 5:28 PM, Jose Mario Quintana
> <jose.mario.quint...@gmail.com> wrote:
>> There are a couple of problems with
>>
>>    to =: [ (+ i.) 1 + -~
>>
>>    5 10 to 15 20
>> |length error: to
>> |   5 10     to 15 20
>> |[-0]
>>
>>
>>    5 to (0.27 inc) 8
>> |domain error: to
>> |   5     to(0.27 inc)8
>> |[-0]
>>
>>
>>    inc=: 1 :'&.(%&m)'
>>
>> Is the explicit equivalent (to some extent) to
>>
>>    inc=. (%&)(<'&.'`)(`:6)
>>
>> I wrote the second form because the original requested a "tacit form"
>> admittedly referring to a verb but I like to be "tacitus" and in some
>> respect I also would like to be as Tacitus "... and as well as the
>> brevity and compactness of his Latin prose, he is known for his
>> penetrating insights ..."
>>
>> The "unnamed parentheticals" are adverbs forming trains in a typical
>> tacit adverbial programming fashion.  Dan Bron wrote a pretty good
>> general explanation:
>> http://www.jsoftware.com/pipermail/programming/2010-November/021172.html
>>
>>
>> On Fri, Aug 24, 2012 at 11:46 AM, Raul Miller <rauldmil...@gmail.com> wrote:
>>> On Fri, Aug 24, 2012 at 11:17 AM, Jose Mario Quintana
>>> <jose.mario.quint...@gmail.com> wrote:
>>>>    to=. [ + i.@:>:@:<.@-~
>>>>
>>>>    5 to 8
>>>> 5 6 7 8
>>> ...
>>>>    inc=. (%&) ((<'&.'`)(`:6))
>>>>
>>>>    5 to (0.25 inc) 8
>>>> 5 5.25 5.5 5.75 6 6.25 6.5 6.75 7 7.25 7.5 7.75 8
>>>
>>> I like your argument patterns.
>>>
>>> But I am uncomfortable with your definitions (especially the unnamed
>>> parentheticals) -- perhaps because I do not understand them well
>>> enough to reason about them generally?
>>>
>>> Anyways, here's how I might define these words:
>>>
>>>    to =: [ (+ i.) 1 + -~
>>>    inc=: 1 :'&.(%&m)'
>>>
>>> Thanks,
>>>
>>> --
>>> Raul
>>> ----------------------------------------------------------------------
>>> 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