bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] A question.


From: Christian Robert
Subject: Re: [Bug-apl] A question.
Date: Tue, 17 May 2016 23:02:25 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

I now understand, many thanks Elias.

will study this further but I understand the basic principle *with your 
example*.

many thanks,

Xtian.


On 2016-05-17 22:56, Elias Mårtenson wrote:
I'll give it a shot:

*      foo ← {⍺ ⍶ ⍵}*

This defines foo as an operator that applies the function on its two arguments.

I.e. in the following example:
*
*
*      10 +foo 20*
30

The foo operator simply applies + to 10 and 20, returning 30. In other words, ⍶ 
is the function that goes to the left of the operator name.

Similarly, ⍹ is the function that goes on the right of the operator name:

*      bar ← {(⍺ ⍶ 2) ⍹ (⍵ **⍶** 3) }*
*      10 +bar- 20*
¯11

The call to bar results in the following formula being evaluated: (10+2)-(20+3).

Regards,
Elias

On 18 May 2016 at 10:48, Christian Robert <address@hidden 
<mailto:address@hidden>> wrote:

    Sorry, no explanations given.

          hook←{⍵⍶⍹⍵}
          +hook÷2
    2.5
          hook←{⍵⍶⍹⍵⊣⎕←⍵⊣⎕←⍶⊣⎕←⍹⊣⎕←⍵}
          +hook÷2
    2
    DOMAIN ERROR
    hook[1]  λ←⍵ ⍶ ⍹ ⍵⊣⎕←⍵⊣⎕←⍶⊣⎕←⍹⊣⎕←⍵
                                 ^^
    please explain the principle to a newbie.

    I really want a working examples.


    Xtian.



    On 2016-05-17 22:30, Xiao-Yong Jin wrote:

        They are for direct function (operator?) definitions.  Try:

              hook←{⍵⍶⍹⍵}
              +hook÷2
        2.5

            On May 17, 2016, at 8:24 PM, Christian Robert <address@hidden 
<mailto:address@hidden>> wrote:

            hi,

            in the result of "]help" I can see:


                 λ       { ... } result
                 ⍺       { ... } left value argument
                 ⍵       { ... } right value argument
                 χ       { ... } axis argument
                 ⍶       { ... } left function argument
                 ⍹       { ... } right function argument


            can someone explain to me the usage of ⍶ and ⍹
            with some examples ?

            I understant the first four, but not the last two.

            many thanks,

            Xtian.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]