|
From: | David Lamkins |
Subject: | Re: [Bug-apl] Defined operator won't accept right constant function |
Date: | Tue, 8 Jul 2014 09:44:54 -0700 |
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] ∇/// Jürgen
1 {⍺ ⍵} foo [{3}] 2
2 1 1 3 2
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?
[Prev in Thread] | Current Thread | [Next in Thread] |