Re: Disclose fails with mixed ranks

2021-09-25 Thread Jay Foad
nable to me to use it also for disclose as opposed to > using a different operation > to conform the argument of disclose. In particular since the > "deficiency" of the arguments (i.e. > differing ranks of the items) is exactly the same in both cases. > > Best Regards, >

Re: Disclose fails with mixed ranks

2021-09-24 Thread Jay Foad
/APL implements it. As does KAP now. > > It's also a pretty obvious implementation, and the behaviour orthogonal, > instead of having a special case for scalars. > > Regards, > Elias > > On Fri, 24 Sept 2021 at 22:35, Jay Foad wrote: > >> Elias, &g

Re: Disclose fails with mixed ranks

2021-09-24 Thread Jay Foad
Elias, This was an extension to Mix in Dyalog 14.0 (http://docs.dyalog.com/14.0/Dyalog%20APL%20Release%20Notes.pdf p22) inspired by the way the Rank operator assembles results with differing ranks. I'm not aware of any other APL2-like APLs implementing this extension. Jay. On Wed, 22 Sept 2021 a

Re: Each ¨ - behavior of func without parameter

2021-01-04 Thread Jay Foad
On Sun, 3 Jan 2021 at 17:08, Dr. Jürgen Sauermann wrote: > simple answer: {3} is niladic in GNU APL (since lack of ⍵) and monadic > (why?) in Dyalog et al. As far as the Dyalog parser is concerned, all dfns are ambivalent. For example: 3{⍵}4 ⍝ left argument is consumed (but ignored because

Re: Operator binding

2020-12-02 Thread Jay Foad
On Wed, 2 Dec 2020 at 17:22, Elias Mårtenson wrote: > > On Thu, 3 Dec 2020 at 00:41, Jay Foad wrote: >> >> Great, this sounds like exactly the right thing to do if you're aiming >> for APL2 compatibility. >> >> Dyalog has to jump through some hoops when i

Re: Operator binding

2020-12-02 Thread Jay Foad
0 at 16:27, Dr. Jürgen Sauermann wrote: > > Hi, > > in following up the recent email discussions with Jay Foad and Hans-Peter > Sorge, > I have changed the operator-to-operator binding in GNU APL. SVN 1367. > > Before the change an expression with 2 adjacent operators, >

Re: APL2 Compatibility

2020-11-30 Thread Jay Foad
> see what happens if I remove all parser reductions with adjacent operators > from the phrase table of GNU APL and see if that causes new problems > (I suppose at least some automatic testcases will fail). > > Best Regards, > Jürgen > > > On 11/30/20 1:25 PM, Jay Foad wr

Re: APL2 Compatibility

2020-11-30 Thread Jay Foad
> My > > 1 / / 1 1 ⍴ 1 > > example was only meant to demonstrate that in APL2 an operator can have > another operator (in this case itself) as left argument. And in that case > binding > the leftmost 1 to the left / operator would be, at least IMHO and referring > only > to the language reference

Re: Support for 'where' primitive '⍸' ?

2020-11-30 Thread Jay Foad
On Mon, 30 Nov 2020 at 11:53, Dr. Jürgen Sauermann wrote: > Still wondering if monadic ⍸ B with non-boolean B has a real-life use case? There's a presentation here that mentions some use cases: https://www.dyalog.com/dyalog/dyalog-versions/180.htm (Language Features of Dyalog version 18.0 in Dept

Re: APL2 Compatibility

2020-11-29 Thread Jay Foad
This ambiguity does not arise in APL2. The A (O P) B parsing is invalid because an operator (O) can't be the operand of another operator (P). Jay. On Sat, 28 Nov 2020, 12:59 Dr. Jürgen Sauermann, wrote: > Hi Hans-Peter, > > this kind of surprises has puzzled me since the early days of APL. > Th

Re: Support for 'where' primitive '⍸' ?

2020-11-27 Thread Jay Foad
Dyalog's documentation for Where (monadic ⍸) is here: http://help.dyalog.com/18.0/#Language/Primitive%20Functions/Where.htm It was implemented long after Mastering Dyalog APL was written. Re: monadic ⍳ with vector arguments, I believe Dyalog got this from the original NARS: see https://aplwiki.com

Re: APL2 Compatibility

2020-11-27 Thread Jay Foad
puzle was ( and as you pointed out) a scalar and a one > element vector are being treated equally. > > in my expression > (⊂1 2) (/¨) (,¨) 'ab' > I ignored that (,¨) operates on 'ab' and that it does not return 'ab' > element-wise > > &

Re: Empty arguments

2020-05-04 Thread Jay Foad
On Sun, 3 May 2020 at 12:16, Kacper Gutowski wrote: > > On Sat, May 02, 2020 at 08:13:17PM -0400, Colin Verrilli wrote: > >This next one I'm not sure about. Theoretically, it should give the > >same result as above, but maybe the behavior is different for defined > >functions. > > ↑ (0↑(1 2)(

Re: Issues with drop of a scalar argument

2020-04-27 Thread Jay Foad
In Dyalog this is part of a consistent extension whereby you're allowed to use a "short left argument" to Take and Drop (and Squad). For example 3↑mat returns the first 3 rows of mat, and 3↓mat removes the first 3 rows. https://help.dyalog.com/13.0/index.html?page=html%2Frelnotes13.0%2Fv13.0%20tak

Re: Inner join vs. outer join

2020-04-14 Thread Jay Foad
s/join/product/ ? In APL's inner product (X a.b Y), each item of the result corresponds to a row of X combined in some way with a column of Y. So the shape of the result is (¯1↓⍴X),(1↓⍴Y). In APL's outer product (X ∘.b Y), each item of the result corresponds to an item of X combined in some way w

Re: Index-of function with structured left-argument

2020-04-14 Thread Jay Foad
Just from staring at the result, it looks like the result of ⍺⍳⍵ has the same shape as ⍵, and for each item of ⍵ it tells you either the coordinates where it was found in ⍺, or ⍬ if it was not found. (Dunno what it does if ⍺ is a scalar, where ⍬ would be a valid coordinate.) N.B. in Dyalog APL dya

Re: Modulo algorithm

2020-04-08 Thread Jay Foad
If you search your email you'll find that we've touched on this subject before. Complex residue (aka remainder, modulo) is defined the same as for real numbers: assuming you already have a complex floor operation then Residue ←{⍵-⍺×⌊⍵÷⍺}. Complex floor is a complex subject, especially when you in

Re: Five-dimensional transpose results in incorrect shape

2020-03-11 Thread Jay Foad
On Tue, 10 Mar 2020 at 18:37, Kacper Gutowski wrote: > > On Wed, Mar 11, 2020 at 12:57:09AM +0800, Elias Mårtenson wrote: > >Now, for the problematic version: > > > >* ⍴ 2 4 1 0 3 ⍉ 3 4 5 6 7 ⍴ ⍳100* > >┏→┓ > >┃6 5 3 7 4┃ > >┗━┛ > > > >As you can see, the numbers are all over

Re: Definition of "first-thingy"

2020-02-21 Thread Jay Foad
9≡⊂9 is pretty much the whole basis of "floating array theory", upon which APL2 was based. Other array languages like Sharp APL and J went in a different direction. Once you accept the floating array model, this sentence seems completely redundant, and I don't know why they put it in the spec: "If

Re: Incorrect results with unique of 20 or more elements

2020-01-29 Thread Jay Foad
For ideas on how to make Unique behave sanely in the presence of tolerant comparison, see: https://www.youtube.com/watch?v=fPWky9IOG40 Jay. On Tue, 28 Jan 2020 at 20:13, Dr. Jürgen Sauermann wrote: > > Hi Kacper, > > I am aware of the non-transitivity of = when ⎕CT ≠ 0. However, the > algorithm

Re: Comments on GNU APL

2020-01-10 Thread Jay Foad
>Alternatively, APL2 couldbe extended to allow the use of data as >operands for operators, as in J. Then the operator operands could be used >as third and fourth arguments. That would allow #FIO and other such >functions to be implemented in much the same way as the foreign co

Re: [Bug-apl] *** Spam *** Error compiling on Mac OS X 10.13.6

2019-04-29 Thread Jay Foad
According to stackoverflow, Darwin doesn't support unnamed semaphores, so sem_init is deprecated and always returns failure, and you should use named semaphores (sem_open) instead. https://stackoverflow.com/questions/1413785/sem-init-on-os-x/1452182 Jay. On Thu, 25 Apr 2019 at 15:13, Dr. Jürgen

Re: [Bug-apl] Index function returns extra elements.

2018-11-06 Thread Jay Foad
Perhaps you're misunderstanding how squad indexing works? ⎕←t←5 5⍴⎕A ABCDE FGHIJ KLMNO PQRST UVWXY (1 3 5)(1 3 5)⌷t ACE KMO UWY t[1 3 5;1 3 5]≡(1 3 5)(1 3 5)⌷t 1 Perhaps you wanted to use something like Dyalog's choose indexing? x[(∊2=⍴¨x)/,s] ┌──┬──┐ │XX│XX│ └──┴──┘ Jay

Re: [Bug-apl] an other inner product ,., bug

2018-05-21 Thread Jay Foad
If you followed this part of the ISO standard verbatim then: 2 3 +.⍴ 4 5 ←→ +/2 3 ⍴ 4 5 ←→ 13 14 GNU APL and APL2 actually return ⊂13 14 which seems more sensible. I am not sure why ISO has (or needs) that special case. It seems wrong to me. Jay. On 18 May 2018 at 16:03, Juergen Sauermann

Re: [Bug-apl] an other inner product ,., bug

2018-05-18 Thread Jay Foad
This is a subtle difference in the definition of inner product. On vectors: A f.g B ←→ ⊂f/A g B ⍝ APL2 A f.g B ←→ f/A g¨ B ⍝ NARS2000, Dyalog Jay. On 17 May 2018 at 17:52, David Tran wrote: > Hi, > > Below shows the bug: > > 1 2 3 ,., 4 5 6 > > result: 1 2 3 4 5 6 > expected: 1 4 2 5 3 6

Re: [Bug-apl] Hang in Residue

2018-01-10 Thread Jay Foad
/ Jürgen > > > On 01/08/2018 02:19 PM, Jay Foad wrote: > > Yes, thanks! Now, when ⎕CT=0 there are some odd results: > > ⎕CT←0 > A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200 > A∘.|A > 0E0 ¯1E100 ¯1E0 ¯1E¯100 ¯1E¯200 0 0E00E0¯1E200 0E0 0E

Re: [Bug-apl] Hang in Residue

2018-01-09 Thread Jay Foad
d expected output of your example > below? > > If I follow the ISO description of mod in the ISO APL standard word by > word then I am getting pretty odd values at times. > > Best Regards, > /// Jürgen > > > On 01/08/2018 02:19 PM, Jay Foad wrote: > > Yes, thanks! Now,

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
en > > > On 01/08/2018 01:02 PM, Jay Foad wrote: > > Thanks. With r1035 I get: > > A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200 > A∘.|A > 0E00E00 0E0 0E00 0E00E00 0E0 0E0 > 0E00E00 0E0 0E00 0E00E00 0E0 0E0 &

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
t; 0 0 0 0* > /// Jürgen > > > > TOn 01/08/2018 10:29 AM, Jay Foad wrote: > > Thanks. At r1034 I get: > > A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200 > A∘.|A > DOMAIN ERROR > > And here's one of the cases that fails: > > 1e¯200|1e

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
t-error in residue" with advice on how to avoid it. (OK, it doesn't mention DOMAIN ERROR, but I think the same principle applies.) Jay. On 6 January 2018 at 11:56, Juergen Sauermann wrote: > Hi, > > thanks, fixed in *SVN 1029*. > > /// Jürgen > > > On 01/05/

Re: [Bug-apl] Hang in Residue

2018-01-05 Thread Jay Foad
∣ A[j] which causes the hanging so it > would > > be interesting to know which one. Probably one with +/- 1E¯200 or 1E¯100. > > > > Best Regards, > > /// Jürgen > > > > > > On 01/05/2018 12:16 PM, Jay Foad wrote: > >> At svn r1028 on Linux I get: > >> > >> A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200 > >> A∘.|A > >> (hangs) > >> > >> Jay. > > > >

[Bug-apl] Hang in Residue

2018-01-05 Thread Jay Foad
At svn r1028 on Linux I get: A←(-⌽A),0,A←1e¯200 1e¯100 1 1e100 1e200 A∘.|A (hangs) Jay.

Re: [Bug-apl] Monadic form of ↓

2017-10-09 Thread Jay Foad
On 9 October 2017 at 10:06, Elias Mårtenson wrote: > In GNU APL, I'd use ⊂⍤1 to achieve Split. Is that the most efficient way? > > Either that or ⊂[2] (or in general ⊂[n] where n is the rank of the argument).

Re: [Bug-apl] ⎕RE merged

2017-10-09 Thread Jay Foad
Could you please update https://www.gnu.org/software/apl/apl.html ? Or will it update automatically in due course? Thanks, Jay. On 8 October 2017 at 17:47, Juergen Sauermann wrote: > Hi, > > I have merged Elias' *⎕RE* implementation into GNU APL. > Thanks, Elias, for contributing it. See *'info

Re: [Bug-apl] Monadic form of ↓

2017-10-09 Thread Jay Foad
On 9 October 2017 at 04:56, Elias Mårtenson wrote: > Currently, monadic ↑ acts as if it was called dyadically with 1 as its > left argument, > That's not quite true: ⍴⍴1↑'ABC' 1 ⍴⍴↑'ABC' 0 while monadic ↓ raises a VALENCE ERROR. In almost every single case where I > have used ↓, it

Re: [Bug-apl] Regex support

2017-09-22 Thread Jay Foad
FYI Dyalog has operators ⎕S (search) and ⎕R (replace) which are implemented with PCRE: ('[Aa]..'⎕S'&')'Dyalog APL' ┌───┬───┐ │alo│APL│ └───┴───┘ ('red' 'green'⎕R'green' 'blue')'red orange yellow green blue' green orange yellow blue blue http://help.dyalog.com/16.0/Content/Language/Sys

Re: [Bug-apl] Modulo or residue function is not generating consistent complete residue systems for some arguments

2017-06-23 Thread Jay Foad
uermann > > > > On 06/21/2017 10:25 PM, Frederick Pitts wrote: > > Jürgen, > > The proposed change to DIVJ does not work because 'q1' is a complex > number, so the '×' in '× q1' is the complex complement function, not the > sign function.

Re: [Bug-apl] Modulo or residue function is not generating consistent complete residue systems for some arguments

2017-06-20 Thread Jay Foad
B3i)+mod+(14%2B5i) > > Regards, > Elias > > On 20 June 2017 at 16:02, Jay Foad wrote: > >> With the demo version of APL2 I get: >> >> 5J3 ∣ 14J5 >> ¯4J1 >> 5J3 | 1J4 >> ¯4J1 >> 5J3 | ¯4J1 >> ¯4J1 >> >> Ja

Re: [Bug-apl] Modulo or residue function is not generating consistent complete residue systems for some arguments

2017-06-20 Thread Jay Foad
With the demo version of APL2 I get: 5J3 ∣ 14J5 ¯4J1 5J3 | 1J4 ¯4J1 5J3 | ¯4J1 ¯4J1 Jay. On 19 June 2017 at 18:03, Frederick Pitts wrote: > Jürgen, > > With gnu apl (svn 961 on Fedora 25, Intel(R) Core(TM) i7-6700 > CPU), the residue function (∣) yields the following:

Re: [Bug-apl] Modulo or residue function is not generating consistent complete residue systems for some arguments

2017-06-20 Thread Jay Foad
I hadn't heard of "complete residue systems" before. Perhaps another way of saying the same thing is: f←{5J3|⍵} should be idempotent, so (f ⍵)≡f f ⍵ for any ⍵ ... ? Jay. On 19 June 2017 at 18:03, Frederick Pitts wrote: > Jürgen, > > With gnu apl (svn 961 on Fedora 25, Intel(R) Core(TM)

Re: [Bug-apl] Problem with modulo arithmetic on Gaussian integers redux

2017-06-15 Thread Jay Foad
Sorry, please ignore that. I had not done an svn update. With the latest svn I get: ¯1J11 | ¯12J10 0 ... so it's looking good! On 15 June 2017 at 13:50, Jay Foad wrote: > I get: > > ¯1J11 | ¯12J10 > computing (-12,10) modulo (-1,11) > ⎕CT is: 1e-13 >

Re: [Bug-apl] Problem with modulo arithmetic on Gaussian integers redux

2017-06-15 Thread Jay Foad
a | b* > *computing (-12,10) modulo (-1,11)* > *⎕CT is: 1e-13* > *the quotient B ÷ A is: (1,1)* > *result is 0 because the quotient is integral within ⎕CT* > *0* > > Just replace your *ComplexCell.cc* with the attached one. > > Thanks, > Jürgen > > > On 06

Re: [Bug-apl] Problem with modulo arithmetic on Gaussian integers redux

2017-06-15 Thread Jay Foad
On Wed, 2017-06-14 at 17:20 +0200, Juergen Sauermann wrote: > > Hi Jay, Fred, > > thanks a lot, Jay, for figuring this out. > > Fred, I made the change proposed by Jay. Please let me know if the > problem persists. *SVN

Re: [Bug-apl] Problem with modulo arithmetic on Gaussian integers redux

2017-06-14 Thread Jay Foad
It got broken in r939. The problem is in Cell.icc: //- inline bool Cell::integral_within(APL_Complex A, APL_Float B) { const APL_Complex C = -A; return tolerant_floor(C, B) == tolerant_floor(A, B); } //-

Re: [Bug-apl] Problem with modulo arithmetic on Gaussian integers

2017-04-26 Thread Jay Foad
I see the wrong result on my machine, just like Fred. Jürgen, the problem seems to be in this code: // if ⎕CT != 0 and B ÷ A is close to an integer within ⎕CT then return 0. // // Note: In that case, the integer to which A ÷ B is close is either // floor(A ÷ B) or ceil(A ÷ B). // co

Re: [Bug-apl] Is the index generator function definition allowed to work on vectors of any length?

2017-04-11 Thread Jay Foad
It's in Dyalog and NARS2000 documentation: http://help.dyalog.com/15.0/Content/Language/Primitive%20Functions/Index%20Generator.htm http://wiki.nars2000.org/index.php/Index_Generator On 11 April 2017 at 02:55, Leslie S Satenstein wrote: > Re Gnu APL. 1,7-1 > > Gnu apl processes ⍳ 25 > a

Re: [Bug-apl] West way to remove substrings?

2017-03-14 Thread Jay Foad
This is a bit simpler and fixes the empty result problem, and returns a non-enclosed result: RemoveSubstrings ← {⍵/⍨ ~⊃∨/ (-⍳⍴⍺) ∘.⌽ ⊂⍺⍷⍵} Like your solution this only works with ⎕IO←0. On 14 March 2017 at 14:20, Elias Mårtenson wrote: > In a discussion on the #lisp IRC channel recently, someo

Re: [Bug-apl] [PATCH]: allow using lambdas in ]USERCMD

