« first day (660 days earlier)      last day (1995 days later) » 

12:00 AM
damn
 
@nathanrogers OK, let's take it step by step:
 
wait no
lemme
(⍸0=(⍳⊢)|⊢)28
 
{⍸0=(⍳⍵)|⍵}
(⍸0=(⍳⊢)|⊢)
(⍸0= ⍳  |⊢)
 
but I don't see the point
oh that's awful
I really don't see the point in the last one
 
@nathanrogers Why? It even reads nicely: The divisors are where zero 0 equals = the integers' division-remainder | of the argument
 
12:16 AM
so this is taking way too long
It seems like project euler would be perfect fodder for APL, but the thing is I'm trying to learn APL and I'm not a mathematician, so having to learn forms of math I've never heard of and APL at the same time, I never know what I should be doing
getting rather impatient
the irritating point is that direct solutions are often horrible as to be impossible to solve simply
 
@nathanrogers Have you tried the phase 1 problems from past student competitions?
 
what is that
is there a primes generator in APL
 
@nathanrogers Go to the bottom of this page and click the Phase I PDF links.
@nathanrogers You can use pco from dfns.
@nathanrogers Or just use this little (but not efficient) train:
⋄ Primes←(⊢~∘.×⍨)1↓⍳ ⋄ ⎕←Primes 100
 
@Adám
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
 
 
4 hours later…
4:50 AM
what is the tacit way to do {a,⍵-a←⌊⍵} 1.234
⎕←{a,⍵-a←⌊⍵} 1.234
 
@nathanrogers
1 0.234
 
5:02 AM
and this one
⋄diceFreq← {{⍺ ((≢⍵)⍴'*')}⌸⍨∊+/¨⍳⍵}⋄⎕←diceFreq 6 6
 
@nathanrogers
┌──┬──────┐
│2 │*     │
├──┼──────┤
│3 │**    │
├──┼──────┤
│4 │***   │
├──┼──────┤
│5 │****  │
├──┼──────┤
│6 │***** │
├──┼──────┤
│7 │******│
├──┼──────┤
│8 │***** │
├──┼──────┤
│9 │****  │
├──┼──────┤
│10│***   │
├──┼──────┤
│11│**    │
├──┼──────┤
│12│*     │
└──┴──────┘
 
answers to problem solving phase 1 2018
 
5:16 AM
Isn't the first one simply ⌊,⊢-⌊?
 
6:09 AM
@nathanrogers see, your code requires backtracking - the first time reading trough I don't have a clue of what a is. Bubblers train on the other hand is a simple "floor and argument minus floor"
@nathanrogers and, as I've said again and again, trains shouldn't just blindly be applied, there are cases when a dfn is better.
but IMO Bubblers train is way nicer than "the variable 'a' and omega minus a, where a is floor of omega". You yourself said way too many times thwt retracing is horrible, and you yourself wrote a function that needs retracing..
(and, unrelatedly, that can also be written as 0 1∘⊤)
 
6:47 AM
@nathanrogers dzaima has already answered, but also note that ⍵-⌊⍵ is the fractional part, which is the division remainder when divided by 1, so ⌊,1∘| works as well.
@nathanrogers diceFreq←(⊣,∘⊂'*'⍴⍨⊢∘≢)⌸⍨∘∊+/¨∘⍳ which is an excellent example of when not to go tacit.
 
