« first day (1421 days earlier)      last day (1530 days later) » 

01:00
0
A: Create a binary matrix based on information given by an "Excel" table in the APL language

AdámFirst, let's get your questions out of the way: how could it interact with matrix t, after all the rules need to be researched in matrix t? Right, this might be involved. I think it is easier to construct the result directly, rather than to modify a pre-made matrix. how to insert the values...

 
3 hours later…
04:27
I'm trying to make an ASCII house:
I need to add a star at the top point
whats the most golfy way to do that
 
1 hour later…
06:11
@Adám The simplest expressions I learned first (+/ vec ; ×/ vec ; ⌈/ vec ; +\ vec ; ×\ vec), I still find them beautiful. Maybe not "impressive" but... I like Roger Hui's answer to a "related" question back in 2012 groups.google.com/g/comp.lang.apl/c/BbyYv7kgvEw/m/rTnUKDMwH9cJ
@Adám One that I found beautiFUN is ⍎⌽⍕⌈*○≡⍬ Maybe just because I like 42.
 
4 hours later…
09:58
@user14835830 Kimmo, I'll get you access to chat here soon.
@Adám No but the concept is pretty stunning I think
@phantomics Wish I'd saved this - seems to be gone now
 
2 hours later…
11:50
Given a nested matrix of integers, I'd like to get to a vector showing which cols have elements containing only 1s. The best I've managed is:
⋄ ⊢a←2 2⍴(1 1)(0 1)(1 1)(0 1) ⋄ ∧⌿(∧/¨)⍤1⊢a
@xpqz
 1 1  0 1
 1 1  0 1
1 0
Is there a better way?
@xpqz are the parentheses and ⍤1 not pointless?
Yes, they are :/
Trying to use breadth first search here:
12:01
@xpqz Are the matrices Boolean?
why is this giving an INDEX error?
@Adám yes
⋄ ∧⌿~0∊¨2 2⍴(1 1)(0 1)(1 1)(0 1)
@Adám 1 0
nice
why didn't I think of that?
 
1 hour later…
13:13
Hello again
Writing an answer to this:
11
Q: Will it ​float?

JamesThe challenge Given a 2d string representing the bottom of a boat as an input, you must determine whether or not the boat will float. This 2D string can be in whatever format is most convenient. (String with newlines, list of string, list of list of chars, etc.) Print a truthy value if it will f...

is this properly golfed?
also, is this algorithm correct?
 
1 hour later…
14:19
For today only (until the next one): Pythagorean triple day! tinyurl.com/yam9ep9v
 
