Again, I know all that, since quite long actually.
But now with the direct definition, {{ }} , how is it done there?


R.E. Boss


-----Original Message-----
From: Programming <[email protected]> On Behalf Of 
Elijah Stone
Sent: vrijdag 24 september 2021 10:34
To: [email protected]
Subject: Re: [Jprogramming] single line direct definition

On Fri, 24 Sep 2021, R.E. Boss wrote:

> See https://www.jsoftware.com/help/learning/12.htm
>
> My point is for a non-trivial verb, how can I cram this in one DD line.

One way is to perform the definitions in-line:

4 : 'la - sm [ la =. x >. y [ sm =. x <. y'

There is also Michal Wallace's proposal to use '..' as a sentence separator, 
with which you might write:

4 : 'la =. x >. y .. sm =. x <. y .. la - sm'

  -E

> R.E. Boss
>
>
> -----Original Message-----
> From: Programming <[email protected]> On Behalf 
> Of Elijah Stone
> Sent: vrijdag 24 september 2021 10:12
> To: [email protected]
> Subject: Re: [Jprogramming] single line direct definition
>
> That is the same as:
>
> 4 : 0
> la =. x >. y
> sm =. x <. y
> la - sm
> )
>
> We can substitute the intermediate variables:
>
> 4 : 0
> (x >. y) - (x <. y)
> )
>
> And collapse onto one line: 4 : '(x >. y) - (x <. y)'
>
> Worth noting is that we can write this as a fork: >. - <.
>
>  -E
>
> On Fri, 24 Sep 2021, R.E. Boss wrote:
>
>> From Learning J
>>
>> PosDiff =: 4 : ('la =. x >. y' ; 'sm =. x <. y' ;  'la - sm')
>>
>> How do I transfer this in a single line direct definition?
>>
>>
>> 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

Reply via email to