Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-12-22 Thread Jose Mario Quintana
You are welcome.  By the way, I just noticed that nc could be redefined as,

nc=. >:@:

Best wishes on your recovery


On Fri, Dec 22, 2023 at 1:35 PM Martin Kreuzer  wrote:

> @Raul | @Pepe -
>
> Sorry for the delay.
> I was ill for quite some time (slowly recovering).
> Thanks for your detailed answers.
>
> With season's greetings
> -Martin
>
> At 2023-06-13 21:11, you wrote:
>
> >Exactly: "(extra parentheses and spaces for clarity)"
> >
> >On Tue, Jun 13, 2023 at 2:27 PM Raul Miller 
> wrote:
> >
> > > [I thought I had sent this yesterday, but today I find it in draft
> status]
> >
> > > Note that you can eliminate some of the parenthesis here, and some of
> > > the quotation marks (though this does place a burden on the reader's
> > > understanding of j syntax):
> >
> > >({{y`:6 nc`''}} ^: 9 +:`'') (`:6) 7
> > > 23
> >
> > > or
> >
> > > ({{y`:6 nc`''}} ^: 9 +:`'') `:6 ]7
> > > 23
> >
> > > The final parentheses are essential (to force early verb evaluation).
> >
> >
> > > --
> > > Raul
> >
> > > On Mon, Jun 12, 2023 at 7:01 PM Jose Mario Quintana
> > >  wrote:
> > > >
> > > >(3 : '((y`:6) nc)`' ^: 9 +: (`'')) (`:6) 7
> > > > 23
> > > >
> > > >
> > > >
> > > > On Mon, Jun 12, 2023 at 6:57 PM Jose Mario Quintana <
> > > > jose.mario.quint...@gmail.com> wrote:
> > > >
> > > > > Concisely,
> > > > >
> > > > >ncver=. 3 : '((y`:6) nc)`'
> > > > >(ncver ^: 9 +: (`'')) (`:6) 7
> > > > > 23
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Jun 12, 2023 at 6:46 PM Jose Mario Quintana <
> > > > > jose.mario.quint...@gmail.com> wrote:
> > > > >
> > > > >> An alternative way is verbing, so to speak, the (nc) adverb
> taking and
> > > > >> producing instead the gerunds corresponding to the verbs,
> powering the
> > > > >> verbed adverb (ncver) and converting the resulting gerund back to
> the
> > > > >> desired verb (extra parentheses and spaces for clarity),
> > > > >>
> > > > >> ncver=. 3 : 0
> > > > >>   u=. (y`:6)
> > > > >>   v=. u nc
> > > > >>   v (`'')
> > > > >> )
> > > > >>
> > > > >>(ncver ^: 2 +: (`'')) (`:6) 7
> > > > >> 16
> > > > >>(ncver ^: 9 +: (`'')) (`:6) 7
> > > > >> 23
> > > > >>
> > > > >> PS.  The previous generation of interpreters allowed one
> (illegally,
> > > of
> > > > >> course) to operate directly on the entities without having to go
> back
> > > > >> and forth.  For example, one can just write,
> > > > >>
> > > > >>+: ((Ver 'nc')^:9 adv) 7
> > > > >> 23
> > > > >>
> > > > >> using the suitable utilities (Ver) for verbing and (adv) for
> > > adverbing.
> > > > >>
> > > > >>
> > > > >>
> > > > >> On Mon, Jun 12, 2023 at 6:12 AM Martin Kreuzer <
> i...@airkreuzer.com>
> > > > >> wrote:
> > > > >>
> > > > >>> Dear all -
> > > > >>>
> > > > >>> Having used Fixed Power (u^:n y) before, I noticed that it works
> on
> > > > >>> the verb-adverb compound to its left.
> > > > >>>
> > > > >>> Let's have a simple, silly example:
> > > > >>>
> > > > >>> nc=. 1 : '[: >: u' NB. defining an adverb 'increase'
> > > > >>>
> > > > >>> +: i. nc 7 NB. which works fine
> > > > >>> 2 4 6 8 10 12 14
> > > > >>>
> > > > >>> Using Fixed Power like
> > > > >>>
> > > > >>> +: nc ^:1 (7)
> > > > >>> 15
> > > > >>> +: nc ^:2 (7)
> > > > >>> 31
> > > > >>>
> > > > >>> I do get the expected results (compound is executed once, twice).
> > > > >>>
> > > > >>> Here we have a verb, followed by two adverbs (if I understand
> > > correctly).
> > > > >>>
> > > > >>> What I have initially been looking for however, is how to apply
> the
> > > > >>> *same* adverb repeatedly, like
> > > > >>>
> > > > >>> +: nc nc (7)
> > > > >>> 16
> > > > >>>
> > > > >>> while having the adverb part "nc nc" somehow abbreviated.
> > > > >>>
> > > > >>> What would be a (or the) way to phrase that ?
> > > > >>>
> > > > >>> Thanks.
> > > > >>> -M
> > > > >>>
> > > > >>>
> > > --
> > > > >>> 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
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] (no subject)

2023-10-18 Thread Jose Mario Quintana
>  Using either of 3 :'... y' and {{...y}} fixes this.

The interpreter can also "fix" it for you although the answer might be
verbose and it is not tacit:

   (w@q)f.
({:`([: $: 0 1&+)@.(9&<@{.)@(([: */ "."0@":@{.) , {:)"1) (1 : 0)@(|:@,: 1:)
u y
:
x u y
)
   (w@q)f. 50 25 33 22 293
1 2 1 1 3

P.S. There was a way, using a previous-generation interpreter, to define an
illegal tacit adverb that could provide a desired context for $: to
maintain tacitness, alas that is no longer possible (as far as I know).



On Tue, Oct 17, 2023 at 7:25 PM 'Viktor Grigorov' via Programming <
programm...@jsoftware.com> wrote:
>
> The ( was a curtailed copy.
>
> I'd considered briefly $:'s context prior to thinking it shouldn't change
in either case, thinking it extended to the the parentheses around the
gerund, conjunction and verb. I didn't know the details of self-recurance's
scope. Using either of 3 :'... y' and {{...y}} fixes this.
>
> Thank you; sorry for the false alarm.
>
> Oct 18, 2023, 02:04 by rauldmil...@gmail.com:
>
> > This sentence gives me an error even without parens.
> >
> > Looking closer, I see six left parentheses and seven right parentheses
here:
> >
> >  ({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1(|:@,:1:))50 25 33
22 293
> >
> > Getting rid of the far right parenthesis gives me the result which you
> > displayed.
> >
> > Meanwhile, you're using $:
> >
> > And, incorporating (|:@,:1:) into the $: phrase changes the context of
> > $: which means that it also changes the definition used for evaluating
> > $: -- so you'll need to do something about that. There's several
> > possibilities, and using a name for the $: phrase is one of those.
> >
> > I hope this helps,
> >
> > --
> > Raul
> > On Tue, Oct 17, 2023 at 6:26 PM 'Viktor Grigorov' via Programming
> >  wrote:
> >
> >>
> >> Hey,
> >>
> >> I have a bit of code I want to include into something large, but I'm
hitting a wall.
> >>
> >>  ({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1(|:@,:1:))50 25 33
22 293
> >> 1 2 1 1 3
> >>
> >> Okay. Slap on some parens, and it fails? Valence error for {:..? Both
resolve to 3, a verb, according to 4!:0. Because both verbs are monadic, I
tried capping either and both, all composing conjunctions, parenthesizing.
Adding in ]. or [., I don't see what the problem is, or how tail's valence
fits into it? Some configurations increase the dimensions and don't give
out the desired thing:
> >>
> >>  (({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1 @ (|:@,:1:))50 25
33 22 293
> >> 1 0
> >> 0 0
> >>
> >> 1 1
> >> 0 0
> >>
> >> 1 0
> >> 0 0
> >>
> >> 1 0
> >> 0 0
> >>
> >> 1 1
> >> 1 0
> >>
> >> However, assigning both to names and composing does work
> >>
> >>  q=:|:@,:1:
> >>  w=:({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1
> >>  w q 50 25 33 22 293
> >> 1 2 1 1 3
> >>  (w@q)50 25 33 22 293
> >> 1 2 1 1 3
> >>
> >> What am I missing? This to me is unexpected behavior. I expect
parethesization and variable substitution to be identical, but it's not.
I'm sure there's a single, explanatory/exculpatory line somewhere about
assignments, variables and or parentheses on the wiki, but it's not easily
discoverable..
> >>
> >> --
> >> 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


Re: [Jprogramming] Interesting Quora Problem:

2023-09-11 Thread Jose Mario Quintana
> Further simplifications are possible, but since this is a one use
> calculation this is probably good enough.

One could argue, for the same reason, that adequate performance is
sufficient.  So, my lazy random search effort is,

   o=. @:

   entry=. 0&{::
   try=. 1&{:: )

   sample=. (>: o ?~ o 9:) ; 1 + try NB. counting tries to avoid a
premature convergence

   good=. (-: 0&*) o ((1+i.9) | 

Re: [Jprogramming] Rank difficulties

2023-09-07 Thread Jose Mario Quintana
Oops, I forgot o=. @:

On Thu, Sep 7, 2023 at 1:27 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:

> > The order of the last two appear "unnatural".  (To my way of thinking at
> least)
> > This seems to beg the question what is the natural order when  slicing.
>
> The answer might depend on the intended usage of the verb that you have in
> mind. If, for example,
> you want to preserve the order of the remaining axes, then Henry's
> suggestion modified by Raul would work,
>
>$ Y=. i.2 3 4 5
> 2 3 4 5
>
>slicep=. ~.@(, i.@#@$) |: ]
>
>(0 1 2 3) ($ o slicep"0 _) Y
> 2 3 4 5
> 3 2 4 5
> 4 2 3 5
> 5 2 3 4
>
> Another possibility is to rotate the axes,
>
>slicer=. (|. i.@:#@:$@:]) |: ]
>
>(0 1 2 3) ($ o slicer"0 _) Y
> 2 3 4 5
> 3 4 5 2
> 4 5 2 3
> 5 2 3 4
>
> I hope this helps
>
>
> On Wed, Sep 6, 2023 at 7:58 PM Piet de Jong  wrote:
> >
> > This works!
> > Except the ordering of the axes is slightly unusual to my way of
> thinking.
> > For example suppose m=.i.3 3 3 is the “cube" be sliced and v is your
> verb.
> > Then the items of (0 v m) has successive items  “going back” into the
> cube.
> > The items (1 v m) are the horizontal slices.
> > The items of (2 v m) are the vertical slices.
> >
> > The order of the last two appear "unnatural".  (To my way of thinking at
> least)
> > This seems to beg the question what is the natural order when  slicing.
> >
> > > On 7 Sep 2023, at 08:32, Henry Rich  wrote:
> > >
> > > Since you want all the slices, what you are looking for is a transpose.
> > >
> > > Maybe
> > >
> > > ~.@(, i.@#) |: ]
> > >
> > > Untested.
> > >
> > > Henry Rich
> > >
> > > On Wed, Sep 6, 2023, 6:10 PM Piet de Jong  wrote:
> > >
> > >> Here is my “wish"
> > >>
> > >> A dyadic (tacit) verb such that x v y gives all the slices of y along
> > >> dimension x, where x is integer.   That is to say
> > >>
> > >> i{ x v y
> > >>
> > >> is slice i of the array y along dimension x.
> > >>
> > >> Thanks for all your help!
> > >>
> > >>> On 7 Sep 2023, at 08:04, 'robert therriault' via Programming <
> > >> programm...@jsoftware.com> wrote:
> > >>>
> > >>> Or something like this?
> > >>>
> > >>>   [n =. i. 2 2 2
> > >>> 0 1
> > >>> 2 3
> > >>>
> > >>> 4 5
> > >>> 6 7
> > >>>  ,./ n
> > >>> 0 1 4 5
> > >>> 2 3 6 7
> > >>> ($ $ (,@,./)) n
> > >>> 0 1
> > >>> 4 5
> > >>>
> > >>> 2 3
> > >>> 6 7
> > >>>
> > >>> Cheers, bob
> > >>>
> > >>>
> > >>>> On Sep 6, 2023, at 14:49, 'robert therriault' via Programming <
> > >> programm...@jsoftware.com> wrote:
> > >>>>
> > >>>> Hi Piet,
> > >>>>
> > >>>> Maybe show us what you would want to do with higher dimensions? Or a
> > >> less symmetric 2 dimensional shape?
> > >>>>
> > >>>> For shape 2 2, I would use the even simpler
> > >>>>
> > >>>>  |: m
> > >>>> 0 2
> > >>>> 1 3
> > >>>>
> > >>>> Hope this helps.
> > >>>>
> > >>>> Cheers, bob
> > >>>>
> > >>>>> On Sep 6, 2023, at 14:26, Brian Schott 
> wrote:
> > >>>>>
> > >>>>> ,./0 1 {"1  m
> > >>>>
> > >>>>
> --
> > >>>> 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
> >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Rank difficulties

2023-09-07 Thread Jose Mario Quintana
> The order of the last two appear "unnatural".  (To my way of thinking at
least)
> This seems to beg the question what is the natural order when  slicing.

The answer might depend on the intended usage of the verb that you have in
mind. If, for example,
you want to preserve the order of the remaining axes, then Henry's
suggestion modified by Raul would work,

   $ Y=. i.2 3 4 5
2 3 4 5

   slicep=. ~.@(, i.@#@$) |: ]

   (0 1 2 3) ($ o slicep"0 _) Y
2 3 4 5
3 2 4 5
4 2 3 5
5 2 3 4

Another possibility is to rotate the axes,

   slicer=. (|. i.@:#@:$@:]) |: ]

   (0 1 2 3) ($ o slicer"0 _) Y
2 3 4 5
3 4 5 2
4 5 2 3
5 2 3 4

I hope this helps


On Wed, Sep 6, 2023 at 7:58 PM Piet de Jong  wrote:
>
> This works!
> Except the ordering of the axes is slightly unusual to my way of thinking.
> For example suppose m=.i.3 3 3 is the “cube" be sliced and v is your verb.
> Then the items of (0 v m) has successive items  “going back” into the
cube.
> The items (1 v m) are the horizontal slices.
> The items of (2 v m) are the vertical slices.
>
> The order of the last two appear "unnatural".  (To my way of thinking at
least)
> This seems to beg the question what is the natural order when  slicing.
>
> > On 7 Sep 2023, at 08:32, Henry Rich  wrote:
> >
> > Since you want all the slices, what you are looking for is a transpose.
> >
> > Maybe
> >
> > ~.@(, i.@#) |: ]
> >
> > Untested.
> >
> > Henry Rich
> >
> > On Wed, Sep 6, 2023, 6:10 PM Piet de Jong  wrote:
> >
> >> Here is my “wish"
> >>
> >> A dyadic (tacit) verb such that x v y gives all the slices of y along
> >> dimension x, where x is integer.   That is to say
> >>
> >> i{ x v y
> >>
> >> is slice i of the array y along dimension x.
> >>
> >> Thanks for all your help!
> >>
> >>> On 7 Sep 2023, at 08:04, 'robert therriault' via Programming <
> >> programm...@jsoftware.com> wrote:
> >>>
> >>> Or something like this?
> >>>
> >>>   [n =. i. 2 2 2
> >>> 0 1
> >>> 2 3
> >>>
> >>> 4 5
> >>> 6 7
> >>>  ,./ n
> >>> 0 1 4 5
> >>> 2 3 6 7
> >>> ($ $ (,@,./)) n
> >>> 0 1
> >>> 4 5
> >>>
> >>> 2 3
> >>> 6 7
> >>>
> >>> Cheers, bob
> >>>
> >>>
>  On Sep 6, 2023, at 14:49, 'robert therriault' via Programming <
> >> programm...@jsoftware.com> wrote:
> 
>  Hi Piet,
> 
>  Maybe show us what you would want to do with higher dimensions? Or a
> >> less symmetric 2 dimensional shape?
> 
>  For shape 2 2, I would use the even simpler
> 
>   |: m
>  0 2
>  1 3
> 
>  Hope this helps.
> 
>  Cheers, bob
> 
> > On Sep 6, 2023, at 14:26, Brian Schott 
wrote:
> >
> > ,./0 1 {"1  m
> 
> 
--
>  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
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-06-13 Thread Jose Mario Quintana
Exactly: "(extra parentheses and spaces for clarity)"

On Tue, Jun 13, 2023 at 2:27 PM Raul Miller  wrote:

> [I thought I had sent this yesterday, but today I find it in draft status]
>
> Note that you can eliminate some of the parenthesis here, and some of
> the quotation marks (though this does place a burden on the reader's
> understanding of j syntax):
>
>({{y`:6 nc`''}} ^: 9 +:`'') (`:6) 7
> 23
>
> or
>
> ({{y`:6 nc`''}} ^: 9 +:`'') `:6 ]7
> 23
>
> The final parentheses are essential (to force early verb evaluation).
>
>
> --
> Raul
>
> On Mon, Jun 12, 2023 at 7:01 PM Jose Mario Quintana
>  wrote:
> >
> >(3 : '((y`:6) nc)`' ^: 9 +: (`'')) (`:6) 7
> > 23
> >
> >
> >
> > On Mon, Jun 12, 2023 at 6:57 PM Jose Mario Quintana <
> > jose.mario.quint...@gmail.com> wrote:
> >
> > > Concisely,
> > >
> > >    ncver=. 3 : '((y`:6) nc)`'
> > >(ncver ^: 9 +: (`'')) (`:6) 7
> > > 23
> > >
> > >
> > >
> > >
> > > On Mon, Jun 12, 2023 at 6:46 PM Jose Mario Quintana <
> > > jose.mario.quint...@gmail.com> wrote:
> > >
> > >> An alternative way is verbing, so to speak, the (nc) adverb taking and
> > >> producing instead the gerunds corresponding to the verbs, powering the
> > >> verbed adverb (ncver) and converting the resulting gerund back to the
> > >> desired verb (extra parentheses and spaces for clarity),
> > >>
> > >> ncver=. 3 : 0
> > >>   u=. (y`:6)
> > >>   v=. u nc
> > >>   v (`'')
> > >> )
> > >>
> > >>(ncver ^: 2 +: (`'')) (`:6) 7
> > >> 16
> > >>(ncver ^: 9 +: (`'')) (`:6) 7
> > >> 23
> > >>
> > >> PS.  The previous generation of interpreters allowed one (illegally,
> of
> > >> course) to operate directly on the entities without having to go back
> > >> and forth.  For example, one can just write,
> > >>
> > >>+: ((Ver 'nc')^:9 adv) 7
> > >> 23
> > >>
> > >> using the suitable utilities (Ver) for verbing and (adv) for
> adverbing.
> > >>
> > >>
> > >>
> > >> On Mon, Jun 12, 2023 at 6:12 AM Martin Kreuzer 
> > >> wrote:
> > >>
> > >>> Dear all -
> > >>>
> > >>> Having used Fixed Power (u^:n y) before, I noticed that it works on
> > >>> the verb-adverb compound to its left.
> > >>>
> > >>> Let's have a simple, silly example:
> > >>>
> > >>> nc=. 1 : '[: >: u' NB. defining an adverb 'increase'
> > >>>
> > >>> +: i. nc 7 NB. which works fine
> > >>> 2 4 6 8 10 12 14
> > >>>
> > >>> Using Fixed Power like
> > >>>
> > >>> +: nc ^:1 (7)
> > >>> 15
> > >>> +: nc ^:2 (7)
> > >>> 31
> > >>>
> > >>> I do get the expected results (compound is executed once, twice).
> > >>>
> > >>> Here we have a verb, followed by two adverbs (if I understand
> correctly).
> > >>>
> > >>> What I have initially been looking for however, is how to apply the
> > >>> *same* adverb repeatedly, like
> > >>>
> > >>> +: nc nc (7)
> > >>> 16
> > >>>
> > >>> while having the adverb part "nc nc" somehow abbreviated.
> > >>>
> > >>> What would be a (or the) way to phrase that ?
> > >>>
> > >>> Thanks.
> > >>> -M
> > >>>
> > >>>
> --
> > >>> 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


Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-06-12 Thread Jose Mario Quintana
   (3 : '((y`:6) nc)`' ^: 9 +: (`'')) (`:6) 7
23



On Mon, Jun 12, 2023 at 6:57 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:

> Concisely,
>
>ncver=. 3 : '((y`:6) nc)`'
>(ncver ^: 9 +: (`'')) (`:6) 7
> 23
>
>
>
>
> On Mon, Jun 12, 2023 at 6:46 PM Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
>
>> An alternative way is verbing, so to speak, the (nc) adverb taking and
>> producing instead the gerunds corresponding to the verbs, powering the
>> verbed adverb (ncver) and converting the resulting gerund back to the
>> desired verb (extra parentheses and spaces for clarity),
>>
>> ncver=. 3 : 0
>>   u=. (y`:6)
>>   v=. u nc
>>   v (`'')
>> )
>>
>>(ncver ^: 2 +: (`'')) (`:6) 7
>> 16
>>(ncver ^: 9 +: (`'')) (`:6) 7
>> 23
>>
>> PS.  The previous generation of interpreters allowed one (illegally, of
>> course) to operate directly on the entities without having to go back
>> and forth.  For example, one can just write,
>>
>>+: ((Ver 'nc')^:9 adv) 7
>> 23
>>
>> using the suitable utilities (Ver) for verbing and (adv) for adverbing.
>>
>>
>>
>> On Mon, Jun 12, 2023 at 6:12 AM Martin Kreuzer 
>> wrote:
>>
>>> Dear all -
>>>
>>> Having used Fixed Power (u^:n y) before, I noticed that it works on
>>> the verb-adverb compound to its left.
>>>
>>> Let's have a simple, silly example:
>>>
>>> nc=. 1 : '[: >: u' NB. defining an adverb 'increase'
>>>
>>> +: i. nc 7 NB. which works fine
>>> 2 4 6 8 10 12 14
>>>
>>> Using Fixed Power like
>>>
>>> +: nc ^:1 (7)
>>> 15
>>> +: nc ^:2 (7)
>>> 31
>>>
>>> I do get the expected results (compound is executed once, twice).
>>>
>>> Here we have a verb, followed by two adverbs (if I understand correctly).
>>>
>>> What I have initially been looking for however, is how to apply the
>>> *same* adverb repeatedly, like
>>>
>>> +: nc nc (7)
>>> 16
>>>
>>> while having the adverb part "nc nc" somehow abbreviated.
>>>
>>> What would be a (or the) way to phrase that ?
>>>
>>> Thanks.
>>> -M
>>>
>>> --
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-06-12 Thread Jose Mario Quintana
Concisely,

   ncver=. 3 : '((y`:6) nc)`'
   (ncver ^: 9 +: (`'')) (`:6) 7
23




On Mon, Jun 12, 2023 at 6:46 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:

> An alternative way is verbing, so to speak, the (nc) adverb taking and
> producing instead the gerunds corresponding to the verbs, powering the
> verbed adverb (ncver) and converting the resulting gerund back to the
> desired verb (extra parentheses and spaces for clarity),
>
> ncver=. 3 : 0
>   u=. (y`:6)
>   v=. u nc
>   v (`'')
> )
>
>(ncver ^: 2 +: (`'')) (`:6) 7
> 16
>(ncver ^: 9 +: (`'')) (`:6) 7
> 23
>
> PS.  The previous generation of interpreters allowed one (illegally, of
> course) to operate directly on the entities without having to go back and
> forth.  For example, one can just write,
>
>+: ((Ver 'nc')^:9 adv) 7
> 23
>
> using the suitable utilities (Ver) for verbing and (adv) for adverbing.
>
>
>
> On Mon, Jun 12, 2023 at 6:12 AM Martin Kreuzer 
> wrote:
>
>> Dear all -
>>
>> Having used Fixed Power (u^:n y) before, I noticed that it works on
>> the verb-adverb compound to its left.
>>
>> Let's have a simple, silly example:
>>
>> nc=. 1 : '[: >: u' NB. defining an adverb 'increase'
>>
>> +: i. nc 7 NB. which works fine
>> 2 4 6 8 10 12 14
>>
>> Using Fixed Power like
>>
>> +: nc ^:1 (7)
>> 15
>> +: nc ^:2 (7)
>> 31
>>
>> I do get the expected results (compound is executed once, twice).
>>
>> Here we have a verb, followed by two adverbs (if I understand correctly).
>>
>> What I have initially been looking for however, is how to apply the
>> *same* adverb repeatedly, like
>>
>> +: nc nc (7)
>> 16
>>
>> while having the adverb part "nc nc" somehow abbreviated.
>>
>> What would be a (or the) way to phrase that ?
>>
>> Thanks.
>> -M
>>
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-06-12 Thread Jose Mario Quintana
An alternative way is verbing, so to speak, the (nc) adverb taking and
producing instead the gerunds corresponding to the verbs, powering the
verbed adverb (ncver) and converting the resulting gerund back to the
desired verb (extra parentheses and spaces for clarity),

ncver=. 3 : 0
  u=. (y`:6)
  v=. u nc
  v (`'')
)

   (ncver ^: 2 +: (`'')) (`:6) 7
16
   (ncver ^: 9 +: (`'')) (`:6) 7
23

PS.  The previous generation of interpreters allowed one (illegally, of
course) to operate directly on the entities without having to go back and
forth.  For example, one can just write,

   +: ((Ver 'nc')^:9 adv) 7
23

using the suitable utilities (Ver) for verbing and (adv) for adverbing.



On Mon, Jun 12, 2023 at 6:12 AM Martin Kreuzer  wrote:

> Dear all -
>
> Having used Fixed Power (u^:n y) before, I noticed that it works on
> the verb-adverb compound to its left.
>
> Let's have a simple, silly example:
>
> nc=. 1 : '[: >: u' NB. defining an adverb 'increase'
>
> +: i. nc 7 NB. which works fine
> 2 4 6 8 10 12 14
>
> Using Fixed Power like
>
> +: nc ^:1 (7)
> 15
> +: nc ^:2 (7)
> 31
>
> I do get the expected results (compound is executed once, twice).
>
> Here we have a verb, followed by two adverbs (if I understand correctly).
>
> What I have initially been looking for however, is how to apply the
> *same* adverb repeatedly, like
>
> +: nc nc (7)
> 16
>
> while having the adverb part "nc nc" somehow abbreviated.
>
> What would be a (or the) way to phrase that ?
>
> Thanks.
> -M
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Search

2023-05-10 Thread Jose Mario Quintana
> I know of at least A,B,C,D,E,I,J,K,M,Q,R, and S

F (programming language) - Wikipedia
https://en.wikipedia.org/wiki/F_%28programming_language%29

P (programming language) - Wikipedia
https://en.wikipedia.org/wiki/P_(programming_language)

T (programming language) - Wikipedia
https://en.wikipedia.org/wiki/T_(programming_language)



On Wed, May 10, 2023 at 6:39 AM Hauke Rehr  wrote:
>
> It might be because it’s not a real issue.
> It not being a real issue might be why none
> of those languages changed its name.
>
> I know of at least A,B,C,D,E,I,J,K,M,Q,R, and S
> as language names¹ – and I bet there are X,Y and Z
> at least.
> Why didn’t their respective communities change
> the name? Are we the only enlightened people
> seeing an issue everyone else is blind to?
>
> (And do we want to set us more apart from K and Q?)
>
> ¹ tbh, I don’t remember if E was actually a proper language
>
>
> Am 10.05.23 um 08:02 schrieb Richard Donovan:
> > What is really weird is that the extremely intelligent humans who invented 
> > this remarkable language didn’t foresee this problem in the first place!
> >
> >> On 9 May 2023, at 22:47, Hauke Rehr  wrote:
> >>
> >> You are right, C is an ususable language.
> >> I think noone uses it. You cannot search.
> >>
> >> This thread is silly.
> >> J is one of  single letter names.
> >> It’s fine.
> >>
> >>> Am 09.05.23 um 22:56 schrieb Richard Donovan:
> >>> One of the most frustrating things about J is its name! For example, on 
> >>> Stack Exchange code review it seems impossible to search for any J 
> >>> articles, comments, code snippets etc. and I could suggest that rather 
> >>> than bother about whether to call the latest version J4, J904 etc which 
> >>> is trivial, you do something really useful such as change the name of the 
> >>> language to something sensible that can be searched upon. I know that in 
> >>> the past radical changes have been made to J eg changing x. and y. to x 
> >>> and y and I also know that a change of name would take a while to filter 
> >>> through but I do feel that eventually this change would have incredible 
> >>> benefits, similar to the recent long overdue introduction of sensible 
> >>> error messages which has been a real boon to me!
> >>> Richard Donovan
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> --
> >> mail written using NEO
> >> neo-layout.org
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> --
> mail written using NEO
> neo-layout.org
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] kadane algorithm vs brute force timing and memory

2023-04-07 Thread Jose Mario Quintana
 implementation in no way changes the algorithm.  It's merely
> a reordering of when comparisons are made.  Pepe's algorithm is O(n), just
> as the usual algorithms are.
> > >
> > > As I tried to explain above the ([ >. +)/ is O(n) but when used on
> suffixes with the ‘\.’ operator it becomes O(n^2). the kadane”0
> implementation that Elijah proposed operates through the array one at a
> time in O(n) producing a list of possible maximal sums which is extracted
> with >./ also in O(n). That kadane algorithm uses your technique in Chapter
> 25 Loopless Code VI, to perform a single run through the array.
> > >
> > > Just trying to be accurate so I can explain the implementations
> correctly in my essay.
> > > >
> > > > Pepe knew that >./ is very fast, probably 10% of the time of the
> other bit.  The time spent in (([ >. +)/\.) is O(n), not worth our
> discussion; but if you want to blame someone for the speed, blame the
> implementation (i. e. me), not the algorithm. Perhaps (+ 00&>.)~/\. would
> be faster; I haven't tested it, but we're down to minute questions of
> instruction ordering.
> > >
> > > No complaints about J’s speed. Even the naive brute force
> implementation runs in less than a second on a 1 element array. I have
> been using the timings as a relative guage that the various implementations
> work the way I think they are supposed to.
> > >
> > > The one thing I did have a question on now that I’ve drawn you into
> this thread. Is that the memory requirement for Pepe’s algorithm is about
> 1/5 the size of the kadane”0 algorithm. The global variable assignment
> appears to be the operation that causes the large amount of memory to be
> used. Elijah tried to explain it and hsi explanation is valid for some of
> the implementations such as the use of ‘\’ and Fold. But I don’t understand
> in the setting of a global variable.
> > >
> > > Tom McGuire
> > > >
> > > > Henry Rich
> > > >
> > > >
> > > >
> > > >
> > > > On 4/6/2023 8:12 PM, Thomas McGuire wrote:
> > > >>
> > > >>> On Apr 3, 2023, at 1:28 PM, Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
> > > >>>
> > > >>> For what it is worth...
> > > >>>
> > > >>> kad=. >./@:(([ >. +)/\.)
> > > >>>
> > > >> OK that is worth a lot. But it’s not really the kadane algorithm.
> It inserts a kadane-like summation in between elements for each suffix
> generated. Kadane obtains the sum on a single pass through the array.
> However it’s an incredibly elegant refactoring of the brute force example
> and saves performing partial sums on the suffixes.
> > > >>
> > > >> I will say after figuring out exactly what is was doing it wasn’t
> intuitively obvious (to me anyway) that this should work. A naive view is
> that the largest sum in the example below is produced by the subsequence :
> > > >> 4 _1 2 1
> > > >>
> > > >> So that sequence is never generated in Jose’s version of maximum
> sum. However due to it’s Kadane-like properties it is generating the
> highest sum for each suffix as if the partial sum started at the first
> element. In essence using a kadane-like approach in place of performing
> partial sums. Therefore in one pass on each suffix you find the greatest
> partial sum without having to calculate each partial sum individually.
> > > >>
> > > >> Jose’s version is fairly quick coming in at about double the
> processing time of Jose’s kadane”0 version and well below the brute force
> method of taking the partial sums of all the suffixes.
> > > >>
> > > >> Tom McGuire
> > > >>
> > > >>> For example, the maximum sum subarray,
> > > >>>
> > > >>>
> > > >>>  kad _2 1 _3 4 _1 2 1 _5 4
> > > >>> 6
> > > >>>
> > > >>>
> > > >>>   kad i.0
> > > >>> __
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> On Mon, Apr 3, 2023 at 5:22 AM Elijah Stone 
> wrote:
> > > >>>
> > > >>>> Your kadane routines are all bound to have asymptotically poor
> space usage
> > > >>>> under the present interpreter because >./ is not fused; so they
> all must
> > > >>>> create an i

Re: [Jprogramming] kadane algorithm vs brute force timing and memory

2023-04-03 Thread Jose Mario Quintana
For what it is worth...

kad=. >./@:(([ >. +)/\.)


For example, the maximum sum subarray,


  kad _2 1 _3 4 _1 2 1 _5 4
6


   kad i.0
__





On Mon, Apr 3, 2023 at 5:22 AM Elijah Stone  wrote:

> Your kadane routines are all bound to have asymptotically poor space usage
> under the present interpreter because >./ is not fused; so they all must
> create an intermediate result array whose length is the same as ranvec,
> and
> then apply >./.  I think (haven't looked very closely) that locmax is the
> same
> as your final answer; so you could skip generating the intermediate array
> and
> simply look at locmax.  Better yet, get rid of the global variable, and
> turn
> this all into a fold single (rather than fold multiple), where locmax
> becomes
> the running value.
>
> On Mon, 3 Apr 2023, Elijah Stone wrote:
>
> >   7!:2 '>./ 1 kadane\ ranvec' [ locmax=: __
> > 1412576
> >7!:2 '>./ kadane"0 ranvec' [ locmax=: __
> > 772960
> >7!:2 '>./ kadane"1 ranvec2' [ locmax=: __ [ ranvec2=: ,.ranvec
> > 1412960
> >1 <@$@$\ i.5
> > ┌─┬─┬─┬─┬─┐
> > │1│1│1│1│1│
> > └─┴─┴─┴─┴─┘
> ><@$@$"0 i.5
> > ┌─┬─┬─┬─┬─┐
> > │0│0│0│0│0│
> > └─┴─┴─┴─┴─┘
> >
> > 1 kadane\ y applies kadane to length-1 subsequences of y--that is, in
> this
> > case, vectors, which have length 1.  Whereas kadane"0 applies to cells
> of y,
> > which have rank 0.  More space is required to store a length-1 vector
> than a
> > scalar, since in the former case the length also needs to be stored.
> >
> > On Mon, 3 Apr 2023, Thomas McGuire wrote:
> >
> >> I’m wondering if someone with more J internals knowledge can tell me
> why my
> > Kadane algorithm implementation is taking up more memory than my naive
> brute
> > force method that generates all subsequences then sums them. The time is
> > about what I would expect except for the FOLD operation. The time space
> data
> > were generated on a MacBook Pro 2019 era I9 processor 2.3GHz.
> >>
> >>   ranvec =: _5 + ?1$10
> >>   kadane =: 3 : 'locmax =: y >. locmax + y'
> >>   kadane1 =: 3 : 'locmax =: (] >. locmax&+) y'
> >>
> >>   NB. first brute force implementation
> >>   timespacex '>./(>./@(+/\))\.ranvec'
> >> 0.032948 396448
> >>
> >>   NB. fork version brute force
> >>   timespacex '>./([: >./ (+/\))\. ranvec'
> >> 0.034208 396448
> >>
> >>   NB. first kadane implementation
> >>   locmax =: __
> >>   timespacex '>./ 1 kadane\ranvec'
> >> 0.004034 1.41251e6
> >>
> >>   NB. fork kadane version
> >>   locmax =: __
> >>   timespacex '>./ 1 kadane1\ranvec'
> >> 0.005267 1.41277e6
> >>
> >>   NB. new dnfs anonymous kadane function
> >>   locmax =: __
> >>   timespacex '>./ 1 {{locmax =: y >. locmax + y}}\ranvec'
> >> 0.003625 1.41347e6
> >>
> >>   NB. fork dnfs anonymous kadane function
> >>   locmax =: __
> >>   timespacex '>./ 1 {{locmax =: (] >. locmax&+) y}}\ranvec'
> >> 0.004776 1.41386e6
> >>
> >>   NB. Fold kadane implementation
> >>   timespacex '>./ __ ] F:. ([ >. +) ranvec'
> >> 0.017393 905792
> >>
> >> This was all part of a J Tutorial I have written
> > https://code.jsoftware.com/wiki/User:Tom_McGuire/KadaneAlgorithmTutorial
> >>
> >> Tom McGuire
> >> --
> >> 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


Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-22 Thread Jose Mario Quintana
I suspect that at least one of us is or was quite confused.  At any rate,
the challenge was and still is to produce a tacit fixed conjunction
counterpart of the explicit conjunction INTEGRATE using a j903 interpreter;
see,

[Jprogramming] Evaluating a Gerund Array (jsoftware.com)
<http://www.jsoftware.com/pipermail/programming/2015-April/041621.html>

On Sun, Jan 22, 2023 at 2:50 PM Raul Miller  wrote:
>
> Well.. hmm...
>
> First off, I have made mistakes in previous posts. I think that the
> old t. primitive has yet to receive a library implementation. That's
> on my personal "things I would like to do" list. This may be relevant
> here, given your reference to past discussions. I vaguely remember
> making incorrect statements about lack of library support for removed
> primitives.. I have not dug far enough here to know whether that's
> relevant in this context or not.
>
> Second, though, given your work with "cloaked verbs", hearing that the
> interpreter shut down isn't surprising -- that has also been my
> experience when working with such things.
>
> But I would be surprised if manipulating regular gerunds would shut
> down the interpreter. (These sorts of bugs might exist, but with a
> good bug report, they would get fixed. But, ... that might close the
> "cloaked verb" loophole, I guess.)
>
> Anyways, this worked;
>
>   ({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
> 0
>({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
> 1542
>({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
> 5
>({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
> 0.184449
>
> And, I guess I could elaborate on that by building larger trains.
>
> For example:
>
>  ({{(x`:6)@:(y`:6)`''}}/200#(200$[`])`:6`'')`:6] 12345
> 12345
>
> Or
>
>  ({{(x`:6)@:(y`:6)`''}}/200#(200$+`%)`:6`'')`:6] 1
> 223.787
>
> This was rather slow -- which should probably be expected from that
> stepwise generation of a gerund containing 4 verbs. But it did not
> shut down J.
>
> FYI,
>
> --
> Raul
>
> On Sun, Jan 22, 2023 at 1:21 PM Jose Mario Quintana
>  wrote:
> >
> > I am replying inline...
> >
> > On Sun, Jan 15, 2023 at 6:09 PM Raul Miller 
wrote:
> > >
> > > On Sun, Jan 15, 2023 at 3:38 PM Jose Mario Quintana
> > >  wrote:
> > > > I am aware that BQN has first-class functions.  Is there any other
array
> > > > language that also has them?
> > >
> > > In this context, a mozilla page on "first class functions" is
interesting:
> > >
> > > https://developer.mozilla.org/en-US/docs/Glossary/First-class_Function
> > >
> > > "A programming language is said to have First-class functions when
> > > functions in that language are treated like any other variable. For
> > > example, in such a language, a function can be passed as an argument
> > > to other functions, can be returned by another function and can be
> > > assigned as a value to a variable."
> > >
> > > -
> > >
> > > Here, BQN uses upper case vs. lower case to distinguish the role of a
> > > function definition (roughly analogous to distinguishing between a
> > > gerund and its verb form).
> >
> > Right, I personally do not like too much that convention; in general, I
use
> > lowercase names for functions and uppercase names for nouns (which I
seldom
> > use).
> >
> > >
> > > From a user perspective this is largely a syntactic issue (though, of
> > > course, there's also implementation issues).
> >
> > The key word is "largely."  Any gerund still is a noun; thus, gerunds
are
> > just representations of their associated functions.
> >
> > >
> > > -
> > >
> > > The K/Q approach is also interesting here. (K is a family of languages
> > > rather than a single language -- it's intentionally undocumented with
> > > large differences between releases, and Q is (somewhat more stably)
> >
> > There is a fair amount of q documentation here,
> >
> > Reference card | kdb+ and q documentation - Kdb+ and q documentation
> > (kx.com) <https://code.kx.com/q/ref/>
> >
> > > implemented in K.) Here, arrays are themselves "first class functions"
> > > -- specifically indexing a list has the same syntax as calling a
> > > function. There's no rank (all arrays are rank 1, though they may
> >
> > Right, since there are list of lists of ... ;so, that does seem to be a
big
> > issue (although one would have to write, for example, verbs for matrix
> >

Re: [Jprogramming] Verbs returning verbs

2023-01-22 Thread Jose Mario Quintana
> If a programmer is restricted to the tacit language (why? - I dunno)

I am a tacit fan(atic) for several reasons.  Here are just four: once
fixed, tacit entities mind their own business without interference either
way with other tacit entities or otherwise; maybe is no longer a
performance issue but, at least aesthetically, I find JTRAN ugly, and one
cannot code tacit JTRAN inadvertently; tacit entities, unorthodox entities
included, satisfy all my specific needs; and coding tacitly brings me joy.
"Every mind is a world."

> I haven't followed the proposals closely.  All I know is that having a
> verb return a non-noun is going to create havoc inside JE.

Then, I am afraid, it is too late now for j to have officially genuine
first-class citizens.  This not only affects the completeness of tacit
adverbial and conjunctional programming, but tacit verbal programming
despite being Turing complete (in principle) becomes is also abated versus
its explicit/hybrid counterpart.  I am not really surprised, I do not know
of any implementor, past or present, of an array programming language who
has recommended coding tacit entities beyond short entities with the
exception of the implementor of Jelly which only allows coding tacitly.

On Tue, Jan 17, 2023 at 6:53 PM Henry Rich  wrote:
>
> Verbs are first-class in J, in that they can be passed as ARs or by name
> and invoked in an explicit verb. Nothing more is needed.
>
> If a programmer is restricted to the tacit language (why? - I dunno)
> verbs cannot be first-class.  That seems to matter to some people.  I
> was trying to give them something.  I don't love the proposal either,
> but it seems pretty harmless.
>
> Any dangerous verb that attempts to return a non-noun is going to be
> crash-prone.  What would DV"0 (6 6)$'+' mean?  Its result is what type?
> what shape?
>
> I haven't followed the proposals closely.  All I know is that having a
> verb return a non-noun is going to create havoc inside JE.
>
> Henry Rich
>
> On 1/17/2023 6:42 PM, Elijah Stone wrote:
> > I don't love the proposal, as I think a conception of verbs as first
> > class should involve _less_ hackery with representations, not more.
> > But I don't feel that strongly either way.
> >
> > More fruitful, IMO, would be to work out how to add closures, as I
> > think there is a more urgent need for that (u./v. is a band-aid).
> > Perhaps taking inspiration from kernel (but skipping the mutation!).
> >
> > On Mon, 16 Jan 2023, Henry Rich wrote:
> >
> >> I have never understood the zeal for having verbs return verbs, but
> >> it must be real if some are willing to use dangerous backdoor hacks
> >> into JE to achieve it. ARs make it possible to pass verbs around, but
> >> executing them requires dropping into explicit code.  To remedy this,
> >> I offer a proposal, backward compatible with older J:
> >>
> >> 1. (". y) and Apply (x 128!:2 y) to be modified so that if the result
> >> of execution is not a noun, it is replaced by its AR (instead of ''
> >> as previously).
> >>
> >> 2. (". y) and Apply to be modified so that if y (for ".) or x (for
> >> Apply) is boxed, the sentence is executed as usual except that each
> >> box is converted using (box 5!:0) before being put onto the execution
> >> stack.
> >>
> >> The idea is that you can execute (".
> >> expr-producing-AR,exp-producing-AR,...) without having to get any
> >> modifiers involved.
> >>
> >> Sentence execution can produce ARs, and can take ARs created by verbs
> >> to represent verbs and modifiers.  That sounds pretty classy to me,
> >> but I don't know whether it's first-class.
> >>
> >> Henry Rich
> >>
> >>
> >>
> >> --
> >> 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


Re: [Jprogramming] Verbs returning verbs

2023-01-22 Thread Jose Mario Quintana
> to achieve it.  ARs make it possible to pass verbs around, but executing
> them requires dropping into explicit code.  To remedy this, I offer a

Unorthodox tacit verbs can execute them.

> Sentence execution can produce ARs, and can take ARs created by verbs to
> represent verbs and modifiers.  That sounds pretty classy to me, but I
> don't know whether it's first-class.

Yet, imao it is not first-classy, according to Wikipedia,

"
In computer science, a programming language is said to have first-class
functions if it treats functions as first-class citizens. This means the
language supports passing functions as arguments to other functions,
returning them as the values from other functions, and assigning them to
variables or storing them in data structures.[1] Some programming language
theorists require support for anonymous functions (function literals) as
well.[2] In languages with first-class functions, the names of functions do
not have any special status; they are treated like ordinary variables with
a function type.[3]
"

Verbs, in particular, should be able to take and produce verbs, the atomic
representations of verbs do not qualify because their type is noun, not
verb.  The verb <, for instance, should be able to take a verb and produce
a boxed verb; more generally, all the other structural verbs should work
similarly, in particular, verbs should be able to take boxed arrays of
nouns, verbs, adverbs, and conjunctions and produce similar constructions,
or any entity (noun, verb, adverb, or conjunction).

By cloaking adverbs and conjunctions as verbs all of the above is possible
when hacking, for instance, a j806 official interpreter.  Atomic
representations are bulky relative to what they represent; this might not
be much of an issue when one is hand coding.  However, it may become an
issue when producing and executing lots of large verbs automatically.  The
following is a tiny demonstration using a single short verb from the
standard library,

   9!:14''
j806/j64nonavx/windows/release/commercial/
www.jsoftware.com/2017-11-06T10:01:33

   fix=. (;:'f.') cloak=. (0:`)(,^:) NB. cloaking f. as a verb

A=. 5!:1< 'splitnostring' NB. not shown because is messy
   (B=. <@:fix'splitnostring') NB. boxing splitnostring
┌─┐
│#@[ }.&.> [ ((i.@#@] e. #@[ ({~^:a:&0@(,&_1)@(] I. +) { _1 ,~ ]) I.@E.)
<;.1 ]) ,│
└─┘

   stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.:@:(<;._2@,~) ]) [ (0 0 $
13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.:@:(<;._2@,~)
]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_)


   stp 71 NB. recovering the verb
A 5!:0
>B
)
┌┬─┬──┬┐
│Sentence│Space│Time  │Space * Time│
├┼─┼──┼┤
│A 5!:0  │6784 │5.33662e_6│0.0362036   │
├┼─┼──┼┤
│>B  │768  │6.05634e_7│0.000465127 │
└┴─┴──┴┘

Furthermore, one can produce tacit adverbs which refer tacitly to the
arguments of the verbs that they produce. (I asked this question before:
can one do that with the help of j90x enhanced retro-trains?  I did not get
an answer)  One can also produce tacit adverbs which provide scope to
anonymous recursive verbs defined using $:; so they can be embedded in
other tacit anonymous verbs and work as intended.  One can produce useful
curried tacit adverbs of arbitrary (fixed or variable) arity, including
fixed 2-arity adverbs (aka, double adverbs) which can be used as an
alternative to tacit conjunctions (user-defined tacit conjunctions are not
possible in j806 because the train (a c a) is absent) and allow one to
write (nv nv a) instead of (nv c nv).  Thus, j806 unorthodox tacit
adverbial programming is complete.

On Mon, Jan 16, 2023 at 8:35 PM Henry Rich  wrote:
>
> I have never understood the zeal for having verbs return verbs, but it
> must be real if some are willing to use dangerous backdoor hacks into JE
> to achieve it.  ARs make it possible to pass verbs around, but executing
> them requires dropping into explicit code.  To remedy this, I offer a
> proposal, backward compatible with older J:
>
> 1. (". y) and Apply (x 128!:2 y) to be modified so that if the result of
> execution is not a noun, it is replaced by its AR (instead of '' as
> previously).
>
> 2. (". y) and Apply to be modified so that if y (for ".) or x (for
> Apply) is boxed, the sentence is executed as usual except that each box
> is converted using (box 5!:0) before being put onto the execution stack.
>
> The idea is that you can execute (".
> expr-producing-AR,exp-producing-AR,...) without having to get any
> modifiers involved.
>
> Sentence execution can produce ARs, and can take ARs created by verbs to
> represent verbs and modifiers.  That sounds pretty classy 

Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-22 Thread Jose Mario Quintana
I am replying inline...

On Sun, Jan 15, 2023 at 6:09 PM Raul Miller  wrote:
>
> On Sun, Jan 15, 2023 at 3:38 PM Jose Mario Quintana
>  wrote:
> > I am aware that BQN has first-class functions.  Is there any other array
> > language that also has them?
>
> In this context, a mozilla page on "first class functions" is interesting:
>
> https://developer.mozilla.org/en-US/docs/Glossary/First-class_Function
>
> "A programming language is said to have First-class functions when
> functions in that language are treated like any other variable. For
> example, in such a language, a function can be passed as an argument
> to other functions, can be returned by another function and can be
> assigned as a value to a variable."
>
> -
>
> Here, BQN uses upper case vs. lower case to distinguish the role of a
> function definition (roughly analogous to distinguishing between a
> gerund and its verb form).

Right, I personally do not like too much that convention; in general, I use
lowercase names for functions and uppercase names for nouns (which I seldom
use).

>
> From a user perspective this is largely a syntactic issue (though, of
> course, there's also implementation issues).

The key word is "largely."  Any gerund still is a noun; thus, gerunds are
just representations of their associated functions.

>
> -
>
> The K/Q approach is also interesting here. (K is a family of languages
> rather than a single language -- it's intentionally undocumented with
> large differences between releases, and Q is (somewhat more stably)

There is a fair amount of q documentation here,

Reference card | kdb+ and q documentation - Kdb+ and q documentation
(kx.com) <https://code.kx.com/q/ref/>

> implemented in K.) Here, arrays are themselves "first class functions"
> -- specifically indexing a list has the same syntax as calling a
> function. There's no rank (all arrays are rank 1, though they may

Right, since there are list of lists of ... ;so, that does seem to be a big
issue (although one would have to write, for example, verbs for matrix
multiplication and inverse unless a suitable library is available).

> contain arrays analogous to J's boxing) and K's monadic verbs support
> a multi-argument sort of valence analogous to APL's multi-dimensional
> indexing A[1 2 3; 4 5 6;7 8 9] for example. And you might get into
> different operators when applying "functions" to values (though,
> because of the many versions, it's difficult to describe this
> comprehensively).

Lo and behold, q verbs are genuinely first-class, they can take and produce
verbs and, apparently, is the recommended way to program functionally in q.
The following is a toy example to illustrate the method by calculating a
sum of squares,

q){x y z}[(+/);{x xexp 2}]
{x y z}[+/;{x xexp 2}]
q)({x y z}[(+/);{x xexp 2}]) 1 2 3 4 / redundant parentheses for clarity
30f

or one could use the built-in keyword ' instead of {x y z}.  In j, of
course, one can do this,

   +/@:*:
+/@:*:
   (+/@:*:) 1 2 3 4
30

Yet, there is a subtle potentially critical difference, the q version {x y
z} is dynamic, but the j version @: is not because @: is a conjunction (not
surprisingly, tacit j8xx dynamic versions are possible when black cats are
involved).

>
> -
>
> Anyways, ... I guess one of the things which makes J's gerunds be
> considered as "not first class" is that they have a unique syntax
> which must be used when we consider them as verb definitions -- more
> specifically we can't use some of this syntax with actual verb
> definitions. (Interestingly, in some contexts, this distinction
> vanishes. So in those contexts we might consider verbs as first class
> while thinking of adverbs and conjunctions as not first class.)
>

Some time ago we had a similar discussion, I mentioned that, in my opinion,
the j9xx tacit tools were relatively weak and I proposed an exercise that
was just beyond trivial,

[Jchat] Was [Jprogramming] Tacit completeness (jsoftware.com)
<http://www.jsoftware.com/pipermail/chat/2021-December/009017.html>

Unfortunately, the j903 calculus add-on was unusable for that purpose.  I
wonder if some progress has been made.

Perhaps, this thread should be moved to the Chat forum although I would
like to see some j90x code here; but, I will let others decide.

> 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


Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-15 Thread Jose Mario Quintana
> If there is ever an attack on the supreme majesty that is Cloak, I do
hope n: is implemented instead.

Unfortunately, once a black cat is out of the bag it becomes potential prey
making them an endangered species.  If worse comes to worst, I bet your
proposed n: could become handy.  However, it would be a band-aid for a
symptom of a weakness that has been noted, publicly and privately, by
current and past members of the forum (you included if I recall correctly);
namely, J does not have first-class functions (verbs are meant to take and
produce nouns, and adverbs and conjunctions are meant to take nouns and
verbs and produce nouns, verbs, and conjunctions).  This weakness goes
unnoticed unless one attempts to perform certain kinds of tasks (e.g., to
dynamically produce and execute lots of verbs, and becomes, in particular,
virtually impossible to do so tacitly, unless one releases a black cat to
catch the mice).

I am aware that BQN has first-class functions.  Is there any other array
language that also has them?



On Fri, Jan 13, 2023 at 7:38 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> To answer Raul,  I did not use r2m after all.  oa through the magic of
cloak allows 'Adverb' oa ('X' oa in example) where Adverb has a noun
parameter.
>
> >  I had: u n: A y is (u y) A y.  Whereas you have u r2m A y as simply (u
y) A.
>
> if [x] u n: A y produced the result of x u y as input to A, then that is
a legal way to get Adverb noun inputs from a verb phrase.  An adverb can
create modifiers is the main benefit, and necessity for the functionality.
>
>
> I feel that u n: A y as (u y) A y would be for producing verbs and noun
results, and can be written as 1 : '(u y) A y' though that doesn't let you
produce a conjunction from A and return (C y).
>
> If there is ever an attack on the supreme majesty that is Cloak, I do
hope n: is implemented instead.
>
>
> On Friday, January 13, 2023 at 05:39:30 p.m. EST, Elijah Stone <
elro...@elronnd.net> wrote:
>
>
>
>
>
> Oh, my n: is a little less expressive than your r2m.  I had: u n: A y is
(u y)
> A y.  Whereas you have u r2m A y as simply (u y) A.
>
> On Fri, 13 Jan 2023, Elijah Stone wrote:
>
> > I proposed your 'r2m' as a primitive n: (for 'now') a while ago, and
received
> > a lukewarm response.  I don't think it can be implemented other than as
a
> > primitive.  (And I still think it would be a good idea to have.)
> >
> > Your solution which quotes the modifier name works, but I find it
> > distasteful.
> > And it has some trouble with conjunctions; how do you disambiguate the
> > following?
> >
> > (u r2m) C v
> >
> > u C (v r2m)
> >
> > (u r2m) C (v r2m)
> >
> > You can't, so you would need a separate form for each.
> >
> > On Fri, 13 Jan 2023, 'Pascal Jasmin' via Programming wrote:
> >
> >> X =: 1 : 'm&+'
> >>
> >>
> >> What definition of r2m (result to m argument) below would allow X to
see
> > the result of + y (or x+y) as its m argument?
> >>
> >> + r2m X 3
> >>
> >> purpose would be for X to produce a modifier from application of
"verb".
> > Requirement is only that y argument (3 above) is outside any verb
phrase.
> >>
> >> Jose/Dan's Cloak magic? turn result into atomic or linear
representation?
> >> --
> >> 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
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-14 Thread Jose Mario Quintana
> Cloak strikes again,

The power conjunction remains (too?) powerful :)

Many years ago a car magazine was interviewing a few car racing drivers
regarding their impressions of a new sports car after testing it for a few
days; one whined that the engine was too powerful and another retorted with
a smile that no engine could ever be too powerful.  (Some car manufacturers
restrict the power of the engines and, of course, there are producers of
gadgets that unleash the power.)

On Fri, Jan 13, 2023 at 12:11 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Cloak strikes again,
>
> isNoun_z_ =: (0 = 4!:0 ( :: 0:))@:<
> eval_z_ =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.' NB.1 : ' a: 1
: m'
> aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 <
''q'' '
> Cloak=: aar(0:`)(,^:)
> oa =: 1 :'u Cloak @:' NB. apply quoted adverb after result. Can produce
modifier
>
>
> + 'X' oa 32
>
> 32&+
>
> 2 (+ 'X' oa) 32
>
> 34&+
>
> 2 + ('X' oa) 32
>
> 34&+
>
>
>
>
>
> On Friday, January 13, 2023 at 11:19:49 a.m. EST, 'Pascal Jasmin' via
Programming  wrote:
>
>
>
>
>
> X =: 1 : 'm&+'
>
>
> What definition of r2m (result to m argument) below would allow X to see
the result of + y (or x+y) as its m argument?
>
> + r2m X 3
>
> purpose would be for X to produce a modifier from application of "verb".
Requirement is only that y argument (3 above) is outside any verb phrase.
>
> Jose/Dan's Cloak magic? turn result into atomic or linear representation?
> --
> 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


Re: [Jprogramming] more fun with parallelism

2023-01-10 Thread Jose Mario Quintana
Exactly,

   e=. &.>
   u=. ('('"_ , 'u '"_ , ] , ')'"_) :('('"_ , [ , ' u '"_ , ] , ')'"_)
   YS=. <;._1 ' Y0 Y1 .. YN'


   u e/\YS
┌──┬─┬┬───┐
│Y0│(Y0 u Y1)│(Y0 u (Y1 u ..))│(Y0 u (Y1 u (.. u YN)))│
└──┴─┴┴───┘

   u e scan YS
┌──┬─┬┬───┐
│Y0│(Y0 u Y1)│((Y0 u Y1) u ..)│(((Y0 u Y1) u ..) u YN)│
└──┴─┴┴───┘





On Tue, Jan 10, 2023 at 3:25 PM Raul Miller  wrote:

> scan=. ((~/)\.)(&.|.)
>-scan p:i.5
> 2 _1 _6 _13 _24
>-/\ p:i.5
> 2 _1 4 _3 8
>
> --
> Raul
>
> On Tue, Jan 10, 2023 at 3:18 PM Jose Mario Quintana
>  wrote:
> >
> > Indeed,
> >
> >scan=. ((~/)\.)(&.|.)
> >
> >%&:{./"_1 +/ .*  /\ (1 0,:~,&1)"0 ]10$1
> > 1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818
> >%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]10$1
> > 1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818
> >
> >stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (,
> */&.:>@:(1
> > 2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.:@:(<;._2@,~) ]) [ (0 0 $
> > 13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.:@:(<;._2@
> ,~)
> > ]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_)
> >
> >stp 11
> > %&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]1000$1
> > %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]1000$1
> > )
> >
> ┌─┬──┬───┬┐
> > │Sentence │Space │Time   │Space *
> > Time│
> >
> ├─┼──┼───┼┤
> > │%&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]1000$1│79552 │0.059218   │4710.91
> >   │
> >
> ├─┼──┼───┼┤
> > │%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]1000$1│206656│0.000644564│133.203
> >   │
> >
> └─┴──┴───┴┘
> >
> >2,1}.,1 1&,"0]2*1+i.3
> > 2 1 2 1 1 4 1 1 6
> >
> >%&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.3
> > 2 3 2.7 2.75 2.71429 2.71875 2.71795 2.71831 2.71828
> >%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.3
> > 2 3 2.7 2.75 2.71429 2.71875 2.71795 2.71831 2.71828
> >
> >
> >stp 11
> >%&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.30
> >%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.30
> > )
> >
> ┌┬─┬───┬┐
> > │Sentence│Space│Time
> > │Space * Time│
> >
> ├┼─┼───┼┤
> > │   %&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1
> > 1&,"0]2*1+i.30│19840│0.00190225 │37.7407 │
> >
> ├┼─┼───┼┤
> > │   %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1
> > 1&,"0]2*1+i.30│30336│0.000149318│4.52972 │
> >
> └┴─┴───┴┘
> >
> > NB. 300 instead of 30 is too many...
> >
> > On Mon, Jan 9, 2023 at 11:21 AM Henry Rich  wrote:
> >
> > > f/\ is quadratic but f/\. shouldn't be.
> > >
> > > Henry Rich
> > >
> > > On 1/9/2023 11:20 AM, Marshall Lochbaum wrote:
> > > > It's not just Fibonacci numbers. This is equivalent to a general
> method
> > > > for computing continued fractions convergents in linear time, using
> > > > matrix multiplication. There's a nice explanation of why it works in
> > > > here:
> > > >
> > > > https://perl.plover.com/classes/cftalk/INFO/gosper.txt
> > > >
> > > > And a J version, with phi's continued fraction 1 1 1... :
> > > >
> > > > %&:{./"_1 +/ .*/\ (1 0,:~,&1)"0 ]10$1
> > > > 1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818
> > > >
> > > 

Re: [Jprogramming] more fun with parallelism

2023-01-10 Thread Jose Mario Quintana
Indeed,

   scan=. ((~/)\.)(&.|.)

   %&:{./"_1 +/ .*  /\ (1 0,:~,&1)"0 ]10$1
1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818
   %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]10$1
1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818

   stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.:@:(<;._2@,~) ]) [ (0 0 $
13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.:@:(<;._2@,~)
]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_)

   stp 11
%&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]1000$1
%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]1000$1
)
┌─┬──┬───┬┐
│Sentence │Space │Time   │Space *
Time│
├─┼──┼───┼┤
│%&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]1000$1│79552 │0.059218   │4710.91
  │
├─┼──┼───┼┤
│%&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]1000$1│206656│0.000644564│133.203
  │
└─┴──┴───┴┘

   2,1}.,1 1&,"0]2*1+i.3
2 1 2 1 1 4 1 1 6

   %&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.3
2 3 2.7 2.75 2.71429 2.71875 2.71795 2.71831 2.71828
   %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.3
2 3 2.7 2.75 2.71429 2.71875 2.71795 2.71831 2.71828


   stp 11
   %&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.30
   %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.30
)
┌┬─┬───┬┐
│Sentence│Space│Time
│Space * Time│
├┼─┼───┼┤
│   %&:{./"_1 +/ .*/\   (1 0,:~,&1)"0 ]2,1}.,1
1&,"0]2*1+i.30│19840│0.00190225 │37.7407 │
├┼─┼───┼┤
│   %&:{./"_1 +/ .*scan (1 0,:~,&1)"0 ]2,1}.,1
1&,"0]2*1+i.30│30336│0.000149318│4.52972 │
└┴─┴───┴┘

NB. 300 instead of 30 is too many...

On Mon, Jan 9, 2023 at 11:21 AM Henry Rich  wrote:

> f/\ is quadratic but f/\. shouldn't be.
>
> Henry Rich
>
> On 1/9/2023 11:20 AM, Marshall Lochbaum wrote:
> > It's not just Fibonacci numbers. This is equivalent to a general method
> > for computing continued fractions convergents in linear time, using
> > matrix multiplication. There's a nice explanation of why it works in
> > here:
> >
> > https://perl.plover.com/classes/cftalk/INFO/gosper.txt
> >
> > And a J version, with phi's continued fraction 1 1 1... :
> >
> > %&:{./"_1 +/ .*/\ (1 0,:~,&1)"0 ]10$1
> > 1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765 1.61818
> >
> > Here's the continued fraction sequence for e:
> >
> > 2,1}.,1 1&,"0]2*1+i.3
> > 2 1 2 1 1 4 1 1 6
> >
> > %&:{./"_1 +/ .*/\ (1 0,:~,&1)"0 ]2,1}.,1 1&,"0]2*1+i.3
> > 2 3 2.7 2.75 2.71429 2.71875 2.71795 2.71831 2.71828
> >
> > My timings show J taking quadratic time for the scan, so this
> > formulation is pretty slow but shows the principle.
> >
> > Marshall
> >
> > On Sun, Jan 08, 2023 at 07:05:46PM -0800, Elijah Stone wrote:
> >> Can we generate phi, the golden ratio, in parallel?
> >>
> >> Of course we can!  Follows is an exposition of a classic method for
> doing
> >> it, which may be of interest; I have not seen it satisfactorily
> described
> >> elsewhere.
> >>
> >> The classic method for generating phi in j uses a continued fraction:
> >>
> >> (+%)/10#1
> >> 1.61818
> >>
> >> (It can be equivalently spelt (1+%)^:n]1.)
> >>
> >> Using rational numbers clarifies slightly:
> >>
> >> (+%)/10#1x
> >> 89r55
> >>
> >> Unsurprisingly, it's generating ratios of successive fibonacci
> numbers.  Can
> >> it be parallelised?  The operation used for reduction is not
> associative:
> >>
> >> ((1 +% 1) +% 1) -: (1 +% (1 +% 1))
> >> 0
> >>
> >> So it's not obvious how we would parallelise it.  Taking a step back, it
> >> performs repeated division, where we don't know the divisor a priori,
> >> instead generating it recursively, so attacking it thus seems hopeless.
> >>
> >> Here's another method, based more directly on fibonacci numbers, which
> is
> >> more promising:
> >>
> >> (u=. {:,+/)^:9]1 1
> >> 55 89
> >>
> >> Here we generate fibonacci numbers via a recurrence relation, using two
> >> successive terms to generate the next.
> >>
> >> At first glance, this seems just as hopelessly sequential as the first
> >> solution, but the use of ^: is a tell.  u^:n is the same as u@:u@:u@:
> ... n
> >> times.  And _@:_ is associative!  So if we can somehow express the
> operation
> >> of u as 'data', and ditto the composition of any number of us, then we
> can
> >> create a big array of n copies of u, and then reduce @: over 

Re: [Jprogramming] Plot a Squircle in J

2022-08-19 Thread Jose Mario Quintana
Yes, that was a good catch and a neat approach to the problem in the
first place.  The following is a slight variation,

viewmat((1>+/~@:(4^~(%~i:)))*.1<+/~@:(2^~(%~i:)))666[load'viewmat'

that works in j806 (untested in a full installation of j903).




On Wed, Aug 17, 2022 at 10:41 AM Raul Miller  wrote:
>
> On Tue, Aug 16, 2022 at 11:24 PM 'Rob Hodgkinson' via Programming
>  wrote:
> > But I noticed that since this is to the 4th power, why do you invoke +&| ?
>
> Hmm...
>
> Well, had I simplified that expression from some code I had written
> previously where the power was an argument (and often fractional).
> And, I had been working with complex numbers recently which led me to
> overlook that potential simplification
>
> (For example:
>
>1ad30^4
> _0.5j0.866025
>
> )
>
> Though I can't think of any useful reason to support complex arguments
> and I certainly didn't use them in that sentence.
>
> But... you asked...
>
> Anyways: good catch.
>
> 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


Re: [Jprogramming] Please remind me of the reason

2022-08-19 Thread Jose Mario Quintana
That would be good, thank you.

On Thu, Aug 18, 2022 at 12:19 PM Henry Rich  wrote:
>
> I must have lost the test for 'explicit definition running' during one
> of the rewrites.
>
> The original (6.02) seems to have it that xyuv are stacked by value when
> an explicit definition is running.  (Not mn).  uv must be stacked by
> value because they are passed as verb arguments into modifiers; xy
> needed that treatment in 6.02 because they might be verb arguments, but
> that usage has been eliminated.
>
> I will change it so that only u v u. v. are stacked by value (and thus
> get value error if undefined), and only when used while an explicit
> definition is running.
>
> x y m n will be like any other names.
>
> Henry Rich
>
> On 8/17/2022 2:41 PM, Jose Mario Quintana wrote:
> > Yet, as I recall, some change in behavior was introduced rather recently,
> >
> > NB. Fresh sessions...
> >
> >
> > 9!:14''
> > j902/j64/windows/beta-l/commercial/www.jsoftware.com/2020-11-05T15:47:37/clang-9-0-0/SLEEF=1
> >
> > x
> > x
> >
> >
> > 9!:14''
> > j903/j64/windows/release-a/commercial/www.jsoftware.com/2021-12-16T15:20:38/clang-13-0-0/SLEEF=1
> >
> > x
> > |value error
> > |   x&y
> >
> >
> > See,
> >
> > [Jprogramming] "accessor" concepts (jsoftware.com)
> > http://www.jsoftware.com/pipermail/programming/2021-September/058773.html
> > [Jprogramming] "accessor" concepts (jsoftware.com)
> > http://www.jsoftware.com/pipermail/programming/2021-September/058775.html
> >
> > and
> >
> > [Jprogramming] "accessor" concepts (jsoftware.com)
> > http://www.jsoftware.com/pipermail/programming/2021-September/058776.html
> >
> >
> >
> >
> > On Tue, Aug 16, 2022 at 11:52 PM Henry Rich  wrote:
> >> Ah, now I remember.
> >>
> >> First, a little detail: when you have the name 'func' in a sentence, and
> >> func is defined as a non-noun, what actually gets put onto the execution
> >> stack is
> >>
> >> 'func'~
> >>
> >> This is what we mean by a 'reference' to the name func.  The reference
> >> is a non-noun, and when it gets executed, the name 'func' is looked up
> >> (again) and its value is executed.
> >>
> >> [For those of us who worry about clock cycles (a set whose cardinality
> >> is perhaps one), the second lookup is wasted effort, and all the more
> >> vexing because of search paths and multiple threads; whence we have
> >> nameref caching and special treatment of nameless adverbs and one-word
> >> references.]
> >>
> >> Using references, a tacit function can refer to an undefined name, and
> >> as long as the name is resolved before the function is /executed/, all
> >> will be well.
> >>
> >> BUT.  Consider the sentence (in an explicit modifier):
> >>
> >>  u otherverb y
> >>
> >> What should be stacked for u?  'u'~ will not do, because that reference
> >> will be passed to otherverb, in whose space u will not have the right
> >> value when it is looked up.  No, u must be passed by /value/; and
> >> because there is no way to tell where a stacked value will go, /any/
> >> reference to u or v must be stacked by value (that is, its value is
> >> stacked instead of 'u'~).
> >>
> >> What I have shown here is that u and v must be stacked by value rather
> >> than by reference, always.
> >>
> >> In earlier versions of J, x and y were sometimes verb arguments to
> >> modifiers (like modern u and v).  Thus they too were stacked by value
> >> always, as being easier than deciding when they needed to be values.
> >>
> >> And then m and n were treated the same way, because since they have to
> >> be nouns anyway why not?
> >>
> >> Then, when a name that must be stacked by value is undefined, what is
> >> there to do?  Nothing except value error.
> >>
> >> Henry Rich
> >>
> >>
> >>
> >> On 8/16/2022 2:40 PM, Henry Rich wrote:
> >>> The names mnuvxy have always been special, giving value error if they
> >>> are not defined.  I'm not sure that's necessary now, but that's how it
> >>> is.
> >>>
> >>> The reason for having undefined names stack a reference is so that you
> >>> can have recursive definitions.  The need for that is less with mnuvxy.
> >>>
> >>> Henry Ric

Re: [Jprogramming] Please remind me of the reason

2022-08-17 Thread Jose Mario Quintana
Yet, as I recall, some change in behavior was introduced rather recently,

   NB. Fresh sessions...


   9!:14''
j902/j64/windows/beta-l/commercial/www.jsoftware.com/2020-11-05T15:47:37/clang-9-0-0/SLEEF=1

   x
x


   9!:14''
j903/j64/windows/release-a/commercial/www.jsoftware.com/2021-12-16T15:20:38/clang-13-0-0/SLEEF=1

   x
|value error
|   x&y


See,

[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058773.html
[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058775.html

and

[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058776.html




On Tue, Aug 16, 2022 at 11:52 PM Henry Rich  wrote:
>
> Ah, now I remember.
>
> First, a little detail: when you have the name 'func' in a sentence, and
> func is defined as a non-noun, what actually gets put onto the execution
> stack is
>
> 'func'~
>
> This is what we mean by a 'reference' to the name func.  The reference
> is a non-noun, and when it gets executed, the name 'func' is looked up
> (again) and its value is executed.
>
> [For those of us who worry about clock cycles (a set whose cardinality
> is perhaps one), the second lookup is wasted effort, and all the more
> vexing because of search paths and multiple threads; whence we have
> nameref caching and special treatment of nameless adverbs and one-word
> references.]
>
> Using references, a tacit function can refer to an undefined name, and
> as long as the name is resolved before the function is /executed/, all
> will be well.
>
> BUT.  Consider the sentence (in an explicit modifier):
>
> u otherverb y
>
> What should be stacked for u?  'u'~ will not do, because that reference
> will be passed to otherverb, in whose space u will not have the right
> value when it is looked up.  No, u must be passed by /value/; and
> because there is no way to tell where a stacked value will go, /any/
> reference to u or v must be stacked by value (that is, its value is
> stacked instead of 'u'~).
>
> What I have shown here is that u and v must be stacked by value rather
> than by reference, always.
>
> In earlier versions of J, x and y were sometimes verb arguments to
> modifiers (like modern u and v).  Thus they too were stacked by value
> always, as being easier than deciding when they needed to be values.
>
> And then m and n were treated the same way, because since they have to
> be nouns anyway why not?
>
> Then, when a name that must be stacked by value is undefined, what is
> there to do?  Nothing except value error.
>
> Henry Rich
>
>
>
> On 8/16/2022 2:40 PM, Henry Rich wrote:
> > The names mnuvxy have always been special, giving value error if they
> > are not defined.  I'm not sure that's necessary now, but that's how it
> > is.
> >
> > The reason for having undefined names stack a reference is so that you
> > can have recursive definitions.  The need for that is less with mnuvxy.
> >
> > Henry Rich
> >
> > On 8/16/2022 2:30 PM, David Lambert wrote:
> >> I think you've already explained this, but I don't recall why x and y
> >> should have special status in global namespace.  Perhaps I need to
> >> study the current documentation and release notes?
> >>
> >> $ j
> >>JVERSION
> >> Engine: j904/j64avx2/linux
> >> Beta-e: commercial/2022-07-16T19:24:59
> >> Library: 9.04.01
> >> Platform: Linux 64
> >> Installer: J904 install
> >> InstallPath: /home/lambertdw/downloads/installs/j904
> >> Contact: www.jsoftware.com
> >>
> >>x
> >> |value error
> >> |   x&y
> >>X
> >> X
> >>
> >>i_used_to_be_a_verb
> >> |value error: i_used_to_be_a_verb
> >>
> >> Thanks, Dave.
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
>
>
> --
> This email has been checked for viruses by AVG antivirus software.
> www.avg.com
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Draft reference card for J9.04

2022-08-10 Thread Jose Mario Quintana
#@:(#/)@:>:@:i.@:>:


On Tue, Aug 9, 2022 at 10:32 PM Henry Rich  wrote:

> Special Combination Hauke asked for: if you don't get a laugh from  (#\
> y) you just don't understand J.
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-04 Thread Jose Mario Quintana
I am extremely allergic to explicit adverbs :)  However, I think the
sentence u^:_1 b. _1 provides the name of the proverb, or its linear
representation if it is unnamed (there might be easier ways).  For example,

   test {{ u^:_1 b. _1 }}
test
   datatype test {{ u^:_1 b. _1 }}
literal

   +/@:*: {{ u^:_1 b. _1 }}
+/@:*:
   datatype +/@:*: {{ u^:_1 b. _1 }}
literal

I hope it helps.






On Wed, May 4, 2022 at 4:55 PM Ric Sherlock  wrote:

> Thanks Raul, Elijah & Jose for your thoughts & discussion.
> It's somewhat reassuring to know that I wasn't missing anything simple and
> for my purposes the current solution suffices.
> Out of interest, is it easier to obtain the name of the verb that "u" in
> the adverb refers to?
>
>
> On Thu, May 5, 2022 at 8:08 AM Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
>
> > In principle, and in general, the problem of determining whether two
> > (arbitrary given) verbs would produce the same result for an (arbitrary
> > given) argument is non-computable; otherwise, it would imply that the
> > halting problem is decidable (as far as I know and I can see).
> >
> > In practice, I use a conjunction similar conceptually to the adverb
> > myadverb to verify that two tacit verbs have essentially the same
> > definition (i.e., apart from cosmetic differences (e.g., redundant
> > parentheses or proverbs)).  I also use occasionally an adverb to
> transform
> > tacit verbs defined in terms of caps to the equivalent verbs in terms of
> > ats (@:) (this is basically term rewriting).
> >
> > I hope it helps.
> >
> > On Tue, May 3, 2022 at 9:38 AM Raul Miller 
> wrote:
> >
> > > There isn't really a better way to do that test.
> > >
> > > Conceptually, what you want is a test that determines whether two
> > > verbs would always produce the same results for the same arguments,
> > > but that's a problem involving infinities. It's proof territory.
> > >
> > > That said, typically we solve this kind of problem by hand, rather
> > > than using a test on the structure of the verb.
> > >
> > > Good luck,
> > >
> > > --
> > > Raul
> > >
> > > On Tue, May 3, 2022 at 5:20 AM Ric Sherlock  wrote:
> > > >
> > > > I want to test if a particular verb was provided to my adverb.
> > > > I came up with the solution below. Is there a better way?
> > > >
> > > > myadverb = {{
> > > >   res=. u {:y
> > > >   if. theverb f.`'' -:  u f.`'' do.
> > > > res=. ({.y) ,: res
> > > >   end.
> > > >   res
> > > > }}
> > > >
> --
> > > > 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
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-04 Thread Jose Mario Quintana
In principle, and in general, the problem of determining whether two
(arbitrary given) verbs would produce the same result for an (arbitrary
given) argument is non-computable; otherwise, it would imply that the
halting problem is decidable (as far as I know and I can see).

In practice, I use a conjunction similar conceptually to the adverb
myadverb to verify that two tacit verbs have essentially the same
definition (i.e., apart from cosmetic differences (e.g., redundant
parentheses or proverbs)).  I also use occasionally an adverb to transform
tacit verbs defined in terms of caps to the equivalent verbs in terms of
ats (@:) (this is basically term rewriting).

I hope it helps.

On Tue, May 3, 2022 at 9:38 AM Raul Miller  wrote:

> There isn't really a better way to do that test.
>
> Conceptually, what you want is a test that determines whether two
> verbs would always produce the same results for the same arguments,
> but that's a problem involving infinities. It's proof territory.
>
> That said, typically we solve this kind of problem by hand, rather
> than using a test on the structure of the verb.
>
> Good luck,
>
> --
> Raul
>
> On Tue, May 3, 2022 at 5:20 AM Ric Sherlock  wrote:
> >
> > I want to test if a particular verb was provided to my adverb.
> > I came up with the solution below. Is there a better way?
> >
> > myadverb = {{
> >   res=. u {:y
> >   if. theverb f.`'' -:  u f.`'' do.
> > res=. ({.y) ,: res
> >   end.
> >   res
> > }}
> > --
> > 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


Re: [Jprogramming] RFC: unicode

2022-03-22 Thread Jose Mario Quintana
> Most J programmers can’t tell nouns and adjectives apart.

:D

> We don’t even have a type function returning grammar terms
> indicating what part of speech our entities are. Poor us!

There is the verb type defined in the standard library; unfortunately, it
cannot handle unnamed entities (primitives),

   _5[\ type@:;:'ARGV type define on base a. = / @ ..'
┌┬┬┬┬┐
│noun│verb│adverb  │conjunction │not defined │
├┼┼┼┼┤
│invalid name│invalid name│invalid name│invalid name│invalid name│
└┴┴┴┴┘

> We should have been “more careful.”

Right!  ;)


On Tue, Mar 22, 2022 at 2:22 AM Hauke Rehr  wrote:
>
> Sure.
> Most J programmers can’t tell nouns and adjectives apart.
> We don’t even have a type function returning grammar terms
> indicating what part of speech our entities are. Poor us!
> We should have been “more careful.”
>
> Am 22.03.22 um 01:00 schrieb Raul Miller:
> > Be careful here -- "implementation" and "automatic" are most likely
> > synonyms unless we make very careful distinctions.
>
> --
> --
> mail written using NEO
> neo-layout.org
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Is j turing-complete without parentheses?

2022-02-13 Thread Jose Mario Quintana
This may be the consensus nowadays but some time ago one person thought
that halting (when applicable) was needed, at least to some degree, to make
"Zuse's Z3 a Universal Computer"

Universal_Computer.pdf (fu-berlin.de)
<http://www.inf.fu-berlin.de/inst/ag-ki/rojas_home/documents/1997/Universal_Computer.pdf>



On Fri, Feb 11, 2022 at 7:02 PM Elijah Stone  wrote:
>
> On Fri, 11 Feb 2022, Jose Mario Quintana wrote:
>
> > CA does not halt, unlike classic Turing machines which might halt.
>
> I don't think that's an issue.  Turing-complete languages are not required
> to themselves have the features of a turing machine; only to be able to
> simulate them.  And (some) cellular automata can simulate turing machines,
> hence they are turing complete.
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Is j turing-complete without parentheses?

2022-02-13 Thread Jose Mario Quintana
One can get the last row of

   (3 (0 1 1 1 0 1 1 0 {~ #.)\ 0 0 , ] , 0:)^:(<11) 1
1 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 0 0 0 1 0 0 0 0 0
1 1 1 0 0 1 1 0 0 0 0
1 1 0 1 0 1 1 1 0 0 0
1 1 1 1 1 1 1 0 1 0 0
1 1 0 0 0 0 0 1 1 1 0
1 1 1 0 0 0 0 1 1 0 1

as follows,

   (3 (0 1 1 1 0 1 1 0 {~ #.)\ 0 0 , ] , 0:)^:10 (1)
1 1 1 0 0 0 0 1 1 0 1

Likewise,

   NB. WARNING: save your work!
   (3 (0 1 1 1 0 1 1 0 {~ #.)\ 0 0 , ] , 0:)^:_ (1)

will keep computing, what is meant to be computing, presumably until it
runs out of resources or the process is killed by external means.

Similarly, one can get a list that includes the relevant bits of the last
row of

{&0 1 1 1 0 1 1 0@#.\~&3^:(<11) (,1,])(0#~20)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0

as follows,

{&0 1 1 1 0 1 1 0@#.\~&3^:10 (,1,])(0#~20)
1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0

and, in general, {&0 1 1 1 0 1 1 0@#.\~&3^:N (,1,])(0#~ 2 * N)...  Alas,

   {&0 1 1 1 0 1 1 0@#.\~&3^:_ (,1,])(0#~ 2 * _)
|domain error
|   {&0 1 1 1 0 1 1 0@#.\~&3^:_(,1,])(0#~2*_)

Unlike (3 (0 1 1 1 0 1 1 0 {~ #.)\ 0 0 , ] , 0:)^:_ (1), the process cannot
start.

The question is: what is an alternative way to launch {&0 1 1 1 0 1 1
0@#.\~&3^:_
successfully?




On Fri, Feb 11, 2022 at 7:00 PM Elijah Stone  wrote:
>
> On Fri, 11 Feb 2022, Jose Mario Quintana wrote:
>
> > However, I could not figure out how to use your version to reproduce the
> > usual example.  Can you show us how to do it?
>
> {&0 1 1 1 0 1 1 0@#.\~&3^:(<11) (,1,])(0#~20)
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
> 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
>
> The pattern slides to the left due to padding (because \ lops off the ends
> at each iteration) but is definitely there.
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] limitation of f. , and AC use case as workaround

2022-02-11 Thread Jose Mario Quintana
One can simply use the recursion scope implicit within f. to avoid that
kind of issue,

   rs=. 1 : 0
u y
:
x u y
)

For example,

   fac=. 1:`(* $:@:<:)@.*


   (1 + fac f.)
1 + 1:`(* $:@:<:)@.*
   (1 + fac f.) 3
22

f. implicitly provides an explicit envelope to dodge the problem,

   (1 + fac)f.
1 + 1:`(* $:@:<:)@.* (1 : 0)
u y
:
x u y
)
   (1 + fac)f.  3
7

Similarly,

   fac=. 1:`(* $:@:<:)@.* rs

   (1 + fac f.)
1 + 1:`(* $:@:<:)@.* (1 : 0)
u y
:
x u y
)
   (1 + fac f.) 3
7

   (1 + fac)f.
1 + 1:`(* $:@:<:)@.* (1 : 0) (1 : 0)
u y
:
x u y
)
u y
:
x u y
)
   (1 + fac)f.  3
7

However, "explicit junk" is there which means that there is no easy way
currently to fix tacit verbs, with embedded recursive tacit verbs, to
produce tacit verbs.

The custom j interpreter that I use has a primitive that allows one to
provide tacit recursion scope,

   fac=. 1:`(* $:@:<:)@.* O.0

   (1 + fac f.) 3
7

   (1 + fac)f.  3
7


Later I realized I could produce illegally tacit adverbs (mRS and dRS are
defined in the Wicked Tacit Toolkit which works with the official j807 and
some other earlier interpreters) to provide tacit recursion scope to
monadic and dyadic tacit verbs.


   fac=. 1:`(* $:@:<:)@.* mRS

   (1 + fac f.) 3
7
   (1 + fac)f.  3
7





On Wed, Feb 9, 2022 at 2:11 PM Elijah Stone  wrote:
>
> On Wed, 9 Feb 2022, 'Pascal Jasmin' via Programming wrote:
>
> > Jose/Pepe has done this.  afaiu I think it is a way to avoid unnecessary
> > intermediate names.
>
> I was going to ask: how?  But then I realised it is completely possible to
> define this as-is:
>
> recur=: 13!:8@21
> scope=: {{
>   old_recur=. recur
>   recur=: u
>   r=. u y
>   recur=: old_recur
>   r }}
>
> Season with try. and ambivalence to taste.
>
> (That said, you cannot retain the old behaviour of $: in cases where you
> have not explicitly specified a scope.)
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Is j turing-complete without parentheses?

2022-02-11 Thread Jose Mario Quintana
> proposed).  For example, it is possible to implement a turing machine in
> j, by representing only the finitely many cells which have been visited so
> far.  As the number of steps simulated increases without bound, so too may

Right, that is how the version

Universal Turing machine - Rosetta Code


is implemented.  By the way, I am somewhat familiar with a related
implementation of rule 110,

   (0 1 1 1 0 1 1 0 {~ #.)\~&3@(0 0 , ] , 0:)^:_

which expands its input/output as necessary.  For example,

   (3 (0 1 1 1 0 1 1 0 {~ #.)\ 0 0 , ] , 0:)^:(<11) 1
1 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 0 0 0 1 0 0 0 0 0
1 1 1 0 0 1 1 0 0 0 0
1 1 0 1 0 1 1 1 0 0 0
1 1 1 1 1 1 1 0 1 0 0
1 1 0 0 0 0 0 1 1 1 0
1 1 1 0 0 0 0 1 1 0 1

However, I could not figure out how to use your version to reproduce the
usual example.  Can you show us how to do it?

Regarding the Turing completeness of a parentheses free J, the best I can
do so far is to reduce it to a single pair of parentheses,

Fractan=. ([ {~ 1 i.~ [ = <.)@:* ::]^:_

Perhaps, you or another member can somehow get rid of them (the above line
also shows concisely that tacit J is, in principle, Turing complete).  At
any rate, unlike the Turing machine emulator, the Fractan implementation
does not give me any practical insight on how one can produce, in
principle, tacit verbs which can accomplish any (Turing) computable tasks.



On Tue, Feb 8, 2022 at 4:41 PM Elijah Stone  wrote:
>
> It is meaningful, because j supports arrays of unbounded length, and it
> does not support arrays of infinite length (though that has been
> proposed).  For example, it is possible to implement a turing machine in
> j, by representing only the finitely many cells which have been visited so
> far.  As the number of steps simulated increases without bound, so too may
> the memory requirements; but so long as the former is finite, the latter
> must be, too.  And there is no expectation that you will be able to
> simulate infinite steps of a turing machine in finite real time.
>
> (In this respect, extant implementations of j are not and can not be
> turing-complete, but that is irrelevant.)
>
>   -E
>
> On Tue, 8 Feb 2022, Raul Miller wrote:
>
> > If we are talking about equivalence to a turing machine --
> > https://en.wikipedia.org/wiki/Turing_machine -- I do not think this is
> > a meaningful distinction.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Tue, Feb 8, 2022 at 3:51 PM Elijah Stone  wrote:
> >>
> >> That is not quite right.  We do not need to explicitly represent
infinite
> >> arrays; we only need array length to be unbounded, such that the
length of
> >> a given array can grow without bound (but finitely) over a finite
amount
> >> of time.  See limit definition.
> >>
> >>   -E
> >>
> >> On Tue, 8 Feb 2022, Raul Miller wrote:
> >>
> >> > On Tue, Feb 8, 2022 at 4:30 AM Elijah Stone 
wrote:
> >> >> Can anyone come up with something which does not require infinite
arrays?
> >> >
> >> > Technically, any system which does not support infinite time and
> >> > infinite space is not turing complete.
> >> >
> >> > That said, in most contexts, we take "infinite" to mean "larger than
I
> >> > need for the example(s) I am concerned about".
> >> >
> >> > FYI,
> >> >
> >> > --
> >> > 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
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Is j turing-complete without parentheses?

2022-02-11 Thread Jose Mario Quintana
> parenthesis-free implementation of rule 30.  One caveat: it only works
> given an infinite input.

Another one is that a CA does not halt, unlike classic Turing machines which
might halt.



On Tue, Feb 8, 2022 at 4:30 AM Elijah Stone  wrote:
>
> A little game I thought of: imagine a version of j with no parentheses
> (nor intermediate definitions); is it still turing-complete?
>
> Turns out the answer is yes, sort of: {&0 1 1 1 1 0 0 0@#.\~&3^:_ is a
> parenthesis-free implementation of rule 30.  One caveat: it only works
> given an infinite input.
>
> Can anyone come up with something which does not require infinite arrays?
>
> Further stipulations: no control structures; no ".; ^:_ and $:@.v are both
> ok; direct definition is ok, and may even be named, but it has to be
> completely self-contained.
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Tacit completeness

2021-12-26 Thread Jose Mario Quintana
I meant to write the following a couple of days ago but the infamous virus
stroke.  Oh well, better late than never...


There have been different kinds of issues with the tacit translator,
especially when one tries to abuse it; see, for example,

[Jforum] Tacit Definitions (jsoftware.com)


> > Suppose s is a sentence [that] makes no use of x. or y. as arguments to
> > an adverb or conjunction
>
> A shame; on multiple occasions, I have wanted to do exactly this, and have
> had to write explicit code.


No kidding!  This simple explicit verb {{ y `:6 }} could be converted, in
theory, into a tacit verb; but, in practice, it seems to be a
challenging task even if "cheating" (i.e., using boxes) is allowed...   Are
there any takers?


> Suggestion: a new primitive adverb.  Call it 'n.'.  Like [:, it is
> syntactically regular, but semantically irregular.  Just as there is a
> rule for the evaluation of forks whose left tines are [: which takes
> precedence over the regular rule for the evaluation of forks, so are there
> rules for the evaluation of sentences containing n. which take precedence
> over the rules for evaluation of ordinary sentences:
>
> [x] u C (v n.) y
> [x] u C ([x] v y) y
>
> [x] u n. C v y
> [x] ([x] u y) C v y
>
> [x] u n. A y
> [x] ([x] u y) A y


This is a related issue, again, there is no apparent practical way to refer
tacitly to the arguments ([x] and y) of verbs (u and [v]) which are in turn
the arguments of tacit adverbs or conjunctions.  The language could be
extended to allow it; however, in my opinion, this would only cure another
symptom, the deeper issue is a weak J tacit
adverbial/conjunctional programming environment.

So, what is the deeper issue?

(To be continued in the Chat Forum...)



On Tue, Dec 21, 2021 at 9:24 PM Elijah Stone  wrote:
>
> With all this discussion of tacit modifiers, I fear their lower-order
> cousins are going out of style!
>
> The proof of completeness for trains
> (https://code.jsoftware.com/wiki/Essays/Trains#Proof_of_Completeness)
> contains two concerning notes:
>
> > Without loss of generality, assume that [sentence] s contains no
> > copulae; for if it does, d=.rhs (say), recursively replace instances of
> > d by (rhs)
>
> This transformation is problematic if rhs performs side effects; for it
> may cause those effects to be performed more than once, or not at all; or
> to be sequenced differently relatively to other side effects.
>
> In some cases, it may nevertheless possible to straightforwardly express
> an effectful verb tacitly.  For instance:
>
> {{ a=. 0 [ echo y
> a + y + a }}
>
> becomes:
>
> (] + [ + ])  (0 [ echo)
>
> but some are not so straightforward
>
> {{ a=. 0 [ echo y
> b=. 0 [ echo y
> a + b + y + a + b }}
>
> It can be done, of course, but not without cheating (e.g. by using boxes,
> or by observing that + is commutative).
>
> Question: what is a clear and concise definition of the subset of
> effectful explicit verbs which may be made tacit without cheating?
>
>
> > Suppose s is a sentence [that] makes no use of x. or y. as arguments to
> > an adverb or conjunction
>
> A shame; on multiple occasions, I have wanted to do exactly this, and have
> had to write explicit code.  (In some cases, it is possible to get around
> the problem by passing a gerund to the conjunction; but that is not
> general; it is somewhat obscure; and frequently requires redundant [ or
].)
>
> Suggestion: a new primitive adverb.  Call it 'n.'.  Like [:, it is
> syntactically regular, but semantically irregular.  Just as there is a
> rule for the evaluation of forks whose left tines are [: which takes
> precedence over the regular rule for the evaluation of forks, so are there
> rules for the evaluation of sentences containing n. which take precedence
> over the rules for evaluation of ordinary sentences:
>
> [x] u C (v n.) y
> [x] u C ([x] v y) y
>
> [x] u n. C v y
> [x] ([x] u y) C v y
>
> [x] u n. A y
> [x] ([x] u y) A y
>
> Objections:
>
> - n. assumes that modifiers return verbs.  Something like 'u n. A'
>_must_ be assumed to be a verb for this mechanism to make any sense.
>Evaluation of A must be deferred, which is even more irregular than [:.
>
> - The common case of u C (f y) requires many parentheses if the input is
>modified by a train:  u C ((f g h)n.).  (On the other hand, this is no
>worse than the explicit code, which must write u C ((f g h) y).
>NARS2000 suggests a mitigation in the form of higher-order modifiers:
>assuming a higher-order ~, one might write (f g h)n. ~C u.  This is not
>a serious suggestion.)
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] sorting up and up

2021-10-24 Thread Jose Mario Quintana
:D

On Sun, Oct 24, 2021 at 6:39 AM R.E. Boss  wrote:

> Self-serendipity.
>
> Actually, the recipe for happiness is good health and a bad memory.
> The first I'm working on, the latter I had all my life.
>
>
> R.E. Boss
>
>
> -Original Message-
> From: Programming  On Behalf Of
> Jose Mario Quintana
> Sent: zaterdag 23 oktober 2021 18:48
> To: Programming forum 
> Subject: Re: [Jprogramming] sorting up and up
>
> Actually, it is  (\: %)  [0, 1].
>
> [0] [Jprogramming] Cute solution (jsoftware.com) <
> http://www.jsoftware.com/pipermail/programming/2018-December/052461.html>
> [1] [Jprogramming] sorting up and up (jsoftware.com) <
> http://www.jsoftware.com/pipermail/programming/2021-October/059162.html>
>
>
>
> On Sat, Oct 23, 2021 at 7:23 AM 'Bo Jacoby' via Programming <
> programm...@jsoftware.com> wrote:
>
> > (/: %) is WOW!
> >
> >
> >
> >
> >
> >
> > Den lørdag den 23. oktober 2021 09.11.23 CEST skrev Henry Rich <
> > henryhr...@gmail.com>:
> >
> >
> >
> >
> >
> > Yes, I thought the spec was for ints.
> >
> > Henry Rich
> >
> > On 10/22/2021 6:54 PM, Elijah Stone wrote:
> > > On Fri, 22 Oct 2021, Henry Rich wrote:
> > >
> > >> I admit that (/: %) is pretty cute, but the % function takes lots
> > >> of bits of significance, more than the input:
> > >
> > > Hmm, if your inputs are already floats, the 0-1 and 1-_ range are
> > > pretty similar, no?
> > >
> > >  -E
> > > 
> > > -- For information about J forums see
> > > http://www.jsoftware.com/forums.htm
> >
> >
> > --
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> >
> > --
> > 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
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] sorting up and up

2021-10-23 Thread Jose Mario Quintana
Actually, it is  (\: %)  [0, 1].

[0] [Jprogramming] Cute solution (jsoftware.com)

[1] [Jprogramming] sorting up and up (jsoftware.com)




On Sat, Oct 23, 2021 at 7:23 AM 'Bo Jacoby' via Programming <
programm...@jsoftware.com> wrote:

> (/: %) is WOW!
>
>
>
>
>
>
> Den lørdag den 23. oktober 2021 09.11.23 CEST skrev Henry Rich <
> henryhr...@gmail.com>:
>
>
>
>
>
> Yes, I thought the spec was for ints.
>
> Henry Rich
>
> On 10/22/2021 6:54 PM, Elijah Stone wrote:
> > On Fri, 22 Oct 2021, Henry Rich wrote:
> >
> >> I admit that (/: %) is pretty cute, but the % function takes lots of
> >> bits of significance, more than the input:
> >
> > Hmm, if your inputs are already floats, the 0-1 and 1-_ range are pretty
> > similar, no?
> >
> >  -E
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
>
> --
> 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


Re: [Jprogramming] Tacit trains o. inverse

2021-10-15 Thread Jose Mario Quintana
> Putting the V N bident to good use already, I see :)

I see a truly modern conjunction bident (C C) and a truly modern way to...

   J=. ((<@:((":0) ,&:< ]) , ])([.].))(`:6)
   CRASH=. 5!:1@<'J'

   CRASH J   ;)




On Fri, Oct 15, 2021 at 3:57 AM Elijah Stone  wrote:
>
> On Fri, 15 Oct 2021, Henry Rich wrote:
>
> >oi =: (& :. ((-([.].)) & ].)) o.
> >1 oi
> > 1 :.(_1)
>
> Putting the V N bident to good use already, I see :)
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Tacit trains o. inverse

2021-10-14 Thread Jose Mario Quintana
I recently posed a similar question (see [0]),

> This trident can be used to operate on raw noun arguments.  One can
define first a noun boxing adverb,
>
>box=. ((<,'<') ; ])hg
>  assert (<1 2 3) -: 1 2 3 box
>
> (Incidentally, I realize I am using a shotgun to kill a fly, I know I can
easily use a pistol instead but I wonder what would be a gentle and kind
method to kill this fly (that is, to produce a nicer equivalent adverb to
the box adverb) using the resurrected trains or your alternative versions.)

However, there were no responses.

An answer to your question using the shotgun is,

   minus=. ((<,'-') ; ])hg

   1 minus
_1

   oi=. ((& :. ('minus' f. & ].)) o.)

   1 oi
1 :.(_1)

A simpler answer using a pistol is,

   minus=. -av

   1 minus
_1

   oi=. ((& :. ('minus' f. & ].)) o.)

   1 oi
1 :.((,_1))

The linear representations of these versions of oi and minus are,

   oi
(& :. (((`'') (&(-@:[)) ((`(<(,'0');_))(`:6))) & ].))o.

   minus
(`'') (&(-@:[)) ((`(<(,'0');_))(`:6))

In general, you can replace the - in the expression above with whatever (tacit)
verb you might like (that is what the adverb (av) can produce for you).

The tacit adverbs hg and av were written in a premodern (aka, postclassic)
style; naturally, their products do not use any of the modern trains either.
Again, I wonder if, say, the adverb minus could be simplified using modern
trains.

[0] [Jprogramming] New in beta-r: old stuff (jsoftware.com)



On Thu, Oct 14, 2021 at 4:43 PM Jan-Pieter Jacobs <
janpieter.jac...@gmail.com> wrote:
>
> Hi all,
>
> I found a use for tacit trains today: making circle verbs with a sensible
> obverse:
>
>oi =: (& :. ({{-m}} & ].)) o.
>1 oi
> 1 :.(_1)
>
> Nice, but I have a question:
> How does one make the {{-m}} part tacit? Or more general, how to make
verbs
> operate on nouns and use their results in a tacit modifier train? I guess
> this could also be useful in experiments like structural under...
>
> Best regards,
> Jan-Pieter
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Reining in train request WAS: New in beta-r: old stuff

2021-10-12 Thread Jose Mario Quintana
Neat!  An adverbial variation...

   Wrap=. (&,) ( :.}.) ((&.|.)@)

   'e'Wrap 'lit'
elite

   'l' Wrap 'eve'
level
   'l' Wrap ^:_1 'l' Wrap 'eve'
eve


On Tue, Oct 12, 2021 at 11:05 AM Hauke Rehr  wrote:
>
> I found a somewhat better approach:
>
> DELIM =: 'e'
> utrobique =: (&.|.)@
> wrap =: DELIM&, :. }. utrobique
> wrap 'lit'
> wrap^:_1 wrap 'lit'
>
> still I wonder if I could have done better
> when I only have a single adhoc use of
> (v((&.|.)@))
>
> Am 12.10.21 um 16:39 schrieb Hauke Rehr:
> > I also have uses for it but I’m very unexperienced in using
> > that resurrected modifier language.
> > In a simplified version of an example I have,
> > how is the obverse part written without that much paren noise?
> >
> > wrap =: DELIM&([ , ,~) :. (}.((&.|.)@))
> >
> >
> > Am 05.10.21 um 00:05 schrieb Henry Rich:
> >>
> >> 2. I found the production (A C)->((x A) C x) useful enough in my work
> >> that I gave it a name, the adverbial hook.
> >
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Benchmarks

2021-10-05 Thread Jose Mario Quintana
I can only comment on the solutions [0, 1] I wrote: I would be very
surprised if (as written) they provide a practical solution to the
production of efficient (anonymous) recursive verbs.

[0] Y combinator - Rosetta Code


[1] Y combinator - Rosetta Code



On Tue, Oct 5, 2021 at 8:24 AM Raoul Schorer 
wrote:

> Does that mean we could consider making the Y combinator part of the
> language as a library or primitive function?
>
> Speaking only for myself, I am very much in support of better recursion
> support in the language, since I usually draw my inspiration from Scheme
> programs.
>
> Cheers,
> Raoul
>
> Le mar. 5 oct. 2021 à 14:02, Raul Miller  a écrit :
>
> > This is an old subject, which may no longer have motivation and/or
> > interest, but it occurred to me, today, that it ought to be possible
> > to avoid stack errors from recursive verb implementations by using the
> > Y Combinator.
> >
> > https://rosettacode.org/wiki/Y_combinator#J
> >
> > FYI,
> >
> > --
> > Raul
> >
> > On Mon, May 24, 2021 at 10:11 PM Thomas McGuire 
> > wrote:
> > >
> > > For those interested in Benchmarks I have split my original benchmark
> > routine into 2 scripts. One the Kernighan/Van Wyk benchmarks and an
> > advanced benchmarks script. The advanced benchmarks were taken from some
> of
> > the functionality that the Scheme language benchmarks for which I found J
> > implementations.
> > >
> > > The deriv benchmark uses Raul’s suggestion with the polynomial taken
> > from the data from the Scheme implementation. Itwon’t be a direct
> > comparison to Scheme since Scheme does a full symbolic differentiation
> > allowing undefined variable coefficients. In this respect the Scheme
> > benchmark tests parsing nested S-expressions.
> > >
> > > I added a QR decomposition benchmark from the QR essay and compare it
> to
> > the foreign 128!:0. I also include a Schwarz-Rutishauser QR decamp
> > implementation. This is translated from python code and uses for loops so
> > on large matrices it is very slow. I comment out the test in the test
> > harness.
> > >
> > > Finally I added a matrix multiplication test given the recent
> discussion
> > on Matrix multiplication on the programming forum. The test takes the Q
> and
> > R matrices and multiplies them for timing. I added a match check on the
> > original matrix since the data is randomly produced.
> > >
> > > The scripts are available at:
> > > https://github.com/tmcguirefl/JBenchmarks
> > >
> > > J902 on MacBook Pro Intel I7 quad core 2.9GHz
> > >ADVbmarks ''
> > > tak: 0.045548 17344
> > > fibN: 1e_6 13376
> > > rsum: 0.005007 5.02125e6
> > > mbrot: 0.875056 199360
> > > deriv: 2.7e_5 9728
> > > fftw: 0.000489 1.5751e6
> > > ifftw: 0.000717 2.09894e6
> > > ft: 3.4e_5 6528
> > > fftws: 1.8e_5 5696
> > > QRdata size: 700 400
> > > QRrec: 0.079073 3.62602e7
> > > QRfor: 0.090745 6.08386e7
> > > MMult: 0.176499 3.3557e7
> > > Match: 1 (not a timing, checks orig matrix matches the mult. QxR)
> > >
> > > Of note to the matrix multiply discussion is that a 700x400 matrix
> takes
> > less than a second on macOS 64 bit in J902. Granted the R matrix is upper
> > triangular but if optimizations are taking place it is under the covers,
> > since this is a straight J +/ . * implementation.
> > >
> > > On J807 I took out the deriv and the rsum due to errors (my 806 doesn’t
> > have the calculus lib and rsum had a stack error I assume 902 has
> improved
> > recursion) and the results:
> > >ADVbmarks ''
> > > tak: 0.069502 36032
> > > fibN: 2e_6 8512
> > > mbrot: 1.02267 200192
> > > fftw: 0.000867 1.57523e6
> > > ifftw: 0.000806 2.09907e6
> > > ft: 5e_5 6848
> > > fftws: 3.2e_5 7104
> > > QRdata size: 700 400
> > > QRrec: 0.08946 4.45858e7
> > > QRfor: 0.100718 6.13482e7
> > > MMult: 0.167292 4.29949e7
> > > Match: 1 (not a timing, checks orig matrix matches the mult. QxR)
> > >
> > > There appears to be an across the board speed up from 806 to 902 in
> > everything but matrix multiplication. That may be due to differences in
> the
> > random matrix generated for each test.
> > >
> > > > On May 19, 2021, at 5:22 AM, Raul Miller 
> > wrote:
> > > >
> > > > deriv_jcalculus_ does symbolic differentiation on tacit expressions.
> > > > For example:
> > > >
> > > >   load'math/calculus'
> > > >   (3+*:) deriv_jcalculus_ 1
> > > > 0"0 + +:
> > > >   3 0 1 deriv_jcalculus_ 1
> > > > 0 2
> > > >   (3+*:) deriv_jcalculus_ 1 i. 5
> > > > 0 2 4 6 8
> > > >   3 0 1 deriv_jcalculus_ 1 i. 5
> > > > 0 2 4 6 8
> > > >
> > > > (The right argument to deriv_jcalculus_ is how many times to take the
> > > > derivative, a negative argument does symbolic integration instead,
> > > > with an integration constant of 0. But integration is a bit fussier
> > > > than derivation, so it has less support for variant expressions.)
> > > >
> > > > FYI,
> > > >
> > > > --
> > > > Raul
> > > >
> > > 

Re: [Jprogramming] New in beta-r: old stuff

2021-10-02 Thread Jose Mario Quintana
> 1. it breaks existing valid code.

Certainly, I had to repair my hg adverb in a couple of places (see below)

> Alternative of (C0 V1) C2 turns this into A C train which has useful
interpretation.  Avoids parentheses in

I am fond of the C0 A1 bident and to a lesser extent of the A0 C1 A2
trident.  I like to write a pseudo while conjunction as,

   w=. ^:(^:_)  NB. (Equivalently, using a resurrected trident, w=. ^:^:_ )

   u w v
|value error
|   u w v

Darn! This new annoying feature that now triggers errors related to
m,n,u,v,x, and y even outside the scope of explicit forms is interfering.
Trying again,

   alpha w beta
alpha^:beta^:_

However, the main reason I like it is that the production of tacit
conjunctions can be reduced to the production of related adverbs; for
example, the conjunction (hook) to produce a hook can be written as,

   hook=. `(`:6)  NB. (Equivalently, hook=. ``:6)

   alpha hook beta
alpha beta

Alternatively, after scripting a repaired hg adverb script (that is, by
replacing the corresponding lines by

d=. (a3=. (@: (aw f.)) ('av'f.)) (a4=. "62) (a5=. `:6)

and

hg=. (`((ar'a6')`(ar'a5'))) (`:6)

),

   hook=. ]hg

   alpha hook beta
alpha beta

Moreover, using a suitable tacit verb instead of ] one can produce any
arbitrary form that is a function of its arguments with one caveat: noun
arguments would have to be boxed.  This brings me to the A0 C1 A2 trident.

This trident can be used to operate on raw noun arguments.  One can define
first a noun boxing adverb,

   box=. ((<,'<') ; ])hg
 assert (<1 2 3) -: 1 2 3 box

(Incidentally, I realize I am using a shotgun to kill a fly, I know I can
easily use a pistol instead but I wonder what would be a gentle and kind
method to kill this fly (that is, to produce a nicer equivalent adverb to
the box adverb) using the resurrected trains or your alternative versions.)

Then one can operate on noun arguments; for instance,

   1 2 3 ((box ` box)(] hg)) (u0`u1`u2)
┌─┬──┐
│1 2 3│┌──┬──┬──┐│
│ ││u0│u1│u2││
│ │└──┴──┴──┘│
└─┴──┘

Again, replacing ] above by a suitable verb one can produce, in principle,
any arbitrary form (that is a function of its arguments); for example, the
conjunction (linear) which produces the corresponding linear combination of
a list of verbs represented by the gerund can be produced as follows,

   9!:14''  NB. By the way...
j903/j64/windows/beta-r/commercial/
www.jsoftware.com/2021-09-26T14:46:15/clang-12-0-0/SLEEF=1

   e=. &.>
   x=. @:[
   y=. @:]

   left=.  ('';1;0)&{::
   right=. ('';1;1)&{::
   plus=.  ([ , (<,'+') , ])
   times=. < o ([ , (<,'*') , ])

   linear=. (box`box)((an e o left > o ((plus e/) . (times e)) @:(('';1;0)&({::)) >@:(([ , (<,'+') , ])&.>/ .
(<@:([ , (<,'*') , ])&.>)) <&.>@:(('';1;1)&({::)))@:(<@:((0;1;0)&(
{::)))@:[)) ((`(<(,'0');_))(`:6(`:6))

but it was produced tacitly, which is the only acceptable way from the
perspective of a genuine tacit fan(atic). ;) )

I am curious, again, to see how old-timers or newcomers can employ the
resurrected bidents and tridents (or your alternative versions) to
facilitate simpler equivalent versions of the linear conjunction shown
above.

P.S.  I do know how to produce a conceptually simpler, at least in my mind,
version of the linear conjunction (if necessary, as a curried adverb which
effectively takes a couple of arguments (aka, double adverb); for instance
when using a j807 interpreter) the wicked way.  That is by casting
blasphemous spells which compel tacit verbs to produce also verbs, adverbs,
and conjunctions; just as adverbs and conjunctions do.  In fact, I wrote
the linear conjunction first the wicked way and use it as a model for
writing the orthodox version (shown above) afterward.

   9!:14''
j807/j64nonavx/windows/release/commercial/
www.jsoftware.com/2018-10-05T10:48:34

   NB. After scripting the wicked tacit toolkit...

   plus=.  [: [ +cv ] Train
   times=. [: [ *cv ] Train

   linear=. > o (an e x ((plus e/) . (times e)) < o train "0 y) f.s2c

   0 1 2 (u0`u1`u2)linear
(0 * u0) + (1 * u1) + 2 * u2

   1 0j2 3j3 (^.`(% + ^)`(1 + *:)) linear
(1 * ^.) + (0j2 * % + ^) + 3j3 * 1 + *:



--


On Mon, Sep 27, 2021 at 8:26 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Lets start with the 2 worst, irredeemable most useless, trains
>
> C0 V1 C2 -> (u C0 v) V1 (u C2 v) fork result.  duplicating input to both
edge conjunctions.  Will never be used.
>
> Alternative of (C0 V1) C2 turns this into A C train which has useful
interpretation.  Avoids parentheses in one of the 2 natural (validating)
parenthesizings of this string.
>
> C1 A2 -> u C1 (u A2) .  A far less dumb alternative would be u C1 (v
A2).  At least both AC and CA would be conjunctions.
>
> I prefer (u C1 v) A2 out of consistency and coherence.  While u C1 (v A2)
may have a use, its 50/50 which would be used/wanted 

Re: [Jprogramming] "accessor" concepts

2021-09-21 Thread Jose Mario Quintana
Pascal, I could not reply sooner but the following is a quick comment...

> h is interesting.  But I would reverse argument, and use scalars rather
than "codes" for the argument to }

My motivation for the name of the conjunction h (as a shorthand for hold)
and the order of the arguments was to use it as a tacit counterpart of the
local copula (=.).  As I mentioned in a reply to Raul (posted after your
post) my version of h handles both, proverbs (codes) and indices (scalars).

These utilities, together with another one (named local), not only allow
one to write any verb tacitly (in principle) but also facilitates the
transcription of explicit verbs into tacit verbs.  I intend to write
another post later, entertaining an example, in the Chat Forum since that
involves the use of the Tacit Toolkit that requires j807 or other earlier
versions of the interpreter.

(Just in case, a subscription is not necessary to access the posts of any
forum, one can just use the search page Forum Search (jsoftware.com)
<https://www.jsoftware.com/forumsearch.htm>.  Moreover, just clicking the
search button will produce the links to all the posts of all the forums
listed in reverse chronological order.)



On Wed, Sep 15, 2021 at 2:48 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> A framework with G =: (&{::)(@])
>
> and G0 G1 G2 defined as 0 G, 1 G, 2 G
>
> has the readability advantage of G0 being a fork term that looks like and
is a verb, while 0 G requires pre-knowledge by the reader that G is an
adverb.
>
> Your f (multiple arguments to G but with { instead of {::) can be
constructed easily with (G0 ; G1) or if they could be joined unboxed (G0 ,
G1)
>
> h is interesting.  But I would reverse argument, and use scalars rather
than "codes" for the argument to }
>
> h =: 2 : '<@:u  v} ]' NB. version where verb determines boxing may be
preferred/useful option.
>
>
>  (B +/ .* D) h 2
> <@:(B +/ .* D) 2} ]
>
>
>
> Some other useful utility approaches
>
> MakeGs =: 1 : 'for_i. (i. m) do. (''G'' ,&": i) =: i G end.'
>
> 5 MakeGs
>
> G2
>
> 2&({::)@]
>
> and then friendly fieldname accessors can also be generated in similar way
>
> accessors =: 1 : 'for_i. (;: m) ([ ,. <"0@]) (i. # ;: m) do. (, G0 i ) =:
(G1 i) G end.'
>
> 'A B C D E' accessors
>
> which with longer names might help document code and structure of y.
>
>
> On Tuesday, September 14, 2021, 07:31:21 p.m. EDT, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
>
>
>
> > 0. to 9. and/or _9. would make good additions to language.
>
> Perhaps one should consider that, rightly or otherwise, 0. currently has a
> meaning according to the interpreters (e.g., j902),
>
>   0.
> 0
>
>
> Often I use an adverb (mne) to define undefined names, or redefine
existing
> proverbs, as pointers to fetch a corresponding content of a box within a
> state consisting of a list of boxes.  For example,
>
> (A B C D)mne
>
> would, as a side effect, define A as 0&({::), ... D as 3&({::).  Thus,
>
>   C
> 2&({::)
>
> Another adverb (f) allows one to use the proverbs to get multiple boxes
> from the state,
>
>   (B C)f
> 1 2&{
>
> and a conjunction (h) allows one to amend the contents of the state in
> terms of the proverbs,
>
>   (A B) h ((B C)f)
> 1 2&{ 0 1} ]
>
> or
>
>   C h (B +/ .* D)
> <@:(B +/ .* D) 2} ]
>
> The following illustrates their use,
>
>   ( S=. 0 ; 1 2 ; '...' ; 1j1*(i.2 3) )
> ┌─┬───┬───┬───┐
> │0│1 2│...│  0 1j1 2j2│
> │ │  │  │3j3 4j4 5j5│
> └─┴───┴───┴───┘
>
>   C  S
> ...
>
>   (B C)f  S
> ┌───┬───┐
> │1 2│...│
> └───┴───┘
>
>   (A B) h ((B C)f)  S
> ┌───┬───┬───┬───┐
> │1 2│...│...│  0 1j1 2j2│
> │  │  │  │3j3 4j4 5j5│
> └───┴───┴───┴───┘
>   C h (B +/ .* D)  S
> ┌─┬───┬─┬───┐
> │0│1 2│6j6 9j9 12j12│  0 1j1 2j2│
> │ │  ││3j3 4j4 5j5│
> └─┴───┴─┴───┘
>
> I define tacitly mne, f, and h (moreover, mne f and h themselves are tacit
> entities) via the unorthodox methods using a fork of J which I have
> mentioned in the past.  However, I cannot see any reason why mne, f, and h
> could not be defined (explicitly, when necessary) using the latest public
> interpreters.
>
>
> On Tue, Sep 14, 2021 at 1:18 PM 'Pascal Jasmin' via Programming <
> programm...@jsoftware.com> wrote:
> >
> >
> > in jpp project,
> >
> > I use 0. as shortcut for (0 {:: ]) and 1. as shortcut for (1 {:: ])
> >
> > The adverb G =: 1 : 'u {:: ]' is the same.
> >
> > 0.

Re: [Jprogramming] "accessor" concepts

2021-09-17 Thread Jose Mario Quintana
> … and “Wicked J”, thanks to you.
> ...
> (si tacuisses philosophus mansisses)

... and Latin. :)

(A former colleague, well versed in Latin, once told me that thinking in
Latin compels one to think more clearly.  I had not realized that this
phenomenon was applicable not only to some artificial languages (or
dialects) but also to certain natural languages.)



On Thu, Sep 16, 2021 at 4:48 AM Hauke Rehr  wrote:
>
> … and “Wicked J”, thanks to you.
>
> I had written a long reply but you’re right:
> sometimes it’s better not to ask questions
> (si tacuisses philosophus mansisses)
>
> Hauke
>
>
>
> [
> still I can’t help but write a comment:
>
> Let’s hope for both English and J not to share
> the fate of German being “simplified” by crimes
> such as the German “spelling reform” driving us
> into an Orwellian society (yes, an exaggeration,
> but not as much of one as you might think).
> ]
>
>
>
> Am 16.09.21 um 00:03 schrieb Jose Mario Quintana:
> > Neat!  There are always opportunities to learn J (and English) in this
> > forum.
> >
> > Thanks
> >
> >
> > On Wed, Sep 15, 2021 at 5:40 PM Raul Miller 
wrote:
> >
> >> Belatedly, I realized that I could have shortened that to:
> >>
> >> mne=: {{)a
> >>".@(('{:]`',[,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> >> }}
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >>
> >> On Wed, Sep 15, 2021 at 5:38 PM Raul Miller 
wrote:
> >>>
> >>> I am not sure how you got your gerunds to display the linear rep of
> >>> the verb. For me, the gerund display always shows the atomic rep of
> >>> verbs. Is this a personal mod to your version of J?
> >>>
> >>> But, anyways, here's an explicit version of mne which returns the
> >>> corresponding gerund:
> >>>
> >>> mne=: {{)a
> >>>,".@(('}.]`',[,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> >>> }}
> >>>
> >>> Thanks,
> >>>
> >>> --
> >>> Raul
> >>>
> >>> On Wed, Sep 15, 2021 at 5:27 PM Jose Mario Quintana
> >>>  wrote:
> >>>>
> >>>>> You might prefer your definitions to be
> >>>>>
> >>>>> 1&{::@]
> >>>>>
> >>>>>
> >>>>> This allows intuitive dyadic use case for y, and allows B~ to access
> >> x
> >>>> argument fields.
> >>>>
> >>>> I seldom have to refer precisely to the left or right arguments when
> >> using
> >>>> pointer proverbs because I use them typically just to sequentially
> >> update a
> >>>> state when writing complex tacit verbs.  However, sporadically I have
> >> done
> >>>> that and I just redefine the suitable pointer proverbs as I go using
> >> the
> >>>> result of mne (see my comment to Raul's post).  For example, since
> >>>>
> >>>> (Y V N)mne
> >>>> ┌───┬───┬───┐
> >>>> │0&({::)│1&({::)│2&({::)│
> >>>> └───┴───┴───┘
> >>>>
> >>>> I can write,
> >>>>
> >>>> (Y`V`N)=. (Y V N)mne at&.> ] >>>>
> >>>> Y
> >>>> 0&({::)@:]
> >>>> V
> >>>> 1&({::)@:]
> >>>> N
> >>>> 2&({::)@:]
> >>>>
> >>>> Similarly,
> >>>>
> >>>> (X`U`M)=. (X U M)mne at&.> [ >>>>
> >>>> X
> >>>> 0&({::)@:[
> >>>> M
> >>>> 2&({::)@:[
> >>>>
> >>>> (The functionality of adv and at is the same as those in the j807
Tacit
> >>>> Toolkit; namely,  >> is
> >>>> @: verbed)
> >>>>
> >>>> Something equivalent could be done legally if mne returns the
> >> corresponding
> >>>> gerund.  Perhaps Raul, you, or someone else can show us how this can
be
> >>>> accomplished.  (A long long time ago it would have been very very
easy
> >>>> (sometimes it is better not to ask questions ;)
> >>>>
> >>>> [Jprogramming] @'' (jsoftware.com)
> >>>> <
> >> http://www.jsoftware.com/pipermail/programming/2006-O

Re: [Jprogramming] "accessor" concepts

2021-09-17 Thread Jose Mario Quintana
I wrote,

> Of course, the mechanisms are different, and usual naming restrictions
that apply only to explicit definitions might interfere; for example,

Incidentally, I noticed an apparent j903 change in (a fresh session)
behavior,

   1 + a
1 + a

is fine; however,

   1 + x
|value error
|   1+x

It seems related to the names associated with explicit arguments.  I have
just been running the DLL without a full installation.  I do not think it
matters but perhaps someone would like to confirm this.


On Wed, Sep 15, 2021 at 5:15 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
> > And, since the mechanisms I am using are quite different from the
> > mechanisms you are using, I am sure that there are examples where the
> > behavior of my mne and f and your mne and f diverge (though I do not
> > know if these differences are as important as the issue with h).
>
> Of course, the mechanisms are different, and usual naming restrictions
that apply only to explicit definitions might interfere; for example,
>
>u mne
> |domain error: mne
> |   0=:0&{::
>n mne
> |value error
> |   n mne
>
> Another aspect that I did not mention is that my version of mne actually
produces a result,
>
>(A B C D)mne
> ┌───┬───┬───┬───┐
> │0&({::)│1&({::)│2&({::)│3&({::)│
> └───┴───┴───┴───┘
>
> That is, the (illegal) list of the boxed pointer proverbs; its legal
counterpart would be the corresponding gerund.  This result is occasionally
useful, see my forthcoming reply to a comment made by Pascal
>
> > and that gets me the same results as in your examples:
> >
> > Still, ... I could define h as
> >
> > h=:{{
>
> > ...
> > But is that close enough? I am not sure.
>
> It seems to me that you guessed correctly (even using only the
information I provided).  There is also another difference between our
versions of the adverb f which I did not specify.  When f's argument is a
single proverb then its behavior is similar to that of h's; namely, its
product is the same as the proverb (e.g., B f is the same as B)
>
> (In addition, in my versions of f and h, indices can be used also in
place of pointer proverbs (e.g. (0 3)f is the same as (A D)f; however, that
is just icing on the cake.)
>
>
>
>
>
>
> On Tue, Sep 14, 2021 at 7:42 PM Raul Miller  wrote:
> >
> > mne and f seem straight forward to define explicitly (I am using j903
> > beta-q here):
> >
> > mne=: {{)a
> >   (".@([,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> >   EMPTY
> > }}
> >
> > f=:{{
> >   u=. u f.
> >   (".(5!:5<'u')-.a.-.":i.10)&{
> > }}
> >
> > However, h is more problematic, because the examples show behavior
> > which was not described.
> >
> > For example, if I define h like this:
> >
> > h=:{{
> >   u=. u f.
> >   v (".(5!:5<'u')-.a.-.":i.10)} ]
> > }}
> >
> > Then its result matches your first example, but not your second example:
> >
> >   (A B) h ((B C)f)
> > 1 2&({ ) 0 1}  ]
> >C h(B +/ .*D)
> > (B +/ .* D) 2}  ]
> >
> > And, since the mechanisms I am using are quite different from the
> > mechanisms you are using, I am sure that there are examples where the
> > behavior of my mne and f and your mne and f diverge (though I do not
> > know if these differences are as important as the issue with h).
> >
> > Still, ... I could define h as
> >
> > h=:{{
> >   u=. u f.
> >   if. 1 e.(5!:5<'v') e.'!"#$%*+,-./;<=>?@[\]^`|}~' do.
> > v=. <@:v::
> >   end.
> >   v (".(5!:5<'u')-.a.-.":i.10)} ]
> > }}
> >
> > and that gets me the same results as in your examples:
> >
> >(A B) h ((B C)f)
> > 1 2&({ ) 0 1}  ]
> >C h(B +/ .*D)
> > <@:(B +/ .* D) 2}  ]
> >
> > But is that close enough? I am not sure.
> >
> > (And, ... since the shallow dereferencing mechanism implemented by
> > name:: was not available in older releases of J, that would make this
> > kind of thing more difficult in older J releases.)
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Tue, Sep 14, 2021 at 5:25 PM Jose Mario Quintana
> >  wrote:
> > >
> > > > 0. to 9. and/or _9. would make good additions to language.
> > >
> > > Perhaps one should consider that, rightly or otherwise, 0. currently
has a
> > > meaning according to the interpreters (e.g., j902),
> > >
> > &g

Re: [Jprogramming] "accessor" concepts

2021-09-15 Thread Jose Mario Quintana
Neat!  There are always opportunities to learn J (and English) in this
forum.

Thanks


On Wed, Sep 15, 2021 at 5:40 PM Raul Miller  wrote:

> Belatedly, I realized that I could have shortened that to:
>
> mne=: {{)a
>   ".@(('{:]`',[,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> }}
>
> Thanks,
>
> --
> Raul
>
> On Wed, Sep 15, 2021 at 5:38 PM Raul Miller  wrote:
> >
> > I am not sure how you got your gerunds to display the linear rep of
> > the verb. For me, the gerund display always shows the atomic rep of
> > verbs. Is this a personal mod to your version of J?
> >
> > But, anyways, here's an explicit version of mne which returns the
> > corresponding gerund:
> >
> > mne=: {{)a
> >   ,".@(('}.]`',[,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> > }}
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Wed, Sep 15, 2021 at 5:27 PM Jose Mario Quintana
> >  wrote:
> > >
> > > > You might prefer your definitions to be
> > > >
> > > > 1&{::@]
> > > >
> > > >
> > > > This allows intuitive dyadic use case for y, and allows B~ to access
> x
> > > argument fields.
> > >
> > > I seldom have to refer precisely to the left or right arguments when
> using
> > > pointer proverbs because I use them typically just to sequentially
> update a
> > > state when writing complex tacit verbs.  However, sporadically I have
> done
> > > that and I just redefine the suitable pointer proverbs as I go using
> the
> > > result of mne (see my comment to Raul's post).  For example, since
> > >
> > >(Y V N)mne
> > > ┌───┬───┬───┐
> > > │0&({::)│1&({::)│2&({::)│
> > > └───┴───┴───┘
> > >
> > > I can write,
> > >
> > >(Y`V`N)=. (Y V N)mne at&.> ] > >
> > >Y
> > > 0&({::)@:]
> > >V
> > > 1&({::)@:]
> > >N
> > > 2&({::)@:]
> > >
> > > Similarly,
> > >
> > >(X`U`M)=. (X U M)mne at&.> [ > >
> > >X
> > > 0&({::)@:[
> > >M
> > > 2&({::)@:[
> > >
> > > (The functionality of adv and at is the same as those in the j807 Tacit
> > > Toolkit; namely,  is
> > > @: verbed)
> > >
> > > Something equivalent could be done legally if mne returns the
> corresponding
> > > gerund.  Perhaps Raul, you, or someone else can show us how this can be
> > > accomplished.  (A long long time ago it would have been very very easy
> > > (sometimes it is better not to ask questions ;)
> > >
> > > [Jprogramming] @'' (jsoftware.com)
> > > <
> http://www.jsoftware.com/pipermail/programming/2006-October/003568.html>
> > >
> > > nevertheless, Dan's DOOG [0],
> > >
> > > User:Dan Bron/Snippets/DOOG - J Wiki (jsoftware.com)
> > > <https://code.jsoftware.com/wiki/User:Dan_Bron/Snippets/DOOG>
> > >
> > > or similar could become handy)
> > >
> > >
> > > On Wed, Sep 15, 2021 at 8:25 AM 'Pascal Jasmin' via Programming <
> > > programm...@jsoftware.com> wrote:
> > > >
> > > > > Perhaps one should consider that, rightly or otherwise, 0.
> currently
> > > has a
> > > > meaning according to the interpreters (e.g., j902),
> > > >
> > > > Not that long ago, it used to give an error.  Never noticed the
> change.
> > > >
> > > > A problem that comes up enough to be annoying when defining 3.. or
> other
> > > . : inflections to numbers is that
> > > >
> > > > ;: '3.. 2'
> > > >
> > > > ┌─┐
> > > >
> > > > │3.. 2│
> > > >
> > > > └─┘
> > > >
> > > > subsequent numbers is the same word.
> > > >
> > > > Avoiding this problem, is a pretty easy change to ;: parser, and
> costs
> > > "nothing" when 3. is a J error, but when 3. was previously valid code,
> can
> > > create new problems.  Still worth the change for me (as a dsl) though.
> > > >
> > > >
> > > > You might prefer your definitions to be
> > > >
> > > > 1&{::@]
> > > >
> > > >
> > > > This allows intuitive dyadic use case for y, a

Re: [Jprogramming] "accessor" concepts

2021-09-15 Thread Jose Mario Quintana
> I am not sure how you got your gerunds to display the linear rep of
> the verb. For me, the gerund display always shows the atomic rep of
> verbs. Is this a personal mod to your version of J?
No, there is no need to blame a certain fork of J for the neat display, as
I mentioned, it is not a gerund it is a list of boxed verbs and that is how
some previous versions of the interpreter (e.g., j807) display such illegal
constructions.



On Wed, Sep 15, 2021 at 5:39 PM Raul Miller  wrote:
>
> I am not sure how you got your gerunds to display the linear rep of
> the verb. For me, the gerund display always shows the atomic rep of
> verbs. Is this a personal mod to your version of J?
>
> But, anyways, here's an explicit version of mne which returns the
> corresponding gerund:
>
> mne=: {{)a
>   ,".@(('}.]`',[,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
> }}
>
> Thanks,
>
> --
> Raul
>
> On Wed, Sep 15, 2021 at 5:27 PM Jose Mario Quintana
>  wrote:
> >
> > > You might prefer your definitions to be
> > >
> > > 1&{::@]
> > >
> > >
> > > This allows intuitive dyadic use case for y, and allows B~ to access x
> > argument fields.
> >
> > I seldom have to refer precisely to the left or right arguments when
using
> > pointer proverbs because I use them typically just to sequentially
update a
> > state when writing complex tacit verbs.  However, sporadically I have
done
> > that and I just redefine the suitable pointer proverbs as I go using the
> > result of mne (see my comment to Raul's post).  For example, since
> >
> >(Y V N)mne
> > ┌───┬───┬───┐
> > │0&({::)│1&({::)│2&({::)│
> > └───┴───┴───┘
> >
> > I can write,
> >
> >(Y`V`N)=. (Y V N)mne at&.> ] >
> >Y
> > 0&({::)@:]
> >V
> > 1&({::)@:]
> >N
> > 2&({::)@:]
> >
> > Similarly,
> >
> >(X`U`M)=. (X U M)mne at&.> [ >
> >X
> > 0&({::)@:[
> >M
> > 2&({::)@:[
> >
> > (The functionality of adv and at is the same as those in the j807 Tacit
> > Toolkit; namely,  > @: verbed)
> >
> > Something equivalent could be done legally if mne returns the
corresponding
> > gerund.  Perhaps Raul, you, or someone else can show us how this can be
> > accomplished.  (A long long time ago it would have been very very easy
> > (sometimes it is better not to ask questions ;)
> >
> > [Jprogramming] @'' (jsoftware.com)
> > <http://www.jsoftware.com/pipermail/programming/2006-October/003568.html
>
> >
> > nevertheless, Dan's DOOG [0],
> >
> > User:Dan Bron/Snippets/DOOG - J Wiki (jsoftware.com)
> > <https://code.jsoftware.com/wiki/User:Dan_Bron/Snippets/DOOG>
> >
> > or similar could become handy)
> >
> >
> > On Wed, Sep 15, 2021 at 8:25 AM 'Pascal Jasmin' via Programming <
> > programm...@jsoftware.com> wrote:
> > >
> > > > Perhaps one should consider that, rightly or otherwise, 0. currently
> > has a
> > > meaning according to the interpreters (e.g., j902),
> > >
> > > Not that long ago, it used to give an error.  Never noticed the
change.
> > >
> > > A problem that comes up enough to be annoying when defining 3.. or
other
> > . : inflections to numbers is that
> > >
> > > ;: '3.. 2'
> > >
> > > ┌─┐
> > >
> > > │3.. 2│
> > >
> > > └─┘
> > >
> > > subsequent numbers is the same word.
> > >
> > > Avoiding this problem, is a pretty easy change to ;: parser, and costs
> > "nothing" when 3. is a J error, but when 3. was previously valid code,
can
> > create new problems.  Still worth the change for me (as a dsl) though.
> > >
> > >
> > > You might prefer your definitions to be
> > >
> > > 1&{::@]
> > >
> > >
> > > This allows intuitive dyadic use case for y, and allows B~ to access x
> > argument fields.
> > >
> > >
> > >
> > > On Tuesday, September 14, 2021, 07:31:21 p.m. EDT, Jose Mario
Quintana <
> > jose.mario.quint...@gmail.com> wrote:
> > >
> > >
> > >
> > >
> > >
> > > > 0. to 9. and/or _9. would make good additions to language.
> > >
> > > Perhaps one should consider that, rightly or otherwise, 0. currently
has a
> > > meaning according to the interpreters 

Re: [Jprogramming] "accessor" concepts

2021-09-15 Thread Jose Mario Quintana
> You might prefer your definitions to be
>
> 1&{::@]
>
>
> This allows intuitive dyadic use case for y, and allows B~ to access x
argument fields.

I seldom have to refer precisely to the left or right arguments when using
pointer proverbs because I use them typically just to sequentially update a
state when writing complex tacit verbs.  However, sporadically I have done
that and I just redefine the suitable pointer proverbs as I go using the
result of mne (see my comment to Raul's post).  For example, since

   (Y V N)mne
┌───┬───┬───┐
│0&({::)│1&({::)│2&({::)│
└───┴───┴───┘

I can write,

   (Y`V`N)=. (Y V N)mne at&.> ] [http://www.jsoftware.com/pipermail/programming/2006-October/003568.html>

nevertheless, Dan's DOOG [0],

User:Dan Bron/Snippets/DOOG - J Wiki (jsoftware.com)
<https://code.jsoftware.com/wiki/User:Dan_Bron/Snippets/DOOG>

or similar could become handy)


On Wed, Sep 15, 2021 at 8:25 AM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> > Perhaps one should consider that, rightly or otherwise, 0. currently
has a
> meaning according to the interpreters (e.g., j902),
>
> Not that long ago, it used to give an error.  Never noticed the change.
>
> A problem that comes up enough to be annoying when defining 3.. or other
. : inflections to numbers is that
>
> ;: '3.. 2'
>
> ┌─┐
>
> │3.. 2│
>
> └─┘
>
> subsequent numbers is the same word.
>
> Avoiding this problem, is a pretty easy change to ;: parser, and costs
"nothing" when 3. is a J error, but when 3. was previously valid code, can
create new problems.  Still worth the change for me (as a dsl) though.
>
>
> You might prefer your definitions to be
>
> 1&{::@]
>
>
> This allows intuitive dyadic use case for y, and allows B~ to access x
argument fields.
>
>
>
> On Tuesday, September 14, 2021, 07:31:21 p.m. EDT, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
>
>
>
> > 0. to 9. and/or _9. would make good additions to language.
>
> Perhaps one should consider that, rightly or otherwise, 0. currently has a
> meaning according to the interpreters (e.g., j902),
>
>   0.
> 0
>
>
> Often I use an adverb (mne) to define undefined names, or redefine
existing
> proverbs, as pointers to fetch a corresponding content of a box within a
> state consisting of a list of boxes.  For example,
>
> (A B C D)mne
>
> would, as a side effect, define A as 0&({::), ... D as 3&({::).  Thus,
>
>   C
> 2&({::)
>
> Another adverb (f) allows one to use the proverbs to get multiple boxes
> from the state,
>
>   (B C)f
> 1 2&{
>
> and a conjunction (h) allows one to amend the contents of the state in
> terms of the proverbs,
>
>   (A B) h ((B C)f)
> 1 2&{ 0 1} ]
>
> or
>
>   C h (B +/ .* D)
> <@:(B +/ .* D) 2} ]
>
> The following illustrates their use,
>
>   ( S=. 0 ; 1 2 ; '...' ; 1j1*(i.2 3) )
> ┌─┬───┬───┬───┐
> │0│1 2│...│  0 1j1 2j2│
> │ │  │  │3j3 4j4 5j5│
> └─┴───┴───┴───┘
>
>   C  S
> ...
>
>   (B C)f  S
> ┌───┬───┐
> │1 2│...│
> └───┴───┘
>
>   (A B) h ((B C)f)  S
> ┌───┬───┬───┬───┐
> │1 2│...│...│  0 1j1 2j2│
> │  │  │  │3j3 4j4 5j5│
> └───┴───┴───┴───┘
>   C h (B +/ .* D)  S
> ┌─┬───┬─┬───┐
> │0│1 2│6j6 9j9 12j12│  0 1j1 2j2│
> │ │  ││3j3 4j4 5j5│
> └─┴───┴─┴───┘
>
> I define tacitly mne, f, and h (moreover, mne f and h themselves are tacit
> entities) via the unorthodox methods using a fork of J which I have
> mentioned in the past.  However, I cannot see any reason why mne, f, and h
> could not be defined (explicitly, when necessary) using the latest public
> interpreters.
>
>
> On Tue, Sep 14, 2021 at 1:18 PM 'Pascal Jasmin' via Programming <
> programm...@jsoftware.com> wrote:
> >
> >
> > in jpp project,
> >
> > I use 0. as shortcut for (0 {:: ]) and 1. as shortcut for (1 {:: ])
> >
> > The adverb G =: 1 : 'u {:: ]' is the same.
> >
> > 0.~ or 0 G~ can be used to access fields of x argument.
> >
> > "State of something complicated" can simply be several boxed fields in x
> or y argument.
> >
> > What easy accessors do is also permits "intermediate tacit results" by
> prepending a calculated box to the y argument, with easy unpacking later
in
> the verb.
> >
> >
> > 0. to 9. and/or _9. would make good additions to language.
> >
> >
> >
> > On Tuesday, September 14, 2021, 12:06:37 p.m. EDT, Michal Wallace <
> michal.wall...@gmail

Re: [Jprogramming] "accessor" concepts

2021-09-15 Thread Jose Mario Quintana
> And, since the mechanisms I am using are quite different from the
> mechanisms you are using, I am sure that there are examples where the
> behavior of my mne and f and your mne and f diverge (though I do not
> know if these differences are as important as the issue with h).

Of course, the mechanisms are different, and usual naming restrictions that
apply only to explicit definitions might interfere; for example,

   u mne
|domain error: mne
|   0=:0&{::
   n mne
|value error
|   n mne

Another aspect that I did not mention is that my version of mne actually
produces a result,

   (A B C D)mne
┌───┬───┬───┬───┐
│0&({::)│1&({::)│2&({::)│3&({::)│
└───┴───┴───┴───┘

That is, the (illegal) list of the boxed pointer proverbs; its legal
counterpart would be the corresponding gerund.  This result is occasionally
useful, see my forthcoming reply to a comment made by Pascal

> and that gets me the same results as in your examples:
>
> Still, ... I could define h as
>
> h=:{{

> ...
> But is that close enough? I am not sure.

It seems to me that you guessed correctly (even using only the information
I provided).  There is also another difference between our versions of the
adverb f which I did not specify.  When f's argument is a single proverb
then its behavior is similar to that of h's; namely, its product is the
same as the proverb (e.g., B f is the same as B)

(In addition, in my versions of f and h, indices can be used also in place
of pointer proverbs (e.g. (0 3)f is the same as (A D)f; however, that is
just icing on the cake.)






On Tue, Sep 14, 2021 at 7:42 PM Raul Miller  wrote:
>
> mne and f seem straight forward to define explicitly (I am using j903
> beta-q here):
>
> mne=: {{)a
>   (".@([,'=:',],'&{::'"_)&":&>i.@#);:'()'-.~5!:5 <'u'
>   EMPTY
> }}
>
> f=:{{
>   u=. u f.
>   (".(5!:5<'u')-.a.-.":i.10)&{
> }}
>
> However, h is more problematic, because the examples show behavior
> which was not described.
>
> For example, if I define h like this:
>
> h=:{{
>   u=. u f.
>   v (".(5!:5<'u')-.a.-.":i.10)} ]
> }}
>
> Then its result matches your first example, but not your second example:
>
>   (A B) h ((B C)f)
> 1 2&({ ) 0 1}  ]
>C h(B +/ .*D)
> (B +/ .* D) 2}  ]
>
> And, since the mechanisms I am using are quite different from the
> mechanisms you are using, I am sure that there are examples where the
> behavior of my mne and f and your mne and f diverge (though I do not
> know if these differences are as important as the issue with h).
>
> Still, ... I could define h as
>
> h=:{{
>   u=. u f.
>   if. 1 e.(5!:5<'v') e.'!"#$%*+,-./;<=>?@[\]^`|}~' do.
> v=. <@:v::
>   end.
>   v (".(5!:5<'u')-.a.-.":i.10)} ]
> }}
>
> and that gets me the same results as in your examples:
>
>(A B) h ((B C)f)
> 1 2&({ ) 0 1}  ]
>C h(B +/ .*D)
> <@:(B +/ .* D) 2}  ]
>
> But is that close enough? I am not sure.
>
> (And, ... since the shallow dereferencing mechanism implemented by
> name:: was not available in older releases of J, that would make this
> kind of thing more difficult in older J releases.)
>
> Thanks,
>
> --
> Raul
>
> On Tue, Sep 14, 2021 at 5:25 PM Jose Mario Quintana
>  wrote:
> >
> > > 0. to 9. and/or _9. would make good additions to language.
> >
> > Perhaps one should consider that, rightly or otherwise, 0. currently
has a
> > meaning according to the interpreters (e.g., j902),
> >
> >0.
> > 0
> >
> >
> > Often I use an adverb (mne) to define undefined names, or redefine
existing
> > proverbs, as pointers to fetch a corresponding content of a box within a
> > state consisting of a list of boxes.  For example,
> >
> > (A B C D)mne
> >
> > would, as a side effect, define A as 0&({::), ... D as 3&({::).  Thus,
> >
> >C
> > 2&({::)
> >
> > Another adverb (f) allows one to use the proverbs to get multiple boxes
> > from the state,
> >
> >(B C)f
> > 1 2&{
> >
> > and a conjunction (h) allows one to amend the contents of the state in
> > terms of the proverbs,
> >
> >(A B) h ((B C)f)
> > 1 2&{ 0 1} ]
> >
> > or
> >
> >C h (B +/ .* D)
> > <@:(B +/ .* D) 2} ]
> >
> > The following illustrates their use,
> >
> >( S=. 0 ; 1 2 ; '...' ; 1j1*(i.2 3) )
> > ┌─┬───┬───┬───┐
> > │0│1 2│...│  0 1j1 2j2│
> > │ │   │   │3j3 4j4 5j5│
> > └─┴───┴───┴───┘
> >
> >C  S
> >

Re: [Jprogramming] "accessor" concepts

2021-09-14 Thread Jose Mario Quintana
> 0. to 9. and/or _9. would make good additions to language.

Perhaps one should consider that, rightly or otherwise, 0. currently has a
meaning according to the interpreters (e.g., j902),

   0.
0


Often I use an adverb (mne) to define undefined names, or redefine existing
proverbs, as pointers to fetch a corresponding content of a box within a
state consisting of a list of boxes.  For example,

(A B C D)mne

would, as a side effect, define A as 0&({::), ... D as 3&({::).  Thus,

   C
2&({::)

Another adverb (f) allows one to use the proverbs to get multiple boxes
from the state,

   (B C)f
1 2&{

and a conjunction (h) allows one to amend the contents of the state in
terms of the proverbs,

   (A B) h ((B C)f)
1 2&{ 0 1} ]

or

   C h (B +/ .* D)
<@:(B +/ .* D) 2} ]

The following illustrates their use,

   ( S=. 0 ; 1 2 ; '...' ; 1j1*(i.2 3) )
┌─┬───┬───┬───┐
│0│1 2│...│  0 1j1 2j2│
│ │   │   │3j3 4j4 5j5│
└─┴───┴───┴───┘

   C  S
...

   (B C)f  S
┌───┬───┐
│1 2│...│
└───┴───┘

   (A B) h ((B C)f)  S
┌───┬───┬───┬───┐
│1 2│...│...│  0 1j1 2j2│
│   │   │   │3j3 4j4 5j5│
└───┴───┴───┴───┘
   C h (B +/ .* D)  S
┌─┬───┬─┬───┐
│0│1 2│6j6 9j9 12j12│  0 1j1 2j2│
│ │   │ │3j3 4j4 5j5│
└─┴───┴─┴───┘

I define tacitly mne, f, and h (moreover, mne f and h themselves are tacit
entities) via the unorthodox methods using a fork of J which I have
mentioned in the past.  However, I cannot see any reason why mne, f, and h
 could not be defined (explicitly, when necessary) using the latest public
interpreters.


On Tue, Sep 14, 2021 at 1:18 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
>
> in jpp project,
>
> I use 0. as shortcut for (0 {:: ]) and 1. as shortcut for (1 {:: ])
>
> The adverb G =: 1 : 'u {:: ]' is the same.
>
> 0.~ or 0 G~ can be used to access fields of x argument.
>
> "State of something complicated" can simply be several boxed fields in x
or y argument.
>
> What easy accessors do is also permits "intermediate tacit results" by
prepending a calculated box to the y argument, with easy unpacking later in
the verb.
>
>
> 0. to 9. and/or _9. would make good additions to language.
>
>
>
> On Tuesday, September 14, 2021, 12:06:37 p.m. EDT, Michal Wallace <
michal.wall...@gmail.com> wrote:
>
>
>
>
>
> Let me amend what I was just saying about name:: ...
>
> I have been experimenting with a tacit style where the y "argument"
> represents the state of some big complicated object or system... for
> example, the state of a parser or a virtual machine.
>
> I've found that "accessor" verbs are really handy, and allow you to
> decouple your tacit code from the actual implementation of the object.
>
> An accessor 'gsn' (for "get/set 'n'") is a ambivalent verb that works like
> this:
>
>   gsn y  -> ignore y and return S
>   x gsn y -> ignore y. sets n to x and return S
>   S here indicates whatever the "state of the whole system" is...
>
> 'gsn' here is a pronoun (proverb?) -- If you had three state variables
> n0,n1,n2,
> you would make three such verbs, gsn0, gsn1, gsn2.
>
> This is quite flexible. If you want to store the state of your system in
an
> object or namespace,
> you can implement gsn like so:
>
> gsn0 =: {{  n0__state  }} :: {{ n0__state =: x }}
>
> Then the y argument you pass is just '' or whatever you want, since it's
> ignored.
>
> Or you can choose to implement the state as some physical array structure,
> which gets accessed and modified in place:
>
> gsn1 =: {{  1 { y }}  :: {{ x 1 } y }}
>
> It would be nice if these accessors could be created automatically.
>
> For example, (if we weren't about to be using the syntax for 'self
effacing
> names', we might
> use name:: to work as the accessor)... And then:
>
> name:: y  could:
>   - invoke  name__y if y is a reference
>   - extract they value for key 'name' from y if y is some kind of
dictionary
>   - extract  n { y  if 'name' is defined as a constant number
>
> x name:: y would do the analagous things for setting the value to x.
>
> Many object-oriented languages (python, C#, javascript) give you the
> ability to define such accessors either for specific names, *or* to design
> generic accessors that take the name as a parameter.
>
> For example, in python, you can arrange for  y.x = n to do any of the
> following:
>
>   1. explicitly set the x attribute of object y to n  (no accessor
defined)
>   2. call a specific  y.set_x(n)  method
>   3. call a generic  y.__setattr__(key='x', value=n)  method
>
> My proposal is thatx name:: y would have similar range of features,
> depending on the presence of certain handler verbs in the implicit locale
> (if y -: '')  or on y itself.
>
> Likewise,  0:: 1::  _1::  etc could be recognized as 'index accessors'
> when y is an array.
>
> If you wanted to get really crazy, then  ( index ):: could produce an
> explicit accessor function, where index is some noun that could be passed
> as m  in  m { 

Re: [Jprogramming] verbs of a gerund per item

2021-08-31 Thread Jose Mario Quintana
> Something to watch out for:
> both solutions need a fairly recent J version

That is correct; however, both

   <:`+:`*: dyad : 'x (`: 0) y'"(0) 5 7 9
4 14 81

and

   <:`+:`*: dyad : 'x (`: 6) y'"(0) 5 7 9
4 14 81

do not need recent versions of the interpreter.




On Tue, Aug 31, 2021 at 5:53 AM Hauke Rehr  wrote:
>
> Thanks Ben,
>
> I didn’t think about the simplest solution
> for if a question like this gets asked I always
> think it must be complicated to achieve and didn’t try
>
> Something to watch out for:
> both solutions need a fairly recent J version
>
> (at least they don’t work with
>
> Engine: j807/j64nonavx/linux
> Beta-e: commercial/2018-05-25T11:59:04
> Library: 8.07.26
> Platform: Linux 64
> Installer: J807 install
> )
>
> Am 31.08.21 um 11:47 schrieb Ben Gorte:
> > Hi R.E.,
> >
> > You mean this?
> >
> > (+`-`*`%`*:`%:`-:`>:)"0 [ 1 2 3 4 5 6 7 8
> >
> > 1 _2 1 0.25 25 2.44949 3.5 9
> >
> > Ben
> >
> > On Tue, 31 Aug 2021 at 19:10, R.E. Boss  wrote:
> >
> >> Given a gerund of 8 (further irrelevant) verbs and a noun of 8 items, I
> >> would like to have each verb work on one item.
> >> How is this be done, given only the possible n=0,3 or 6 for `: n?
> >>
> >>
> >> R.E. Boss
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Monadic verb chains: The J-way

2021-08-04 Thread Jose Mario Quintana
Alternatively, if the chain gets long, one can use an adverb (a
modification of an adverb by Dan Bron) to produce a tacit verb based on @:
as Elijah suggested,

   pipe=. ([ , (,<'@:') , ])/

   strand =: 2 : ' if. ([:`) -: u` do. (pipe n)`:6 else. strand
(u`n) end.'
   At =: strand ''

   [: a4 u3 u2 u1 u0 AtNB. [: is used just as a delimiter
a4@:u3@:u2@:u1@:u0

   [:-+/|:>:*:At
-@:(+/)@:|:@:>:@:*:

One could even write At tacitly, without much difficulty, in previous
versions of the interpreter, now...




On Wed, Aug 4, 2021 at 3:50 PM Jan-Pieter Jacobs 
wrote:

> If a verb is needed, one could easily make an explicit verb out of it as
> well:
>
> v1=: 3 :'|:>:*:y'
>
> or
>
> v2=: {{|:>:*:y}} NB. in J902 and onwards
>
> I can imagine that this could be a lot shorter than a tacit version if the
> chain gets long.
>
> Best regards,
> Jan-Pieter
>
>
>
>
> On Wed, Aug 4, 2021, 20:33 Thomas Bulka  wrote:
>
> > Am Mi., 4. Aug. 2021 um 19:31 Uhr schrieb Raul Miller <
> > rauldmil...@gmail.com
> > >:
> >
> > > Tacit code may often be more concise than explicit code when you are
> > > using the same named arguments multiple times.
> > >
> > > But that would not happen when you are using a name only once.
> > >
> >
> > Hi Raul,
> >
> > though this is obviously true, I never thought about it like that before.
> > In any case, I'll try to take it as a rule of thumb.
> >
> > Regards,
> >
> > Thomas
> >
> > PS. @Elijah: Thanks very much for your input, too!
> > --
> > 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


Re: [Jprogramming] Episode 6 of Array Cast with special guest Henry Rich

2021-07-27 Thread Jose Mario Quintana
Yes, Bob, I was flattered when I heard Henry saying that and also when I
read about your invitation.  However, I am somewhat hesitant, hence the
delay in my response, due to the following reasons:

0. It seems that you and I have something in common, I am not a
professional programmer either.  Moreover, programming is not even my
second field of expertise.  Although I am fluent in tacit programming, I am
not a J expert either (for example, when I am programming I keep the boxed
display on all the time, consult the vocabulary often, and I am not very
familiar with explicit programming, locales, addons, mapped files, etc.).

1. I noticed that there was some interest in the tacit programming of
adverbs and conjunctions.  If the goal were to discuss adverbial
programming applied in the context of current versions of the official
interpreter, and if Dan Bron were still active, I would have suggested
having him at least as a co-guest.  Although, he discovered the backdoor
that made the wicked heretical way possible he never embraced it. On the
contrary, when I wrote a wicked version of an adverb he described (he
called it the holy grail) which reduces tacit adverbial programming to
tacit verbal programming, he dismissed it in such a clever way that
prompted me to write a non-wicked version.  I must add that although I
wrote it, many of his insights and even bits of his code made it possible.
I should also point out that I am not quite sure if this non-wicked version
is kosher (it largely depends on what is ultimately decided regarding the
kind of arguments that train (`:6) is allowed to take).  I would refer this
question to the rabbis.

2. I am not sure if there would be enough interest to discuss the wicked
tacit adverbial and conjunctional programming way that I practice.

I do not want to sound too negative.  So,

0. Having a non-expert as a guest might be interesting in itself.

1. I could try to refresh my memory and skills related to the purist tacit
way.  I do not have a j903 engine handy but the holy grail adverb (the
script should appear as a hg.txt file at the bottom) seems to run on the
j902 engine.

2. The wicked way is most likely no longer possible using the latest j
engines; yet, verbs produced in this manner can run fine.  I would be happy
to talk about what I regard as a simpler, better, and more enjoyable way to
practice adverbial and conjunctional programming.Maybe Perlis' epigram
on programming #59 was a joke; but, a serious joke as far as I am
concerned. ;)

Please feel free to let me know if you would like to discuss the matter
further.  Of course, if you decide to go ahead I would consider it an honor.

Best regards,

Pepe


On Sun, Jul 25, 2021 at 11:04 PM 'robert therriault' via Programming <
programm...@jsoftware.com> wrote:

> Pepe,
>
> I am not sure whether you have listened to the podcast, but Henry
> expressed great admiration
> for your ability to write tacit code. If you are interested, I would love
> to have you on as a guest,
> as your approach is one that has influenced a number of J programmers.
>
> I actually was able to dig up the old j406 documentation through the
> wayback machine
>
>
> https://web.archive.org/web/20010127031200/http://www.jsoftware.com/dict/main.htm
>
> Cheers, bob
>
> > On Jul 25, 2021, at 18:48, Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
> >
> > Here they are...
> >
> > One can find an old Dictionary's relevant information at Martin's site:
> > F. Trains (gaertner.de) <
> http://juggle.gaertner.de/ref/dictionary/dictf.htm>
> > http://juggle.gaertner.de/ref/dictionary/dictf.htm
> >
> > I was never fully fluent because there were too many forms for me to
> > remember.  However, the decision to remove most of them rendered the
> > programming of tacit conjunctions impossible.  Remarkably, the
> programming
> > of tacit adverbs survived and it is, for the most part, complete.  Years
> > later I realized that the last form in the list ( C0 A1  conj  (x C0 y)
> A1
> > ) would alone make the programming of tacit conjunctions also complete,
> for
> > the most part.  Alas, all this is academic because it has been made
> > abundantly clear that none of those forms removed will ever come back to
> > the official language.
> >
> > I have that last form restored in my custom version of J not because is
> > necessary (my version treats verbs, and adverbs and conjunctions, as
> > genuine first-class citizens and reduces tacit conjunctional programming
> to
> > tacit dyadic verbal programming) but as a tribute to the foresight (fully
> > conscious or otherwise).
> >
> > On Sat, Jul 24, 2021 at 4:22 AM Hauke Rehr 
> wrote:
> >
> >> maybe Jose, author of the J Wicked Tacit Toolkit,
> >> wan

Re: [Jprogramming] Episode 6 of Array Cast with special guest Henry Rich

2021-07-25 Thread Jose Mario Quintana
Here they are...

One can find an old Dictionary's relevant information at Martin's site:
F. Trains (gaertner.de) 
http://juggle.gaertner.de/ref/dictionary/dictf.htm

I was never fully fluent because there were too many forms for me to
remember.  However, the decision to remove most of them rendered the
programming of tacit conjunctions impossible.  Remarkably, the programming
of tacit adverbs survived and it is, for the most part, complete.  Years
later I realized that the last form in the list ( C0 A1  conj  (x C0 y) A1
) would alone make the programming of tacit conjunctions also complete, for
the most part.  Alas, all this is academic because it has been made
abundantly clear that none of those forms removed will ever come back to
the official language.

I have that last form restored in my custom version of J not because is
necessary (my version treats verbs, and adverbs and conjunctions, as
genuine first-class citizens and reduces tacit conjunctional programming to
tacit dyadic verbal programming) but as a tribute to the foresight (fully
conscious or otherwise).

On Sat, Jul 24, 2021 at 4:22 AM Hauke Rehr  wrote:

> maybe Jose, author of the J Wicked Tacit Toolkit,
> wants to throw in his 2¢?
>
>
> Am 24.07.21 um 09:29 schrieb 'robert therriault' via Programming:
> >   I started programming in J just after ti was taken out, but I believe
> it allowed you to create trains in conjunctions the way that we currently
> do with verbs. In the interview Henry indicated that the processing was
> simplified when it was taken out and the language became easier to use for
> most.
> >
> > Cheers, bob
> >
> >> On Jul 24, 2021, at 00:11, Elijah Stone  wrote:
> >>
> >>> there used to be a much richer of version of the language that was
> taken away 15 years ago.  It was possible to do tacit programming with
> conjunctions
> >>
> >> I think I remember somebody else's mentioning that as well, at some
> point. How did that work?
> >>
> >> -E
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] ups & downs

2021-05-23 Thread Jose Mario Quintana
> This works, but it doesn't seem like it was a worthwhile exercise:

Maybe, maybe not, depending on one's priority regarding conciseness and
space-time performance.  A comparison of three fixed tacit verbs follows,
foo is a tacit version of Boss' explicit verb, goo is your tacit verb
(fixed), and hoo is a tacit straightforward transcription of your explicit
version produced elsewhere (and reproduced here using a j902 interpreter),

   Y=. ?.@#~66

   stp 666
  foo Y
  goo Y
  hoo Y
)
┌┬─┬──┬┐
│Sentence│Space│Time  │Space * Time│
├┼─┼──┼┤
│  foo Y │12672│2.60968e_5│0.330699│
├┼─┼──┼┤
│  goo Y │22976│1.15749e_5│0.265945│
├┼─┼──┼┤
│  hoo Y │13760│1.15728e_5│0.159242│
└┴─┴──┴┘

   Y=. ?.@#~666

   stp 666
  foo Y
  goo Y
  hoo Y
)
┌┬──┬───┬┐
│Sentence│Space │Time   │Space * Time│
├┼──┼───┼┤
│  foo Y │122752│0.000258194│31.6938 │
├┼──┼───┼┤
│  goo Y │210368│5.90565e_5 │12.4236 │
├┼──┼───┼┤
│  hoo Y │127424│5.35683e_5 │6.82589 │
└┴──┴───┴┘

   Y=. ?.@#~

   stp 666
  foo Y
  goo Y
  hoo Y
)
┌┬───┬───┬┐
│Sentence│Space  │Time   │Space * Time│
├┼───┼───┼┤
│  foo Y │1181440│0.00280684 │3316.11 │
├┼───┼───┼┤
│  goo Y │2175168│0.00104154 │2265.53 │
├┼───┼───┼┤
│  hoo Y │1118400│0.000541218│605.298 │
└┴───┴───┴┘




On Sat, May 22, 2021 at 8:59 AM Raul Miller  wrote:
>
> Nope, I didn't take my thinking far enough. Those last two lines
> require some significant duct tape and glue if I want to "minimize"
> recalculation.
>
> But... one thing I could do is glue the ucnt and uval values together
> (since they have the same length). And, then, when I calculate sndx, I
> can glue that on top of the other two (since it also had the same
> length). And, then, when I compute reps, I can glue that to the top of
> the stack (since it is also the same length). This greatly simplifies
> value passing, since I can now pick whichever of these four values I
> want to work with. But that still leaves useg buried in the middle, so
> I might as well make useg the same length as everything else and throw
> it onto the stack.
>
> This works, but it doesn't seem like it was a worthwhile exercise:
>
> undx=: [: +/\ 2~:/\(,~ 1+{.)
> ucvs=: (#/.~@] ,: {./.~) undx NB. uval: _1{  ucnt: _2{
> useg=: ,~ 1,[: ((2 ~:/\ ]) , 0#~0<#)@:* 2 -/\ {: NB. useg: _3{
> reps=: ,~ _2&{ * 1, 1+1}._3&{ NB. reps: _4{
> sndx=: ,~ +/\@(_4&{) NB. sndx: _5{
> segs=: _3&{@]`((_5{])-_2{])`(0#~(<_5 _1){])}~ NB. _6{
> result=: <;.1 (_4&{) # _1&{
> updowns=: (result~ segs)@sndx@reps@useg@ucvs
>
> Oh well... at least it's harder to read. Or, something like that.
>
> --
> Raul
>
> On Fri, May 21, 2021 at 9:01 PM Raul Miller  wrote:
> >
> > After thinking about this for a little bit, I have decided that it
> > should be *almost* straightforward to convert this definition to a
> > fully tacit form.
> >
> > The simplest tactic would be to define tacit expressions for each of
> > the local names in the definition, but that would result in
> > significant repeat work.
> >
> > But we can use trains to calculate and save two values and of course a
> > third value can be calculated inside the train if it's used only once.
> > So, looking at the structure of the definition:
> >
> > labels=: ;:'y undx uval ucnt useg reps sndx segs result'
> > reset=:{{
> >   connections=:0$~2##labels
> > }}
> > depends=:{{
> >   connections=:1 ({(labels i.;:x);(#labels)-.~labels i.;:y)} connections
> > }}
> >
> >   reset''
> >   'uval' depends ' undx {./. y'
> >   'ucnt' depends ' #/.~ undx'
> >   'useg' depends ' ((2 ~:/\ ]),0#~0<#) * 2 -/\ uval'
> >   'reps' depends ' ucnt*1,1+useg'
> >   'sndx' depends ' +/\reps'
> >   'segs' depends ' (1,useg) (sndx-ucnt)} 0#~{:sndx'
> >   'result' depends ' segs<;.1 reps#uval'
> >
> > We can also see that each value is used by at most two other values
> > which is promising:
> >+/connections
> > 1 2 2 2 2 2 1 1 0
> >
> > And, we can remind ourselves that each value depends on at most three
> > other values, which is also promising:
> >+/"1 connections
> > 0 0 2 1 1 2 1 3 3
> >
> > But those last two could use some further inspection:
> >
> > Looking at the computation for segs:
> >(labels i.;:'useg sndx ucnt') { +/connections
> > 2 1 2
> >
> > sndx is only used once, so it could be computed inside a train. But,
> > it appears twice in the expression, so we would need to rearrange
> > things to eliminate that as a problem. Perhaps the simplest approach
> > would be to replace those two uses with +/\reps and +/reps.
> >
> > 

Re: [Jprogramming] Contrintuitive argument order in Fold right verb

2021-03-05 Thread Jose Mario Quintana
Thank you for the reminder, I had forgotten that this is one of the reasons
why I decided, a long time ago, to write only tacitly (apart from
inconsequential sporadic occasions).

On Fri, Mar 5, 2021 at 7:03 AM Raul Miller  wrote:

> The names u and v are special, of course:
>
>fold=. {{ y (v F:. u) x}}
>u=. '('"_ , [ , ' u '"_ , ] , ')'"_
>v=. '('"_ , 'v '"_ , ] , ')'"_
>(4 2$'X0X1..XN') u fold v 'Y0'
> |stack error
> |   y(v F:.u)x
>
> But this works, as you probably knew it would:
>(4 2$'X0X1..XN') u f.fold (v f.)'Y0'
> (v (X0 u Y0))
> (v (X1 u (X0 u Y0)))
> (v (.. u (X1 u (X0 u Y0
> (v (XN u (.. u (X1 u (X0 u Y0)))))
>
> Thanks,
>
> --
> Raul
>
> On Thu, Mar 4, 2021 at 6:11 PM Jose Mario Quintana
>  wrote:
> >
> > > When I first read about it, I considered it a fun and approachable
> > > example – and it lends itself to folding so I support elaborating on
> > > this when compiling some learning material/show casing of folds.
> >
> > I would simplify the example by considering the state to be just the
> coins
> > on the plate.  Thus,
> >
> >knave=. [ , \:~@:] }.~ #@:[
> >
> > and the state history becomes,
> >
> >K (knave fold ]) P
> >  50 50 50 25 10 5
> > 100 25 50 25 10 5
> >   5 10 25 25 10 5
> >  25 50 10 10  5 5
> >  25 10 10 10  5 5
> >
> > and if one is only interested in the amounts on the plate, then those
> could
> > be produced as follows,
> >
> >K (knave fold (+/)) P
> > 190 215 80 105 65
> >
> > I often find illustrating the use of symbolic nouns and verbs, for
> example,
> >
> >u=. '('"_ , [ , ' u '"_ , ] , ')'"_
> >v=. '('"_ , 'v '"_ , ] , ')'"_
> >
> >'X' u 'Y'
> > (X u Y)
> >v 'Y'
> > (v Y)
> >
> > to visualize the products of applied adverbs and conjunctions.  Thus, for
> > the (swapped) noun arguments,
> >
> >(4 2$'X0X1..XN') ; 'Y0'
> > ┌──┬──┐
> > │X0│Y0│
> > │X1│  │
> > │..│  │
> > │XN│  │
> > └──┴──┘
> >
> > the conjunction F:. produces,
> >
> >'Y0' v F:. u (4 2$'X0X1..XN')
> > (v (X0 u Y0))
> > (v (X1 u (X0 u Y0)))
> > (v (.. u (X1 u (X0 u Y0
> > (v (XN u (.. u (X1 u (X0 u Y0)
> >
> > By the way, I tried to show that,
> >
> >(4 2$'X0X1..XN') u fold v 'Y0'
> >
> > would produce the same result; but, for some reason, j902 did not comply.
> > Oh well...
> >
> >
> > On Fri, Feb 26, 2021 at 2:30 AM Hauke Rehr 
> wrote:
> > >
> > > I remember that knaves example.
> > > Glad to see you agree x/y are better used the other way around.
> > > P is a state altered by each of the knaves in K, respectively.
> > > Another good example showing that, if 'control' vs 'data' were
> > > a decisive creterion, the order of arguments would need to be changed.
> > >
> > > When I first read about it, I considered it a fun and approachable
> > > example – and it lends itself to folding so I support elaborating on
> > > this when compiling some learning material/show casing of folds.
> > >
> > >
> > > Automata are another example: a starting state is altered by
> > > successive transitions depending on items of a control input
> > > into an accepting state.
> > > So replaying a macro (fixed array of commands) takes any current
> > > situation (data) and applies the commands one after the other,
> > > resulting in the (hopefully intended) final situation.
> > >
> > > Maybe a “robot in a maze”-like game could show this where
> > > users are given a set of macros and some goal to achieve,
> > > and can apply the macros until they reach it, macros being
> > > replayed by a fold. I’ll add that one to the list of projects
> > > I’d hope to get around to implementing. Might even be used
> > > for teaching programming, just as the “laby” game does.
> > >
> > > https://sgimenez.github.io/laby/
> > >
> > >
> > > Am 26.02.21 um 02:33 schrieb Jose Mario Quintana:
> > > > Different people may have different preferences, mine is a form that
> I
> > have
> > > > used for many years and roughly corresponds to,
> > > >
> > > >fold=. {{ y (v F:. u) x}}
> > > >
> > > >
> > > > Thus, the example in,
> > > >
> > > > Loopless Code VI: Tempor

Re: [Jprogramming] Contrintuitive argument order in Fold right verb

2021-03-04 Thread Jose Mario Quintana
> When I first read about it, I considered it a fun and approachable
> example – and it lends itself to folding so I support elaborating on
> this when compiling some learning material/show casing of folds.

I would simplify the example by considering the state to be just the coins
on the plate.  Thus,

   knave=. [ , \:~@:] }.~ #@:[

and the state history becomes,

   K (knave fold ]) P
 50 50 50 25 10 5
100 25 50 25 10 5
  5 10 25 25 10 5
 25 50 10 10  5 5
 25 10 10 10  5 5

and if one is only interested in the amounts on the plate, then those could
be produced as follows,

   K (knave fold (+/)) P
190 215 80 105 65

I often find illustrating the use of symbolic nouns and verbs, for example,

   u=. '('"_ , [ , ' u '"_ , ] , ')'"_
   v=. '('"_ , 'v '"_ , ] , ')'"_

   'X' u 'Y'
(X u Y)
   v 'Y'
(v Y)

to visualize the products of applied adverbs and conjunctions.  Thus, for
the (swapped) noun arguments,

   (4 2$'X0X1..XN') ; 'Y0'
┌──┬──┐
│X0│Y0│
│X1│  │
│..│  │
│XN│  │
└──┴──┘

the conjunction F:. produces,

   'Y0' v F:. u (4 2$'X0X1..XN')
(v (X0 u Y0))
(v (X1 u (X0 u Y0)))
(v (.. u (X1 u (X0 u Y0
(v (XN u (.. u (X1 u (X0 u Y0)

By the way, I tried to show that,

   (4 2$'X0X1..XN') u fold v 'Y0'

would produce the same result; but, for some reason, j902 did not comply.
Oh well...


On Fri, Feb 26, 2021 at 2:30 AM Hauke Rehr  wrote:
>
> I remember that knaves example.
> Glad to see you agree x/y are better used the other way around.
> P is a state altered by each of the knaves in K, respectively.
> Another good example showing that, if 'control' vs 'data' were
> a decisive creterion, the order of arguments would need to be changed.
>
> When I first read about it, I considered it a fun and approachable
> example – and it lends itself to folding so I support elaborating on
> this when compiling some learning material/show casing of folds.
>
>
> Automata are another example: a starting state is altered by
> successive transitions depending on items of a control input
> into an accepting state.
> So replaying a macro (fixed array of commands) takes any current
> situation (data) and applies the commands one after the other,
> resulting in the (hopefully intended) final situation.
>
> Maybe a “robot in a maze”-like game could show this where
> users are given a set of macros and some goal to achieve,
> and can apply the macros until they reach it, macros being
> replayed by a fold. I’ll add that one to the list of projects
> I’d hope to get around to implementing. Might even be used
> for teaching programming, just as the “laby” game does.
>
> https://sgimenez.github.io/laby/
>
>
> Am 26.02.21 um 02:33 schrieb Jose Mario Quintana:
> > Different people may have different preferences, mine is a form that I
have
> > used for many years and roughly corresponds to,
> >
> >fold=. {{ y (v F:. u) x}}
> >
> >
> > Thus, the example in,
> >
> > Loopless Code VI: Temporary Variables (jsoftware.com)
> > <https://www.jsoftware.com/help/jforc/loopless_code_vi_temporary_v.htm>
> >
> > becomes,
> >
> >knave=. [ ,~ \:~ @: (] }.~ [: # [)
> >
> >( P=. 100 25 100 50 5 10 )
> > 100 25 100 50 5 10
> >( K =. _2 ]\ 50 50 100 25 5 10 25 50 25 10 )
> >  50 50
> > 100 25
> >   5 10
> >  25 50
> >  25 10
> >
> >K ([ (knave fold ] ) {:@:[ , ]) P
> > 100 100 50 25 10 5  50 50
> >  50  50 50 25 10 5 100 25
> > 100  50 25 25 10 5   5 10
> >  25  25 10 10  5 5  25 50
> >  50  25 10 10  5 5  25 10
> >
> > I hope it helps
> >
> >
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Contrintuitive argument order in Fold right verb

2021-02-25 Thread Jose Mario Quintana
Different people may have different preferences, mine is a form that I have
used for many years and roughly corresponds to,

   fold=. {{ y (v F:. u) x}}


Thus, the example in,

Loopless Code VI: Temporary Variables (jsoftware.com)


becomes,

   knave=. [ ,~ \:~ @: (] }.~ [: # [)

   ( P=. 100 25 100 50 5 10 )
100 25 100 50 5 10
   ( K =. _2 ]\ 50 50 100 25 5 10 25 50 25 10 )
 50 50
100 25
  5 10
 25 50
 25 10

   K ([ (knave fold ] ) {:@:[ , ]) P
100 100 50 25 10 5  50 50
 50  50 50 25 10 5 100 25
100  50 25 25 10 5   5 10
 25  25 10 10  5 5  25 50
 50  25 10 10  5 5  25 10

I hope it helps





On Thu, Feb 25, 2021 at 7:03 PM Hauke Rehr  wrote:

> For labs and the wiki, we should have some examples
> easily understood. I have an example where at least
> what it does is easily understood but I won’t show
> the implementation – I did a bad job there
> Essentially, it’s $ with fill.
> Just like the other example I mentioned, {
>
>
>2 4 7 (] F.: step)~ i.100
>  0  1  2  3  4  5  6
>  7  8  9 10 11 12 13
> 14 15 16 17 18 19 20
> 21 22 23 24 25 26 27
>
> 28 29 30 31 32 33 34
> 35 36 37 38 39 40 41
> 42 43 44 45 46 47 48
> 49 50 51 52 53 54 55
>
>
> 56 57 58 59 60 61 62
> 63 64 65 66 67 68 69
> 70 71 72 73 74 75 76
> 77 78 79 80 81 82 83
>
> 84 85 86 87 88 89 90
> 91 92 93 94 95 96 97
> 98 99  0  0  0  0  0
>  0  0  0  0  0  0  0
>
>
> Am 25.02.21 um 17:51 schrieb Eric Iverson:
> > I am a member of the silent majority on this issue.
> >
> > I have been pleased with the civility of the fold discussion considering
> > how emotional language issues can be.
> >
> > J is not designed by vote or committee. There are always going to be
> strong
> > disagreements. But we are a small community and are best served by, at
> the
> > appropriate time, burying those disagreements and moving on. I think that
> > time has come for fold.
> >
> > J is the better for having fold. Let's focus now on using it and sharing
> > how it can be used. Some labs or wiki pages would be nice!
> >
> >
> >
> >
> > On Thu, Feb 25, 2021 at 11:25 AM Hauke Rehr 
> wrote:
> >
> >> Good point about the silent ones: you’re right, I guess.
> >>
> >> I still disagree regarding fold being used the way you tell us.
> >> What you want to do can be done with / and the likes.
> >> Again, the main advantage of the fold verbs from my pont of view
> >> is that there may be any kind of initial data processed by v
> >> in a way given by x’s items’ values.
> >>
> >> But let’s just settle on “we agree to disagree” – I don’t think
> >> further back and forth will lead us somewhere.
> >>
> >> (and maybe I need to get some rest ere I write more rubbish here)
> >>
> >> Hauke
> >>
> >> Am 25.02.21 um 17:19 schrieb 'Sergey Kamenev' via Programming:
> >>> I think Henry Rich is most likely a genius programmer.
> >>>
> >>> By the way, I am a supporter of meritocracy,
> >>> when the weight of a person's voice depends on his merits.
> >>>
> >>> But a programming language is written for the community.
> >>> And so the voice of the community when discussing new features
> >>> should carry a lot of weight.
> >>>
> >>> The definition of a fold itself implies that there is an array that
> will
> >>> fold.
> >>> However, the initial value does not have to be an array,
> >>> but what is collapsed arg must be an array.
> >>>
> >>> Right argument have more arrayness in comparing with left arg.
> >>>
> >>> The silent majority most likely does not use Fold verbs,
> >>> therefore they are silent, since this topic does not concern them.
> >>>
> >>> Sergey.
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> --
> >> mail written using NEO
> >> neo-layout.org
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] almost real numbers

2021-02-20 Thread Jose Mario Quintana
>  (0j1 * 1p1) = (^. _1)
> 1

Alternatively,

   _1 = ^ j. 1p1
1

Yet,

   0 = 1 + ^ j. 1p1
0

is a pity.


PS. Beautiful profile picture "María."   ;)




On Sat, Feb 20, 2021 at 12:46 AM María Magdalena Mixuhca <
mariamagdalenamixu...@gmail.com> wrote:
>
> I find this lack of beauty surprisingly disturbing:
>
>   (^ j. 1p1)
> _1j1.22465e_16
>
> So much so, in fact, that if I'm ever in the situation of having to prove
> to a finicky Galactic Emperor that humanity is indeed capable of producing
> the most sublime beauty and thus worthy of saving, I would undoubtedly
> resort to something like:
>
>  (0j1 * 1p1) = (^. _1)
> 1
>
> ...lest he finds the former as perturbing  as I do on my bad days, turns
me
> into catfood on the spot and makes the Sun go supernova just like that.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Fermat or not Fermat?

2020-12-30 Thread Jose Mario Quintana
> Simpler even
>
>=`+/ 12^~ 2| 1922 1782 1841
> 0

  =`+/ 12^~ 1922 1782 1841
0

   1922 = 1782 +&.(^&12) 1841
0

   ( 1782 +&.(^&12) 1841 )"_
1921.9995586541"_


On Wed, Dec 30, 2020 at 5:13 AM R.E. Boss  wrote:
>
> Simpler even
>
>=`+/ 12^~ 2| 1922 1782 1841
> 0
>
> Or, with intermediate values
>
>(,[:+`=/\.{:) (,12^~ {:) (,:2&|) 1922 1782 1841
> 1922 1782 1841
>001
>001
>011
>
>
> R.E. Boss
>
>
> -Original Message-
> From: Programming  On Behalf Of
Jimmy Gauvin
> Sent: dinsdag 29 december 2020 15:54
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Fermat or not Fermat?
>
> Hi,
>
> -/1782 1922 1841^12x
>
> _700212234530608691501223040959
>
>
> Jimmy
>
>
> PS Have you been watching too many Simpson's episodes ?
>
> More specifically :
>
https://ew.com/tv/2018/10/19/the-simpsons-homer-cubed-treehouse-of-horror-vi/
>
>
>
> On Tue, Dec 29, 2020 at 5:09 AM R.E. Boss  wrote:
>
> >
> >   1782 +&.(^&12) 1841
> > 1922
> >
> > LOL.
> >
> > R.E. Boss
> > --
> > 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


Re: [Jprogramming] Getting indices of matrix elements

2020-11-14 Thread Jose Mario Quintana
> Wow.  Just when I think I'm starting to get proficient in the language...
>M (4 $. [: $. =) 6 32 58

One might never stop learning, or relearning J  ;)

[Jgeneral] (i. 2 3) i. 4 NB. you know what i mean... how do iget it to
work?!
Dan Bron
http://www.jsoftware.com/pipermail/general/2007-May/029887.html





On Fri, Nov 13, 2020 at 1:26 PM Devon McCormick  wrote:
>
> Wow.  Just when I think I'm starting to get proficient in the language...
>M (4 $. [: $. =) 6 32 58
> 0 1 1
> 1 2 2
> 2 3 3
>
> This sparse array approach behaves differently from my proposal for an
edge
> condition (lookup not found):
>M (4 $. [: $. ="_ 0~) 99   NB. Empty result for "not found"
>M (([: $ [) #: ] i.~ [: , [) 99NB.  versus potentially misleading
> result.
> 0 0 0
>
> I stumbled on this in my attempt to accommodate an array right argument
> with Ric's solution:
>M ([: 4&$.@:$. ="_ 0~) 2 3$6 7 8 32 58 59
> 0 1 1 0 0
> 0 1 2 0 1
> 0 1 3 0 2
> 1 2 2 1 0
> 2 3 3 1 1
> 2 3 4 1 2
>
> This appears to indicate the indexes into the left argument in the first 3
> columns and the indexes of the corresponding items on the right in the
last
> two columns (because a 3D argument on the left and a 2D argument on the
> right).
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Rational?

2020-10-19 Thread Jose Mario Quintana
You are welcome, David.

On Mon, Oct 19, 2020 at 9:36 AM David Lambert  wrote:
>
> Oops, sorry.  I had parenthesized incorrectly.  Thanks Pepe.
>
> |. &.   (":&.>)   324.567 23465  243345j4.65 4r5
> +---+-+---+---+
> |324.567|23465|243345j4.65|0.8|
> +---+-+---+---+
>
> |Date: Sun, 18 Oct 2020 15:09:20 -0400
> |From: David Lambert 
> |To: programming 
> |Subject: [Jprogramming] rational?
> |Message-ID: 
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] strange obverse

2020-10-18 Thread Jose Mario Quintana
I fail to see what the big issue regarding

8 -inv 5
3

is.

Since  x u^:n y  is equivalent to  (x)^:n y  then  8 (-^:_1) 5  is
equivalent to  (8&-^:_1) 5, and the inverse of   8&- is itself, one
can do the math or just ask J,

   (8&-) b._1
8&-

Thus,

   (8&-)5
3

Am I confused?

On Sun, Oct 18, 2020 at 6:03 PM Henry Rich  wrote:
>
> I agree that - : (-~) might be a better obverse.  If there is only one
> inverse, it is for the monad.
>
> I like the idea of more documentation - care to add it to NuVoc?
>
> Henry Rich
>
> On 10/18/2020 6:00 PM, Raul Miller wrote:
> > Yes, that represents the expectation and the implementation. But I am
> > not seeing how there's any inverse here, for the dyadic case.
> >
> > - b. _1
> > -
> >
> > Personally I would expect either
> >
> > - : +
> >
> > or
> >
> > - : (-~)
> >
> > or some writeup explaining the thinking that makes the current
> > implementation the right approach.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> > On Sun, Oct 18, 2020 at 5:49 PM Henry Rich  wrote:
> >>  (-&5 inv) 8
> >> 13
> >>  (8&- inv) 5
> >> 3
> >>
> >> You are thinking it does the first, but it does the second.
> >>
> >> Henry Rich
> >>
> >> On 10/18/2020 3:27 PM, David Lambert wrote:
> >>> JVERSION
> >>> Engine: j902/j64avx2/linux
> >>> Beta-h: commercial/2020-10-03T19:37:53
> >>> Library: 9.02.05
> >>> Platform: Linux 64
> >>> Installer: J902 install
> >>> InstallPath: /home/lambertdw/downloads/installs/j902
> >>> Contact: www.jsoftware.com
> >>>
> >>>
> >>> NB. huh?  13 looks right to me.
> >>> 8 -inv 5
> >>> 3
> >>>
> >>> NB. expected
> >>> 8 *inv 5
> >>> 0.625
> >>>
> >>> 8 +inv 5
> >>> _3
> >>>
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] strange obverse

2020-10-18 Thread Jose Mario Quintana
> Looks like it hasn't worked and everyone has avoided using it.

What "hasn't worked and everyone has avoided using it"?

On Sun, Oct 18, 2020 at 4:04 PM Raul Miller  wrote:
>
> I get the same thing in j807:
>
>(-/ -: -inv"0/)~i.10
> 1
>
> Looks like it hasn't worked and everyone has avoided using it.
> (Probably because + is simpler to type, and inv is not robust enough
> to put into tools that work on arbitrary code).
>
> Thanks,
>
> --
> Raul
>
>
> On Sun, Oct 18, 2020 at 3:27 PM David Lambert  wrote:
> >
> > JVERSION
> > Engine: j902/j64avx2/linux
> > Beta-h: commercial/2020-10-03T19:37:53
> > Library: 9.02.05
> > Platform: Linux 64
> > Installer: J902 install
> > InstallPath: /home/lambertdw/downloads/installs/j902
> > Contact: www.jsoftware.com
> >
> >
> > NB. huh?  13 looks right to me.
> > 8 -inv 5
> > 3
> >
> > NB. expected
> > 8 *inv 5
> > 0.625
> >
> > 8 +inv 5
> > _3
> >
> > --
> > 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


Re: [Jprogramming] strange obverse

2020-10-18 Thread Jose Mario Quintana
> NB. huh?  13 looks right to me.
> 8 -inv 5
> 3

  (8&-^:_1) 5
3
   (8&*^:_1) 5
0.625
   (8&+^:_1) 5
_3


On Sun, Oct 18, 2020 at 3:27 PM David Lambert  wrote:
>
> JVERSION
> Engine: j902/j64avx2/linux
> Beta-h: commercial/2020-10-03T19:37:53
> Library: 9.02.05
> Platform: Linux 64
> Installer: J902 install
> InstallPath: /home/lambertdw/downloads/installs/j902
> Contact: www.jsoftware.com
>
>
> NB. huh?  13 looks right to me.
> 8 -inv 5
> 3
>
> NB. expected
> 8 *inv 5
> 0.625
>
> 8 +inv 5
> _3
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] rational?

2020-10-18 Thread Jose Mario Quintana
> NB. here I do not understand
> (|.&.":)&>324.567 23465  243345j4.65 4r5
> 765.423 56432 56.4j543342 8

   datatype 324.567 23465  243345j4.65 4r5
complex

   ": &> 324.567 23465  243345j4.65 4r5
324.567
23465
243345j4.65
0.8

   (":inv@|.) '0.8'
8



On Sun, Oct 18, 2020 at 3:09 PM David Lambert  wrote:
>
> NB. reversing digits of a number
>
> NB. conversion of 4r5 to 8 makes sense to me
> |. |.&.":324.567 23465  243345j4.65 4r5
> 765.423 56432 56.4j543342 8
>
> NB. here I do not understand
> (|.&.":)&>324.567 23465  243345j4.65 4r5
> 765.423 56432 56.4j543342 8
>
> JVERSION
> Engine: j902/j64avx2/linux
> Beta-h: commercial/2020-10-03T19:37:53
> Library: 9.02.05
> Platform: Linux 64
> Installer: J902 install
> InstallPath: /home/lambertdw/downloads/installs/j902
> Contact: www.jsoftware.com
>
> (|.&.":)&.>324.567 23465  243345j4.65 4r5
> ┌───┬─┬───┬─┐
> │765.423│56432│56.4j543342│8│
> └───┴─┴───┴─┘
>
> |.&.": 4r5
> 5r4
>
>
> Thanks!  Dave
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] jajh anyone?

2020-09-01 Thread Jose Mario Quintana
> If we're going to go with obscure large numbers,

Well, the point of providing an argument a couple of hundred orders of
magnitude higher than necessary to the Turing tar-pit was to emphasize that
one could easily obfuscate its code indefinitely.  Was it not?

> ".a.{~35+91#.inv".0 :0-.LF
> 81366029708523506035417756025037363272973280294647519604819263
> ...
> )

I just get an error when I try your version, never mind.



On Mon, Aug 31, 2020 at 8:22 PM Raul Miller  wrote:
>
> If we're going to go with obscure large numbers, beware of
> ...
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] jajh anyone?

2020-08-31 Thread Jose Mario Quintana
Beware of line wrapping...

   ".@:(a. {~ 

Re: [Jprogramming] tacit syntax again

2020-07-09 Thread Jose Mario Quintana
There is no simple way to "@:/" because a conjunction cannot be an adverb's
argument...  Unless one cheats and cloaks the conjunction (@:) as a verb
(at), at least in j807.

Personally, I prefer a multiple adverb (At) faking strand notation together
with a guard ([:) instead of using a gerund because it looks cleaner, see
[0] near the bottom; for example,

   [: alpha beta gamma delta At
alpha@:beta@:gamma@:delta

   [: echo # ucp At
echo@:#@:ucp

The definition of At in [1],

At=. train o (at~&:>/) o |. f.sb  NB. (Curried adv)

is essentially implementing "@:/" operating on an illegal list of boxed
verbs produced by the adverb sb (it is a little more complicated than
expected to be able to handle the anomalous case of a single verb and to
take in account that a conjunction, @: in this case, associate the other
way around vs a verb).

I cannot see any reason, apart from being a somewhat tedious exercise, why
At could not be implemented explicitly or even tacitly in an orthodox
manner.

I only use At sporadically; what I use regularly is a convenient double
adverb taking multiple lines, a watered-down single adverb version (is) can
be found in [2]

   9!:14''
j901/j64/windows/release-e/commercial/www.jsoftware.com/2020-01-29T11:13:46

test is
  echo  NB. A standard library monadic verb
  #
  ucp   NB. Another standard library verb
)

   test
ucp@:#@:echo

The adverb is is wicked; yet, again, I see no reason why it could not be
implemented explicitly or even tacitly in an orthodox manner.

References

[0] [Jprogramming] Verb pipelines
http://www.jsoftware.com/pipermail/programming/2010-June/019756.html

[1] [Jprogramming] tacit
http://www.jsoftware.com/pipermail/programming/2020-June/056075.html

[2] Dining philosophers
https://rosettacode.org/wiki/Dining_philosophers#J


On Thu, Jul 9, 2020 at 5:26 AM Hauke Rehr  wrote:
>
> Hello everybody,
>
> I wonder if there’s a simple way to “@:/“ a sequence of steps:
> say I want to apply verbs a,b,c,d,e in turn, I could say
> sequence =: 3 : 0
>e d c b a y
> )
> turning sequence tacit
> sequence =: e@:d@:c@:b@:a
> or
> sequence =: [: e [: d [: c [: b a
> (this is 13:’s suggestion)
>
> I’d rather have a kind of “/” working for conjunctions.
> (I’m quite sure one could do it on the ar level somehow
>   crossing the function/data representation border twice
>   but I’m not used to playing around with that)
> Maybe there is a way I don’t know of?
> Or a good reason to not have this kind of thing in J?
>
> --
> --
> mail written using NEO
> neo-layout.org
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] tacit

2020-06-03 Thread Jose Mario Quintana
If any tacit counterpart to onsub has been shown ... I missed it!

> onsub =: 2 : 'n&{. , n&}.@:(n&{."1) ,. u@:(n&}."1)@(n&}.)'
> (
...
> |. onsub 2 mat =: ? 5 6 $ 20
> reversing (mirror) the 3 by 4 lower right submatrix
>
> (a) how to write this without reference to u or n?

Unfortunately, due to the cleanup mentioned by Henry in the other related
thread, at least two babies were thrown out with the bathwater rendering
the production of new user-defined tacit conjunctions impossible.  So, one
would have to follow the rules and write a tacit adverb operating on a
gerund; but, that would be a pain.  Alternatively, running on j807 (or some
earlier versions), one can use the tacit wicked toolkit I have mentioned a
few times before (attached at the bottom for completeness (fingers crossed) )
as follows (beware of session wrapping henceforth!),

   (0!:0)<'.../j wicked toolkit. ijs'
   onsub =: 2 :'n&{. , n&}.@:(n&{."1) ,. u@:(n&}."1)@(n&}.)'

   os=. train f. x ([: u n 'n&{. , n&}.@:(n&{."1) ,. u@:(n&}."1)@(n&}.)'
xi) o j f. ]

Do they produce the same results?

   Y=. ? 5 6 $ 20

   |.onsub 2 Y
 9 11  1  4  8  3
 3 12  5  4  7 11
10 11  5 19 17 14
 6 16 13  8 17 12
13  2  9 10  0  8

   |.`'' os2 Y
 9 11  1  4  8  3
 3 12  5  4  7 11
10 11  5 19 17 14
 6 16 13  8 17 12
13  2  9 10  0  8


   |.onsub 2
2&{. , 2&}.@:(2&{."1) ,. |.@:(2&}."1)@(2&}.)

   |.`'' os2
2&{. , 2&}.@:(2&{."1) ,. |.@:(2&}."1)@(2&}.)

Is os tacit?

   55 Wrap'os'
,^:(0:``:)&6 :.(<@:((,'0') ,&:< ]))@:[ ((<<11 0),(<(<,'
n'),(<,'&'),(<'{.'),(<,','),(<'}.'),(<'@:'),(<,'('),(<,
'"'),(<<(,'0');1),(<,')'),(<',.'),(<,'u'),<,'@'),(<(<0)
,(<1),(<2),(<3),(<0),(<1),(<4),(<5),(<0;1;2;7;8),(<10),
(<11),(<5),(<0;1;4;7;8),(<12),<0;1;4),<1 1)&((1&({::) ,
^:(0:`@.) 2&({::))@:(<@:((0: 0&({::)@:]`(<@:(1&({::)@:]
))`(2&({::)@:])} ])@:(4 0 1&{)) 1} ])@:((<@:(3&({::) #
4&({::)) 4} ])^:(0 e. 3&({::)))@:(, <))@:(<@:((,'0') ,&
:< ])&.>)@:(,&:<) ]

Beware, os is a wicked...

   type'os'
┌┐
│verb│
└┘

The tookit, as written, makes j901 crash.  However, one can still define os,

   ". noun define -. CRLF
os=.
,^:(0:`(<'`:'))&6 :.(<@:((,'0') ,&:< ]))@:[ ((<<11 0),(<(<,'
n'),(<,'&'),(<'{.'),(<,','),(<'}.'),(<'@:'),(<,'('),(<,
'"'),(<<(,'0');1),(<,')'),(<',.'),(<,'u'),<,'@'),(<(<0)
,(<1),(<2),(<3),(<0),(<1),(<4),(<5),(<0;1;2;7;8),(<10),
(<11),(<5),(<0;1;4;7;8),(<12),<0;1;4),<1 1)&((1&({::) ,
^:(0:`(<'@.')) 2&({::))@:(<@:((0: 0&({::)@:]`(<@:(1&({::)@:]
 ))`(2&({::)@:])} ])@:(4 0 1&{)) 1} ])@:((<@:(3&({::) #
4&({::)) 4} ])^:(0 e. 3&({::)))@:(, <))@:(<@:((,'0') ,&
:< ])&.>)@:(,&:<) ]

)

   (|.`'' os 2)
2&{. , 2&}.@:(2&{."1) ,. |.@:(2&}."1)@(2&}.)

However,

   Y=. ? 5 6 $ 20

   (|.`'' os 2)   Y
|syntax error
|   (|.`''os 2)Y
|[-26]

Yet, one can force j901 to comply,

   (|.`'' os 2)f. Y
12  6 18  1  7  6
 1 12  5 18  5  8
13 16 14 19  9 18
14  3 13 18  8 12
17 17 15  9 12  3

What is happening?  Do not ask me!

All the above is, I am afraid, academic; since I do not use j901 (or j807)
for any serious work, I have negligible, forbidden or otherwise, experience
with them.  Sadly, if I had to use j901 I would probably only write simple
tacit adverbs and follow Pascal's approach as much as possible.
Nevertheless, if you still would like to learn tacit adverbial programming,
the following is an excellent place to start (in my opinion),

[Jprogramming] A phrase for amendment
http://www.jsoftware.com/pipermail/programming/2010-November/021172.html
NB. 
NB. J Wicked Tacit Toolkit...
NB. 
   
NB. DO NOT TRY TO LOAD THIS SCRIPT!!!  
NB. Instead, run it using 0!:0, or similar, or paste 
NB. it on an J editing window and use Crtl-A Crtl-E, or
NB. of course, run the script using a hot key

NB. (0!:0)<'/.../J Wicked Toolkit.js_'
   
NB. WARNING: This tookit relies unorthodox (theoretically illegal) constructions
NB. which make possible to cloak adverbs and conjunctions as verbs; thus, 
NB. effectively making higher-order functions (i.e., allowing tacit verbs be  
NB. be able to take verbs, adverbs and conjunctions as arguments and produce 
NB. verbs, adverbs and conjunctions)

NB. Word means noun, verb, adverb or conjunction

JVERSION

(_ o=. @:) (c=. "_) (e=. &.>) (x=. @:[) (y=. @:]) (p=. &:>/) (q=. @:(,&:<))

j=. ,&:<  NB. Joining (dyadic verb)
an=.  <@:((,'0') j ])f.  NB. Atomizing words (monadic verb)

tm=. , ((2 (#.\"1) 0 ,. (] ./)))@:(+/\@:(=/\@:( ~: ]) * 1 _1 
0 {~ '()' i. ]))) { ' ' , 6 8 10 { 9!:6@:(''"_))
  NB. Tacit map (dyadic verb)
  NB. (e.g., tm (5!:5)<'tm' )

for=. ("1)(@:(>@:{))  NB. For (adv)
  assert (< for 1 ; 2 3 ; 4 5 6) -: 2 3$1 2 4;1 2 5;1 2 6;1 3 4;1 3 5;1 3 6

Wrap=.-@:[ ]\ 5!:5@<@:]  NB. (dyadic verb)

(lr=. 5!:5@(<^:(L. = 0:))) (ar=. 5!:1@(<^:(L. = 0:)))

NB. Ver and ver...

Ver=. (0:`)(,^:)
  NB. Verbing (the atomic representations of)
  NB. 

Re: [Jprogramming] quaint

2020-05-25 Thread Jose Mario Quintana
I have seen redundant parentheses in the context of {:: (e.g.,

   0&{::
0&({::)

) since who-knows-when; that never bothered me much.  If this is an
indication of how often {:: is used by others, then that would be quite
puzzling to me.


On Sat, May 23, 2020 at 8:46 PM bill lam  wrote:

> I would complain 5!:5 rather than 5!:6,
> 5!:6 purposely added extra parentheses to aid readability.
>
> the extra parentheses in 5!:5 gave users misinformation that their hand
> crafted code are non-standard.
>
>
>
> On Sun, May 24, 2020, 12:46 AM Raul Miller  wrote:
>
> > Ok... well... the linear representation provided by 5!:6 has too many
> > parenthesis.
> >
> > Good enough?
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Sat, May 23, 2020 at 11:29 AM Henry Rich 
> wrote:
> > >
> > > There were cases where the code for linear representation left out
> > > needed parentheses.  The code is complex.  I decided I would rather
> hear
> > > complaints about too many parentheses than too few.
> > >
> > > Henry Rich
> > >
> > > On 5/22/2020 10:38 PM, bill lam wrote:
> > > > This looks like a regression in j901.
> > > > NB. j602
> > > > a=.   +^:(0>.1+])
> > > > 5!:5<'a'
> > > > +^:(0 >. 1 + ])
> > > > 5!:6<'a'
> > > > +^:(0 >. (1 + ]))
> > > >
> > > > NB. j901
> > > > a=.   +^:(0>.1+])
> > > > 5!:5<'a'
> > > > +^:(0 (>.) 1 + ])
> > > > 5!:6<'a'
> > > > +^:(0 (>.) (1 + ]))
> > > >
> > > >
> > > > On Sat, May 23, 2020 at 10:01 AM David Lambert  >
> > wrote:
> > > >
> > > >> +^:(0>.1+])
> > > >> +^:(0 (>.) 1 + ])
> > > >>
> > > >> There's probably a reason for parenthesized maximum?
> > > >> Inspired by fixing ys at
> > > >> http://rosettacode.org/wiki/Yellowstone_sequence#tacit
> > > >>
> --
> > > >> For information about J forums see
> > http://www.jsoftware.com/forums.htm
> > > >>
> > > >
> --
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > >
> > >
> > > --
> > > This email has been checked for viruses by AVG.
> > > https://www.avg.com
> > >
> > > --
> > > 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


Re: [Jprogramming] if (a v) were a valid expression...

2020-05-06 Thread Jose Mario Quintana
A0 V1 adv  (x A0) V1

http://www.jsoftware.com/pipermail/programming/2016-March/044744.html


On Wed, May 6, 2020 at 4:42 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

> I cannot find what (a v) did back then.
>
>
>
> Early J had a complete language of bidents/tridents.  It was beautiful
> and powerful.  Not five people understood it.  It was removed in J5,
> never to return.
>
> Henry Rich
>
> On 5/6/2020 3:00 PM, 'Pascal Jasmin' via Programming wrote:
> > what should (a v) do? (if it were valid)
> >
> > then what would (a v v) or (a v v v) do?
> >
> > option 1:  change v into an adverb (letting it return functions or
> return an lr that will be evaled to any form of speech), and then run v 'a'
> >
> > option 2: Compose v on (u a).  (a v) remains an adverb.
> >
> > btw, there is a missing composition operator in J.  I'd suggest O. (on)
> as a conjunction where O. allows for both dyadic u and v.
> >
> > O. =: (u@:v) : ([ u v)
> >
> > so option 2 above would be v O. (u a) .  This doesn't seem useful
> because you could just write the adverb a ( v O.) for the same result.  A
> generalization of option 2 is there is some implied conjunction partially
> bound to v that gets executed in (a v)
> >
> > Where option 2 gets interesting is in the expression
> >
> > v1 (a1 v2) (a2 v3)
> >
> > There is no reason to write such an expression if the intent were for v1
> to be an argument to the adverb (a1 v2) if there is an implied conjunction
> meaning.  Instead the above example would be a multi adverb where
> parameters are "templated in"
> >
> > u1 u2 (v1 (a1 v2) (a2 v3))  ==> v1  v2 O.(u1 a1) v3 O.(u2 a2 )
> >
> >
> > Any other options/proposals?
>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> 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


Re: [Jprogramming] generate integers from a to be with a step

2020-03-29 Thread Jose Mario Quintana
I have used this pair for a very long time,

   to=. [ + 1 i.@+ <.@-~
   inc=. (%&) ((<,'&.')`) (`:6)  NB. replacing <'&.' to make it "future proof"

   0 to 10
0 1 2 3 4 5 6 7 8 9 10

   0 to (10 inc) 100
0 10 20 30 40 50 60 70 80 90 100

   0j2 to (0.1j_0.2 inc) 1j0
0j2 0.1j1.8 0.2j1.6 0.3j1.4 0.4j1.2 0.5j1 0.6j0.8 0.7j0.6 0.8j0.4 0.9j0.2 1


On Sun, Mar 29, 2020 at 5:52 AM Rudolf Sykora  wrote:
>
> Dear all,
>
>
> how do you usually generate a sequence of integers from 'a' to 'b' with
> a step 's'?
>
> If I ignore the step, yesterday I wrote
>
>interval=.{.+(i. @ >: @ ({:-{.))
>interval 5 19
> 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
>
> but that seems overly complicated...
> Then I can include the step in this way
>
> _3 {.\ interval 5 19
> 5 8 11 14 17
>
> Putting the two parts together would make it even more complicated.
> There must be a better way...
>
>
> Thanks
> Ruda
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-03-19 Thread Jose Mario Quintana
Agreed!


On Thu, Mar 19, 2020 at 10:57 AM Raul Miller  wrote:
>
> I would keep in mind that one advantage of redundant information (such
> as redundant parenthesis) is that this can let you ignore some
> surrounding issues.
>
> That is not always the best tactic - it often pays to have a deep
> understanding - but the ability to focus attention where it's needed
> is crucial.
>
> Thanks,
>
> --
> Raul
>
> On Thu, Mar 19, 2020 at 10:14 AM 'Pascal Jasmin' via Programming
>  wrote:
> >
> > Your interesting new example is
> >
> >   (<,'/')`(<(<,'@')`(<(<,'2'), > /(@(g h))
> >
> > The explicit hook indicator (2) seems needed here because it seems hard
to weave extra boxing levels without the hook indicator, but there is such
a form:
> >
> > ((<,'/')`(<(<,'@')`(< >
> > /(@(g h))
> >
> > ((;:'/@'),(g`h))@.(0 ; < 1 ; << 2 3)
> >
> > /(@(g h))
> >
> > So your D2 definition is already part of the implementation.
> >
> > Still, in constructing gerrunds/ARs, the advice to use the verb train
indicators when that is the intention seems recommendable/safe, though if
every train has a nested representation (I need more thought to evaluate)
then there'd be no reason to use the safe approach, and perhaps no reason
to not represent train ARs with nesting levels.
> >
> >
> >
> >
> >
> > On Wednesday, March 18, 2020, 11:52:16 p.m. EDT, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > > You are suggesting that a list of ARs be construed as a valid AR.
> >
> > No, I would not dare to mess with the description of what an AR is.
> > Probably the source of the confusion was my unfortunate use of the
phrases
> > "M represents R" when I just meant "The product of M `:6 is R."  What I
am
> > suggesting is to extend the description of what a kosher argument (m)
is in
> > (m`:6).  (Its valid boxed structure would be similar to the one for a
> > (current) kosher argument (n) in (m@.n).)
> >
> > This is a more precise recursive description of the construction of a
> > kosher argument (m) in (m`:6) assuming D2 holds:
> >
> >   A  is,
> >
> >   0. An AR, or
> >
> >   1. A list of one or more s, or
> >
> >   2. A boxed .
> >
> > If (2) above is not included then it becomes the description of the
> > construction of a valid argument assuming D1 holds (if I am not
mistaken).
> > (If one replaces (AR) above by (integer) then, I think, it becomes a
> > description of the construction of a (current) kosher argument (n) in
(m@
> > .n).)
> >
> > Hopefully, answering the question (and it is a very good question) you
> > posed might clarify further what I am trying to convey.  Assuming (g)
and
> > (h) are verbs, if (f) is a verb then,
> >
> >   f`( > ┌─┬─┐
> > │f│┌─┬─┐│
> > │ ││g│h││
> > │ │└─┴─┘│
> > └─┴─┘
> >   f`( > f (g h)
> >
> > This argument is not a list of ARs regardless if one is assuming D1 or
D2.
> > It is not kosher assuming D1 but it is assuming D2.  Likewise, if (f)
is a
> > conjunction, say (@), then,
> >
> >   (<,'@')`( > ┌─┬─┐
> > │@│┌─┬─┐│
> > │ ││g│h││
> > │ │└─┴─┘│
> > └─┴─┘
> > (<,'@')`( > @(g h)
> >
> > Again, this argument is not a list of ARs regardless if one is assuming
D1
> > or D2.  It is not kosher assuming D1 but it is assuming D2.  In
addition,
> > in both scenarios (if (f) is a verb or (f) is a conjunction) the
product,
> > assuming D2, can be thought as a train of two entities, the trailing one
> > being a derived entity (g h).
> >
> > In contrast, the boxed form of ((<,'@')`( >
> >   <(<,'@')`( > ┌─┐
> > │┌─┬─┐│
> > ││@│┌─┬─┐││
> > ││ ││g│h│││
> > ││ │└─┴─┘││
> > │└─┴─┘│
> > └─┘
> >   (<(<,'@')`( > g@h
> >
> > Is the AR of g@h and it is kosher assuming D1 (and, of course assuming
D2
> > as well).  Furthermore, one can simply use,
> >
> >   (;:'g@h')
> > ┌─┬─┬─┐
> > │g│@│h│
> > └─┴─┴─┘
> >   (;:'g@h') `:6
> > g@h
> >
> > the result is the same but it is produced as the train of three
entities.
> >
> > A remaining question is, why the result of ((<(<,'@')`( > (@(g h))? Apparently, the interpreter gives priority to ARs.
> >
> > > I don't like having to parse the ARs to figure out how to interpret
them.
> >
> > What is th

Re: [Jprogramming] modifiers

2020-03-19 Thread Jose Mario Quintana
Yes, > ((<,'/')`(<(<,'@')`(<
> /(@(g h))

Excellent, thanks!  I had the feeling that there could be such a form but I
could not find it quickly late last night.

> So your D2 definition is already part of the implementation.

Yes, the point of D2 is to legitimize a useful bug/feature of the current
implementation; so, it would be regarded as just a feature (not a bug) and
it would be preserved.


On Thu, Mar 19, 2020 at 10:14 AM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Your interesting new example is
>
>   (<,'/')`(<(<,'@')`(<(<,'2'), /(@(g h))
>
> The explicit hook indicator (2) seems needed here because it seems hard
to weave extra boxing levels without the hook indicator, but there is such
a form:
>
> ((<,'/')`(<(<,'@')`(<
> /(@(g h))
>
> ((;:'/@'),(g`h))@.(0 ; < 1 ; << 2 3)
>
> /(@(g h))
>
> So your D2 definition is already part of the implementation.
>
> Still, in constructing gerrunds/ARs, the advice to use the verb train
indicators when that is the intention seems recommendable/safe, though if
every train has a nested representation (I need more thought to evaluate)
then there'd be no reason to use the safe approach, and perhaps no reason
to not represent train ARs with nesting levels.
>
>
>
>
>
> On Wednesday, March 18, 2020, 11:52:16 p.m. EDT, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
>
>
>
> > You are suggesting that a list of ARs be construed as a valid AR.
>
> No, I would not dare to mess with the description of what an AR is.
> Probably the source of the confusion was my unfortunate use of the phrases
> "M represents R" when I just meant "The product of M `:6 is R."  What I am
> suggesting is to extend the description of what a kosher argument (m) is
in
> (m`:6).  (Its valid boxed structure would be similar to the one for a
> (current) kosher argument (n) in (m@.n).)
>
> This is a more precise recursive description of the construction of a
> kosher argument (m) in (m`:6) assuming D2 holds:
>
>   A  is,
>
>   0. An AR, or
>
>   1. A list of one or more s, or
>
>   2. A boxed .
>
> If (2) above is not included then it becomes the description of the
> construction of a valid argument assuming D1 holds (if I am not mistaken).
> (If one replaces (AR) above by (integer) then, I think, it becomes a
> description of the construction of a (current) kosher argument (n) in (m@
> .n).)
>
> Hopefully, answering the question (and it is a very good question) you
> posed might clarify further what I am trying to convey.  Assuming (g) and
> (h) are verbs, if (f) is a verb then,
>
>   f`( ┌─┬─┐
> │f│┌─┬─┐│
> │ ││g│h││
> │ │└─┴─┘│
> └─┴─┘
>   f`( f (g h)
>
> This argument is not a list of ARs regardless if one is assuming D1 or D2.
> It is not kosher assuming D1 but it is assuming D2.  Likewise, if (f) is a
> conjunction, say (@), then,
>
>   (<,'@')`( ┌─┬─┐
> │@│┌─┬─┐│
> │ ││g│h││
> │ │└─┴─┘│
> └─┴─┘
> (<,'@')`( @(g h)
>
> Again, this argument is not a list of ARs regardless if one is assuming D1
> or D2.  It is not kosher assuming D1 but it is assuming D2.  In addition,
> in both scenarios (if (f) is a verb or (f) is a conjunction) the product,
> assuming D2, can be thought as a train of two entities, the trailing one
> being a derived entity (g h).
>
> In contrast, the boxed form of ((<,'@')`(
>   <(<,'@')`( ┌─┐
> │┌─┬─┐│
> ││@│┌─┬─┐││
> ││ ││g│h│││
> ││ │└─┴─┘││
> │└─┴─┘│
> └─┘
>   (<(<,'@')`( g@h
>
> Is the AR of g@h and it is kosher assuming D1 (and, of course assuming D2
> as well).  Furthermore, one can simply use,
>
>   (;:'g@h')
> ┌─┬─┬─┐
> │g│@│h│
> └─┴─┴─┘
>   (;:'g@h') `:6
> g@h
>
> the result is the same but it is produced as the train of three entities.
>
> A remaining question is, why the result of ((<(<,'@')`( (@(g h))? Apparently, the interpreter gives priority to ARs.
>
> > I don't like having to parse the ARs to figure out how to interpret
them.
>
> What is the interpreter doing now?  I do not know...  Maybe you can let us
> know?
>
> How would one produce, for instance, (/(@g h)) then?  One way is to use
the
> AR of (u v),
>
>   (<,'/')`(<(<,'@')`(<(<,'2'), ┌─┬─┐
> │/│┌─┬─┐│
> │ ││@│┌─┬─┐││
> │ ││ ││2│┌─┬─┐│││
> │ ││ ││ ││g│h
> │ ││ ││ │└─┴─┘│││
> │ ││ │└─┴─┘││
> │ │└─┴─┘│
> └─┴─┘
>   (<,'/')`(<(<,'@')`(<(<,'2'), /(@(g h))
>
> The above is just an elaborated version of Pascal's answer given
> earlier.  Thinking
> mor

Re: [Jprogramming] modifiers

2020-03-18 Thread Jose Mario Quintana
> You are suggesting that a list of ARs be construed as a valid AR.

No, I would not dare to mess with the description of what an AR is.
Probably the source of the confusion was my unfortunate use of the phrases
"M represents R" when I just meant "The product of M `:6 is R."  What I am
suggesting is to extend the description of what a kosher argument (m) is in
(m`:6).  (Its valid boxed structure would be similar to the one for a
(current) kosher argument (n) in (m@.n).)

This is a more precise recursive description of the construction of a
kosher argument (m) in (m`:6) assuming D2 holds:

  A  is,

  0. An AR, or

  1. A list of one or more s, or

  2. A boxed .

If (2) above is not included then it becomes the description of the
construction of a valid argument assuming D1 holds (if I am not mistaken).
(If one replaces (AR) above by (integer) then, I think, it becomes a
description of the construction of a (current) kosher argument (n) in (m@
.n).)

Hopefully, answering the question (and it is a very good question) you
posed might clarify further what I am trying to convey.  Assuming (g) and
(h) are verbs, if (f) is a verb then,

   f`( I don't like having to parse the ARs to figure out how to interpret them.

What is the interpreter doing now?  I do not know...  Maybe you can let us
know?

How would one produce, for instance, (/(@g h)) then?  One way is to use the
AR of (u v),

   (<,'/')`(<(<,'@')`(<(<,'2'), wrote:
>
> You are suggesting that a list of ARs be construed as a valid AR.  I
> agree with the goal.  I worry that the encoding is not reversible.
>
> +-+
> |+-+-+|
> ||f|+-+-+||
> || ||g|h|||
> || |+-+-+||
> |+-+-+|
> +-+
>
> Is this (f (g h))  (as it must be if f is a verb)
> or  (g f h)   (if f is a conjunction)?
>
> I don't like having to parse the ARs to figure out how to interpret them.
>
> Henry Rich
>
>
> On 3/16/2020 10:18 PM, Jose Mario Quintana wrote:
> >> I would say that (<,'"') is kosher and (<'"') not, already, based on
> >> this interpretation of what Ye Dic meant.  The implementation is
> > I am adopting your suggestion henceforth.
> >
> >> My vote would be that 'train' refers to any sequence of ARs and that
> >> when `:6 said 'train of individual verbs' it meant to say 'the
(possibly
> >> derived) words created by executing the train of the (possibly derived)
> >> words represented by each AR'.
> > So,
> >
> > D0. m `: 6  Train  Result is the train of individual verbs.
> >
> > would become (or be understood as),
> >
> > D1. m `: 6  Train  Result is the (possibly derived)
> > words created by executing the train
> > of the (possibly derived) words
> > represented by each AR.
> >
> > I have thought more about this and I am not quite sure about the wisdom
of
> > banning, eventually (when the negligence rather than benevolence stops),
> > the boxed arrays of ARs currently supported by the interpreter.  My
> > perspective comes from the tacit adverbial programer's viewport which
will
> > try to explain next assuming that D1 is the law (i.e., henceforth kosher
> > also implies compliance with D1).
> >
> > If the argument of (`:6) is a list of ARs of primary parts-of-speech,
(`:6)
> > produces the non-parenthesized (i.e., with the parsing rules implied
> > parenthesization) train of the corresponding primary
parts-of-the-speech.
> > However, when its argument is boxed the interpreter's result is the
train
> > which is parenthesized accordingly, and this is not kosher.
> >
> > How can this extra illegal flexibility be important to a tacit adverbial
> > programmer?  Consider the following slight variation of my
general-purpose
> > generator of tacit adverbs (hg),
> >
> > o=. @:
> > c=."_
> > ar=. 5!:1@:<
> >
> > d=. (a0=. `'') (a1=. (@:[) ((<,'&')`) (`:6)) (a2=. (`(<(":0);_))
(`:6))
> > av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
> >   assert 1 4 9 -: 1 2 3 *: av
> >
> > The only change was replacing (<'&') by (<,'&') (this does not me too
> > much).  I think its construction and operation is kosher; ye, The Wise
of
> > J, be the judges.
> >
> > The last part of (hg)'s construction is unchanged,
> >
> > aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation
> > d=. (a3=. (@: (aw f.)) ('av'f.)) (a4=. "_) (a5=. `:6)
> > a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)
> >
> > hg=. `((ar'a6')`(ar'a5')) (`:6)
> >
> > Again, if I am not mistaken, (hg

Re: [Jprogramming] modifiers

2020-03-16 Thread Jose Mario Quintana
> I would say that (<,'"') is kosher and (<'"') not, already, based on
> this interpretation of what Ye Dic meant.  The implementation is

I am adopting your suggestion henceforth.

> My vote would be that 'train' refers to any sequence of ARs and that
> when `:6 said 'train of individual verbs' it meant to say 'the (possibly
> derived) words created by executing the train of the (possibly derived)
> words represented by each AR'.

So,

D0. m `: 6  Train  Result is the train of individual verbs.

would become (or be understood as),

D1. m `: 6  Train  Result is the (possibly derived)
   words created by executing the train
   of the (possibly derived) words
   represented by each AR.

I have thought more about this and I am not quite sure about the wisdom of
banning, eventually (when the negligence rather than benevolence stops),
the boxed arrays of ARs currently supported by the interpreter.  My
perspective comes from the tacit adverbial programer's viewport which will
try to explain next assuming that D1 is the law (i.e., henceforth kosher
also implies compliance with D1).

If the argument of (`:6) is a list of ARs of primary parts-of-speech, (`:6)
produces the non-parenthesized (i.e., with the parsing rules implied
parenthesization) train of the corresponding primary parts-of-the-speech.
However, when its argument is boxed the interpreter's result is the train
which is parenthesized accordingly, and this is not kosher.

How can this extra illegal flexibility be important to a tacit adverbial
programmer?  Consider the following slight variation of my general-purpose
generator of tacit adverbs (hg),

   o=. @:
   c=."_
   ar=. 5!:1@:<

   d=. (a0=. `'') (a1=. (@:[) ((<,'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
   av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
 assert 1 4 9 -: 1 2 3 *: av

The only change was replacing (<'&') by (<,'&') (this does not me too
much).  I think its construction and operation is kosher; ye, The Wise of
J, be the judges.

The last part of (hg)'s construction is unchanged,

aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation
d=. (a3=. (@: (aw f.)) ('av'f.)) (a4=. "_) (a5=. `:6)
a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)

hg=. `((ar'a6')`(ar'a5')) (`:6)

Again, if I am not mistaken, (hg)'s construction is kosher.  However,
whether its operation is kosher, or not, depends on its controlling (tacit)
verb argument.  This verb operates on the AR of the argument of the
generated adverb and, I believe, if (and only if) it produces the AR, or a
list of AR(s), representing the desired product, then it is kosher.  Two
toy examples follow, one simple and another slightly more complicated.

One can use (hg) to generate an adverb (a) which is meant to take a
non-parenthesized train of two or more proverbs and produce the verb where
(@:) is inserted between the proverbs,

   a=. ([ , (<,'@:') , ])/ o (((3 = ]) +. (_1 = ])) o (4!:0) # ]) o ( wrote:
>
> I think I agree.
>
> My vote would be that 'train' refers to any sequence of ARs and that
> when `:6 said 'train of individual verbs' it meant to say 'the (possibly
> derived) words created by executing the train of the (possibly derived)
> words represented by each AR'.
>
> I would say that (<,'"') is kosher and (<'"') not, already, based on
> this interpretation of what Ye Dic meant.  The implementation is
> permissive in some cases.
>
> Henry Rich
>
> On 3/12/2020 11:21 PM, Jose Mario Quintana wrote:
> >> because the long sequence of ARs is not a valid AR.
> > Certainly, the purpose of posing those questions was to find out where
the
> > permissiveness breaking point would be.  This is what, I think, I have
> > learned regarding the tie, train, and (left) agenda arguments in J (as
> > described or might be described by the official documentation):  lists
of
> > ARs of verbs are kosher, lists of ARs might become kosher; anything
else is
> > almost surely not kosher.  Therefore, these are not kosher,
> >
> > (<'"')
> > ┌─┐
> > │"│
> > └─┘
> >
> > (<'"') (`:6)
> > "
> > (<'"') (@.0)
> > "
> >
> > but these might become kosher,
> >
> > (<,'"')
> > ┌─┐
> > │"│
> > └─┘
> >
> > (<,'"') (`:6)
> > "
> > (<,'"') (@.0)
> > "
> >
> > these are not kosher,
> >
> > ((<'"') ,~ (<;:'u@:v-v@:u'))
> > ┌─┬─┐
> > │┌─┬──┬─┬─┬─┬──┬─┐│"│
> > ││u│@:│v│-│v│@:│u││ │
> > │└─┴──┴─┴─┴─┴──┴─┘│ │
> &g

Re: [Jprogramming] modifiers

2020-03-12 Thread Jose Mario Quintana
I was not stating that all boxed representation (BR) can, or should be,
interpreted using the train (`:6) and agenda (@.).  I mentioned them
just because
when I was learning, many years ago, to construct these (almost surely
illegal) forms supported by the interpreter, the related BRs were
enlightening.  That is all.


On Thu, Mar 12, 2020 at 12:37 AM Raul Miller  wrote:
>
> I think one issue is that interpreting 5!:2 results as trains can
> result in ambiguities.
>
>ar=:1 :'5!:1<''u'''
>br=:1 :'5!:2<''u'''
>F=: ,&(3 ar)
>F
> ,&(<(,'0');3)
>F f. br`:6
> ,&3
>
> Or, generally speaking, nouns in 5!:2 results are not intended for use
> in trains.
>
>G=: +&3
>G f. br`:6
> |domain error
>
> I hope this helps,
>
> --
> Raul
>
> On Thu, Mar 12, 2020 at 12:20 AM Henry Rich  wrote:
> >
> > Change?  We have been discussing whether certain forms are valid.  The
> > spec, Ye Dic, is silent and we are filling it in.
> >
> > Jsoftware's policy has been to leave the JE as it is in some cases where
> > it accepts forms that are not valid according to the language
> > definition.  This is from indolence more than benevolence, and a
> > programmer would be unwise to rely on its continuance.  If I can save
> > one mispredicted branch by disallowing an invalid form, I will.
> >
> > Here Pepe has noted some forms that the interpreter accepts.  I think
> > they are not legal.  Use them at your peril.
> >
> > FWIW, I would not remove support for these forms without consulting the
> > /ulama/.  They are in a gray area, unlike, say, verbs that return
> > non-noun results, which I feel no commitment for.
> >
> > Henry Rich
> >
> >
> >
> > On 3/12/2020 12:00 AM, Devon McCormick wrote:
> > > Would this change be likely to break existing code?
> > >
> > > On Wed, Mar 11, 2020 at 8:58 PM Henry Rich 
wrote:
> > >
> > >> I would object to
> > >>
> > >>((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
> > >>
> > >> because the long sequence of ARs is not a valid AR.  This seems like
an
> > >> interpreter artifact.
> > >>
> > >> The result of 5!:2 is not germane here, as it is not an AR.  Your
> > >> examples using it also seem to be interpreter artifacts to me.
> > >>
> > >> Henry Rich
> > >>
> > >> On 3/11/2020 8:22 PM, Jose Mario Quintana wrote:
> > >>>> Of course the fact that m@.n allows certain forms does not imply
that
> > >>>> m@.v would support similar forms.
> > >>> Of course.
> > >>>
> > >>>> I don't see anything to object to here.
> > >>> Great!  This means tacit adverbs functioning as parameterized
macros are,
> > >>> or might be eventually, legitimized.
> > >>>>There are gerunds and
adverbs,
> > >>>> producing trains that evaluate properly.
> > >>> Right, the trains evaluate properly; even though the list (;:'@:-"')
> > >>> includes ARs of conjunctions (it is not my intention at all to argue
> > >> with a
> > >>> /mufti/ of J, I am just accentuating).
> > >>>
> > >>>> By The Wise I mean the /ulama/ of J (neminem nominabo, genus
hominum
> > >>>> significasse contentus)  You know who you are.
> > >>> Train (`:6) can also evaluate properly forms associated with the
> > >>> corresponding agenda (m@.n) evaluation, mutatis mutandis; exempli
> > >> gratia,
> > >>>  ((<'"') ,~ (<;:'u@:v-v@:u'))
> > >>> ┌─┬─┐
> > >>> │┌─┬──┬─┬─┬─┬──┬─┐│"│
> > >>> ││u│@:│v│-│v│@:│u││ │
> > >>> │└─┴──┴─┴─┴─┴──┴─┘│ │
> > >>> └─┴─┘
> > >>>
> > >>>  ((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
> > >>> (u@:v - v@:u)"
> > >>>
> > >>> Do the /ulama/ of J (et alli) disapprove?
> > >>>
> > >>> By the way, some boxed representations belong to this class of
forms,
> > >>>
> > >>>  t=. (u@:v - v@:u)"
> > >>>
> > >>>  (5!:2<'t')
> > >>> ┌─┬─┐
> > >>> │┌┬─┬┐│"│
> > >>> ││┌─┬──┬─┐│-│┌─┬──┬─┐││ │
> > >>> │││u│@:│v││ ││v│@:│u│││ │
> > >>> ││└

Re: [Jprogramming] modifiers

2020-03-12 Thread Jose Mario Quintana
> because the long sequence of ARs is not a valid AR.

Certainly, the purpose of posing those questions was to find out where the
permissiveness breaking point would be.  This is what, I think, I have
learned regarding the tie, train, and (left) agenda arguments in J (as
described or might be described by the official documentation):  lists of
ARs of verbs are kosher, lists of ARs might become kosher; anything else is
almost surely not kosher.  Therefore, these are not kosher,

   (<'"')
┌─┐
│"│
└─┘

   (<'"') (`:6)
"
   (<'"') (@.0)
"

but these might become kosher,

   (<,'"')
┌─┐
│"│
└─┘

   (<,'"') (`:6)
"
   (<,'"') (@.0)
"

these are not kosher,

   ((<'"') ,~ (<;:'u@:v-v@:u'))
┌─┬─┐
│┌─┬──┬─┬─┬─┬──┬─┐│"│
││u│@:│v│-│v│@:│u││ │
│└─┴──┴─┴─┴─┴──┴─┘│ │
└─┴─┘

   ((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
(u@:v - v@:u)"
   ((<'"') ,~ (<;:'u@:v-v@:u')) (@.0)
u@:v - v@:u

but these might become kosher,

  (<(<,'4'),<(<(<,'3'),<(<(<'@:'),<<;._1 ' u v'),(<,'-'),<(<'@:'),<<;._1 '
v u'),<,'"')
┌─┐
│┌─┬─┐│
││4│┌─┬─┐││
││ ││┌─┬─┐│"│││
││ │││3│┌──┬─┬──┐││ │││
││ │││ ││┌──┬─┐│-│┌──┬─┐│││ │││
││ │││ │││@:│┌─┬─┐││ ││@:│┌─┬─┐ │││
││ │││ │││  ││u│v│││ ││  ││v│u│ │││
││ │││ │││  │└─┴─┘││ ││  │└─┴─┘ │││
││ │││ ││└──┴─┘│ │└──┴─┘│││ │││
││ │││ │└──┴─┴──┘││ │││
││ ││└─┴─┘│ │││
││ │└─┴─┘││
│└─┴─┘│
└─┘
   (<(<,'4'),<(<(<,'3'),<(<(<'@:'),<<;._1 ' u v'),(<,'-'),<(<'@:'),<<;._1 '
v u'),<,'"')(`:6)
(u@:v - v@:u)"
   (<(<,'4'),<(<(<,'3'),<(<(<'@:'),<<;._1 ' u v'),(<,'-'),<(<'@:'),<<;._1 '
v u'),<,'"')(@.0)
(u@:v - v@:u)"

There would tedious extra work involved when one wants to be kosher but it
is doable.

So far so good?


On Wed, Mar 11, 2020 at 8:58 PM Henry Rich  wrote:
>
> I would object to
>
>   ((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
>
> because the long sequence of ARs is not a valid AR.  This seems like an
> interpreter artifact.
>
> The result of 5!:2 is not germane here, as it is not an AR.  Your
> examples using it also seem to be interpreter artifacts to me.
>
> Henry Rich
>
> On 3/11/2020 8:22 PM, Jose Mario Quintana wrote:
> >> Of course the fact that m@.n allows certain forms does not imply that
> >> m@.v would support similar forms.
> > Of course.
> >
> >> I don't see anything to object to here.
> > Great!  This means tacit adverbs functioning as parameterized macros
are,
> > or might be eventually, legitimized.
> >>   There are gerunds and
adverbs,
> >> producing trains that evaluate properly.
> > Right, the trains evaluate properly; even though the list (;:'@:-"')
> > includes ARs of conjunctions (it is not my intention at all to argue
with a
> > /mufti/ of J, I am just accentuating).
> >
> >> By The Wise I mean the /ulama/ of J (neminem nominabo, genus hominum
> >> significasse contentus)  You know who you are.
> > Train (`:6) can also evaluate properly forms associated with the
> > corresponding agenda (m@.n) evaluation, mutatis mutandis; exempli
gratia,
> >
> > ((<'"') ,~ (<;:'u@:v-v@:u'))
> > ┌─┬─┐
> > │┌─┬──┬─┬─┬─┬──┬─┐│"│
> > ││u│@:│v│-│v│@:│u││ │
> > │└─┴──┴─┴─┴─┴──┴─┘│ │
> > └─┴─┘
> >
> > ((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
> > (u@:v - v@:u)"
> >
> > Do the /ulama/ of J (et alli) disapprove?
> >
> > By the way, some boxed representations belong to this class of forms,
> >
> > t=. (u@:v - v@:u)"
> >
> > (5!:2<'t')
> > ┌─┬─┐
> > │┌┬─┬┐│"│
> > ││┌─┬──┬─┐│-│┌─┬──┬─┐││ │
> > │││u│@:│v││ ││v│@:│u│││ │
> > ││└─┴──┴─┘│ │└─┴──┴─┘││ │
> > │└┴─┴┘│ │
> > └─┴─┘
> > (5!:2<'t') (`:6)
> > (u@:v - v@:u)"
> >
> > but not all of them,
> >
> > t=. "1
> >
> > (5!:2<'t')
> > ┌─┬─┐
> > │"│1│
> > └─┴─┘
> >
> > (5!:2<'t') (`:6)
> > |domain error
> > |   (5!:2<'t')(`:6)
> >
> > The issue here is the missing (in the evaluation sense) AR of 1,
>

Re: [Jprogramming] modifiers

2020-03-11 Thread Jose Mario Quintana
> Of course the fact that m@.n allows certain forms does not imply that
> m@.v would support similar forms.

Of course.

> I don't see anything to object to here.

Great!  This means tacit adverbs functioning as parameterized macros are,
or might be eventually, legitimized.
>  There are gerunds and adverbs,
> producing trains that evaluate properly.

Right, the trains evaluate properly; even though the list (;:'@:-"')
includes ARs of conjunctions (it is not my intention at all to argue with a
/mufti/ of J, I am just accentuating).

> By The Wise I mean the /ulama/ of J (neminem nominabo, genus hominum
> significasse contentus)  You know who you are.

Train (`:6) can also evaluate properly forms associated with the
corresponding agenda (m@.n) evaluation, mutatis mutandis; exempli gratia,

   ((<'"') ,~ (<;:'u@:v-v@:u'))
┌─┬─┐
│┌─┬──┬─┬─┬─┬──┬─┐│"│
││u│@:│v│-│v│@:│u││ │
│└─┴──┴─┴─┴─┴──┴─┘│ │
└─┴─┘

   ((<'"') ,~ (<;:'u@:v-v@:u')) (`:6)
(u@:v - v@:u)"

Do the /ulama/ of J (et alli) disapprove?

By the way, some boxed representations belong to this class of forms,

   t=. (u@:v - v@:u)"

   (5!:2<'t')
┌─┬─┐
│┌┬─┬┐│"│
││┌─┬──┬─┐│-│┌─┬──┬─┐││ │
│││u│@:│v││ ││v│@:│u│││ │
││└─┴──┴─┘│ │└─┴──┴─┘││ │
│└┴─┴┘│ │
└─┴─┘
   (5!:2<'t') (`:6)
(u@:v - v@:u)"

but not all of them,

   t=. "1

   (5!:2<'t')
┌─┬─┐
│"│1│
└─┴─┘

   (5!:2<'t') (`:6)
|domain error
|   (5!:2<'t')(`:6)

The issue here is the missing (in the evaluation sense) AR of 1,

   (<,'"'),<<(,'0');1
┌─┬───┐
│"│┌─┐│
│ ││┌─┬─┐││
│ │││0│1│││
│ ││└─┴─┘││
│ │└─┘│
└─┴───┘
   ((<,'"'),<<(,'0');1) (`:6)
"1


On Tue, Mar 10, 2020 at 11:49 PM Henry Rich  wrote:
>
> I don't see anything to object to here.  There are gerunds and adverbs,
> producing trains that evaluate properly.
>
>
> By The Wise I mean the /ulama/ of J (neminem nominabo, genus hominum
> significasse contentus)  You know who you are.
>
> Henry Rich
>
> On 3/10/2020 11:34 PM, Jose Mario Quintana wrote:
> >> I don't think it's illegal.  The spec (Ye Dic, here) is incomplete.  It
> > That is good to know.
> >
> >> I don't see anything bad coming from executing a train containing
> >> non-verbs; so I would vote to expand the spec to include all trains.
> > I do not see anything bag coming either, on the contrary.
> >
> >> There would need to be discussion among The Wise before any such
change.
> > May I offer some food for thought to The Wise?
> >
> > I would expect that whatever is decided regarding the legality in J
about
> > the train's (`:6) arguments would, or should, affect its capable
relative,
> > agenda (@.), specifically the m@.n form; for instance, do The Wise, or
you,
> > in particular, think that the following sentences, supported by j901,
are
> > legal or illegal in J?
> >
> > a=. (`(;:'@:-"'))(@.(4 ;~ (<0 2 1 3 1 2 0)))
> >
> > u`v a
> > (u@:v - v@:u)"
> >
> > _1 *:`(+/) a i. 2 3 4
> >64  118  184  262
> > 1504 1702 1912 2134
> >
> >
> >
> >
> >
> > On Tue, Mar 10, 2020 at 10:09 AM Henry Rich 
wrote:
> >> I don't think it's illegal.  The spec (Ye Dic, here) is incomplete.  It
> >> says what will be done if there is a verb train but is silent about
> >> other trains.
> >>
> >> What the implementation does is accept any train and evaluate it.
> >> Thinking about it I don't see anything else you could do with a train;
&
> >> I don't see anything bad coming from executing a train containing
> >> non-verbs; so I would vote to expand the spec to include all trains.
> >>
> >> There would need to be discussion among The Wise before any such
change.
> >>
> >> Henry Rich
> >>
> >> On 3/9/2020 11:36 PM, Jose Mario Quintana wrote:
> >>> Henry wrote:
> >>>
> >>>> Ye Dic mentions only verb trains under `: .
> >>> Therefore, the sentence ((<,'"') ` (an 1) (`:6)) is illegal in J
> > because "1
> >>> is not a train of verbs (even if it is supported by j).  Correct?
(This
> > is
> >>> not a rhetorical question.)
> >>>
> >>
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-03-10 Thread Jose Mario Quintana
> I don't think it's illegal.  The spec (Ye Dic, here) is incomplete.  It

That is good to know.

> I don't see anything bad coming from executing a train containing
> non-verbs; so I would vote to expand the spec to include all trains.

I do not see anything bag coming either, on the contrary.

> There would need to be discussion among The Wise before any such change.

May I offer some food for thought to The Wise?

I would expect that whatever is decided regarding the legality in J about
the train's (`:6) arguments would, or should, affect its capable relative,
agenda (@.), specifically the m@.n form; for instance, do The Wise, or you,
in particular, think that the following sentences, supported by j901, are
legal or illegal in J?

   a=. (`(;:'@:-"'))(@.(4 ;~ (<0 2 1 3 1 2 0)))

   u`v a
(u@:v - v@:u)"

   _1 *:`(+/) a i. 2 3 4
  64  118  184  262
1504 1702 1912 2134





On Tue, Mar 10, 2020 at 10:09 AM Henry Rich  wrote:
>
> I don't think it's illegal.  The spec (Ye Dic, here) is incomplete.  It
> says what will be done if there is a verb train but is silent about
> other trains.
>
> What the implementation does is accept any train and evaluate it.
> Thinking about it I don't see anything else you could do with a train; &
> I don't see anything bad coming from executing a train containing
> non-verbs; so I would vote to expand the spec to include all trains.
>
> There would need to be discussion among The Wise before any such change.
>
> Henry Rich
>
> On 3/9/2020 11:36 PM, Jose Mario Quintana wrote:
> > Henry wrote:
> >
> >> Ye Dic mentions only verb trains under `: .
> > Therefore, the sentence ((<,'"') ` (an 1) (`:6)) is illegal in J
because "1
> > is not a train of verbs (even if it is supported by j).  Correct? (This
is
> > not a rhetorical question.)
> >
>
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-03-09 Thread Jose Mario Quintana
I wrote:

> This has been an area of J (the language described by the official
documentation, as opposed to j, the language implemented by a particular
interpreter) that it is not entirely clear to me.  May I start from the
beginning?
>
> > >   an=.  <@:((,'0') ,&:< ])f.  NB. Atomizing nouns (monadic verb)
> > >
> > >   (<,'"') ` (an 1) (`:6)
> > > "1
> > >   (<,'"') ` (an 1) @. 0 1
> > > "1
> > >
> > > They are considered illegal because,
>
> Can you, or anyone else, confirm of deny that the last two sentences
above are illegal in J?  In addition, if they are illegal, what is the
rationale?
>

Raul replied:

> I can't think of any reason to believe that this is illegal.

I could not think, in the past, of any reason to believe there were illegal
in J (the language described by the official documentation, as opposed to
j, the language implemented by a particular interpreter) either.

> Also, I would expect that if the implementation changes, making
> something that used to be legal into something illegal, that that
> would be accompanied by an explanation of why this would be seen as
> advantageous

I would also expect that as well.

> Does this help at all?

Yes, thank you.  However...

Henry wrote:

> Ye Dic mentions only verb trains under `: .

Therefore, the sentence ((<,'"') ` (an 1) (`:6)) is illegal in J because "1
is not a train of verbs (even if it is supported by j).  Correct? (This is
not a rhetorical question.)

> Make sure you distinguish 'legal'/'illegal' from
> 'supported'/'unsupported'.

I did, see the original context reproduced at the top of this post.

> There are some sequences that the current
> interpreter executes in violation of the rule that verbs must take noun
> arguments and produce noun results.  They are illegal, but 'supported'
> in a limited sense.

I am aware of that; but, I did not mention that kind of verbs when I possed
the questions above.







On Mon, Mar 9, 2020 at 8:29 PM Henry Rich  wrote:
>
> Ye Dic mentions only verb trains under `: .
>
> an=.  <@:((,'0') ,&:< ])f.
> (<,'+:') ` (an 1) @. 0 1
> 2
>
> The ARs are converted to a sequence of words and that sequence is
> executed.  I guess it couldn't be any other way - a value has to have a
> single part of speech.
>
> (an 1) `(<,'+:')  @. 0 1
> |syntax error
> |   1+:
>
> This is an example of Raul's third paragraph.
>
> Make sure you distinguish 'legal'/'illegal' from
> 'supported'/'unsupported'.  There are some sequences that the current
> interpreter executes in violation of the rule that verbs must take noun
> arguments and produce noun results.  They are illegal, but 'supported'
> in a limited sense.
>
> Henry Rich
>
>
>
> On 3/9/2020 7:29 PM, Raul Miller wrote:
> > On Mon, Mar 9, 2020 at 6:21 PM Jose Mario Quintana
> >  wrote:
> >> May I start from the beginning?
> >>
> >>>>an=.  <@:((,'0') ,&:< ])f.  NB. Atomizing nouns (monadic verb)
> >>>>
> >>>>(<,'"') ` (an 1) (`:6)
> >>>> "1
> >>>>(<,'"') ` (an 1) @. 0 1
> >>>> "1
> >>>>
> >>>> They are considered illegal because,
> >> Can you, or anyone else, confirm of deny that the last two sentences
above
> >> are illegal in J?  In addition, if they are illegal, what is the
rationale?
> > I can't think of any reason to believe that this is illegal.
> >
> > I do slightly prefer the current handling of this issue at
> > https://code.jsoftware.com/wiki/Vocabulary/graveco ('If m is a gerund,
> >   m`:n creates a verb based on m') over that at
> > https://code.jsoftware.com/wiki/Vocabulary/atdot (which is more of a
> > scattering of statements representing lesser examples, which do not
> > seem to be expressed conditionally).
> >
> > But it might also be worthwhile adding to the wiki brief mentions that
> > a list of atomic representations, when treated as a train, is
> > currently handled based on how J's parser would treat that sequence of
> > atoms. And, that a single element atomic representation, when treated
> > as a train, gives the thing represented by that atomic representation.
> > Documentation is a group effort, and good documentation helps
> > everyone.
> >
> > That said, I do imagine that there could be contexts which would throw
> > an error when handed the atomic representation of a non-verb (or a
> > non-verb resulting from a train) even though those contexts accept the
> 

Re: [Jprogramming] modifiers

2020-03-09 Thread Jose Mario Quintana
gt; > └─┴─┘
> >
> > Thus, one can reproduce the adverb (a) using hg as follows,
> >
> >   a=. ('"' ;~ ]) o (([ , '@:' ; ] , '-' ; ] , '@:' ; [)/) o
(('';1)&{::)hg
> >
> > indeed,
> >
> >   u`v a
> > (u@:v - v@:u)"
> >
> >   _1 *:`(+/) a i. 2 3 4
> >   64  118  184  262
> > 1504 1702 1912 2134
> >
> > (It should not be a surprise by now that this version of (a) also has a
> > faulty LR.)
> >
> > In addition, the adverb hg can produce adverbs which can compute verbs;
for
> > instance, fast growing functions (do not try the 4 b variants; unless
you
> > like to watch a zombie j),
> >
> >   b=. (< o ((;:'&') , <) o an"0) o x: o (3 + i.) o (('';1)&{::) f.hg
> >
> >   + 3 b 0 1 2
> > 5 19 61
> >   * 3 b 0 1 2
> > 5 972
> >
2311636689599124105290248227248346311907805731599025040424058727845362278706486831678549034616390931929990722740950483148706576493125959644408795745069851838858348082593920080669882260917889638613299807576081950958129855915252733008332811030412805596...
> >
> > Similar forms to ARs can be defined recursively; since this post is
already
> > too long, I will not go into details but the following is a standard
> > counterpart (apart from the theoretical restrictions) of a wicked
version,
> >
> >   ". noun define -. CRLFNB. Fixed tacit code...
> >
> >   recur=.
> >
> >   (_1 |. 0 = 1 _1 0 +/\@:{~ (;:'()') i. ])(an f.)@:".^:(( = {.)
> >   +. (':' ~: {:) *. '_0123456789' e.~ {.)@:;&.:>`(<@:$:@:}.@:}:)@.(
> >   (;:'()') -: {. , {:);.1 ]
> >
> > )
> >   tail=. (}:^:('NB.' -: 3 {. >@:{:))@:;:
> >   as=. , o recur o tail  NB. "atomizing" sentences
> >
> > Tie, train, and agenda can handle this kind of "atomized" sentences,
> >
> >   (as'((*:@:(+/) - +/@:*:)@:i.) NB. verb') ` (as '(2 * (3 + 4)) NB.
noun')
> > ┌─┬───┐
> > │┌─┬──┬──┐│┌───┬─┬───┐│
> > ││┌──┬──┬─┬─┬─┬─┬──┬──┐│@:│i.│││┌─┐│*│┌───┬─┬───┐││
> > │││*:│@:│┌─┬─┐│-│+│/│@:│*:││  │  ┌─┬─┐││ ││┌─┐│+│┌─┐│││
> > │││  │  ││+│/││ │ │ │  │  ││  │  │0│2│││ │││┌─┬─┐││ ││┌─┬─┐
> > │││  │  │└─┴─┘│ │ │ │  │  ││  │  └─┴─┘││ 0│3│││ │││0│4│
> > ││└──┴──┴─┴─┴─┴─┴──┴──┘│  │  │││└─┘│ │││└─┴─┘││ ││└─┴─┘
> > │└─┴──┴──┘││  │ ││└─┘│ │└─┘│││
> > │││  │ │└───┴─┴───┘││
> > ││└───┴─┴───┘│
> > └─┴───┘
> >
> >   (as'((*:@:(+/) - +/@:*:)@:i.)') ` (as '(2 * (3 + 4))') (`:6)
> > 7462
> >   (as'((*:@:(+/) - +/@:*:)@:i.)') ` (as '(2 * (3 + 4))') @. 0 1
> > 7462
> >
> >   ((*:@:(+/) - +/@:*:)@:i.) (2 * (3 + 4))
> > 7462
> >
> > The verb (as) borrows concepts and even code from Dan's original
anonymous
> > evoke (ae) adverb; its source code seems to be missing in action but the
> > following is an alternative derivation by means of (as) and (hg),
> >
> >   ae=. as o (('';1)&{::) hg
> >
> >   '(*:@:(+/) - +/@:*:)@:i.' ae
> > (*:@:(+/) - +/@:*:)@:i.
> >
> >
> > Are all the forms that can be handled covered?  Not necessarily.
> >
> >
> > > > Note that getting useful linear representations from 5!:5 becomes
> > > > significantly harder if it must also represent nouns which contain
> > > > non-nouns.
> > >
> > > No, I was not necessarily referring to wicked (non-standard) nouns
> >
> > Alright, now I will be referring to wicked (non-standard) programming.
Why
> > do I care about nouns which contain verbs, adverbs and conjunctions (as
> > opposed to only noun representations), adverbs and conjunctions
cloaking as
> > verbs, and many other goodly creatures?
> >
> > With this kind of entities one can produce tacit adverbs which in turn
can
> > refer tacitly to the arguments of the verbs they produce; one can also
> > produce recursive verbs which can be fixed without losing their meaning
> > (e.g., the wicked version of the verb (as), as opposed to its
counterpart
> > entertained here,
> >
> >   as'(*:@:(+/) - +/@:*:)@:i.'
> > ┌─┬──┬──┐
> > │┌──┬──┬─┬─┬─┬─┬──┬──┐│@:│i.│
> > ││*:│@:│┌─┬─┐│-│+│/│@:│*:││  │  │
> > ││  │  ││+│/││ │ │ │  │  ││  │  │
> > ││  │  │└─┴─┘│ │ │ │  │  ││  │  │
> > │└──┴──┴

Re: [Jprogramming] modifiers

2020-03-08 Thread Jose Mario Quintana
unctions (as
opposed to only noun representations), adverbs and conjunctions cloaking as
verbs, and many other goodly creatures?

With this kind of entities one can produce tacit adverbs which in turn can
refer tacitly to the arguments of the verbs they produce; one can also
produce recursive verbs which can be fixed without losing their meaning
(e.g., the wicked version of the verb (as), as opposed to its counterpart
entertained here,

   as'(*:@:(+/) - +/@:*:)@:i.'
┌─┬──┬──┐
│┌──┬──┬─┬─┬─┬─┬──┬──┐│@:│i.│
││*:│@:│┌─┬─┐│-│+│/│@:│*:││  │  │
││  │  ││+│/││ │ │ │  │  ││  │  │
││  │  │└─┴─┘│ │ │ │  │  ││  │  │
│└──┴──┴─┴─┴─┴─┴──┴──┘│  │  │
└─┴──┴──┘
   as f.'(*:@:(+/) - +/@:*:)@:i.'
1 1

)

This matters to me because I have been running a system using custom
interpreters for many years.  It is tacit and fixed (in the (f.) sense of
the word) and it is produced with fixed tacit tools, no names imply no
names conflicts.  Contrary to common wisdom, it has been easy to write and
to update (even while it is running).  If only for those reasons, I would
continue to use only J interpreters which are friendly to wicked entities
to perform critical tasks.

> > (An issue, here, is that J currently doesn't provide operations to
> > build such structures,

That is in theory, in practice the official interpreters still do.
Granted, each new release makes it increasingly difficult (that is,
unfriendly to wicked entities).

> >and verifying the correctness of the
> > abstraction leaks becomes a whole new issue when we also demand a
> > correct and robust system.)

Do you know of any actual issue, from a language perspective, associated
with lifting the restrictions which demand that verbs can only produce and
take nouns, and adverbs and conjunctions can only take verbs or nouns?

One major reason to use wicked entities is that it greatly facilitates
tacit meta-programming, verbs are capable to produce dynamically any kind
of word, including verbs.  A component of the system automatically produces
and searches constantly, weekends are not excluded, for suitable variants
of trading algorithms (that is, verbs, complex tacit fixed verbs); this
component is particularly valuable during turbulent periods.

I have never heard of any compelling reason to forbid the wicked way.  Who
knows?  Maybe there is one...  Yet, it works (and would not be betting
without it).



On Fri, Mar 6, 2020 at 12:33 PM Raul Miller  wrote:
>
> On Fri, Mar 6, 2020 at 12:09 PM Jose Mario Quintana
>  wrote:
> > The short answer is: I would like, at least, to change whatever needs
to be
> > changed in the interpreter to produce and display proper linear
> > representations (LRs) of adverbs which currently have faulty ones, and
> > change what needs to be changed in the documentation to legitimize the
past
> > (and current?) behavior of tie (`), train (`:6), and agenda (@.) by
> > removing needless restrictions, or at least preserve the behavior.
>
> Note that getting useful linear representations from 5!:5 becomes
> significantly harder if it must also represent nouns which contain
> non-nouns.
>
> (An issue, here, is that J currently doesn't provide operations to
> build such structures, and verifying the correctness of the
> abstraction leaks becomes a whole new issue when we also demand a
> correct and robust system.)
>
> A "simple" solution, here, might be to extend J with something like `
> which takes an atomic representation for its left argument and builds
> a gerund (or maybe "gerund" -- we might also need to sort out our
> terminology) whose left-most element is the value represented by that
> atomic representation. (And, deals with the memory management issues
> and domain issues which result.) But even this level of "simple" might
> be above the level of complexity for j901 bugfixes. (And need some
> supporting use cases -- practical examples where this is not just
> possible but also is clearly the right approach.) (And, I don't know
> if this (`) analog would be a primitive or a foreign...)
>
> So, for J901 at least, I think it makes sense to restrict focus to
> getting 5!:5 to represent the things that J901 represents. (I already
> have problems keeping up with all the details that Henry has been
> working with.)
>
> I suspect my point of view is disappointing to you, but I am hoping
> you can at least understand where I'm coming from...
>
> 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


Re: [Jprogramming] modifiers

2020-03-06 Thread Jose Mario Quintana
> Note that getting useful linear representations from 5!:5 becomes
> significantly harder if it must also represent nouns which contain
> non-nouns.

No, I was not necessarily referring to wicked (non-standard) nouns.  I
will try to provide more details during the weekend.

On Fri, Mar 6, 2020 at 12:33 PM Raul Miller  wrote:
>
> On Fri, Mar 6, 2020 at 12:09 PM Jose Mario Quintana
>  wrote:
> > The short answer is: I would like, at least, to change whatever needs to be
> > changed in the interpreter to produce and display proper linear
> > representations (LRs) of adverbs which currently have faulty ones, and
> > change what needs to be changed in the documentation to legitimize the past
> > (and current?) behavior of tie (`), train (`:6), and agenda (@.) by
> > removing needless restrictions, or at least preserve the behavior.
>
> Note that getting useful linear representations from 5!:5 becomes
> significantly harder if it must also represent nouns which contain
> non-nouns.
>
> (An issue, here, is that J currently doesn't provide operations to
> build such structures, and verifying the correctness of the
> abstraction leaks becomes a whole new issue when we also demand a
> correct and robust system.)
>
> A "simple" solution, here, might be to extend J with something like `
> which takes an atomic representation for its left argument and builds
> a gerund (or maybe "gerund" -- we might also need to sort out our
> terminology) whose left-most element is the value represented by that
> atomic representation. (And, deals with the memory management issues
> and domain issues which result.) But even this level of "simple" might
> be above the level of complexity for j901 bugfixes. (And need some
> supporting use cases -- practical examples where this is not just
> possible but also is clearly the right approach.) (And, I don't know
> if this (`) analog would be a primitive or a foreign...)
>
> So, for J901 at least, I think it makes sense to restrict focus to
> getting 5!:5 to represent the things that J901 represents. (I already
> have problems keeping up with all the details that Henry has been
> working with.)
>
> I suspect my point of view is disappointing to you, but I am hoping
> you can at least understand where I'm coming from...
>
> 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


Re: [Jprogramming] ^:

2020-03-06 Thread Jose Mario Quintana
>  >./vec times.

   >./ 3 2 1
3

   <@:([ echo@'Invoked.')^:(3 2 1) 0
Invoked.
Invoked.
Invoked.
Invoked.
┌─┬───┬─┐
│┌───┐│┌─┐│0│
││┌─┐│││0││ │
│││0│││└─┘│ │
││└─┘││   │ │
│└───┘│   │ │
└─┴───┴─┘

?

   9!:14''
j901/j64/windows/release-e/commercial/www.jsoftware.com/2020-01-29T11:13:46


On Thu, Mar 5, 2020 at 1:25 PM Henry Rich  wrote:
>
> The current implementation is as you left it for this case.
>
>  >./vec times.
>
> Henry Rich
>
> On 3/5/2020 1:09 PM, Roger Hui wrote:
> > u is a verb and vec is a vector of non-negative integers.  In u:vec 0,
in
> > the current implementation, is u invoked +/vec times or >./vec times?
> >
> > (Sorry if you are seeing this twice.  Apparently my first post
disappeared.)
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-03-06 Thread Jose Mario Quintana
> > What should be changed, and how, to make the system you want?
> I would gladly try to describe the system that I would want to have in
the context of train (`:6), agenda (@.), gerunds, and related forms; but,
it is too late for me to do so coherently tonight.

The short answer is: I would like, at least, to change whatever needs to be
changed in the interpreter to produce and display proper linear
representations (LRs) of adverbs which currently have faulty ones, and
change what needs to be changed in the documentation to legitimize the past
(and current?) behavior of tie (`), train (`:6), and agenda (@.) by
removing needless restrictions, or at least preserve the behavior.

Why do I care about this kind of adverbs?  One can just write programs, or
one can write programs to write programs, prefer the latter; in addition, I
prefer tacit programming which is the natural functional programming in J,
quoting a quote from NuVoc 'as the expert J programmer Randy MacDonald has
said, "If you're not programming functionally, you're programming
dysfunctionally".'

P.S.  I will try to provide an answer with details during the weekend.




On Mon, Mar 2, 2020 at 11:43 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
> > What I read here is complaining.  What I am asking for is a suggestion
> > for action.
>
> What I showed is that replacing the AR of a noun does not always make
sense.  Thus, do not replace the AR or replace it, if you want, only when
the context is suitable; that is your decision.  Mind you, I cannot foresee
all the repercussions of what I am suggesting; I do not know for sure if
that alone would cure all the issues related to the LR of certain adverbs
or if it would cause unintended consequences.  Yet, it seems a good start
to me.
>
> > What should be changed, and how, to make the system you want?
> I would gladly try to describe the system that I would want to have in
the context of train (`:6), agenda (@.), gerunds, and related forms; but,
it is too late for me to do so coherently tonight.
>
>
> On Mon, Mar 2, 2020 at 9:55 PM Henry Rich  wrote:
> >
> > What I read here is complaining.  What I am asking for is a suggestion
> > for action.  What should be changed, and how, to make the system you
want?
> >
> > Henry Rich
> >
> > On 3/2/2020 9:51 PM, Jose Mario Quintana wrote:
> > > The issue, to me, is not reflected in your example (wherein that
context
> > > makes sense to replace the AR).  Consider instead the following
adverb,
> > >
> > > a2=. (`(<(":0);_)) (`:6)
> > >
> > > a2
> > > (`_)(`:6)
> > >
> > > (5!:5)<'a2'
> > > (`_)(`:6)
> > >
> > > The issue, in this context, is that,
> > >
> > > b2=. (`_)(`:6)  NB. defined using the LR of a2
> > >
> > > (5!:1)<'b2'
> > > ┌──┐
> > > │┌─┬──┐│
> > > ││4│┌─┬──┐││
> > > ││ ││┌─┬─┐│┌─┬──┐│││
> > > ││ │││4│┌─┬─┐│││4│┌──┬─┐
> > > ││ │││ ││`│┌─┬─┐ ││`:│┌─┬─┐│
> > > ││ │││ ││ ││0│_│ ││  ││0│6││
> > > ││ │││ ││ │└─┴─┘ ││  │└─┴─┘│
> > > ││ │││ │└─┴─┘│││ │└──┴─┘
> > > ││ ││└─┴─┘│└─┴──┘│││
> > > ││ │└─┴──┘││
> > > │└─┴──┘│
> > > └──┘
> > >
> > > is not the same adverb as a2
> > >
> > > (5!:1)<'a2'
> > > ┌┐
> > > │┌─┬┐│
> > > ││4│┌───┬──┐││
> > > ││ ││┌─┬───┐│┌─┬──┐│││
> > > ││ │││4│┌─┬───┐│││4│┌──┬─┐
> > > ││ │││ ││`│┌─┬───┐ ││`:│┌─┬─┐│
> > > ││ │││ ││ ││0│┌─┐│ ││  ││0│6││
> > > ││ │││ ││ ││ ││┌─┬─┐││ ││  │└─┴─┘│
> > > ││ │││ ││ ││ │││0│_│││ │└──┴─┘
> > > ││ │││ ││ ││ ││└─┴─┘│└─┴──┘│││
> > > ││ │││ ││ ││ │└─┘  │││
> > > ││ │││ ││ │└─┴───┘│││  │││
> > > ││ │││ │└─┴───┘││  │││
> > > ││ ││└─┴───┘│  │││
> > > ││ │└───┴──┘││
> > > │└─┴┘│
> > > └┘
> > >
> > > In other words, the LR of a2 is faulty.
> > >
> > >
> > >
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-03-02 Thread Jose Mario Quintana
The issue, to me, is not reflected in your example (wherein that context
makes sense to replace the AR).  Consider instead the following adverb,

   a2=. (`(<(":0);_)) (`:6)

   a2
(`_)(`:6)

   (5!:5)<'a2'
(`_)(`:6)

The issue, in this context, is that,

   b2=. (`_)(`:6)  NB. defined using the LR of a2

   (5!:1)<'b2'
┌──┐
│┌─┬──┐│
││4│┌─┬──┐││
││ ││┌─┬─┐│┌─┬──┐│││
││ │││4│┌─┬─┐│││4│┌──┬─┐
││ │││ ││`│┌─┬─┐ ││`:│┌─┬─┐│
││ │││ ││ ││0│_│ ││  ││0│6││
││ │││ ││ │└─┴─┘ ││  │└─┴─┘│
││ │││ │└─┴─┘│││ │└──┴─┘
││ ││└─┴─┘│└─┴──┘│││
││ │└─┴──┘││
│└─┴──┘│
└──┘

is not the same adverb as a2

   (5!:1)<'a2'
┌┐
│┌─┬┐│
││4│┌───┬──┐││
││ ││┌─┬───┐│┌─┬──┐│││
││ │││4│┌─┬───┐│││4│┌──┬─┐
││ │││ ││`│┌─┬───┐ ││`:│┌─┬─┐│
││ │││ ││ ││0│┌─┐│ ││  ││0│6││
││ │││ ││ ││ ││┌─┬─┐││ ││  │└─┴─┘│
││ │││ ││ ││ │││0│_│││ │└──┴─┘
││ │││ ││ ││ ││└─┴─┘│└─┴──┘│││
││ │││ ││ ││ │└─┘  │││
││ │││ ││ │└─┴───┘│││  │││
││ │││ │└─┴───┘││  │││
││ ││└─┴───┘│  │││
││ │└───┴──┘││
│└─┴┘│
└┘

In other words, the LR of a2 is faulty.



On Mon, Mar 2, 2020 at 7:03 PM Henry Rich  wrote:

> I am trying to follow this to see if there is a bug that needs fixing.
> That has not been made clear to me.  I observe
>
>
> (f@g)`h`]
> +-+-+-+
> |+-+-+|h|]|
> ||@|+-+-+|| | |
> || ||f|g||| | |
> || |+-+-+|| | |
> |+-+-+| | |
> +-+-+-+
> (f@g)`h`] `: 6
> +---+-+-+
> |+-+-+-+|h|]|
> ||f|@|g|| | |
> |+-+-+-+| | |
> +---+-+-+
> f@g h ]
>
> In the linear-rep display, the AR in the first box has been replaced
> with a value that has the same AR, to make the display easier to read.
>
> (<,'0';3)`h`]
> +-+-+-+
> |+-+-+|h|]|
> ||0|3|| | |
> |+-+-+| | |
> +-+-+-+
> (<,'0';3)`h`] `: 6
> +-+-+-+
> |3|h|]|
> +-+-+-+
> 3 h ]
>
> The same thing has been done here, but you don't like that.  Can you
> give a clear statement of what you would like changed, for example
> "don't replace the AR of a noun with the display value - write the AR in
> full".  As stated that would not be a good idea, because
>
> a =. 3 h ]
> 5!:1 <'a'
> +---+
> |+-+---+|
> ||3|+-+-+-+||
> || ||+-+-+|h|]|||
> || |||0|3|| | |||
> || ||+-+-+| | |||
> || |+-+-+-+||
> |+-+-------+|
> +---+
> a
> 3 h ]
>
> Replacing the noun's AR is good in this case.  What statement would you
> endorse?
>
> Henry Rich
>
>
> On 3/2/2020 6:46 PM, Jose Mario Quintana wrote:
> >   > Any definition of gerunds limited to atomic representations of verbs
> is
> > an oversimplification (for natural language gramatical analogy).  It
> should
> > be atomic representations without limitations. @. and `:6 can produce
> nouns
> > and modifiers from their atomic representations.
> >
> > I fully agree with you (except that, to me, the name gerund would be
> > irrelevant as long as, for example, (`:6) would continue to make sense of
> > those forms); I would go even further.  I would include *anything* that
> > (`:6) can take and make sense of it (at least up to J807), these include
> > forms that are not necessarily confined to lists of atomic
> representations;
> > I included a couple in my first post, to wit,
> >
> > (9!:3) 5 2  NB. Box (display) and linear representations...
> >
> > (<(<<(,'0');3),(<,'+'),<<(,'0');5),(<,'*'),<<(,'0');2  NB. (3 + 5) *
> 2
> > ┌───┬─┬───┐
> > │┌───┬─┬───┐│*│┌─┐│
> > ││┌─┐│+│┌─┐││ ││┌─┬─┐││
> > │││┌─┬─┐││ ││┌─┬─┐│││ │││0│2│││
> > 0│3│││ │││0│5 ││└─┴─┘││
> > │││└─┴─┘││ ││└─┴─┘│││ │└─┘│
> > ││└─┘│ │└─┘││ │   │
> > │└───┴─┴───┘│ │   │
> > └───┴─┴───┘
> >
> > ((<(<<(,'0');3),(<,'+'),<<(,'0');5),(<,'*'),<<(,'0');2) (`:6)
> > 16
> >
> > and
> >
> > (<(<,'"'),<<(,'0');1),<(<'@:'),<;:'>@:{'  NB. ("1)(@:(>@:{))
> > ┌───┬─┐
> > │┌─┬───┐│┌──┬─

Re: [Jprogramming] modifiers

2020-03-02 Thread Jose Mario Quintana
│
│└─┴───┘│
└───┘
   l2a '''bind'' f.'
┌───┐
│┌─┬───┐│
││:│┌─┬───┐││
││ ││┌─┬─┐│┌─┬───┐│││
││ │││0│2│││0│x@(y"_)
││ ││└─┴─┘│└─┴───┘│││
││ │└─┴───┘││
│└─┴───┘│
└───┘
   UNO=. 1
   l2a '''UNO'' f.'
┌─┐
│┌─┬─┐│
││0│1││
│└─┴─┘│
└─┘

If I had to use J901 then, at least for now, I would use,

  l2a=. verb : '(5!:1)<''y'' [ ".''y=. '' , y'

and live with potential side effects,

   UNO=. 1
   l2a '''UNO''f.'
┌─┐
│┌─┬─┐│
││0│1││
│└─┴─┘│
└─┘
   y=. 1
   l2a '''y''f.'
┌─┐
│┌─┬─┐│
││0│'y'f.││
│└─┴─┘│
└─┘


On Sun, Mar 1, 2020 at 12:03 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Any definition of gerunds limited to atomic representations of verbs is
an oversimplification (for natural language gramatical analogy).  It should
be atomic representations without limitations. @. and `:6 can produce nouns
and modifiers from their atomic representations.  The nuvoc page for `
includes the "gramatically" qualifier which makes it an acceptable
"simplification explainer"
>
> In example 2 of that page,
>
> "NB. x is 3 gerunds; execute one on y, depending on the sign of y"
>
> mistakenly uses gerunds instead of "atomic representations"
>
> I've always used gerund to mean a list of atomic representations.  One
basis to think so: +`'' produces  a list of one item
>
> Your an definition differs from my ar definition in that ar accepts verbs.
>
> I also use aar to handle modifiers (and names distinguished from strings)
>
> aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 <
''q'' '
>
> eval =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.'
>
> isNoun =: (0 = 4!:0 ::0:)@:<
>
>
> + aar
>
> ┌─┐
>
> │+│
>
> └─┘
>
> three =: 3
>
>'three' ar
>
> ┌─┐
>
> │┌─┬─┐│
>
> ││0│three││
>
> │└─┴─┘│
>
> └─┘
>
> 'three' aar
>
> ┌─┐
>
> │┌─┬─┐│
>
> ││0│3││
>
> │└─┴─┘│
>
> └─┘
>
>
>'/\' aar
>
> ┌─┐
>
> │/│
>
> └─┘
>
> '/\' aar
>
> ┌─┐
>
> │┌─┬─┐│
>
> ││4│┌─┬─┐││
>
> ││ ││/│\│││
>
> ││ │└─┴─┘││
>
> │└─┴─┘│
>
> └─┘
>
>
>
>
>
>
> On Sunday, March 1, 2020, 09:07:05 a.m. EST, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
>
>
>
> In my previous post I wrote,
>
> "First I thought that only atomic representations of trains of verbs were
> allowed"
>
> but I should have written instead,
>
> "First I thought that only nouns representing trains of verbs under de
> adverb train (`:6) were allowed"
>
> that is, for instance, ((u`v)`w) where u,v, and w are verbs is valid.
>
> (I should stop writing posts to the forum and watching fights
> simultaneously.)
>
>
>
> On Sun, Mar 1, 2020 at 12:35 AM Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
> >
> > < Though that lr bug caused the problems with f. that we both have noted
> in the past.
> >
> > Right, I remember; however, I think the issue reverts back to what,
> officially, a gerund is, or more generally what are admissible arguments
to
> train (`:6), agenda (@.), and tie (`) (and their products) because if an
> entity is not valid a faulty linear representation of it might not be
> regarded as a bug.
> >
> > On the one hand, the dictionary was ambiguous (and permissive in my
mind)
> on this subject but my understanding is that NuVoc is nowadays the
official
> documentation; thus, a gerund is "the atomic representation of a verb, or
a
> list thereof"  (which among other things implies that your isgerund verb
> might need to be revised or renamed).  After reading the tie (`) entry is
> not entirely clear to me what are valid values for n and m.  First I
> thought that only atomic representations of trains of verbs were allowed,
> but apparently '' is also considered valid in some instances.  Perhaps,
for
> example, the use of (3 ar) in,
> >
> >((3 ar)`*`])
> > ┌─┬─┬─┐
> > │┌─┬─┐│*│]│
> > ││0│3││ │ │
> > │└─┴─┘│ │ │
> > └─┴─┴─┘
> >
> >((3 ar)`*`]) (`:6)
> > 3 * ]
> >
> > is invalid because (3 ar) is not the atomic representation of a verb.
In
> addition,
> >
> >+ ((3 ar)`) (`(5 ar))
> > ┌─┬─┬─┐
> > │┌─┬─┐│+│┌─┬─┐│
> > ││0│3││ ││0│5││
> > │└─┴─┘│ │└─┴─┘│
> > └─┴─┴─┘
> >
> > seems to be an invalid use of ties even if only because

Re: [Jprogramming] modifiers

2020-03-01 Thread Jose Mario Quintana
In my previous post I wrote,

"First I thought that only atomic representations of trains of verbs were
allowed"

but I should have written instead,

"First I thought that only nouns representing trains of verbs under de
adverb train (`:6) were allowed"

that is, for instance, ((u`v)`w) where u,v, and w are verbs is valid.

(I should stop writing posts to the forum and watching fights
simultaneously.)



On Sun, Mar 1, 2020 at 12:35 AM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
> < Though that lr bug caused the problems with f. that we both have noted
in the past.
>
> Right, I remember; however, I think the issue reverts back to what,
officially, a gerund is, or more generally what are admissible arguments to
train (`:6), agenda (@.), and tie (`) (and their products) because if an
entity is not valid a faulty linear representation of it might not be
regarded as a bug.
>
> On the one hand, the dictionary was ambiguous (and permissive in my mind)
on this subject but my understanding is that NuVoc is nowadays the official
documentation; thus, a gerund is "the atomic representation of a verb, or a
list thereof"  (which among other things implies that your isgerund verb
might need to be revised or renamed).  After reading the tie (`) entry is
not entirely clear to me what are valid values for n and m.  First I
thought that only atomic representations of trains of verbs were allowed,
but apparently '' is also considered valid in some instances.  Perhaps, for
example, the use of (3 ar) in,
>
>((3 ar)`*`])
> ┌─┬─┬─┐
> │┌─┬─┐│*│]│
> ││0│3││ │ │
> │└─┴─┘│ │ │
> └─┴─┴─┘
>
>((3 ar)`*`]) (`:6)
> 3 * ]
>
> is invalid because (3 ar) is not the atomic representation of a verb.  In
addition,
>
>+ ((3 ar)`) (`(5 ar))
> ┌─┬─┬─┐
> │┌─┬─┐│+│┌─┬─┐│
> ││0│3││ ││0│5││
> │└─┴─┘│ │└─┴─┘│
> └─┴─┴─┘
>
> seems to be an invalid use of ties even if only because
>+ ((3 ar)`) (`(5 ar)) (`:6)
> 8
>
> is a noun rather than a verb.
>
> On the other hand, there has been an effort in the past to correct
similar faulty linear representations that have been pestering some of us
for many years.  Maybe they are invalid but tolerated; several years ago I
wrote the following tacit double adverb (hg) which allows one to produce a
wide class of tacit adverbs by reducing the task of tacit adverbial
programming to tacit verbal programming.  When I wrote hg Dan and I
thoutght it was kosher but nowadays apparently it is not,
>
  o=. @:
> c=."_
> ar=. 5!:1@:<
> d=. (a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
> av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
>   NB. Adverbing a monadic verb (adv)
>   assert 1 4 9 -: 1 2 3 *: av
> aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation
> d=. (a3=. (@: (aw f.)) ('av'f.)) (a4=. "_) (a5=. `:6)
> a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)
>
> NB. hg...
> hg=. `((ar'a6')`(ar'a5')) (`:6)
>   assert (*: 1 2 3)-: 1 2 3  ((<'*:') ; ]   )
  hg
>   assert (*/ 1 2 3)-: *  (< , ((<'/')c))
   hg 1 2 3
>   assert ((*: - +/\)1 2 3) -: (*:`(+/\)) (0&{ , (<'-') ,
1&{)@:(('';1)&{::) hg 1 2 3
> erase'a0 a1 a2 a3 a4 a5 a6 av aw d'
>
> A simple application is to produce a tacit version of your ar adverb
(mildly tested),
>
> an=.  <@:((,'0') ,&:< ])f.  NB. Atomizing words (monadic verb)
> ar=. an f.hg
>
> A shorter tacit version of ar exists but the point is that hg can produce
a tacit version of the adverb ar as well as lots of other tacit adverbs.
The linear representations of both adverbs (hg and ar) are faulty; that is,
running on J807, I have not tried with J901.
>
> P.S.  I merely have a mild academic interest on this matter since I
neither use J901 nor J807 for any important work.
>
>
> On Thu, Feb 27, 2020 at 11:04 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
> >
> > Henry reported (I think/thought) fixing this display (lr) bug within
the j9 cycle.
> >
> > Though that lr bug caused the problems with f. that we both have noted
in the past.
> >
> > There are 2 separate display bugs with "partial gerunds" (bound adverb
with `)
> >
> > ((<(,'0');3)`)  NB. not equivalent to displayed result
> >
> > <(,'0');3`
> >
> > Any other adverb "trained" with partial gerund creates a more obvious
distortion
> >
> >  /((<(,'0');3)`)
> >
> > /(3`)
> >
> > though it still works (internally it is not messed up as display)
> >
> > +(/((<(,'0');3)`))
> >
> > ┌─┬───┐
> >
> > │┌─┬─┐│┌─┬───┐│
> >
> > ││0│3│││/│┌─┐││
> >
> > │└─┴─┘││ ││+│││
> >
> > │ ││ │└─┘││
> >
> > │ │└─┴───┘│
> >
> > └─┴───┘
> >
> >
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] modifiers

2020-02-29 Thread Jose Mario Quintana
< Though that lr bug caused the problems with f. that we both have noted in
the past.

Right, I remember; however, I think the issue reverts back to what,
officially, a gerund is, or more generally what are admissible arguments to
train (`:6), agenda (@.), and tie (`) (and their products) because if an
entity is not valid a faulty linear representation of it might not be
regarded as a bug.

On the one hand, the dictionary was ambiguous (and permissive in my mind)
on this subject but my understanding is that NuVoc is nowadays the official
documentation; thus, a gerund is "the atomic representation of a verb, or a
list thereof"  (which among other things implies that your isgerund verb
might need to be revised or renamed).  After reading the tie (`) entry is
not entirely clear to me what are valid values for n and m.  First I
thought that only atomic representations of trains of verbs were allowed,
but apparently '' is also considered valid in some instances.  Perhaps, for
example, the use of (3 ar) in,

   ((3 ar)`*`])
┌─┬─┬─┐
│┌─┬─┐│*│]│
││0│3││ │ │
│└─┴─┘│ │ │
└─┴─┴─┘

   ((3 ar)`*`]) (`:6)
3 * ]

is invalid because (3 ar) is not the atomic representation of a verb.  In
addition,

   + ((3 ar)`) (`(5 ar))
┌─┬─┬─┐
│┌─┬─┐│+│┌─┬─┐│
││0│3││ ││0│5││
│└─┴─┘│ │└─┴─┘│
└─┴─┴─┘

seems to be an invalid use of ties even if only because
   + ((3 ar)`) (`(5 ar)) (`:6)
8

is a noun rather than a verb.

On the other hand, there has been an effort in the past to correct similar
faulty linear representations that have been pestering some of us for many
years.  Maybe they are invalid but tolerated; several years ago I wrote the
following tacit double adverb (hg) which allows one to produce a wide class
of tacit adverbs by reducing the task of tacit adverbial programming to
tacit verbal programming.  When I wrote hg Dan and I thoutght it was kosher
but nowadays apparently it is not,

o=. @:
c=."_
ar=. 5!:1@:<
d=. (a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
  NB. Adverbing a monadic verb (adv)
  assert 1 4 9 -: 1 2 3 *: av
aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation
d=. (a3=. (@: (aw f.)) ('av'f.)) (a4=. "_) (a5=. `:6)
a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)

NB. hg...
hg=. `((ar'a6')`(ar'a5')) (`:6)
  assert (*: 1 2 3)-: 1 2 3  ((<'*:') ; ]   )
hg
  assert (*/ 1 2 3)-: *  (< , ((<'/')c))
 hg 1 2 3
  assert ((*: - +/\)1 2 3) -: (*:`(+/\)) (0&{ , (<'-') , 1&{)@:(('';1)&{::)
hg 1 2 3
erase'a0 a1 a2 a3 a4 a5 a6 av aw d'

A simple application is to produce a tacit version of your ar adverb
(mildly tested),

an=.  <@:((,'0') ,&:< ])f.  NB. Atomizing words (monadic verb)
ar=. an f.hg

A shorter tacit version of ar exists but the point is that hg can produce a
tacit version of the adverb ar as well as lots of other tacit adverbs.  The
linear representations of both adverbs (hg and ar) are faulty; that is,
running on J807, I have not tried with J901.

P.S.  I merely have a mild academic interest on this matter since I neither
use J901 nor J807 for any important work.


On Thu, Feb 27, 2020 at 11:04 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Henry reported (I think/thought) fixing this display (lr) bug within the
j9 cycle.
>
> Though that lr bug caused the problems with f. that we both have noted in
the past.
>
> There are 2 separate display bugs with "partial gerunds" (bound adverb
with `)
>
> ((<(,'0');3)`)  NB. not equivalent to displayed result
>
> <(,'0');3`
>
> Any other adverb "trained" with partial gerund creates a more obvious
distortion
>
>  /((<(,'0');3)`)
>
> /(3`)
>
> though it still works (internally it is not messed up as display)
>
> +(/((<(,'0');3)`))
>
> ┌─────┬───┐
>
> │┌─┬─┐│┌─┬───┐│
>
> ││0│3│││/│┌─┐││
>
> │└─┴─┘││ ││+│││
>
> │ ││ │└─┘││
>
> │ │└─┴───┘│
>
> └─┴───┘
>
>
> On Thursday, February 27, 2020, 10:23:28 p.m. EST, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
>
>
>
>
> > Seems I found a bug
>
> The question is:
>
> Is the long-standing ability of (`:6), and @.,  to handle arrays of atomic
> representations (and similar), a bug or a feature?
>
> Dan mentioned a decade ago,
>
>   No subject [!]
>   http://www.jsoftware.com/pipermail/general/2009-April/033220.html
>
> (Unfortunately, a link therein pointing to Dan's svn project with "Lots of
> scripts I've written or stolen" seems to be broken.)
>
> I have mentioned before a verb I wrote to produce, so to speak, an atomic
> representation of a sentence (as); for example,
>
>   as'3 + 5'
> ┌───┬─┬───┐
&

Re: [Jprogramming] modifiers

2020-02-27 Thread Jose Mario Quintana
 > Seems I found a bug

The question is:

Is the long-standing ability of (`:6), and @.,  to handle arrays of atomic
representations (and similar), a bug or a feature?

Dan mentioned a decade ago,

   No subject [!]
   http://www.jsoftware.com/pipermail/general/2009-April/033220.html

(Unfortunately, a link therein pointing to Dan's svn project with "Lots of
scripts I've written or stolen" seems to be broken.)

I have mentioned before a verb I wrote to produce, so to speak, an atomic
representation of a sentence (as); for example,

   as'3 + 5'
┌───┬─┬───┐
│┌─┐│+│┌─┐│
││┌─┬─┐││ ││┌─┬─┐││
│││0│3│││ │││0│5│││
││└─┴─┘││ ││└─┴─┘││
│└─┘│ │└─┘│
└───┴─┴───┘
is similar to,

   (+ ((3 ar)`) (`(5 ar)))
┌─┬─┬─┐
│┌─┬─┐│+│┌─┬─┐│
││0│3││ ││0│5││
│└─┴─┘│ │└─┴─┘│
└─┴─┴─┘

since

   (as'3 + 5') (`:6)
8

One can produce more complicated (as)'s; for instance,
   as'(3 + 5) * 2'
┌───┬─┬───┐
│┌───┬─┬───┐│*│┌─┐│
││┌─┐│+│┌─┐││ ││┌─┬─┐││
│││┌─┬─┐││ ││┌─┬─┐│││ │││0│2│││
0│3│││ │││0│5 ││└─┴─┘││
│││└─┴─┘││ ││└─┴─┘│││ │└─┘│
││└─┘│ │└─┘││ │   │
│└───┴─┴───┘│ │   │
└───┴─┴───┘

   (as'(3 + 5) * 2') (`:6)
16

or,
   as'("1)(@:(>@:{))'
┌───┬─┐
│┌─┬───┐│┌──┬┐│
││"│┌─┐│││@:│┌─┬──┬─┐││
││ ││┌─┬─┐  ││>│@:│{│││
││ │││0│1│  │└─┴──┴─┘││
││ ││└─┴─┘│││└──┴┘│
││ │└─┘││ │
│└─┴───┘│ │
└───┴─┘

   (as'("1)(@:(>@:{))') (`:6)
("1)(@:(>@:{))
┌─┬─┐
│┌─┬─┐│┌──┬┐│
││"│1│││@:│┌─┬──┬─┐││
│└─┴─┘││  ││>│@:│{│││
│ ││  │└─┴──┴─┘││
│ │└──┴┘│
└─┴─┘

If it is regarded as a bug rather than a feature, then adverbial tacit
programming (orthodox or otherwise) would be severely limited (then again,
that seems to be the trend).

On Thu, Feb 27, 2020 at 12:51 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:
>
> Seems I found a bug, though the following approach still works, and has
the best performance
>
> ar =: 1 : '5!:1 <''u'''
>
> the bug is:
>
>  ((3 ar)`) (`(5 ar)) (`:6)
>
> ((3`)(`5))(`:6)  NB. not valid gerunds, though magically the following
still works
>
> + ((3 ar)`) (`(5 ar)) (`:6)
> 8
>
> +  A=: (((3 ar)`) (`(5 ar)) (`:6))  NB. separate lines still work despite
"invalid return"
>
> 8
>
> though the following fails,
>
> + ((3`)(`5))(`:6)
>
> |domain error
>
> representation is supposed to be,
>
> + ((3 ar)`) (`(5 ar))
>
> ┌─┬─┬─┐
>
> │┌─┬─┐│+│┌─┬─┐│
>
> ││0│3││ ││0│5││
>
> │└─┴─┘│ │└─┴─┘│
>
> └─┴─┴─┘
>
>
> An incompatible change that would seem very welcome to me, would be that
>
> noun ` noun
>
> instead of creating a list from the 2 nouns (pair) if they are magically
compatible, would create a pair of atomic representations of each noun.
>
> Because the above code works, it appears as though just "visual sugar" is
provided for display.  The proposed incompatible change would make the
visual sugar valid code, which is consistent (other than this) within J.
>
> On Thursday, February 27, 2020, 11:33:59 a.m. EST, Raul Miller <
rauldmil...@gmail.com> wrote:
>
>
>
>
>
> Or, more robust:
>
> C=:2 :0
>   mRep=. 5!:5<'m'
>   mVn=. m V n
>   mVnRep=. 5!:5<'mVn'
>   1 :('(',mRep,') u~ ',mVnRep)
> )
>
> Example use:
>
>   V=:+
>   ,. 10 C (i.2 3)
> 10 11 12 10
> 13 14 15 10
>
> (The issue here is that 5!:5 is better than ": when serializing nouns
> for use in sentences.)
>
> Perhaps even better, though, would be to define a verb to serialize
> nouns and use that in place of ":
>
> lrep=:3 :0
>   '(',(5!:5<'y'),')'
> )
>
> C=:2 :0
>   1 :((lrep m),'u~',lrep m V n)
> )
>
> Thanks,
>
> --
> Raul
>
> On Thu, Feb 27, 2020 at 6:48 AM 'Pascal Jasmin' via Programming
>  wrote:
> >
> > C =: 2 : 0
> > 1 : ((": m) , ' u~ ' , ": m V n)
> > )
> >
> >
> >
> >
> >
> >
> > On Thursday, February 27, 2020, 03:04:57 a.m. EST, Hauke Rehr <
hauke.r...@uni-jena.de> wrote:
> >
> >
> >
> >
> >
> > What I want is rather something (C here) callable like
> > noun1 C noun2
> > resulting in the adverb
> > noun1 u~ 
> >
> > What you say I knew except if the evaluation
> > rules changed in j9 and this is new bahaviour.
> >
> > That said, I got rid of my nested 1 :/2 :
> > construct (I didn’t mention that yet)
> > and tried replacing m and n by x and y
> > but to no avail.
> >
> > Am 27.02.20 um 01:37 schrieb 'Pascal Jasmin' via Programming:
> > > u or m will be the argument to A.  x and y arguments to resulting
verb.
> > >
> > > it sounds as though you may be trying to do
> > >
> > > A =: 1 : 'x u~ x V y'  NB. a valid dyadic adverb in j9
> > >
> > > and this would be equivalent to
> > >
> > > ([ u~ V)
> > >
> > >
> > >
> > >
> > > On Wednesday, February 26, 2020, 06:20:45 p.m. EST, Hauke Rehr <
hauke.r...@uni-jena.de> wrote:
> > >
> > >
> > >
> > >
> > >
> > > Hello again,
> > >
> > > I’m still confused about modifiers.
> > > Please tell me where to find more 

Re: [Jprogramming] constant substitution

2020-02-16 Thread Jose Mario Quintana
Let us start with your verb example but with some specific values,

   X=. 0 1 2

   ( test=. (>: X) {~ ] )
1 2 3 {~ ]

as you mentioned, the result of (>: X) becomes the left tine of the fork
that defines the resulting verb,

   type'test'
┌┐
│verb│
└┘

which, presumably is meant to be used monadically (otherwise, it will
simply ignore its left argument),

   2 test 0 1
1 2
 test 0 1
1 2

An almost equivalent definition is,

  ( test=. (>:X)&({~) )
1 2 3&({~)

 test 0 1
1 2

However,

   2 test 0 1
2 3

(but that is another story).  The main point, so far, is to emphasize that
(<: X) is bonded to the dyadic verb ({~) and produces a monadic verb.

Can we do something similar with conjunctions?  Yes.  How?  To illustrate
how one can do that, let us use the verb ({~) as the conjunction ( 2 : 'u
{~ v' ),

   ( test=. ((>: X) 2 : 'u {~ v' ) )
(1 2 3)(2 : 'u {~ v')

and the conjunction (2 : 'u {~ v'), with (>:X) as a bonded argument is an
adverb ((1 2 3)(2 : 'u {~ v')),

   type'test'
┌──┐
│adverb│
└──┘

   1 2 test
2 3


Of course, there might be instances where the use of a computed argument
bonded to a conjunction (or, for that matter, a computed argument bonded to
a verb) might not be advisable.  (Incidentally, in the example above one
can use, u and v, or x and y, or m and n, in the conjunction's body;
however, I do not have a J901 interpreter handy to verify this is still the
case).

Do not try to code tacit conjunctions; as far as I know, it is an
impossible brain teaser.  However, there are two ways to produce tacit
adverbs, one is as trains of tacit adverbs; the other, of course, is via a
primitive conjunction with a bonded tacit argument.  Perhaps surprisingly,
one can go a very long way coding tacit adverbs combining these two forms
(at least if one is prepared to use arrays of atomic representations, in
place of gerunds, in some syntactic forms) and, in particular, tacit double
adverbs can be coded that way which effectively can take two arguments;
this is a counterpart of what is called currying in traditional programming
languages.  Mind you, adverbial tacit programming is much more difficult
than tacit verbal programming (at least at the beginning).

I hope it helps



On Sun, Feb 16, 2020 at 10:38 AM Hauke Rehr  wrote:

> Sorry, I thought I had done it tacitly
> but your examples seem to prove me wrong.
> (Maybe I didn’t understand the concept
>   of “semi-tacit” and where it applies.)
> Of course we want to have late binding
> available but there are also cases when
> early binding is preferred.
> My confusion is due to a sentence I thought
> was tacit but didn’t show the benefits of
> early binding.
> Thanks for the explanation.
>
> Am 16.02.20 um 15:23 schrieb 'Pascal Jasmin' via Programming:
> > this all behaves correctly (did not understand your initial post)
> >
> > "N
> >
> > "1
> >
> > +/"N
> >
> > +/"1
> >
> > (2 : 'u"v y')N
> >
> > 2 : 'u"v y'1
> >
> > 3(2 : 'u"v y')N
> >
> > 3 (2 : 'u"v y') 1
> >
> > 3 (2 : 'u"v y') 1
> >
> > (3) (2 : 'u"v y') 1
> >
> > 3(2 : 'u"v y')N
> >
> > (3) (2 : 'u"v y') 1
> >
> > M =: 3
> >
> > M(2 : 'u"v y')N
> >
> > (3) (2 : 'u"v y') 1
> >
> > What you are actually commenting/complaining about is that explicit code
> should substitute global variables inside the explicit code.  This also
> applies to verb definitions.
> >
> > It will behave as you want if you use tacit code.  The concept of
> "semi-tacit" modifiers are explicit definitions that do not refer to x or y.
> >
> > so,
> >
> > (3) (2 : 'u"v') 1
> >
> > 3"1
> >
> > does "compile"/substitute away the explicit code.
> >
> > The reason this design/behaviour is useful is that you can use explicit
> code to late bind to variables, and tacit code to early bind.  J would need
> a constant directive to consider substitutions.
> >
> > One method to get what you want for code that uses constants that are
> usefully changed prior to load is to have an init_verb called at the end of
> the script that reassigns (tacit) verbs based on constant values.
> >
> >
> >
> >
> > On Sunday, February 16, 2020, 09:02:47 a.m. EST, Hauke Rehr <
> hauke.r...@uni-jena.de> wrote:
> >
> >
> >
> >
> >
> > I don’t have any concrete example that’s actually
> > expensive in terms of time or space (where space
> > means “memory”) but in place of >: in the verb
> > example, there could be any function, it could
> > take hours. This is no less true for conjunctions.
> > And I don’t want this to be called each and every
> > time I use it when the arguments have already
> > been given when defining the verb.
> >
> > Furthermore, this may be arbitrarily deeply nested.
> > Say you build a couple of conjunctions atop of
> > each other, you use the derived verb to define
> > another one and maybe a library on top
> > of them where it will be called routinely.
> >
> > It is a good idea to evaluate constant expressions
> > as soon as possible and that’s why J does it in the
> > case of functions. I don’t see any reason 

Re: [Jprogramming] Explicit vs tacit with assignment

2019-12-10 Thread Jose Mario Quintana
> The "(a,a=. ...)" expression reminded me of an upgrade we once did to a
> Sharp APL mainframe system where one of the points of interest was how the
> upgrade handled what they called "pornographic assignment".  I don't
> remember the exact example they used but this reminds me of that.  I made
a

That reminded me of an APL expression which can be paraphrased as,

   ". A=. '".>(Y>0){''1'';''(>:Y) * ".A [ Y=. <:Y''' [ Y=. 6
720
Where did this "obscenity" appeared?  In one of the "sacred texts..."

Gilman and Rose's APL: An Interactive Approach
(If my memory is not betraying me.)

;)


On Sun, Nov 24, 2019 at 3:57 PM Devon McCormick  wrote:
>
> The "(a,a=. ...)" expression reminded me of an upgrade we once did to a
> Sharp APL mainframe system where one of the points of interest was how the
> upgrade handled what they called "pornographic assignment".  I don't
> remember the exact example they used but this reminds me of that.  I made
a
> vain attempt to look up this phrase but, of course, it was so long ago,
and
> so niche, there is no hope of pulling up a relevant result; not to mention
> the numerous domain errors such a phrase hits.
>
> On Sun, Nov 24, 2019 at 2:59 PM Jose Mario Quintana <
> jose.mario.quint...@gmail.com> wrote:
>
> > > To break the rules deliberately one must first know where to swing!
> >
> > Certainly...
> >
> > "Learn the rules like a pro, so you can break them like an artist."
> >
> > Picasso
> >
> > Did he know of what he spoke?  His father, a painter and a teacher,
> > reportedly overwhelmed gave his own palette, brushes, and colors to his
> > thirteen-year-old son stating that he will never paint again. This,
> >
> >   https://www.pablo-ruiz-picasso.net/work-9.php
> >
> > illustrates what he knew when he was fifteen years old.
> >
> > Back to the subject of tacit assignment, how can one faithfully (to some
> > extent) reproduce the behavior of the explicit verb 3 : 'a,a=:?@#y'
> > (e.g,
> >
> >3 : 'a,a=:?@#y' '01234'
> > 4 4
> >a
> > 4
> >
> > ) tacitly?  (Yes, using a global assignment as opposed to the original
> > local assignment, to make things more interesting.)
> >
> > Right, producing named entities seems to be against the spirit of tacit
> > writing.  In addition, a copula is neither a noun, verb, adverb nor
> > conjunction.  Nevertheless, one can simply ignore those minor details
and
> > go ahead anyway,
> >
> >(('a'"_) ,&:". 'a=: ' , ":@:?@#) '01234'
> > 3 3
> >a
> > 3
> >
> >(('a'"_) ,&:". 'a=: ' , ":@:?@#) ''
> > 0.732158184 0.732158184
> >a
> > 0.732158184
> >
> > Perhaps surprisingly, a more challenging puzzle is to reproduce the
> > behavior of,
> >
> >4 :'(x)=:y'
> >
> > tacitly.
> >
> > On Sat, Nov 23, 2019 at 8:53 PM Louis de Forcrand 
> > wrote:
> > >
> > > To follow up on all this, while I am a member of the generation which
> > might write off "lie", I find that correct grammar and spelling are
> > qualities necessary (although certainly not sufficient) for writing
clearly
> > and with good style, and in learning the former one inevitably improves
on
> > the latter.
> > >
> > > To break the rules deliberately one must first know where to swing!
> > >
> > > Cheers,
> > > Louis
> > >
> > > > On 21 Nov 2019, at 18:21, Jose Mario Quintana <
> > jose.mario.quint...@gmail.com> wrote:
> > > >
> > > > "By all means break the rules, and break them beautifully,
deliberately
> > and
> > > > well."
> > > >
> > > > Bringhurst, Robert (2005). The Elements of Typographic Style
> > > >
> > > > PS.  I try to keep that in mind when writing (particularly in J).
> > > >
> > > >
> > > >> On Thu, Nov 21, 2019 at 4:26 AM R.E. Boss 
> > wrote:
> > > >>
> > > >> AMEN.
> > > >>
> > > >> When you try to uphold the rules of a language (which is done only
by
> > > >> older people), you are fighting a lost battle.
> > > >>
> > > >>
> > > >> R.E. Boss

> > > >>>>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Removing annihilating pairs

2019-12-08 Thread Jose Mario Quintana
> In my tests, on longer sequences, Henry Rich's approach seemed about
> the same speed as mine.

  an2 1 _1 2

|length error: an1

| an2 1 _1 2

Maybe the specs assume an even number of items?

On Sun, Dec 8, 2019 at 12:04 AM Raul Miller  wrote:
>
> In my tests, on longer sequences, Henry Rich's approach seemed about
> the same speed as mine.
>
> Thanks,
>
> --
> Raul
>
> On Sat, Dec 7, 2019 at 6:33 AM R.E. Boss  wrote:
>
> > Forcrand's solution is more or less the version I came up with,
> > unfortunately, it's far from linear (what is not compensated by its
> > elegance).
> >foo=: ,`(}.@])@.(0=(+{.))/
> >   ts'foo 1 _1 2 _2{~1?.@#4'
> > 0.0166915 854720
> >   ts'foo 1 _1 2 _2{~10?.@#4'
> > 1.9109807 6818496
> >
> > Miller's solution is better in that respect (and much faster)
> >   ts'an2 1 _1 2 _2{~1?.@#4'
> > 0.0024111 722816
> >   ts'an2 1 _1 2 _2{~10?.@#4'
> > 0.0281419 6293376
> >
> > ddup from Rich also seems to be linear but is a factor 10 slower than
an2
> >   ts'ddup 1 _1 2 _2{~1?.@#4'
> > 0.0219618 395264
> >   ts'ddup 1 _1 2 _2{~10?.@#4'
> > 0.2124874 3147776
> >
> > Jasmin's solution is far too slow
> >ts'(delitemG~ 2, 0 i.~ 2&(+/\))(^:_) 1 _1 2 _2{~1?.@#4'
> > 1.2363434 1585408
> >
> > Thanks for all the contributions
> >
> >
> > R.E. Boss
> >
> >
> > > -Oorspronkelijk bericht-
> > > Van: Programming 
> > > Namens Louis de Forcrand
> > > Verzonden: zaterdag 7 december 2019 00:26
> > > Aan: programm...@jsoftware.com
> > > Onderwerp: Re: [Jprogramming] Removing annihilating pairs
> > >
> > > Not particularly J-ish, but (array-shuffling aside) linear solution:
> > >
> > >s=: ,`(1}.])@.(= -@{.)/
> > >s 1 _1 2 _2{~100?.@#4
> > > 2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2 _2
_2
> > _2 _1 _2 _1
> > > _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2
> > >
> > > Since the reduced form of the input list is unique, we are free to
> > perform
> > > reductions in any order we please; in particular, we can start
> > simplifying from
> > > the back, which is what s does.
> > > Might do strange stuff on an empty input list.
> > >
> > > Cheers,
> > > Louis
> > >
> > > Original Message
> > > From : ol...@bluewin.ch
> > > Date : 06/12/2019 - 23:51 (CEST)
> > > To : programm...@jsoftware.com
> > > Subject : Re: [Jprogramming] Removing annihilating pairs
> > >
> > > If the answer to Jimmy's question is no, then the uniqueness of the
> > resulting
> > > array has to do (surprisingly) with free groups
> > > (https://en.wikipedia.org/wiki/Free_group).
> > > Indeed we can view a vector of numbers as a word over the alphabet
[0,∞)
> > > of positive real numbers (where negative numbers / zero are inverses
of
> > > letters in our alphabet). The fact that all maximal reductions
> > (reductions
> > > which contain no adjacent inverses) of a given word are equal means
> > exactly
> > > that our reduced list is unique.
> > > For a proof see:
> > > https://math.stackexchange.com/a/2425147
> > >
> > > I'll look into this problem, it's interesting!
> > > Cheers,
> > > Louis
> > >
> > > Original Message
> > > From : jimmy.gau...@gmail.com
> > > Date : 06/12/2019 - 23:36 (CEST)
> > > To : programm...@jsoftware.com
> > > Subject : Re: [Jprogramming] Removing annihilating pairs
> > >
> > > Hi,
> > >
> > > is the expected output of transforming 1 3 _3 3 5 to be 1 3 5 or 1 5 ?
> > >
> > > On Fri, Dec 6, 2019 at 7:15 AM R.E. Boss  wrote:
> > >
> > > > Given an array with zero or more annihilating pairs, i.e., two
> > > > subsequent numbers which add up to zero, the question is to clean up
> > > > the array by deleting all annihilating pairs such that no such pairs
> > are left.
> > > > I do have a solution that is both elegant and efficient (I believe),
> > > > but I am curious about other thoughts.
> > > >
> > > >foo  2 1 1 _1 2 _2 _1
> > > > 2
> > > >
> > > >foo 1 _1 2 _2{~100?.@#4  NB. Notice (?.)
> > > > 2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2
_2
> > > > _2
> > > > _2 _1 _2 _1 _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2
> > > >
> > > >
> > > > R.E. Boss
> > > >
--
> > > > 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
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> 

Re: [Jprogramming] Selecting trains with m@.v

2019-12-08 Thread Jose Mario Quintana
> This is closer to what I am trying to do:
>
> (+1:)`*`%`(+2:)@.(0 , (1 + 2&|) , 3:)"0 [ 5 6  NB. fictional usage
> 0.857143 56

This explicit verb seems to produce what you want,

   u=. 3 : '(+1:)`*`%`(+2:)@.((0,(1+2&|),3:) y) y'"0

   u 5 6
0.857142857 56

Writing a tacit counterpart of u is a conundrum...  But, breaking rules (at
your own risk) helps,

   an=. <@:((":0) ,&< ])
   agenda=. (<'@.')(0:`)(,^:)

   v=. (((+1:)`*`%`(+2:) agenda (0,(1+2&|),3:)) (0 1 agenda~ ;) an )"0 f.

   v 5 6
0.857142857 56

(Untested using the latest and greatest interpreters.)



On Sat, Dec 7, 2019 at 8:08 PM ethiejiesa via Programming <
programm...@jsoftware.com> wrote:

> > is the following what you want ?
> >
> >1 2 3 (+ ; * ; -) 6 7 8
>
> Not quite. The example in my original email was probably overly minimal to
> be
> completely unhelpful.
>
> This is closer to what I am trying to do:
>
> (+1:)`*`%`(+2:)@.(0 , (1 + 2&|) , 3:)"0 [ 5 6  NB. fictional usage
> 0.857143 56
>
> The salient feature being that the choice of * or % depends on the
> argument.  I
> certainly could just compute both * and %, selecting the desired result
> post
> facto, but I would like to avoid the unnecessary computation.
>
> That said, perhaps I am just going about the solution in an entirely non-J
> way.
> The problem is Advent of Code 2019, day 2, so I essentially have an array
> of
> integers where each row is an "opcode". I am attempting to decode and
> execute
> these opcodes. This is why I want to compute the arguments as well as the
> operation from the input.
>
> I certainly want to solve this on my own, but if I would love any pointers
> on
> how to *think* about the problem in a J-ish way.
>
> Jimmy Gauvin  wrote:
>
> > Hi,
> >
> > is the following what you want ?
> >
> >1 2 3 (+ ; * ; -) 6 7 8
> > ┌──┬───┬┐
> > │7 9 11│6 14 24│_5 _5 _5│
> > └──┴───┴┘
> >
> >
> >
> > On Fri, Dec 6, 2019 at 9:54 PM ethiejiesa via Programming <
> > programm...@jsoftware.com> wrote:
> >
> > > Am I just doing something silly? Or does @. really not support building
> > > trains
> > > when the right operand is a verb? Here is an overly minimal example of
> > > what I
> > > want:
> > >
> > >(1:)`+`(1:)@.(0 1 2) 0
> > > 2
> > >(1:)`+`(1:)@.(0 1 2"_) 0
> > > |rank error
> > > |   (1:)`+`(1:)@.(0 1 2"_)0
> > >
> > > This is an obvious enough feature, that I feel I must be missing some
> > > obvious
> > > construction.
> > >
> > > For context, I was futzing around with this year's Advent of Code[0],
> day
> > > 2,
> > > and found myself wanting a fork-like that behaves as
> > >
> > > x (u v w) y <-> (x u y) (x v y) (x w y).
> > >
> > > After sufficient floundering, I decided to just read NuVoc for all
> > > modifiers
> > > and discovered that I had somehow not noticed the usefulness of @.
> > > However, the
> > > above restriction really surprised me.
> > >
> > > Anyway, happy holidays, J birds.
> > >
> > > [0]:https://adventofcode.com/2019/
> > > --
> > > 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


Re: [Jprogramming] Explicit vs tacit with assignment

2019-12-04 Thread Jose Mario Quintana
I do not know any easy way to write tacit verbs to support assigment...
Unless, one is prepared to brake some rules.  Local assignments, for
example, can be achieved via the following poor man's verb as side effects,

   k=. ] [ ".@:([ , '=. ' , (_2 }. ":)@:((<'"')(0:`)(,^:)&_)@:])

   ('T' k <"0) i.3 4
┌─┬─┬──┬──┐
│0│1│2 │3 │
├─┼─┼──┼──┤
│4│5│6 │7 │
├─┼─┼──┼──┤
│8│9│10│11│
└─┴─┴──┴──┘
   T
┌─┬─┬──┬──┐
│0│1│2 │3 │
├─┼─┼──┼──┤
│4│5│6 │7 │
├─┼─┼──┼──┤
│8│9│10│11│
└─┴─┴──┴──┘
   (T -: <"0) i. 3 4
1

which could be used also to solve the problem possed in the original post,

   (".@:('a'"_) , 'a' k ?@#) '01234'
3 3
   a
3

Beware, deliberately or not, the interpreters seem to be evolving to a kind
Procrustian bed (from my vantage point).  I have not tested the above with
the latest and greatest versions of the interpreters and might produce
undesirable side effects.


On Wed, Nov 27, 2019 at 3:03 PM Nimp O  wrote:

> Interesting.
>
> Also, checking the Requests page I see that support for assignment in
> tacit expressions has already been suggested.
>
> Another approach could be to make it less awkward to mix tacit and
> explicit.
> In this regard, I really like the Fast Function Definition suggestion:
> https://code.jsoftware.com/wiki/System/Interpreter/Requests#Fast_Function_Definition
> .
>
> I think it goes well with the Tool of Thought idea, since sometimes it is
> easier to think tacitly and sometimes the explicit solution is more
> obvious. Why not to make it easy to do both simultaneously?
>
>
> System/Interpreter/Requests - J Wiki<
> https://code.jsoftware.com/wiki/System/Interpreter/Requests#Fast_Function_Definition
> >
> In the definition of a bivalent adverb or conjunction, the sequence :::
> can be used to separate the monadic and dyadic definitions.. Unresolved
> issues: Selection of bracket characters; How to enter the bracket
> characters as Unicode, or convert to Unicode
> code.jsoftware.com
>
>
> 
> From: Programming  on behalf of
> Kirk Iverson 
> Sent: Monday, November 25, 2019 8:27 AM
> To: programm...@jsoftware.com 
> Subject: Re: [Jprogramming] Explicit vs tacit with assignment
>
> Anyone following this thread may be interested in a short discussion
> between Igor Zhuravlov, Raul Miller, and myself on Raul's user_talk wiki
> page:
> https://code.jsoftware.com/wiki/User_talk:Raul_Miller
>
> /K
>
>
>
> > Date: Sun, 24 Nov 2019 15:59:29 -0500
> > From: Jose Mario Quintana 
> > To: Programming forum 
> > Subject: Re: [Jprogramming] Explicit vs tacit with assignment
> > Message-ID:
> >  > pr93ao8h4qhmojqnkk7wesx...@mail.gmail.com>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > > To break the rules deliberately one must first know where to swing!
> >
> > Certainly...
> >
> > "Learn the rules like a pro, so you can break them like an artist."
> >
> > Picasso
> >
> > Did he know of what he spoke?  His father, a painter and a teacher,
> > reportedly overwhelmed gave his own palette, brushes, and colors to his
> > thirteen-year-old son stating that he will never paint again. This,
> >
> >   https://www.pablo-ruiz-picasso.net/work-9.php
> >
> > illustrates what he knew when he was fifteen years old.
> >
> > Back to the subject of tacit assignment, how can one faithfully (to some
> > extent) reproduce the behavior of the explicit verb 3 : 'a,a=:?@#y'
> > (e.g,
> >
> >3 : 'a,a=:?@#y' '01234'
> > 4 4
> >a
> > 4
> >
> > ) tacitly?  (Yes, using a global assignment as opposed to the original
> > local assignment, to make things more interesting.)
> >
> > Right, producing named entities seems to be against the spirit of tacit
> > writing.  In addition, a copula is neither a noun, verb, adverb nor
> > conjunction.  Nevertheless, one can simply ignore those minor details and
> > go ahead anyway,
> >
> >(('a'"_) ,&:". 'a=: ' , ":@:?@#) '01234'
> > 3 3
> >a
> > 3
> >
> >(('a'"_) ,&:". 'a=: ' , ":@:?@#) ''
> > 0.732158184 0.732158184
> >a
> > 0.732158184
> >
> > Perhaps surprisingly, a more challenging puzzle is to reproduce the
> > behavior of,
> >
> >4 :'(x)=:y'
> >
> > tacitly.
> >
> > On Sat, Nov 23, 2019 at 8:53 PM Louis de Forcrand 
> > wrote:
> > >
> > > To follow up on all this, while I am a member of the generation which
> > might write off "lie", I find that correct grammar and spelling are
>

Re: [Jprogramming] Explicit vs tacit with assignment

2019-11-26 Thread Jose Mario Quintana
That is an interesting application.  The original verb (alpha) could have
been defined as follows,

   sum=. +/
   count=. #

   ( alpha=. (sum , count, sum % count )f."1 )
(+/ , # , +/ % #)"1

the one (beta) using a form of teleportation is produced as follows (beware
of wrapping),

   in=.  adverb def 'y [ (m,''_inout_'')=: y'
   out=. adverb def '3 : (m,''_inout_'')'

   ( beta=. ('sum'out , 'count'out , 'sum'in@(+/) % 'count'in@#)"1 )
(3 : 'sum_inout_' , 3 : 'count_inout_' , 'sum' (1 : 'y [ (m,''_inout_'')=:
y')@(+/) % 'count' (1 : 'y [ (m,''_inout_'')=: y')@#)"1

I often use a different method [0] for refferencing the results of previous
calculations (without embbeding explicit definitions), which for the case
at hand produces the following tacit verb (gamma),

   gamma=. (1&({::) , 2&({::) , 1&({::) % 2&({::))@:(<@:(#@:(0&({::))) 2}
])@:(<@:(+/@:(0&({::))) 1} ])@:(,&(<;._1 ' . .')@:<)"1

This is how they compare using different arguments,

   stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.:@:(<;._2@,~) ]) [ (0 0 $
13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.:@:(<;._2@,~)
]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_)


   T=. i.3 11

   stp 666
  alpha  T
  beta   T
  gamma  T
)
┌──┬─┬──┬┐
│Sentence  │Space│Time  │Space * Time│
├──┼─┼──┼┤
│  alpha  T│1792 │4.12658e_6│0.00739483  │
├──┼─┼──┼┤
│  beta   T│2560 │1.52727e_5│0.039098│
├──┼─┼──┼┤
│  gamma  T│2240 │9.80135e_6│0.021955│
└──┴─┴──┴┘

   T=. i.33 111

   stp 666
  alpha  T
  beta   T
  gamma  T
)
┌──┬─┬───┬┐
│Sentence  │Space│Time   │Space * Time│
├──┼─┼───┼┤
│  alpha  T│2560 │4.70158e_5 │0.12036 │
├──┼─┼───┼┤
│  beta   T│3328 │0.000142892│0.475544│
├──┼─┼───┼┤
│  gamma  T│3776 │6.78763e_5 │0.256301│
└──┴─┴───┴┘

   T=. i.33 1

   stp 66
  alpha  T
  beta   T
  gamma  T
)
┌──┬──┬───┬┐
│Sentence  │Space │Time   │Space * Time│
├──┼──┼───┼┤
│  alpha  T│2560  │0.00103981 │2.66192 │
├──┼──┼───┼┤
│  beta   T│133376│0.00107527 │143.415 │
├──┼──┼───┼┤
│  gamma  T│133824│0.000839982│112.41  │
└──┴──┴───┴┘

The comparisons above might evoke the KISS principle.  ;)  (I know, Iknow,
it was just an illustration.)

[0] The verb (gamma) was produced, breaking a lot of J rules, with the aid
of a Tacit Toolkit (similar to those which I have shown before) as follows,

   (Y SUM COUNT)mn
┌───┬───┬───┐
│0&({::)│1&({::)│2&({::)│
└───┴───┴───┘

   gamma=. [ tv f. "1
  (SUM COUNT)local o <
  SUM   h (+/ o Y)
  COUNT h (#  o Y)
  SUM , COUNT , SUM % COUNT
)

   gamma
(1&({::) , 2&({::) , 1&({::) % 2&({::))@:(<@:(#@:(0&({::))) 2}
])@:(<@:(+/@:(0&({::))) 1} ])@:(,&(<;._1 ' . .)@:<)"1

However, the verb itself (gamma) is kosher, as far as I know.




On Mon, Nov 25, 2019 at 8:28 AM Kirk Iverson 
wrote:
>
> Anyone following this thread may be interested in a short discussion
> between Igor Zhuravlov, Raul Miller, and myself on Raul's user_talk wiki
> page:
> https://code.jsoftware.com/wiki/User_talk:Raul_Miller
>
> /K
>
>
>
> > Date: Sun, 24 Nov 2019 15:59:29 -0500
> > From: Jose Mario Quintana 
> > To: Programming forum 
> > Subject: Re: [Jprogramming] Explicit vs tacit with assignment
> > Message-ID:
> >  > pr93ao8h4qhmojqnkk7wesx...@mail.gmail.com>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > > To break the rules deliberately one must first know where to swing!
> >
> > Certainly...
> >
> > "Learn the rules like a pro, so you can break them like an artist."
> >
> > Picasso
> >
> > Did he know of what he spoke?  His father, a painter and a teacher,
> > reportedly overwhelmed gave his own palette, brushes, and colors to his
> > thirteen-year-old son stating that he will never paint again. This,
> >
> >   https://www.pablo-ruiz-picasso.net/work-9.php
> >
> > illustrates what he knew when he was fifteen years old.
> >
> > Back to the subject of tacit assignment, how can one faithfully (to some
> > extent) reproduce the behavior of the explicit verb 3 : 'a,a=:?@#y'
> > (e.g,
> >
> >3

Re: [Jprogramming] Explicit vs tacit with assignment

2019-11-24 Thread Jose Mario Quintana
> To break the rules deliberately one must first know where to swing!

Certainly...

"Learn the rules like a pro, so you can break them like an artist."

Picasso

Did he know of what he spoke?  His father, a painter and a teacher,
reportedly overwhelmed gave his own palette, brushes, and colors to his
thirteen-year-old son stating that he will never paint again. This,

  https://www.pablo-ruiz-picasso.net/work-9.php

illustrates what he knew when he was fifteen years old.

Back to the subject of tacit assignment, how can one faithfully (to some
extent) reproduce the behavior of the explicit verb 3 : 'a,a=:?@#y'
(e.g,

   3 : 'a,a=:?@#y' '01234'
4 4
   a
4

) tacitly?  (Yes, using a global assignment as opposed to the original
local assignment, to make things more interesting.)

Right, producing named entities seems to be against the spirit of tacit
writing.  In addition, a copula is neither a noun, verb, adverb nor
conjunction.  Nevertheless, one can simply ignore those minor details and
go ahead anyway,

   (('a'"_) ,&:". 'a=: ' , ":@:?@#) '01234'
3 3
   a
3

   (('a'"_) ,&:". 'a=: ' , ":@:?@#) ''
0.732158184 0.732158184
   a
0.732158184

Perhaps surprisingly, a more challenging puzzle is to reproduce the
behavior of,

   4 :'(x)=:y'

tacitly.

On Sat, Nov 23, 2019 at 8:53 PM Louis de Forcrand  wrote:
>
> To follow up on all this, while I am a member of the generation which
might write off "lie", I find that correct grammar and spelling are
qualities necessary (although certainly not sufficient) for writing clearly
and with good style, and in learning the former one inevitably improves on
the latter.
>
> To break the rules deliberately one must first know where to swing!
>
> Cheers,
> Louis
>
> > On 21 Nov 2019, at 18:21, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
> >
> > "By all means break the rules, and break them beautifully, deliberately
and
> > well."
> >
> > Bringhurst, Robert (2005). The Elements of Typographic Style
> >
> > PS.  I try to keep that in mind when writing (particularly in J).
> >
> >
> >> On Thu, Nov 21, 2019 at 4:26 AM R.E. Boss  wrote:
> >>
> >> AMEN.
> >>
> >> When you try to uphold the rules of a language (which is done only by
> >> older people), you are fighting a lost battle.
> >>
> >>
> >> R.E. Boss
> >>
> >>
> >>> -Oorspronkelijk bericht-
> >>> Van: Programming 
> >>> Namens Henry Rich
> >>> Verzonden: donderdag 21 november 2019 04:02
> >>> Aan: programm...@jsoftware.com
> >>> Onderwerp: Re: [Jprogramming] Explicit vs tacit with assignment
> >>>
> >>> Think nothing of it.  I was back in the highschool today, talking
linear
> >> algebra
> >>> to the very top layer of the high-performing students, having them
write
> >>> proofs on the board. It is obvious that the distinction between "its"
> >> and "it's"
> >>> is not observed in practice, even among these kids who are tomorrow's
> >>> elite.  It will be gone in another 100 years.
> >>>
> >>> Back when I was teaching Latin, I tried to give examples of the
> >> difference
> >>> between transitive and intransitive verbs in English. I started,
> >>>
> >>> We say "I lay the book on the table: I lay it, I laid it yesterday, I
> >> have laid it
> >>> there many times."
> >>>
> >>> We say "I lie down for a nap.  I lie down, I lay down yesterday, I
have
> >> lain
> >>> down..."
> >>>
> >>> the rest of the sentence was drowned out by cries of "No!".  They had
> >> never
> >>> heard such a thing.  My conclusion: "lie" is dead. Write it off.
> >>>
> >>> I have already written off "whom".  The language evolves.
> >>>
> >>> Henry Rich
> >>>
> >>>> On 11/20/2019 9:52 PM, Louis de Forcrand wrote:
> >>>> Just to correct a mistake that I always hate making:
> >>>>
> >>>> "... for use after _its_ application ..."
> >>>>
> >>>> Sorry for the noise,
> >>>> Louis
> >>>>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Explicit vs tacit with assignment

2019-11-21 Thread Jose Mario Quintana
"By all means break the rules, and break them beautifully, deliberately and
well."

Bringhurst, Robert (2005). The Elements of Typographic Style

PS.  I try to keep that in mind when writing (particularly in J).


On Thu, Nov 21, 2019 at 4:26 AM R.E. Boss  wrote:

> AMEN.
>
> When you try to uphold the rules of a language (which is done only by
> older people), you are fighting a lost battle.
>
>
> R.E. Boss
>
>
> > -Oorspronkelijk bericht-
> > Van: Programming 
> > Namens Henry Rich
> > Verzonden: donderdag 21 november 2019 04:02
> > Aan: programm...@jsoftware.com
> > Onderwerp: Re: [Jprogramming] Explicit vs tacit with assignment
> >
> > Think nothing of it.  I was back in the highschool today, talking linear
> algebra
> > to the very top layer of the high-performing students, having them write
> > proofs on the board. It is obvious that the distinction between "its"
> and "it's"
> > is not observed in practice, even among these kids who are tomorrow's
> > elite.  It will be gone in another 100 years.
> >
> > Back when I was teaching Latin, I tried to give examples of the
> difference
> > between transitive and intransitive verbs in English. I started,
> >
> > We say "I lay the book on the table: I lay it, I laid it yesterday, I
> have laid it
> > there many times."
> >
> > We say "I lie down for a nap.  I lie down, I lay down yesterday, I have
> lain
> > down..."
> >
> > the rest of the sentence was drowned out by cries of "No!".  They had
> never
> > heard such a thing.  My conclusion: "lie" is dead. Write it off.
> >
> > I have already written off "whom".  The language evolves.
> >
> > Henry Rich
> >
> > On 11/20/2019 9:52 PM, Louis de Forcrand wrote:
> > > Just to correct a mistake that I always hate making:
> > >
> > > "... for use after _its_ application ..."
> > >
> > > Sorry for the noise,
> > > Louis
> > >
> > >> On 21 Nov 2019, at 03:49, Louis de Forcrand  wrote:
> > >>
> > >> (a,a=.?@#) is a verb, namely (?@# , ?@#). In this expression a is set
> to the
> > _verb_ ?@# and then train (a,a) is evaluated.
> > >>
> > >> In the second case a is set to the _result_ of ?@# and then (a,a) is
> > evaluated. To do this tacitly:
> > >>
> > >> (] , ]) @ (?@#)
> > >>
> > >> or more concisely
> > >>
> > >> ,~@?@#
> > >>
> > >> or equivalently (how I would write it)
> > >>
> > >> 2 $ ?@#
> > >>
> > >> As Henry said, to store an intermediate value in a verb's evaluation
> for use
> > _after_ it's application, you must use an explicit verb, for example:
> > >>
> > >> ,~ @ (3 : 'a=: y') @ (?@#)
> > >>
> > >> Cheers,
> > >> Louis
> > >>
> > >>> On 21 Nov 2019, at 03:26, Nimp O  wrote:
> > >>>
> > >>> Hello, simple question.
> > >>>
> > >>> This behaviour surprised me.
> > >>>
> > >>>   (a,a=.?@#)'01234'
> > >>> 2 4
> > >>>
> > >>>   3 : 'a,a=.?@#y' '01234'
> > >>> 1 1
> > >>>
> > >>> Why a is not equal to a in the first case? How can I save the roll
> as an
> > intermediate result in the tacit version?
> > >>> Thanks.
> > >>> 
> > >>> -- 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
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] x u/. y Key

2019-10-15 Thread Jose Mario Quintana
On Mon, Oct 14, 2019 at 12:51 AM Roger Hui 
wrote:
>
> What you described is a different adverb K2 where
>
>   x u K2 y  ←→  ((~.x)i.y) u/. y
>
> (If x has no duplicates, then it's just  (x i.y) u/. y .)  Please try it
> and tell us whether it does what you want.
>
> This is an interesting computation where the left argument x does not
> specify keys for the right argument (that's what x u/. y does).  Instead,
> the left argument specify the entire universe of possible values for y
> together with a final "none-of-the-above" category.
>

The above reminds me of the key thread,

  [Jprogramming] key

http://www.jsoftware.com/pipermail/programming/2013-April/thread.html#32317


and

> Yes, very much.  I am continually writing
>
> x (~.@[ ... f/.) y
>
> And what does it cost?  f@]/. would get the current behavior.
>
> Henry Rich
>
> On 4/15/2013 8:43 PM, Roger Hui wrote:
> >
* I have a question concerning your use of *key*.  Do you find yourself*> >
* wishing that in x f/.y, the f would be invoked with a left argument which*>
>
* is key value corresponding to the items in the right argument?  This does*>
>
* not mean that the J definition or implementation will be changed, but to*>
>
* find out that if I have an opportunity to define/implement key in another*>
>* context ;-) whether I should consider changing it.*

in particular.





> On Sun, Oct 13, 2019 at 9:20 PM 'Jim Russell' via Programming <
> programm...@jsoftware.com> wrote:
>
> > Just to explain my confusion, and with apologies for my terminology...
> >
> > Since iota (and i.) return an "off the scale" index to mean "not
found", I
> > assumed that a "not found", or "none of the above" category would
return a
> > count (in the case of #) in the final (1+$nub) item of the result. My
> > uneducated guess, looking at the results of u="<" or" ,"   on the same
> > trigrams I was applying to #/.  was that instead of the 3's I would have
> > expected, it seemed each was being used in an iota search of the left
> > argument rows to add to the tally of each unique (first encountered)
member
> > of the x argument. The result is the length of the nub of the left
> > argument, so the rest of the left argument seems, for a u of #, to be
> > ignored and not needed, at least if x has duplicate entries.
> > And if that is the case, it seemed that a final "none of the above"
> > element (indexed by the "not found" result of my probably mythical i.
> > search) for each y argument row ought would just fall out.
> >
> > But I did give absolutely no thought to other verbs as u. (Other than
> > wonder which might help be understand the behavior of /.  .)
> >
> > Don't take the time to point out my stupidity--I'm happy to wait until
I'm
> > smart enough to understand it better.
> >
> > And thanks for checking in to the discussion, Roger.
> > > On Oct 13, 2019, at 10:21 PM, Roger Hui 
> > wrote:
> > >
> > > Oh no, it's not because I said so.  As I said, it's because this
> > particular
> > > definition, the current definition, says so.  If you think the
definition
> > > should be / could be something else, we can discuss it.  Truth be
told, I
> > > don't understand how you can have keys that don't have corresponding
> > data,
> > > or data that don't have corresponding keys.  Sounds like a completely
> > > different computation than _key_.
> > >
> > > _Key_ (the current definition) is cognate with the GROUP-BY statement
in
> > > SQL, the monadic = function in k, the generalized beta in the
Connection
> > > Machine.
> > >
>
> > >>>
> > >>>
> >  On Sun, Oct 13, 2019 at 3:58 PM 'Jim Russell' via Programming <
> >  programm...@jsoftware.com> wrote:
> > 
> >  Rick: My ability to read tacit expressions is so poor that I
> > overlooked
> >  the fact that the your quoted output did not come directly from the
> > Key
> >  expression; silly me, I thought there was some form of the
> >  modifiers/arguments to Key that yielded the results of two inputs.
> > 
> >  (In contrast to your skill, it took be about a half a day to come
up
> > >> with
> >  the tacit dyad(?) mmjnn=:(; ,.) to glue together my trigram table
and
> > >> one
> >  result vector.)
> > 
> >  So I wonder if I dare ask again:
> >    why do the sizes of the x and y argument to Key need
to
> >  match?
> > 
> >  (Thanks again for all the help!)
> > 
> > >> On Oct 12, 2019, at 5:16 AM, Ric Sherlock 
> > wrote:
> > >
> > >>> Or to summarise by trigram:
> > >>>
> > >>> (~.@; trig);|: <: #/.~&> supertrig
> > >>>
> > >>> +---+---+
> > >>>
> > >>> |ggt|1 2|
> > >>>
> > >>> |gta|2 0|
> > >>>
> > >>> |taa|1 1|
> > >>>
> > >>> |aaa|2 0|
> > 
> > 
--
> >  For information about J forums see
> > http://www.jsoftware.com/forums.htm
> > 
> > >>>

Re: [Jprogramming] Learning Tacit Programming

2019-07-26 Thread Jose Mario Quintana
Use your favorite search engine and type tacit programming site:
jsoftware.com and you will get plenty of useful links.

In particular,

https://www.jsoftware.com/help/primer/explicit_tacit_trans.htm

That translator was my teacher.


On Fri, Jul 26, 2019 at 7:20 PM The3DSquare Josh Yang <
joshua.the3dsqu...@gmail.com> wrote:

> I was wondering if you guys have any resources for learning tacit
> programming in J. I've been struggling with tacit programming, probably
> because all the other programming languages are mainly explicit. Something
> like "Tacit programming for the explicit programmer" would be great since I
> often fail to derive the tacit equivalent of a series of explicit
> eeaxpressions (especially when there are mutable variables).
>
> I know I need to think differently, but having some guidance would help
> greatly.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


  1   2   3   4   5   6   7   8   >