Re: Disclose fails with mixed ranks

2021-09-25 Thread Jay Foad
reasonable 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
PL 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, >> >

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

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

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
, 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, > for exam

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 wrote:

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

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

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. >

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

Re: APL2 Compatibility

2020-11-27 Thread Jay Foad
my expression > (⊂1 2) (/¨) (,¨) 'ab' > I ignored that (,¨) operates on 'ab' and that it does not return 'ab' > element-wise > > > so this does the job: >(⊂ 1 2) (/¨)¨(,¨)'ab' >a aab bb > > Thank you for your patience > > Best regards >

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

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.

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

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

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

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:

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

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│ └──┴──┘

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

Re: [Bug-apl] Hang in Residue

2018-01-09 Thread Jay Foad
xpected 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, th

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
e *SVN 1036* works better. > > /// Jürgen > > > 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

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
*0 0 0 0 > 0 0 0 0 > 0 0 0 0 > 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

Re: [Bug-apl] Hang in Residue

2018-01-08 Thread Jay Foad
en > > > On 01/05/2018 04:37 PM, Jay Foad wrote: > > Yes, that expression hangs on my Linux box too. It gets stuck here: > > FloatCell::bif_residue (this=0x55ae13a8, Z=0x55ae24f8, > A=0x55ae11d8) at FloatCell.cc:643 > 643 while (z <

Re: [Bug-apl] Hang in Residue

2018-01-05 Thread Jay Foad
ppose it is one of the A[i] ∣ 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,

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

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

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

2017-06-23 Thread Jay Foad
nn > > > > 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. I tried the proposed change and every

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

2017-06-20 Thread Jay Foad
amalpha.com/input/?i=(5%2B3i)+mod+(14%2B5i) > > Regards, > Elias > > On 20 June 2017 at 16:02, Jay Foad <jay.f...@gmail.com> wrote: > >> With the demo version of APL2 I get: >> >> 5J3 ∣ 14J5 >> ¯4J1 >> 5J3 | 1J4 >> ¯4J1 >&g

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

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

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 <jay.f...@gmail.com> wrote: > I get: > > ¯1J11 | ¯12J10 > computing (-12,10) modulo (-1,1

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

2017-06-15 Thread Jay Foad
1J11* > * b ← ¯12J10* > * 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. > &

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

2017-06-15 Thread Jay Foad
red > > 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 958*. >

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). //

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

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

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

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

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 <jay.f...@gmail.com> 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

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) >

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

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,

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,

[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:

Re: [Bug-apl] Spell corrector - APL

2016-09-13 Thread Jay Foad
wrote: > Thanks 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 <jay.f...@gmail.com&g

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

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? >

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

2016-08-15 Thread Jay Foad
don't know if that statement 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 a

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

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

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.

Re: [Bug-apl] 0⍟0

2016-07-13 Thread Jay Foad
; errors) within *⎕IO* > makes more sense 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

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

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