1 hour later…
ngn
ngn
@Razetime you're addicted to ≠⊆⊢ :)
Anything to not use regex
@ngn It might actually qualify as my favourite APL expression
ngn
ngn
cmc: extract the numbers from a string, ignoring all non-digits. e.g. 'departure location: 49-258 or 268-960' -> 49 258 268 960
@ngn regex allowed?
ngn
ngn
@xpqz sure
15:57
'(\d+)'⎕S'&'⊢
working on a non - regex solution
Or for actual numbers, ⍎⍕'(\d+)'⎕S'&'⊢
I need something like reduce but that preserves structure
so 1 1 1 0 0 1 0 smt 1 2 3 4 5 6 7 gives 1 2 3 0 0 6 0
ngn
ngn
@Wezl ×
oh, I was just thinking and but not only for booleans. thanks
16:03
@ngn ⋄'departure location: 49-258 or 268-960'(⍎¨∊⊆⊣)⎕D
@Razetime VALUE ERROR
⋄'departure location: 49-258 or 268-960'(∊⊆⊣)⎕D
@Razetime 49 258 268 960
execute isn't allowed i guess
@ngn ok {⍎⍵×⍨(⍵∊'0123456789')} would work if × worked for characters
16:06
@Razetime nice!
I'm stealing that.
I think it's somewhere in the thread
@RikedyP @RikedyP, you can still get the image here: i.postimg.cc/pVj8rM01/APLLogo1.png
ngn
ngn
16:22
@Wezl ×⍨ is ×. '0123456789' is ⎕d. i think one of the meanings of \ can be helpful for what you're trying to do: {⍎∊(⍵∊⎕d)\¨⍵}
what's monadic epsilon?
ngn
ngn
@xpqz no need for ( ) in the regex. btw, the usual golfing rules allow only a "full program" or a function, so it should be either ⍎⍕'(\d+)'⎕S'&'⊢⎕ or some kind of train or dfn or derived or function, etc
@Wezl flatten, e.g. (0 1)2(⊂⊂2 2⍴3 4 5 6) -> 0 1 2 3 4 5 6
I guess partition is what I needed, like in Razetime's excellent answer
ngn
ngn
@xpqz an idea for shortening that: instead of searching for runs of digits, replace the nondigits (\D) with spaces and ⍎
Like so: ⍎'\D+'⎕R' '⊢⎕ ?
ngn
ngn
16:35
@Razetime so, that's either ⎕(⍎¨∊⊆⊣)⎕D or (⍎¨∊⊆⊣)∘⎕D. to get rid of the parens and make the whole thing a train: ⍎¨∊∘⎕d⊆⊢
@xpqz yes, without +
@phantomics Yeah I can thanks - also later after that message I was able to see the original ones so not sure what was up with that
@phantomics Anyway I'm personally leaning towards this as my favourite one, if only because people can adapt the boxed-with-arrow motif for all kinds of purposes, with any colours and fonts they like - the only downside then is what would be the canonical "official" APL logo? Not sure I'd go with the pixel-style for that, personally, even though I think your designs look great
@Razetime I am also very fond of this, even if sometimes I have to reach for (~∊⍨)⊆⊢ for multiple delimiters
16:51
Finally got my day 16 solution to something reasonable: here
@ngn nice
@RikedyP interesting
ngn
ngn
cmc: given a number ⍺ and 4 sorted distinct numbers ⍵, find out if (⍵[0]≤⍺)∧(⍺<⍵[1])∧(⍵[2]≤⍺)∧(⍺<⍵[3]), i.e. ⍺ is in one of the closed-open intervals ⍵[0 1] and ⍵[2 3] (flexible on open/closed, ⎕io, and swapping ⍺⍵)
@RikedyP Thanks, I also had adaptability in mind when designing the logo. The pixel styles can be adapted with many different color palettes. I could also create a vector version of the boxed arrow design that wouldn't have the pixelated look.
17:39
@ngn Neat. I somehow always forget that you can just use multiplication for selection with boolean arrays :(
@ngn if they are 4 distinct sorted numbers, isnt the answer always 0?
the number can only ever be in one interval
@Razetime Should be ((⍵[0]≤⍺)∧(⍺<⍵[1]))∨((⍵[2]≤⍺)∧(⍺<⍵[3])) I think.
ngn
ngn
@Razetime oops.. you and marshall are right
I have three characters unless I confused some of the flexibilities.
Also they don't have to be distinct.
ngn
ngn
@Marshall me too :)
@Marshall duplicates in ⍵ could cause problems if someone chooses to use closed-closed intervals
the two intervals could overlap
17:59
Oh wait, there are at least two different three-character strategies. My first works for arrays and my second doesn't.
ngn
ngn
@voidhawk interesting part2. i thought it should always include some loop equivalent to ⍣≡
18:17
Is there any try-it-online service implementing NARS2000?
@phantomics Answer from last time seems to be no.
Dec 10 at 20:54, by dzaima
@Adám it runs fine under wine
@ngn Yeah, in the general case that would be true, but the inputs for this problem are constructed such that there's never any "branching" when we pick the next field assignment
18:39
@Adám that's performance/not-erroring-wise. Actually using it is horrible.
Can you elaborate?
@Adám it ignores the linux keyboard, forcing its own left-alt one; the various hover popups randomly remain after mouse has left, or even after tabbing away. those 2 things (plus in general the windows 2000-esque UI) have me mostly not want to use it for long enough to find more problems
@dzaima OK, so that's basically the same as on Windows. It also forces its own keyboarding on me there, including combos that I cannot access, like Alt+number.
@Adám oh yay
who will sacrifice themselves and write a NARS2000 RIDE interface
The interpreter doesn't speak RIDE protocol, though. I'd be so nice if all APL interpreters spoke the same front-end language, so you could just mix and match front- and back-ends… Won't happen, of course.
18:50
@Adám my message was about making it able to speak the RIDE protocol
Oh. Well, NARS2000 is open source, so sure: Any volunteers?
@Adám exactly.
Thanks, I'll try it under Wine then
ngn
ngn
@Adám plain text on stdin and stdout is the best universal language
@ngn cannot support autocompletion, multiple windows, etc. of course you don't need those, but you're not the only user of all APL impls
18:54
Another thing, is the ⎕ct comparison tolerance part of the APL standard? Is it considered an essential feature?
@dzaima (but i'll agree that it'd be good if every impl at least had a simple in→out REPL)
@phantomics It is part of the standard. ngn will tell you it is not needed.
(well, ngn will also tell you floats aren't needed, so)
Latest iteration with slight adjustments of line widths and positioning:
ngn
ngn
@Adám correct :) it breaks transitivity
@dzaima correct :) but sadly they are part of the metal
18:56
@phantomics but i'll also say that comparison tolerance isn't really needed. maaybe a modifier for checking equality, taking an operand of the acceptable error, but one can survive without that too
@dzaima I once wrote a blog post draft for such an operator, but it was never published. Interested?
@Adám ooh, interesting, yeah. thought it'd be too verbose for an APL audience, but i guess (maybe) not?
If it's part of the standard I'll probably implement it, currently I just wrap CL's =, /= and other functions with the APL ones
Since April has rationals, there's a problem with ⍣ fixpoints for functions that can have rational output; usually they never converge and loop infinitely
⎕ct will help with that but it feels less elegant
@phantomics making it apply to rationals seems very weird to me
That's why I want to see how NARS2000 does it
To use it I'll have to convert rationals to floats and compare them using the ⎕ct
@phantomics what it does
@Adám being a fan of ⎕CT what ←0 oh :D
I could just set a special condition in the ⍣ implementation to handle ⍣=
@phantomics at that point an approximate equality operator would be much simpler
I like the deviant operator concept
@dzaima That's from NARS2000?
@phantomics that's from Adám's article
19:15
I meant is your paste from NARS2000?
@phantomics yeah
Got it, so ⎕ct doesn't affect rational comparison
also note that in NARS 1000000000000000000=1000000000000000001 is false - it has a separate 64-bit int type (adding a .0 to either constant makes it return 1)
Anything that big entered in April generates a bignum, CL numbers can get really huge
ngn
ngn
@dzaima the right approach! two numeric towers
20:07
@dzaima (oops used BQN lingo there - "modifier" is "operator")
@dzaima Yeah, I noticed.
@Adám that's an interesting alternative to what i had in mind - essentially just 1.5 (.2⁼) 1.6 for .2≥|1.5-1.6 and hoping everything else isn't needed because it shouldn't
@dzaima I can definitely see things like and being useful.
@Adám heh, my first thoughts were that ⌊⌈ and maybe would be useful but and definitely being completely useless
@dzaima i guess they'd be useful in deduplicating similar numbers, wherever that's useful (heh, monadic ≠±n)
20:42
github.com/rak1507/Advent-Of-Code-2020-APL/blob/main/… I have to say I'm quite pleased with my solution for advent of code from today
20:59
One other question: APL and Lisp have slightly different formats for nested arrays. I added an option to April that converts nested arrays to Lisp-format when they are output. This option is currently called "unformat-output." What it does is convert from APL-style nested arrays where every nested array is wrapped in a 0-rank array to BQN-style output where n-rank arrays can be contained directly inside another array.
Can anyone think of a better name than "unformat-output"? It's not very descriptive.
@phantomics why do you need to wrap nested arrays in rank-0 arrays? The only difference between APL and BQN style arrays is the existence of enclosed scalars
In APL every element in an array must be scalar, hence nested arrays must be wrapped in a 0-rank scalar array
@dzaima Enclosed simple scalars, and non-array atoms.
@Adám 1) right; 2) that's purely a terminology difference as far as i'm concerned
@phantomics not sure why that'd be needed. Arrays can just contain other arrays
That's my understanding, otherwise x[1 2;1 2]←2 2⍴9 doesn't work correctly
21:05
@phantomics I call what you're referring to a 0-cell rather than an element (which is the thing a 0-cell contains; APLWiki has my definition of element because I wrote that page).
(But APLers tend to use "element" and "item" inconsistently and don't even notice).
Got it, each element being a 0-cell
@phantomics regardless, those still shouldn't show up in the internal representation
If those aren't part of the internal representation, a lot of complicated logic is needed so that functions will handle nested arrays correctly
Like ⊃ and ⌷
@phantomics x[1 2;1 2] is equivalent to 2 2↑x, and there's no reason for (2 2↑x)←2 2⍴9 to not work
The choice was either to create a structure that was orthogonal to APL's, which Lisp's array model fortunately makes straightforward, or to write logic into every function that would treat a nested array element as if it were scalar in the right situations
21:10
@phantomics should work fine ('ab' ≡ (⊂1 1)⊃2 2⍴⊂'ab'); is a weird case, but again, it's much like in that it only rearranges elements
@phantomics I think the problem is that you're trying to get 0-cells by taking array elements in Lisp. You shouldn't do that: get a 0-cell by selecting the element then enclosing it.
If the element is a simple scalar then enclose needs to detect that and not enclose it, because in nested APLs enclosing a simple scalar doesn't do anything.
@dzaima (forgot that can be used to get non-0-cells ಠ_ಠ; it still should absolutely not care about anything about what the elements of are)
@dzaima The point of that example is that the logic for assignment becomes confusing in some cases without the scalar element model
@Marshall That's what I did in the past, I can't recall off the top of my head but there were definitely situations where that model had problems
@phantomics assignment logic shouldn't be that different from regular logic
I'll look over those functions again, I already have an internal function analogous to ⊂ that encloses arrays but not scalars
21:18
@phantomics Simple scalars, right? ⊂⊂1 2 should be different from ⊂1 2 even though it's a scalar.
Yes, non-array scalars
I think my adoption of the 0-rank wrapping was driven by observations of the behavior of ⊃, ⌷ and [] indexing. Also the fact than when you employ it, the logic for assigning from one array to another becomes simpler
so v[1;1]←3 4⍴⍳9 produces an error instead of assigning the enclosed array
@phantomics what enclosed array where?
But the logic for assignment of nested arrays vs. elements from an array is also straightforward
@dzaima That's just it, the array to the right of ← isn't enclosed
But it's easy enough to just insist that an array to be assigned as a nested array must be enclosed
@phantomics Typically that expression should see that v[1;1] would always have empty shape but 3 4⍴⍳9 has shape 3 4: they don't match, so it's an error.
Yeah, that logic is simple
I think there were other factors driving the decision I made at the time, but I can't remember them.
After I get some of the current changes done I'll create a source branch without the 0-rank nesting and see if it can be made to work
If that's not a problem then it'll be a big improvement, no incongruity with regular CL nested arrays
21:51
@Marshall Didn't you once tell me that ∨/⍷ was optimised?
@Adám I sure hope not. There's definitely an issue for it, maybe under RFEs. I barely touched .
Ah, ok. I probably began writing X(∨/⍷)Y instead of ∨/X⍷Y in anticipation of that.

« first day (1421 days earlier)      last day (1530 days later) »