« first day (658 days earlier)      last day (1983 days later) » 

12:00 AM
@nathanrogers Just let it all sink in. Little by little you'll come to recognise patterns and have intuitions about how to attack problems. We're all learning APL here.
 
OOP is probably the least intuitive of all programming paradigms, and it didn't take me so long to get the hang of it
i know what most of the operators are, but I can't read solutions because I can't understand them, and I can't write them because I don't understand how all the operators interact with all the different shapes
I still can't figure out when I need ¨ or when I don't
or when I need to ⊂ or not
 
@nathanrogers Good luck solving this problem with pure OO.
 
to hell with pure OO. I'll take functional solutions all day
 
@nathanrogers Are you reading golfed code without comments, by chance?
 
I have no idea.
I'm reading whatever I find
What I mean by not understanding is the solution is so steeped in the domain, and I don't understand the domain probably\
 
12:04 AM
@nathanrogers Heh, maybe that's because anything non-domain specific, is so trivial in APL that there's not much to read…
 
FWIW a cool way to solve the problem is ⊃{⍺+2⌈/⍵}/. For a vector of rows of increasing lengths
 
isn't that basically what @Adám earlier? @H.PWiz
 
No, it is the same as yours but from the bottom up, rather than the top down
 
12:24 AM
⊃{⍺+2⌈/⍵}/⌽↓↑rows
doesn't work for me
 
> For a vector of rows of increasing lengths
Don't need ⌽↓↑
 
⊃{⍺+2⌈/⍵}/⌽↓rows
oh
splain 2⌈/
why does that work
 
What does it do?
 
no
why does it work
why does it solve the problem
oh
greatest neighbor got it
⊃{⍺+2⌈/⍵}/rows
that's nice
but also, I am here because APL is supposed to making reasoning easier. I had this exact model in mind when I started this problem, but then I spent the rest of the time it seemed struggling with how I need to format the data to get it into a workable form
follow back to the beginning of this converesation
2 hours ago, by nathan rogers
2{⌈/(↓2 3⍴⍺,¯1⌽⍺)+⊂⍵}/↓a
I spend so much time arguing with the format of the data to get to the expression I want
in hindsight I can see {⍺+2⌈/⍵} but I can't seem to see it from the onset
 
 
11 hours later…
11:56 AM
What about this extension of iota function i←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}?
 
ngn
12:31 PM
@Adám why not ascending?
 
@ngn that was my suggestion
Oh I hadn't noticed the extended Iota had a string version now, I love it.
 
ngn
12:46 PM
wow, cyrillic :)
 
I know like four or five words in Russian, and most of them are swear words at that.
I'm planning on studying it though some day.
 
@ngn Interesting. J uses negatives to indicate reversal along that axis, but the values are positive. K reverses and ascends negative numbers.
@ngn I guess it is more consistent with my but maybe it would be better to have them complement each other? Also, it seems my doesn't obey ⎕IO. Hm.
 
1:15 PM
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨¯3 ¯1 0 1 4
 
@RosLuP
┌──────────┬────┬┬─┬───────┐
│¯3 ¯2 ¯1 0│¯1 0││1│1 2 3 4│
└──────────┴────┴┴─┴───────┘
 
@RosLuP What would you do for ⍳2 ¯3?
 
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}2 ¯3
 
@RosLuP
LENGTH ERROR
 
@RosLuP Your condition ⍵≥0 gives 1 0!
 
1:20 PM
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨2¯3
 
@RosLuP
SYNTAX ERROR
 
@RosLuP Missing space before ¯
 
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨2 ¯3
 
@RosLuP
┌───┬──────────┐
│1 2│¯3 ¯2 ¯1 0│
└───┴──────────┘
 
@Adám for me ⍳2 ¯3 is one error... not is one error ⍳¨2 ¯3
 
1:26 PM
@RosLuP Of course. Your model for an extended doesn't consider non-singleton arguments :-)
 
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨ ¯3 ¯2 ¯1 0 1 2 3
 
@RosLuP
┌──────────┬───────┬────┬┬─┬───┬─────┐
│¯3 ¯2 ¯1 0│¯2 ¯1 0│¯1 0││1│1 2│1 2 3│
└──────────┴───────┴────┴┴─┴───┴─────┘
 
ngn
@Adám feature request: ⍳,scalar ←→ ,¨⍳scalar
 
> extended
@ngn Just use ,¨⍤⍳
 
ngn
@Adám i know i can work around it, but it feels inconsistent
 
1:29 PM
With the display option it is easy see what happens ...
⎕←⍬={⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}0
 
@RosLuP
 
@RosLuP iirc is never = to anything. You should do ⍬≡ instead of ⍬=
Can't remember if ⍬=⍬
 
ngn
@J.Sallé the answer is
 
@ngn mindblowing
 
⎕←⍬≡{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}0
 