2017-02-24 Thread Jay Foad
⎕AI gives you a way to measure elapsed time and CPU time. On 24 February 2017 at 07:29, Elias Mårtenson wrote: > I agree with you that extensions should, as far as possible, be in a > loadable package. > > However, some features can't be built in pure APL. Either because the > underlying functio

Re: [Bug-apl] indexing precedence

2017-02-16 Thread Jay Foad
This was a breaking change in APL2 (previously 1 2 3[2] was valid and returned 2) but I think it was the right decision for a language with stranding. It means that A[1] B[2] parses as (A[1])(B[2]) which seems sane. The alternative (ISO, Dyalog) is that A[1] B[2] parses as (A[1] B)[2], which is pr

Re: [Bug-apl] ⎕FIO[49]

2017-01-27 Thread Jay Foad
Just FYI, it's similar to Dyalog's ⎕NGET . (I'm not suggesting NGET is necessarily a good name to use in wslib5.) On 27 January 2017 at 02:03, Elias Mårtenson wrote: > Speaking of which, ⎕FIO[49] needs a name in wslib5. Any

Re: [Bug-apl] Best way to solve my daughter's maths problem

2017-01-26 Thread Jay Foad
Simpler f and g: e←{⍵,⊂f ⍵} f←{↑,/⍵ g¨⌽⍵} g←{↑,/,⍺∘.h ⍵} h←{(⊂'(',⍺),¨'+-×÷',¨⊂(⍵,')')} Jay. On 25 January 2017 at 10:59, Jay Foad wrote: > How about this, based on enumerating binary trees: > > e←{⍵,⊂f ⍵} > f←{↑,/(⊂⍵)g¨⍳≢

Re: [Bug-apl] Best way to solve my daughter's maths problem

2017-01-25 Thread Jay Foad
How about this, based on enumerating binary trees: e←{⍵,⊂f ⍵} f←{↑,/(⊂⍵)g¨⍳≢⍵} g←{↑,/,(⍵⊃⍺)∘.h ⍵⊃⌽⍺} h←{(⊂'(',⍺),¨'+-×÷',¨⊂(⍵,')')} t1←,⊂,'4' ⍝ vec of charvecs representing trees of size 1 t←,⊂t1 ⋄ t←e⍣4⊢t (t1 t2 t3 t4 t5)←t Now t5 is a list of parenthesi

Re: [Bug-apl] Quad-DLX implementation of Sudoku soon

2016-12-02 Thread Jay Foad
Your boxed display seems to be missing the 3 in the bottom left corner of a. Jay. On 2 December 2016 at 03:10, Christian Robert wrote: > Not a bug report, > > > Left arg of GenGRID is maximum number of seconds to run (arg is optional > and default to 30 secs) > Right arg of GenGRID is the targe

Re: [Bug-apl] Squad

2016-11-01 Thread Jay Foad
FYI this was introduced as a compatible extension in Dyalog APL 13.0, along with a similar extension to Take and Drop: MAT 11 12 13 14 21 22 23 24 31 32 33 34 2↑MAT 11 12 13 14 21 22 23 24 1↓MAT 21 22 23 24 31 32 33 34 Jay. On 31 October 2016 at 23:34, Christian Robert wrote:

Re: [Bug-apl] hexcodes to unicode points

2016-10-28 Thread Jay Foad
The rows of 13 4 ⍴ idx show the individual bytes of the UTF-8 encoding of some characters. Convert to text with e.g.: 19 ⎕CR ⎕UCS 226 141 186 226 141 181 ⍺⍵ To convert the other way: ⎕UCS 18 ⎕CR cards 240 159 130 168 240 159 130 166 ... Jay. On 28 October 2016 at 06:10, wrote: >

Re: [Bug-apl] Assertion failed in 'equal'

2016-10-18 Thread Jay Foad
This is called "ranking" and is very simple in APL: ⍋⍋'GNUAPL' 2 4 6 1 5 3 The permutations 4 1 6 2 5 3 (i.e. ⍋'GNUAPL') and 2 4 6 1 5 3 are inverses of each other, and ⍋ will invert a permutation. Jay. On 17 October 2016 at 15:41, Ala'a Mohammad wrote: > Hi Juergen, > > Thanks for the

[Bug-apl] Incomplete value at Symbol.cc:132

2016-09-26 Thread Jay Foad
r←6371 hf←{2×rׯ1○(+/(2*⍨1○(p-q)÷2)×1(×/2○⊃¨p q))*÷2⊣(p q)←○⍺ ⍵÷180} 36.12 ¯86.67 hf 33.94 ¯118.40 Incomplete value at Symbol.cc:132 Addr:0x2645b00 Rank:1 Shape: ⊏2⊐ Flags: -- First: 0.6304129258 Dynamic: DynamicObject: 0x2645b08 (Value: 0x2645b00) : prev: 0

Re: [Bug-apl] Spell corrector - APL

2016-09-13 Thread Jay Foad
hanks for the alternative, I'd tried to run it, but got Rank Error > > RANK ERROR > λ1[1] λ←⍵[⍒⍵[;2];] > ^^ > > How can I help debug this? > > Regards, > > Ala'a > > On Mon, Sep 12, 2016 at 5:32 PM, Jay Foad wrote: > > Hi Ala'a,

Re: [Bug-apl] Spell corrector - APL

2016-09-12 Thread Jay Foad
Hi Ala'a, How about replacing the last line with this? It runs in about 1 minute on my machine: desc 39 2⍴(⍪u),≢¨⊂⍨x[⍋x←u⍳w] Jay. On 11 September 2016 at 19:23, Ala'a Mohammad wrote: > Just an update as a reference, I'm now able to parse the big.txt file > (without WS full or killed process),

Re: [Bug-apl] A couple of bugs, and a question on the power operator

2016-08-16 Thread Jay Foad
On 16 August 2016 at 02:53, Louis de Forcrand wrote: > If I understand correctly then, in F {pow} G, G's left argument is > _always_ the result of the power operator if G is true. Its right argument > then is _always_ the result of the previous iteration. Is that correct? > Yes, G is always used

Re: [Bug-apl] A couple of bugs, and a question on the power operator

2016-08-15 Thread Jay Foad
tement is correct or not, but if it is then I > would prefer to not > introduce this "monadic case" in GNU APL for the reasons explained earlier. > > Thanks, > Jürgen > > > On 08/15/2016 10:16 AM, Jay Foad wrote: > > On 13 August 2016 at 13:05, Juergen Sauer

Re: [Bug-apl] A couple of bugs, and a question on the power operator

2016-08-15 Thread Jay Foad
> > thanks, I see. If I read your examples correctly then Dyalog has a special > syntax {A} to mark the left argument A > of a defined function as optional and, as a consequence, to declare a > function as ambivalent. > Right. In Dyalog tradfns can be monadic, dyadic or ambivalent; dfns are always

Re: [Bug-apl] A couple of bugs, and a question on the power operator

2016-08-15 Thread Jay Foad
On 13 August 2016 at 13:05, Juergen Sauermann wrote: > In "Mastering Dyalog APL" I haven't found the monadic case for the right > function argument > G of the power operator. In that book G seems to be always dyadic. So the > monadic case looks > like a new Dyalog invention. And, if it is defined

Re: [Bug-apl] 0⍟0

2016-07-14 Thread Jay Foad
In practice I think the "if A and B are equal" case is only there to handle 0⍟0. For all other cases of A=B the result of 1 falls out naturally from the general definition (as long as you support complex numbers). And for testing 0=0, ⎕CT is irrelevant; comparisons with zero are never tolerant. And

Re: [Bug-apl] 0⍟0

2016-07-13 Thread Jay Foad
ense to me but the standard does not mention *⎕IO* for *⍟*. > > /// Jürgen > > > On 07/13/2016 01:05 PM, Jay Foad wrote: > > My ISO ("First edition 2001-02-01") says: > > Evaluation Sequence: > If either of A or B are not numbers signal domain-error. >

Re: [Bug-apl] 0⍟0

2016-07-13 Thread Jay Foad
My ISO ("First edition 2001-02-01") says: Evaluation Sequence: If either of A or B are not numbers signal domain-error. If A and B are equal, return one. If A is one, signal domain-error. Set A1 to the natural-logarithm of A. Set B1 to the natural-logarithm of B. Return B1 divided-by A

Re: [Bug-apl] multiple inner product

2016-07-08 Thread Jay Foad
On 8 July 2016 at 09:04, Kacper Gutowski wrote: > But I was looking at the evaluation sequence just below the informal > description you quoted and after some reshaping and scalar expansion > it says: > > > If A1 and B1 are both vectors, return f/A1 g B1. > > Otherwise, set Z to an array such tha

[Bug-apl] dfn-reduction bug

2016-07-08 Thread Jay Foad
Juergen, Just in case you missed this, buried in another thread: X←⊂¨,¨⍳2 ⋄ (+/X) ≡ ({⍺+⍵}/X) 0 FYI I get the following results on various APLs: X←⊂¨,¨⍳2 ⋄ (≡+/X)(≡{⍺+⍵}/X) ⍝ GNU APL 2 3 X←⊂¨,¨⍳2 ⋄ (≡+/X)(≡{⍺+⍵}/X) ⍝ Dyalog APL 3 3 X←⊂¨,¨⍳2 ⋄ (≡+/X)(≡{⍺+⍵}/X) ⍝ NARS 2000

Re: [Bug-apl] multiple inner product

2016-07-08 Thread Jay Foad
On 7 July 2016 at 12:57, Kacper Gutowski wrote: > On 7 July 2016 at 12:55, Jay Foad wrote: > > (⊂+/3 4 ⍴ 5 6)≡3 4 +.⍴ 5 6 > > 1 > > Ah, I see what you mean. But it still wasn't my error, it's really what > ISO says. It's not equivalent to APL2 de

Re: [Bug-apl] multiple inner product

2016-07-07 Thread Jay Foad
There was some relevant discussion in comp.lang.apl here: https://groups.google.com/forum/#!topic/comp.lang.apl/23LrwRZKmPs On 6 July 2016 at 19:31, Xiao-Yong Jin wrote: > The following from GNU APL, > > (⊂[1]⍳2 3)+.+.+⊂[1]10×⍳2 3 > 209 198 > (⊂[1]⍳2 3)(+.+).+⊂[1]10×⍳2 3 > 209 198

Re: [Bug-apl] multiple inner product

2016-07-07 Thread Jay Foad
On 7 July 2016 at 11:39, Kacper Gutowski wrote: > On 7 July 2016 at 11:07, Jay Foad wrote: > > (I think you meant ⊂f/A g B on the RHS?) > > No, I don't think I did. That enclosure is already a result of reduction. > I was thinking of cases like this (in GNU APL):

Re: [Bug-apl] multiple inner product

2016-07-07 Thread Jay Foad
On 7 July 2016 at 03:59, Kacper Gutowski wrote: > The standard explicitly says A f.g B ←→ f/A g B when A & B vectors. > (I think you meant ⊂f/A g B on the RHS?) But in the +.(+.+) case, it's Dyalog that gives unexpected results: > > +/A(+.+)B > 33 66 66 66 > A+.(+.+)B > 99 132

Re: [Bug-apl] jot dot jot dot?

2016-06-29 Thread Jay Foad
Can you explain what cases you have fixed? All the cases I showed seemed to working correctly already in GNU APL. Thanks, Jay. On 28 June 2016 at 19:09, Juergen Sauermann wrote: > Hi, > > thanks, fixed in *SVN 620*. > > /// Jürgen > > > On 06/28/2016 01:23 PM, Jay

Re: [Bug-apl] jot dot jot dot?

2016-06-29 Thread Jay Foad
gt; > >>> +.×/ ←→ (+.× )/ not + .(× /) > >>> " > >>> > >>> However, the binding strength resolves the ambiguity in the IBM > example only > >>> because / is not a dyadic operator. In Alex's example the operator is > dyadi

Re: [Bug-apl] jot dot jot dot?

2016-06-28 Thread Jay Foad
I don't think that's true. Here's an example from IBM APL2 Workstation: (1 2)(3 4)∘.∘.*(5 6)(7 8) SYNTAX ERROR (1 2)(3 4)∘.∘.*(5 6)(7 8) ^ (1 2)(3 4)(∘.∘).*(5 6)(7 8) SYNTAX ERROR (1 2)(3 4)(∘.∘).*(5 6)(7 8) ^ (1 2)(3 4)∘.(∘.*)(5 6)(7 8) 1 1 1

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-28 Thread Jay Foad
On 23 June 2016 at 15:28, Xiao-Yong Jin wrote: > > > On Jun 23, 2016, at 7:07 AM, Louis Chretien wrote: > > > > R←{X} (A ⎕R B) Y > > The line on the title? It’s not really the language syntax. It’s their > way to tell you that ⎕R is an operator that receives required left and > right operands

Re: [Bug-apl] jot dot jot dot?

2016-06-28 Thread Jay Foad
ived > function) because all arguments > of . are available before the . and ∘ on the left show up. > > What is missing in both the ISO standard and in the APL2 language > reference is a > statement about left-to-right or right-to-left associativity of APL > operators. I persona

Re: [Bug-apl] jot dot jot dot?

2016-06-27 Thread Jay Foad
So it looks like GNU APL parses ∘.∘.+ as ∘.(∘.+). IBM APL2 and Dyalog appear to parse it as (∘.∘).+. Jay. On 15 June 2016 at 04:05, Xiao-Yong Jin wrote: > Hi Alex, > > It is correct. You need nested vectors to see the effect. > > Try the following. > > (⊂[2]2 3⍴⍳6)∘.{⍺∘.{⍺+⍵⊣⎕←⍺,'I',⍵}⍵

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-05-06 Thread Jay Foad
On 6 May 2016 at 13:52, Juergen Sauermann wrote: > Except maybe for the Dyalog ¯1 case (primarily because I don't know what > "major cells" are). Dyalog treats ¯1 the same as the ISO standard (and therefore also GNU APL). "Major cell" is explained on page 14 of: http://docs.dyalog.com/14.1/Dyalog

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Jay Foad
Incidentally, it works like this in Dyalog and NARS2000 too, though the Dyalog documentation doesn't mention the 3-item form. Jay. On 27 April 2016 at 09:02, Jay Foad wrote: > Given g ← f⍤P Q R: > P is the monadic rank > Q is the left rank > R is the right rank > > So: &

Re: [Bug-apl] Supporting negative ranks for ⍤ operator

2016-04-27 Thread Jay Foad
You're reading section 9.3.4 "Rank operator deriving monadic function". You also need to look at 9.3.5 "Rank operator deriving dyadic function". Given g ← f⍤P Q R: P is the monadic rank Q is the left rank R is the right rank So: g Y applies g to the P-cells of Y X g Y applies g to the Q-cells of

Re: [Bug-apl] Unexpected result when attempting to enclose over rows

2016-04-26 Thread Jay Foad
I agree that this seems like a bug. Your example works in NARS2000 and Dyalog. To make it work in GNU APL I currently have to do an extra enclose: ({⊂⊂⍵}⍤1)z,⍪z←⍳4 ┌→──┐ │┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐│ ││1 1│ │2 2│ │3 3│ │4 4││ │└───┘ └───┘ └───┘ └───┘│ └∊──

Re: [Bug-apl] fractional power ¯8⋆÷3

2016-04-13 Thread Jay Foad
I'd guess -ffinite-math-only. Jay. On 13 April 2016 at 19:36, Xiao-Yong Jin wrote: > Looks like a gcc optimization problem (clang works correctly). > Using ‘-Ofast’ with gcc 5.3 reproduces the bug. > Using ‘-O3’ works fine. > > So one of the options down here caused the bug: > -fassociative-math

Re: [Bug-apl] Substring replacement in APL

2016-04-12 Thread Jay Foad
replace←{(⍴v)↓∊(⊂v),¨(↑⍴u)↓¨(+\u⍷a)⊂a←u,⍺⊣(u v)←⍵} Jay. On 12 April 2016 at 11:39, Elias Mårtenson wrote: > I had a need to to replace substrings with a replacement, and I'm having a > hard time coming up with an concise solution. What I need to do is this: > > 'foobartestfootest' replace

Re: [Bug-apl] Feature suggestion: multiple function arguments

2016-03-15 Thread Jay Foad
On 15 March 2016 at 13:24, Elias Mårtenson wrote: > On 15 March 2016 at 21:14, Jay Foad wrote: >> >> 1 2 /¨ 3 4 ⍝ in APL2 this parses as (1 2 /)¨ 3 4 >> 3 3 3 4 4 4 > > Are you saying that (1 2 /)¨ 3 4 is syntactically correct in APL2? Yes. / is an ope

Re: [Bug-apl] Feature suggestion: multiple function arguments

2016-03-15 Thread Jay Foad
In APL2 this is not a problem, because / et al are always operators: 1 2 /¨ 3 4 ⍝ in APL2 this parses as (1 2 /)¨ 3 4 3 3 3 4 4 4 1 2 /¨ 3 4 ⍝ in GNU APL this parses as 1 2 (/¨) 3 4 3 4 4 Jay. On 14 March 2016 at 13:03, Juergen Sauermann wrote: > Hi Kacper, > > yes. The tricky

Re: [Bug-apl] indexing of the array

2016-03-07 Thread Jay Foad
Right. This is one of the few cases where APL2 broke compatibility with first-generation APL, where 7 8 9[2] was 8. Personally I think the APL2 way is better, because A[B] C[D] parses as (A[B])(C[D]). This makes much more sense to me than the Dyalog parsing, which is ((A[B]) C)[D]. Jay. On 5 Mar

Re: [Bug-apl] Feature suggestion: multiple function arguments

2016-03-07 Thread Jay Foad
FYI Dyalog version 14 has forks. You can try it at tryapl.org: http://tryapl.org/?a=%28+%u233F%F7%u2262%291%202%203%204&run Jay. On 5 March 2016 at 17:17, Louis de Forcrand wrote: > To add to the confusion, while > ( {+⌿ ÷ ≢} y) ≡ ( +⌿y) ÷ ≢y > (x {+⌿ ÷ ≢} y) ≡ (x+⌿y) ÷ x≢y > whatever that doe

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
On 3 March 2016 at 11:40, Juergen Sauermann wrote: > Therefore I believe Elias' statement > > My understanding was that (⊂⊂x)≡⊂x for all x? > > is correct as far as ISO, IBM APL2, and GNU APL are concerned. It is clearly not true in APL2! x←1 2 3 (⊂⊂x)≡⊂x 0 (Same result in NARS2000

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
On 3 March 2016 at 08:12, Elias Mårtenson wrote: > What is the purpose of the double-enclose ⊂⊂⍬ ? > > My understanding was that (⊂⊂x)≡⊂x for all x? No! ⊂ is a no-op on simple scalars like 42, but not on enclosures like ⊂⍬. You can enclose most arrays (i.e. anything except simple scalars) as many

Re: [Bug-apl] IOTA

2016-03-03 Thread Jay Foad
Right. Here's a variation on Elias's solution that gets IOTA ⍬ right, but doesn't handle the singleton cases correctly! IOTA ← {⊃∘.,/(⍳¨⍵),⊂⊂⍬} On 3 March 2016 at 01:08, Nick Lobachevsky wrote: > There is at least one other degenerate case, namely the "legacy" > singleton, or one element vector.

Re: [Bug-apl] IOTA

2016-03-02 Thread Jay Foad
Cool! For bonus marks can you make it work in the degenerate case: ⍳⍬ ←→ ⊂⍬ ? Jay. On 2 March 2016 at 02:23, Elias Mårtenson wrote: > Looking at it further, I realise you need do disclose the result in order to > make them equivalent: > > IOTA ← {⊃∘.,/⍳¨⍵} > > Regards, > Elias > > On 2

Re: [Bug-apl] value error when using 'Cut'

2016-02-08 Thread Jay Foad
FYI Dyalog are considering introducing Cut into a future version of Dyalog APL and would welcome feedback or collaboration on the design: http://video.dyalog.com/Dyalog15/?v=9KOto3xXS3c http://www.dyalog.com/uploads/conference/dyalog15/presentations/D16_Future_Operator_Proposals.zip http://www.dya

Re: [Bug-apl] Fwd: tensor product

2016-01-25 Thread Jay Foad
How about: tensor←{((⍴⍺)×⍴⍵)⍴(⍋⍋0 1⍴⍨(⍴⍴⍺)+⍴⍴⍵)⍉⍺∘.×⍵} I think this is a more elegant generalisation than using ⍣. It should also work in 3 or more dimensions. The left argument of the dyadic transpose needs to be 1 2 (for vectors), 1 3 2 4 (for matrices), 1 4 2 5 3 6 (for cubes) etc. This is an

Re: [Bug-apl] 100?100 hang-up

2015-10-13 Thread Jay Foad
But 104?104 is fine! It's broken when the argument is not a multiple of 8. This code (in Bif_F12_ROLL::eval_AB in ScalarFunction.cc) should round up to a multiple of 8, not down. // set_size can be rather big, so we new/delete it // uint8_t * used = new uint8_t[set_size/8]; memset(used, 0

Re: [Bug-apl] Performance problem with simple program

2015-10-07 Thread Jay Foad
On 7 October 2015 at 15:19, Peter Teeson wrote: > I was wondering why the APL Lang Ref Manual p.161 shows: > ⌊1+L⍟(|R)+R=0 > > Why would this not be just as correct? > ⌈L⍟(|R)+R=0 > > and so >> ((⌈10⍟N)⍴10)⊤... This would tell you that 1000 only has 3 digits. Jay.

Re: [Bug-apl] Performance problem with simple program

2015-10-06 Thread Jay Foad
It's slightly annoying that you have to know how many 10s to use on the left of ⊤. You can work it out as: ((1+⌊10⍟N)⍴10)⊤... On 6 October 2015 at 09:44, Jay Foad wrote: > (⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400

Re: [Bug-apl] Performance problem with simple program

2015-10-06 Thread Jay Foad
Your solution is inherently O(n²) because you're using ¨⍳ inside ¨⍳. The obvious way to fix this is with +\: (⍳N)⍪[1.5]+\{+/⍎¨⍕⍵}¨⍳N←400 The other obvious source of inefficiency is your use of ⍕ and ⍎. Instead, how about: (⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400 I don't know how to do timings in GNU APL s

Re: [Bug-apl] A better way to insert characters into a character vector?

2015-08-28 Thread Jay Foad
You can use ∊ (Enlist) instead of ⊃,/. Here's another way from "the good old days, before all this nested array malarkey" (from Morten Kromberg): a←'alex' rep←1+2×m←a='e' r←rep/a ⋄ m←rep/m (m/r)←'www' r alwwwx Jay. On 28 August 2015 at 03:17, wrote: > Hi Bug APL,

[Bug-apl] problems with ^D

2015-08-21 Thread Jay Foad
When I build and run GNU APL on Ubuntu 15.04, ^D seems to behave strangely. 1. The first four times I hit it I get "^D" echoed, followed by a blank line and a helpful message. After that I just get "^D" echoed, with no message at all. (I expected it to exit the interpreter if I hit it n times in a

  1   2   >