bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Defined operator won't accept right constant function


From: Juergen Sauermann
Subject: Re: [Bug-apl] Defined operator won't accept right constant function
Date: Sun, 06 Jul 2014 16:45:34 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi David,

thanks, fixed in SVN 363.

Please note that using a value as right function argument of an operator
is IMHO a rather dubious construct. I know that IBM APL2 allows it, but the
ISO standard is rather unclear about it. On one hand ISO defines the ⍤ operator
using a value y as right operator argument. On the other hand they define
the syntax of operators and other things as as "search the form-table for ..."
without ever telling how the form-table is constructed, eg. for user defined
functions.

A syntactically cleaner approach would be to use an axis (χ in lambdas) for
an extra value argument of the operator (not fully tested yet):

      ∇z←l (f foo)[x] r
[1]  z←(r f l) (l x r)
[2] ∇
     
            1 {⍺ ⍵} foo [{3}] 2
 2 1  1 3 2

/// Jürgen



On 07/06/2014 12:39 AM, David B. Lamkins wrote:
The last time I worked on my component-file code was circa SVN 220. At
the time, I was using a defined operator that took a constant function
as its right function. Something akin to this, where g would always be a
constant function, e.g. {1}:

∇z←l (f foo g) r
 z←(r f l) (l g r)
∇

At the time, I could call this operator as:

      1 {⍺ ⍵} foo {3} 2
 2 1  1 3 2

(The above isn't exactly what I was doing... I was using the constant
value by itself. That used to work. This is just illustrative of what I
think that call ought to do, but doesn't in the current build.)

Interestingly, I can still use a constant function on the left of the
operator:

      1 {3} foo {⍺ ⍵} 2
 2 3 1  1 2 

When I try to put a constant function to the right of the operator, this
is what happens:

      1 {⍺ ⍵} foo {3} 2
VALUE ERROR
      1 λ2 foo λ1 2
        ^

Are my expectations out of line, or is this a bug?





reply via email to

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