1:35 PM
@RosLuP
1
 
⎕←⍬≡⍳0
 
@RosLuP
1
 
What is ×⍬? If it is ⍬ →⍬ means goto to the next instruction?
 
×⍬ is ...
 
⎕←⍬≡×⍬
 
1:46 PM
@RosLuP
1
 
@RosLuP ⍴A⍴×A (or any monadic scalar function instead of ×, or dyadic scalar one when the left arg is either the same shape or is scalar)
 
@RosLuP →⍬ doesn't do anything, which mean you can conditionally branch to a label with →condition/mylabel
@J.Sallé Notice the difference:
⎕←⍬(≡,∧.=)''
 
@Adám
0 1
 
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨ ¯3 ¯2 ¯1 0 1 2 3 ⋄ →⍬ ⋄ ⎕← 123456789
 
@RosLuP
┌──────────┬───────┬────┬┬─┬───┬─────┐
│¯3 ¯2 ¯1 0│¯2 ¯1 0│¯1 0││1│1 2│1 2 3│
└──────────┴───────┴────┴┴─┴───┴─────┘
SYNTAX ERROR
 
1:54 PM
⎕←{⍵≥0:⍳⍵⋄0,⍨⌽-⍳∣⍵}¨ ¯3 ¯2 ¯1 0 1 2 3 ⋄ ⎕← 123456789
 
@RosLuP
┌──────────┬───────┬────┬┬─┬───┬─────┐
│¯3 ¯2 ¯1 0│¯2 ¯1 0│¯1 0││1│1 2│1 2 3│
└──────────┴───────┴────┴┴─┴───┴─────┘
123456789
 
@RosLuP The but runs your code inside a dfn, where branching isn't supported.
 
@Adám yes →⍬ in one function that allow goto is like the void instruction
 
@RosLuP Yes, and you can even use it in the APL session (at least in Dyalog — I know you tend to use NARS).
 
Ok thank you
⎕←(⍬='') , (⍬≡'')
 
2:08 PM
@RosLuP
0
 
@RosLuP ⍬='' is so the only indication of it is that the total result is a vector:
⍞←⍴(⍬='') , (⍬≡'')
 
@Adám 1
 
⎕←(⍬≡⍬='') , (⍬≡'')
 
@RosLuP
1 0
 
@Adám out of curiosity: do you call "Zilde" as it's called in the REPL?
For some reason whenever I see I think of "zilch"
 
2:14 PM
@J.Sallé When speaking APL, I say zilde for z(ero-t)ilde and squad for s(quish)-quad.
 
I see
Squad I already knew, Zilde is new for me but I can see it
I still like "zilch" better though because it represents, well, nothing >.>
 
⎕←(⍬≡⍬)
 
@RosLuP
1
 
2:31 PM
So the for array one has to use ≡ instead for scalar one has to use =... yes is how APL is build... but in general what is the problem in the use of the same symbol = because one array one can be thought as scalar if it is one element of one array too. So one array is one array and can be a scalar too...
 
looks like somebody approved that face... :P
 
@RosLuP Really, is the general function, and = is a special pervasive case of it. If is the depth operator, then = is the same as ≡⍥0. Similarly, ("precedes") is the general function, and < is just ≺⍥0
 
@RosLuP because 1 2 3 = 3 2 1 is a thing too and special-casing it for is just ugly
and 1≡1 also works, so if you only care about getting a boolean output, always using doesn't hurt
 
⎕← (1 2 3 = 3 2 1 )
 
@RosLuP
0 1 0
 
2:42 PM
It seems 1 2 3 = 3 2 1 is 1=3 2=2 3=1 so at end it is apply on scalars...
 