[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

Re: [Bug-apl] multiple inner product

2016-07-08 Thread Jay Foad
On 7 July 2016 at 12:57, Kacper Gutowski <mwgam...@gmail.com> 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 equi

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

Re: [Bug-apl] multiple inner product

2016-07-07 Thread Jay Foad
On 7 July 2016 at 11:39, Kacper Gutowski <mwgam...@gmail.com> 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 cas

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

2016-06-29 Thread Jay Foad
t; > On 06/28/2016 01:23 PM, Jay Foad wrote: > > The APL2 manual (p35) says "The right operand of a dyadic operator is the > function or array to its immediate right." This is their way of saying that > operator expressions are left-associative. For example, in ∘.∘.+ the ri

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

2016-06-29 Thread Jay Foad
o the slash as its left operand. > >>> > >>> +.×/ ←→ (+.× )/ not + .(× /) > >>> " > >>> > >>> However, the binding strength resolves the ambiguity in the IBM > example only > >>> because / is not a dyadic operator. In Alex

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

Re: [Bug-apl] Not a bug, need help coding search 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

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

2016-06-28 Thread Jay Foad
gt; 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 personally > would find it counter-intui

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

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:

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 <jay.f...@gmail.com> wrote: > Given g ← f⍤P Q R: > P is the monadic rank > Q is the left rank > R is the right

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

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: > >

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

2016-03-15 Thread Jay Foad
On 15 March 2016 at 13:24, Elias Mårtenson <loke...@gmail.com> wrote: > On 15 March 2016 at 21:14, Jay Foad <jay.f...@gmail.com> 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

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: >

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

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 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 >

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,

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

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,

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

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 <jay.f...@gmail.com> wrote: > (⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400

Re: [Bug-apl] Localizing ⎕CT

2015-08-21 Thread Jay Foad
FYI this is different from NARS2000 and Dyalog, which leave ⎕-variables set to their current value, rather than setting them to some default value. Jay. On 21 August 2015 at 11:04, Juergen Sauermann juergen.sauerm...@t-online.de wrote: this is a GNU APL feature. Instead of leaving ⎕-variables

[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

Re: [Bug-apl] Localizing ⎕CT

2015-08-21 Thread Jay Foad
FYI Dyalog works the same way. It's called pass-through localisation of system variables. Jay. On 20 August 2015 at 15:20, Mike Duvos m...@wolf359.net wrote: The behavior seems to be that localized ⎕ variables inherit the value they had in the outer context unless you change them. If you do

Re: [Bug-apl] What do Quad-slash and Quad-Backslash do?

2015-07-20 Thread Jay Foad
What's the paper? Does it say which APL they were using? On 19 July 2015 at 16:25, alexwei...@alexweiner.com wrote: Hi Bug APL, I found a paper that computes eigenvalues using the following equation eig←{t[;⍒(t←⍂⍵)[0;]]} where ⍵ is a matrix of coefficients. It looks like the symbols are

Re: [Bug-apl] line label branching style

2015-07-14 Thread Jay Foad
I don't think there's much difference. Both are (were) reasonably common. The first one has the condition on the left, so you usually have to parenthesise it. The second one only works when ⎕IO=1. Jay. On 14 July 2015 at 03:19, alexwei...@alexweiner.com wrote: I found some very old code that

[Bug-apl] Fwd: tensor product

2015-05-20 Thread Jay Foad
(Forgot to cc the list.) -- Forwarded message -- From: Jay Foad jay.f...@gmail.com Date: 20 May 2015 at 14:55 Subject: Re: [Bug-apl] tensor product To: Fausto Saporito fausto.sapor...@gmail.com Why does it give a multidimensional result? Because that's the way it's defined

Re: [Bug-apl] SVN 624 Warnings

2015-05-07 Thread Jay Foad
Hi Jürgen, It's warning about line 51: rw_sv_def(CHI, { ... } axis argument) In this case you get CHI + 5, which is indexing way off the end of the string, which is why it's warning. Jay. On 7 May 2015 at 11:27, Juergen Sauermann juergen.sauerm...@t-online.de wrote: Hi, I believe by

Re: [Bug-apl] axis specification issue... (?)

2015-04-14 Thread Jay Foad
On 14 April 2015 at 07:31, Fausto Saporito fausto.sapor...@gmail.com wrote: Hello, as I wrote before I'm trying to use the Sullivan multi precision package with GNU APL. That workspace was written with Dyalog APL in mind, so there're some Dyalog feature we saw before ([]SIGNAL, []FMT).

Re: [Bug-apl] Ctrl-D and )off

2014-12-19 Thread Jay Foad
(Resending because I forgot to cc the list.) I agree that this is annoying, especially for new and casual users. The only good reason I can think of for APL not exiting on Ctrl-D is that if you accidentally hit Ctrl-D, you could accidentally lose the whole contents of your workspace. At least

Re: [Bug-apl] Bug in the parser?

2014-11-27 Thread Jay Foad
Hi Jürgen, Thanks for doing the analysis. 2. Alternatives - I have tested what happens if we would introduce a M M pattern into GNU APL in order to get IBM APL2's behavior. I don't understand this bit. Monadic operators don't bind like this in APL2. Surely the way to

  1   2   >