7:10 AM
@Adám for the inner function buitins for {⍺⍺ ⍵} and {⍺ ⍵} would make that a nicer expression, but a dfn would still be better (though it'd too benefit from {⍺ ⍵}!)
 
@dzaima {⍺⍺ ⍵} is ignore-left-and apply-monadically? I've thought about that. Yes, I agree that a single-char {⍺⍵} would be very valuable. seems like a nice symbol…
 
as I was typing that I too thought of ; underbar but my phones keyboard doesn't have it :/ I'll definitely think (again) about adding the two to my APL when home
 
@dzaima Ah, the apply-monadically could be f\ if f⍀ is outer product.
 
I'd like to have a symetric {⍺⍺ ⍺} too though
 
@dzaima Wait a minute, you don't need any of those when you have atop. f{⍺⍺ ⍵} is simply f⍤⊢ and f{⍺⍺ ⍺} is simply f⍤⊣!
 
7:22 AM
@Adám that's two chars though and imo unnecessary dyadic ops are the main thing decreasing readibility of trains
 
@dzaima and ? Or maybe and ?
 
@Adám oh god I was just about to whine about there being no right/left tack underbar but those are awesome chars
 
7:49 AM
@dzaima Wouldn't it be better (more readable) to have a special dummy left e.g. ¯ such that ¯f⍵ ←→ f ⍵?
 
8:13 AM
@Adám how does that fit into trains? trains are all about not having to mention arguments when possible
 
@dzaima Can you give me an example of using {⍺⍺ ⍵}? Just use the symbol $ for now.
 
8:35 AM
I don't like trains (perhaps because I not understand that) I like instead a {f} z because I can insert a and z in f where I want... one extension of that will be a b c ...{f} d e... where one can see where in the expression f goes exactly a,b,c,...d ea... but this in Apl is impossible because it is seen as 2 array...
 
8:46 AM
{(+⌿⍵)÷≢⍵} is the more easy to understand...
 
I think it is very helpful to have a good naming convention. I keep all variables dromedaryCase and all functions CamelCase. I use descriptive names, and try to keep variables as nouns and functions as verbs. If possible, I prefer that monadic operators are adverbs, and dyadic operators should be prepositions.
 
9:00 AM
It is possible {(a b c d)←⍵⋄ fdependpositionabcd} a b c d
 
@RosLuP Uh, yes. Wait, what?
 
it is possible doing all in Apl but the problem remain how make all readable as one read a novel? Yes good names for function and operator should be ok; primitive just one symbol should be ok if few; but something is difficult to read because is difficult operations and algorithm
 
@Adám (≢⊨-≢⫤) - get the difference in lengths. Not super useful, but I see ≢⊨ and ≢⫤ being used every now and then
 
@dzaima -⍥≢
 
9:16 AM
@Adám oh yeah, mashing the two together in a simple expression is bound to have a better way of being written. Still, the 2nd sentence stands
@Adám your own train for the dice graph (or whatever it was)
 
Hm, (⊣,∘⊂'*'⍴⍨⊢∘≢)⌸⍨∘∊+/¨∘⍳ — let me see…
 
⊢∘≢ there could be ≢⊨
 
@dzaima Yeah, but that doesn't have a huge effect, and one you learn the idioms ⍤⊣ and ⍤⊢ I think that'll be sufficient. A much bigger issue is dealing with runs of monadic functions inside trains, especially if some of them are reductions.
 
@Adám i was just about to say that trains are horrible at calling monadic functions. IMO the two are worth it, just as is prefered over ⊢⍨
 
@dzaima Yeah, how would you write {-×/⌈/⍵} tacitly?
 
9:23 AM
also IMO learning idioms shouldn't be a requirement for understanding good apl, they should just be good things to know for writing good apl
 
@dzaima f⍤⊣ is certainly understandable just from the primitives' definitions, but a reader of tacit APL will quickly learn to recognise this phrase and start reading it as a whole.
 
@Adám yeah, that's one example when tacit is very horrible
 
@dzaima Well, that's why J has the anomalous [: ("cap"). Hey, did you know that APL also "has" "cap"? It is spelled _←:
⋄ train←-_←×/⌈/ ⋄ ⎕←train 3 4⍴3 1 4 1 5
 
@Adám
¯100
 
@DyalogAPL Maybe you should add as cap if its anomalousness doesn't bother you.
On the other hand, an inline dfn has very little overhead for a long row of monadic applications, and it nicely delimits the run while declaring which argument it uses on its far right side. You can use that as a kind of quoting mechanism inside a bigger train.
 
 
2 hours later…
11:08 AM
In our latest blog post Marshall looks at a cool technique - added in Dyalog 17.0 - called “tolerated comparison” You can read part 1 here https://www.dyalog.com/blog/2018/11/tolerated-comparison-part-1/
 
 
3 hours later…
2:09 PM
is there anything useful monadic could do?
 
ngn
@dzaima ,⊂ ?
 
:o
that reminds me, ,⊂ somehow is broken in my apl
 
@ngn I like that.
 
oh the reason its broken is because using Value.ofShape on a scalar is not allowed
:47644812 eh, misinterpreted my reasonings there a bit
still, it should've really been an error not null
 
@dzaima Did you notice my latest extensions?
 
2:18 PM
@Adám not the latest ones
 
(not updated on TIO yet) now handles all array sizes, extends its` ⍵⍵` and allows you to specify how you want edges (along each dimension separately, if you want) treated: zero, replicate, mirror, reverse, wrap. It also allows twisting.
 
oh this also is a thing.. yeaah the reshape business is hard
that specifically is a DoubleArr instance with shape and a single number in it. When getting converted to a HArr for the printing (because why would i optimize the repl printing) it gets converted to a HArr of shape , with a single Num in it.
if I made a DoubleArr of shape be equal to a scalar number always it'd make it much harder to switch to an APL where 1 ≢ ⊂1, checking out which is still on my todo list.
I wish I could tell IDEA to scream this at me every time I use Value.ofShape :p
 
2:41 PM
@Adám this is great, I like it
 
@Adám was about to complain about how the items being∘.∧⍨⍺ is strange but turns out this works too :D
 
I've also added ⊇[k] so you can select the first and third columns with 1 3⊇[2]A
@dzaima Sure, and you can omit axes too. / replicates the trailing axes, and replicates leading axes.
You can also skip axes with a scalar 1
And then I've added extensions so and all comparison functions work on characters too.
I'm currently working on the spec for a system function to manipulate datetimes, e.g. 100∘+⍢⎕T ⎕TS means 100 days from now, but this work is for the real product, not for my extended playground.
 
2:56 PM
@Adám what part of that specifies the day part? Or will that only work with days?
 
@dzaima It converts dates to a float number of days before/after an origin, so you can do calculations. It can also convert dates to human-readable text in various languages
 
3:14 PM
@dzaima how does 0 1∘⊤ work?
I know it's encoding, but I don't understand that encoding
 
@nathanrogers 0 practically means infinity for . Past that, it's regular usage of
 
3:27 PM
⎕←¯551{⍵[(0>×⍺)+12|⍺]}'Rooster' 'Dog' 'Pig' 'Rat' 'Ox' 'Tiger' 'Rabbit' 'Dragon' 'Snake' 'Horse' 'Goat' 'Monkey'
 
@nathanrogers
┌───┐
│Dog│
└───┘
 
any thoughts on this one?
same, 2018 phase 1
 
@nathanrogers 0>×⍺ is just 0>⍺, no?
 
I suppose it is :/
silly me
 
@nathanrogers You need a or just use ⊃⍨ instead of []
 
3:33 PM
{⍵⊃⍨(0>⍺)+12|⍺}
 
@nathanrogers Yup, looks good. However, to be precise, the problem calls for a monadic function, no? so you can either the right arg, or just inline it and put instead of your current s.
 
yeah, it was all inline and took year as argument
but I didn' tlike reading the expression
suppose I could have used a variable
⋄signs←'Rooster' 'Dog' 'Pig' 'Rat' 'Ox' 'Tiger' 'Rabbit' 'Dragon' 'Snake' 'Horse' 'Goat' 'Monkey'⋄⎕←{signs⊃⍨(0>⍵)+12|⍵} ¯551
 
@nathanrogers Binding an argument with or even using an operand is perfectly ok.
 
@nathanrogers
Dog
 
Does using ⊃ in place of [] have universal application?
 
3:47 PM
@nathanrogers Look at lesson 7
Gotta go. Have a good weekend, everyone!
 
 
2 hours later…
6:16 PM
@arcfide can I get a link to your paper about the use of ⌸ in your compiler?
 
hmm, if 1 ≢ ⊂1, what should ⍬⍴1 be? I can see 1 and ⊂1 both making sense
 
ngn
6:33 PM
@dzaima why 1 ≢ ⊂1?
 
@ngn because why not? :p
 
1 ≡ ⊂1 is a lot of special-cases everywhere and I've gotten tired of them
 
ngn
@dzaima that's only because you have special classes to represent scalars
 
@ngn I mean surely there's no good way to implement ⊂1 without having a check for if the arg is a simple scalar
or ⍬⍴'abc'. or 1 2 3[2]
 
ngn
6:40 PM
@dzaima for you might need to check, but i don't think so for the other examples
 
@ngn my "special cases" are the regular cases, the DoubleArr/ChrArr are special cases.
'hi' 2 'bye'[,2] vs 'hi' 2 'bye'[2 3] are wildly differently structured too
 
ngn
@dzaima A[B] has the same shape as B and the same type (before squeezing) as A
 
oh right 1 2[,2] does indeed return a 1 item array ಠ_ಠ
yeah ignore that
 
ngn
as for ⍬⍴A, it's like any other reshape
you allocate memory for ×/⍺ items of the same type as
and fill it in, wrapping around, with the elements of
 
how'd you go about implementing 'hi' 2 'bye'[2] not returning an enclosed 2? That either requires checking whether the picked items are all the same type and handling the scalarization in the resulting object, or checking if the pick returns a scalar
 
ngn
6:50 PM
@dzaima an enclosed 2 is the same as 2 in the array model used by dyalog
 
@ngn doing just that results in an enclosed one - it allocates a 1-item HArr, and puts the number in, and bam, ⊂1
@ngn right, but how does one make {1 ⍵[2]}⍣1000⊢1 not allocate 1000 nested objects?
 
ngn
@dzaima i think squeeze() (or whatever it may be called) should take care of that
 
@ngn see, that feels like special-casing a lot for me.
 
ngn
@dzaima but you need a squeeze() anyway
for instance to handle things like 2↑1 2 'c'
 
@ngn I don't need it, it just is good to call to save memory.
squeezing shouldn't be forced imo.
 
ngn
6:56 PM
@dzaima shouldn't 1 ⍵[2] be the same as ?
when is scalar, i mean
 
@ngn see, special-case
 
ngn
@dzaima but a special case in one place, not "everywhere" :)
 