@RosLuP ..that's because = is a scalar function, and that's the definition of them
= works just like + (or -/×/÷/*/! or whatever), just that instead of adding (or subtracting, ect), it checks for equality
 
⎕←(1≡1)
 
@RosLuP
1
 
⎕←('1'≡'1')
 
@RosLuP
1
 
2:46 PM
⎕←(1≡9)
 
@RosLuP
0
 
@Adám But doesn't exist in current Dyalog, does it?
 
@J.Sallé No, though you can easily write it.
CMC:
 
If ≡ can do all of above why use =?
 
@RosLuP because you're supposed to use it when you need to do multiple things, e.g. 2 = 1 2 3 4
 
2:49 PM
@RosLuP a) = was there from day one. b) convenience/readability. c) hasn't been added (yet).
@dzaima vv
 
@Adám just to be sure J.Sallé isn't going to run into surprised: do two equal values precede each other?
 
⍞←2(≡⍤0)1 2 3 4
 
@Adám 0 1 0 0
 
@EriktheOutgolfer No.
 
@Adám yeah, but that's very unAPLy and requires a smart optimizing interpreter
also hence why "supposed to" instead of "forced to"
 
2:52 PM
@dzaima True, but if one wanted a minimalist-but-powerful APL…
Potentially, one could also devise the opposite: an operator which takes a scalar comparison function as operand and derives a precedence function.
 
 
2 hours later…
4:24 PM
⍞←2{⍺≡⍵}¨1 2 3 4
 
@RosLuP 0 1 0 0
 
⍞←2≡∘¨1 2 3 4
 
@RosLuP SYNTAX ERROR
 
⍞←2{⍺≡⍵}∘¨1 2 3 4
 
@RosLuP SYNTAX ERROR
 
4:44 PM
⍞←2≡¨1 2 3 4
 
@Adám 0 1 0 0
 
⍞←2∘≡¨1 2 3 4
@RosLuP ^ and ^^
 
5:31 PM
Is there any way to see past messages or mentions of my name?
 
@arcfide You can search for your name in the top right corner search box.
 
Aaah.
Thanks.
 
5:49 PM
@Adám can you give me some test cases with the precedes operator? What would 1 2 3 ≺ 3 2 1 return, for example?
 
@J.Sallé 1
1 ≡ 'Hello' ≺ 'hello'
1 ≡ 'Hello' ≺ 'hell'
1 ≡ 'hell' ≺ 'hello'
1 ≡ 100 ≺ 'A'
1 ≡ ⍬ ≺ ''
1 ≡ 42 ≺ ,42
1 ≡ (,42) ≺ (⍪42)
@J.Sallé ^^ and ^. Identical elements give 0.
 
@Adám okay, I'll see what I can do then
 
6:23 PM
@J.Sallé Don't overthink it. I can do it in 10.
 
@Adám So basically compareTo in Java (and probably many other languages)?
 
@Adám thing is, I can't see how that's different from {⍺≢⍵} since identical elements give 0.
so technically I think my problem here is under thinking
 
@J.Sallé Reversing the arguments gives 0 too.
@Quintec No, compareTo/cmp/etc gives ¯1 or 0 or 1. This is like compareTo<0
 
6:40 PM
So 0 or 1 boolean? Got it
 
@Adám what does it give if ⍺ equals ⍵?
 
@Cowsquack 0.
≺ is to < what ≡ is to =
 
I'm assuming you can't just use because comparing vectors with scalars?
 
It looks at whether the left argument (not its atomic parts!) precedes the right
@Quintec Sure you can:
⍞←⍋42 'hello'
 
@Adám 1 2
 
6:42 PM
⍞←⍋((,42) 42)
 
@Quintec 2 1
 
Fails on TryAPL? @Adám
DOMAIN ERROR
 
@Quintec Yes, requires version 17.0
 
Oh gotcha
 
6:43 PM
@Cowsquack Yup, looks right.
 
@dzaima 5 bytes?
 
@Cowsquack oh yeah grade down is ⍋⌽ ಠ_ಠ
 
@dzaima Not really.
⎕←{(⍒⍵)(⍋⌽⍵)}4 4 5
 
@Adám
┌─────┬─────┐
│3 1 2│2 3 1│
└─────┴─────┘
 
Now you all see why it isn't worth adding 4 more primitives? When do you ever need them anyway?
 
Actually, can't we take out the compose and just have 2 bytes? lol
 
@Quintec Right. I don't think there are any primitives that can be written with just two other primitives.
 
@Adám + is --
 
Touché
 
6:55 PM
@H.PWiz Only when used as an infix snippet. Doesn't work as a stand-alone function or monadically.
 
@Adám Oh, yeah. It's -∘-
 
@H.PWiz And still only the dyadic case.
 
Obviously
 
Actually, and are s of each other.
And even then, you can't just drop them in as is; they may need parentheses.
 
> and < also?
 
6:58 PM
@Quintec True, and ≤≥
And ∧⍲ and ∨⍱ are ~s of each other.
OK, so there are a few, but they are really fundamental and would be pretty awkward to not have.
>≤ and ≥< are also ~s of each other.
Though I guess a lot of languages don't have NOR or NAND (despite their fundamental roles in computing!)
 
regarding ^, I wonder how codegolf.stackexchange.com/q/110648/41805 would be approached using only the single-charred glyphs (meaning without ⎕ucs, ⎕av, ...)
or a minimal character set with which all others can be emulated
 
 
2 hours later…
9:01 PM
@Cowsquack Hm, technically everything is computable with NOR or NAND, both of which can be implemented using no primitives whatsoever, so…
 
 
2 hours later…
10:51 PM
@ngn Just a reminder for the bounty
 
@Bubbler Thanks, I've unstarred.
 
ngn
11:12 PM
@Bubbler done (i hadn't forgotten), and it was worth it :)
@Bubbler -1 0 2 -1+-4!#x -> 4#-1 0 2+-4!#x
 

« first day (658 days earlier)      last day (1983 days later) »