@ngn a[index] is one function. Then there's , , , , ect.
 
ngn
@dzaima i meant squeeze(), not the implementation of a[index]
 
@ngn I just feel like handling special-cases in a global "please fix my mistakes" function is stupid
I even don't really like the fact that I have squeeze at all actually
i wonder how much would break if i made squeeze not recurse down the whole array (i.e. short-circuit return if from the checked items a simple DoubleArr/ChrArr can't be made) and asked the caller to do that only if it's necessary
 
ngn
7:04 PM
@dzaima you can implement the other array model of apl, then - with enclosed scalars
@dzaima more info
 
⋄wzod←'Aquarius' 'Pisces' 'Airies' 'Taurus' 'Gemini' 'Cancer' 'Leo' 'Virgo' 'Libra' 'Scorpio' 'Sagittarius' 'Capricorn'⋄nums←20 19 21 20 21 21 23 23 23 23 22 22⋄⎕←{m d←¯1 0+⍵ ⋄ wzod⊃⍨12|m-d<nums⊃⍨12|m} 1 19
 
@nathanrogers
INDEX ERROR
 
⋄wzod←'Aquarius' 'Pisces' 'Airies' 'Taurus' 'Gemini' 'Cancer' 'Leo' 'Virgo' 'Libra' 'Scorpio' 'Sagittarius' 'Capricorn'⋄nums←20 19 21 20 21 21 23 23 23 23 22 22⋄⎕←{m d←¯1 0+⍵ ⋄ wzod⊃⍨12|m-d<nums⊃⍨12|m} 1 19⊣⎕IO←0
 
@nathanrogers
Capricorn
 
that was an interesting solution there.
{m d←¯1 0+⍵ ⋄ wzod⊃⍨12|m-d<nums⊃⍨12|m} can anyone reduce that?
at first glance it appears that 12|m can be swappified, but not
problem 5 from 2018 phase 1
take a month and day, and return the sign from the western zodiac
 
7:15 PM
@ngn ah so the idea was that the shape trough depths of an array ends with an infinite amount of s
I've thought of it that way for a while, but infinity doesn't translate well to code
 
ngn
@dzaima that's just my attempt to summarize Jim Brown's paper, which is more concerned with the mathematical side of the array model than its practical implementation
 
it just feels strange that x ≡ ⊂x for only some x
 
ngn
@dzaima initially i felt the same way too, but then i became convinced that this is consistent
 
ngn
@nathanrogers is that your best-golfed solution?
 
7:33 PM
no
@ngn it's my best attempt at legibility
though, I'd be interested in whether ⊃⍨12|m can be reduced
it looks like a great opportunity for a macro!!! @Adám @arcfide
 
ngn
@nathanrogers legibility is in the eye of the reader... well, i can read it, so it's good :)
 
well, directness then
maximinimal explicitness
 
ngn
@nathanrogers yes, nums⊃⍨12|m could be ⊃m⌽nums (assuming ⎕io←0)
 
io is 0
the solution wouldn't work otherwise, hence ¯1 0 + ⍵
where month -1 is the index to nums
 
wow so ugly and it doesn't even work lmao
 
7:49 PM
what is it you're trying to do?
unique combinations?
 
8:11 PM
@arcfide do you have a bug on page 5?
⎕←{⍺ ⍵}⌸⍨∊x←1 6 4 1 0 1 3 1 2 1
 
@nathanrogers
┌─┬─────────┐
│1│1 1 1 1 1│
├─┼─────────┤
│6│6        │
├─┼─────────┤
│4│4        │
├─┼─────────┤
│0│0        │
├─┼─────────┤
│3│3        │
├─┼─────────┤
│2│2        │
└─┴─────────┘
 
Does that link work for you?
 
Well I guess it works for only you then
 
8:24 PM
@nathanrogers code golf challenge increasing digits only (247, 123, etc.)(not 113 or 541)
 
8:38 PM
@ngn what's the advantage of 1≡⊂1 though? that's a thing I'm still wondering about
 
In what ways would 1 and ⊂1 behave differently, except for that they are unequal, and have different depths ()
 
@H.PWiz I wasn't sure what to answer at first but depths seem like a thing that definitely should increment with each added
and even if everything else about 1 and ⊂1 is the same, I still don't see a reason for them being equal having an advantage
 
ngn
@dzaima i can't really compare, as i've only used the 1≡⊂1 model, but it seems to me that with 1≢⊂1 you'd be forced to use a lot more for simple operations
 
@ngn well your original ngn/apl was 1≢⊂1 :p
@ngn that's the simple operations fault for enclosing then imo
 
ngn
@dzaima that was very early in its development
 
8:46 PM
@ngn but from the issue it seems like you didn't know about it, not that it was a bug
 
ngn
@dzaima correct, i didn't know about it :)
 
@ngn so, logic says that you used (even if unknowingly) the 1≢⊂1 model
 
ngn
@dzaima yes, that's how i started and it was not intentional
 
I remember being very confused about why +/(1 2)(3 4) returned an enclosed result because +/1 2 3 didn't. +/1 2 3 not returning an enclosed result feels special-casey to me
^ another reason for my APLs f/vec automatically disclosing the result
 
I don't understand why you see it as auto disclosing. I would just see it as not enclosing in the first place. There isn't really a good reason for it to be enclosed.
 
ngn
8:52 PM
@H.PWiz reduction always removes one dimension from the shape
 
@H.PWiz the good reason for f/vec returning an enclosed result is consistency among dimensions. I didn't think that was worth it. (but yeah, I think of it that way too, just that the people here are more used to Dyalog APL than mine :p)
@H.PWiz isn't it strange how in this the last line suddenly hops to 5 6, not logically stay at ? (i know i'm arguing against my own decisions, but whatever :p)
 
maybe
 
 
3 hours later…
11:52 PM
what is cross product in APL?
 

« first day (660 days earlier)      last day (1995 days later) »