« first day (722 days earlier)      last day (1940 days later) » 

1:55 AM
One of the topics addressed in the codfns presentation this year is that APL is particularly difficult to parse. Are there any good blog posts investigating how the syntax of APL would have to change to make it easier to parse?
 
2:26 AM
I guess I don't mean syntax, I mean grammar. And I ran across a literature review on APL, which makes me less convinced that APL grammar is in fact difficult. Part of my thinking is in the context of meta-programming, although I suppose that meta-programming doesn't need to operate on the textual representation of a given language.
 
ngn
@eyepatch what is the specific difficulty mentioned in that presentation?
 
@eyepatch and what literature are you referring to? I'd like to read it
 
2:48 AM
@eyepatch I can't imagine what about APL is hard to parse, besides getting comfortable with the symbols and what they represent.
 
ngn
@Quintec sequences of names are hard to parse because you don't know until runtime whether they represent arrays, functions, or monadic/dyadic operators
in dyalog some expressions containing dots cause trouble because a dot could mean many things - inner product, outer product (after a jot), lookup from a namespace, decimal point in an fp literal
tradfn headers are also very messy
 
3:30 AM
I've never read non-golf APL
 
4:04 AM
@Quintec Hard to parse for a compiler. Rather than humans.
@ngn After resolving the ambiguity of square brackets using a lexical analyzer, Giradot and Rollin show that APL2 is LALR. The review is: https://cs.nyu.edu/manycores/litrev.pdf
 
 
3 hours later…
7:09 AM
@eyepatch a simple question - in {⍺⍺ - ⍵} is - called monadically or dyadically? A compiler must know that, but that requires knowing rhe operands type, which is annoying to deal with in a compiler
i have no idea if that's what codfns was talking about, but it surely is a thing that's annoyed me
also this is cool i guess
 
 
2 hours later…
9:14 AM
Page 30 of "An Introduction to Array Programming in Klong" [1] introduces an exercise involving pretty-printing matrices of numbers. Here's my solution (38 characters):

`pm::{.p'(,/'+{(-|/1+#'x)$'x}'+$x);[]}`

That's half the size of the book's solution (76 characters):

`vf::{(-|/{#$x}'x)$x}`
`mf::{+vf'+x}`
`pm::{{{.d(" ");.d(x)}'x;.p("")}'mf(x);[]}`

(Note that both solutions include an extra leading space in every row.)

[1] http://www.lulu.com/shop/nils-m-holm/an-introduction-to-array-programming-in-klong/paperback/product-23925566.html
 
 
1 hour later…
10:36 AM
@nathanrogers p2: You may want to exploit the fact that when you try to evenly divide a non-integer by 1, the remainder is the fractional part.
@nathanrogers p3: You have an unnecessary parenthesis around and can get rid of the inner dfn with '*'⊣¨⍵. Also, I'd recommend using monadic , over monadic whenever possible, as it "does less".
@nathanrogers p4: Consider using A⊃⍨B instead of ⊃A[B] when A is nested and B is a scalar.
 
10:55 AM
@nathanrogers p5 is really clever. Nice! You could avoid splitting by changing the dfn to be dyadic and insert it into the pair ⊃{wzod⊃⍨12|m+⍵<dates⊃⍨12|m←⍺-1}/ or you could use indexing and pre-process the argument with {wzod⊃⍨12|⍵[0]-⍵[1]<dates⊃⍨12|⊃⍵}-∘1 0 but don't get me wrong, your solution is good as it is.
 
11:06 AM
@dzaima As of today, it does use binary search.
@nathanrogers p6 requires work. Here are some hints: You can filter with and look for starting points of contiguous subarrays with
@nathanrogers p7 does the same (expensive) computation twice. When you see things like (f g A)h g A consider "factoring out" g: (f h ⊢)g A or even h⍨∘f⍨g A
@nathanrogers p9 could benefit greatly from looking into dyadic .
 
 
1 hour later…
ngn
12:40 PM
@jordancurve so, from what i gather, klong is "in the public domain or whatever you call it" (quoting from its licence file), yet the book is paywalled. klong's performance is "abysmal" compared to k and it deviates substantially from its syntax and semantics. i wonder, what's the point...
 
 
2 hours later…
2:10 PM
@dzaima Fixed in 18.0:
      w←⍳1000000
      ]runtime -c "ר⍨w" "{⍺×⍵}¨⍨w" "(⊣×⊢)¨⍨w"

  ר⍨w     → 1.9E¯3 |      0%
  {⍺×⍵}¨⍨w → 3.0E¯1 | +15633% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (⊣×⊢)¨⍨w → 1.7E¯1 |  +9166% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
2:51 PM
@Adám oh cool :D does that mean this has changed or was that some special case?
 
@dzaima What has happened is that for trains, the last stack frame is skipped, so a train may very well be faster than an equivalent dfn.
 
 
2 hours later…
4:38 PM
@Adám you said p7 but linked to p8. which one has the expensive operation?
the ∪⍺ in p8?
 
@nathanrogers Sorry, that was a typo, yes, in p8.
 
 
2 hours later…
6:52 PM
It would have been helpful if I included the exercise I was solving, given that the book isn't free. Here it is: imgur.com/gallery/kJSFlGV
@ngn, Klong's reference guides are both comprehensive and in the public domain (t3x.org/klong/index.html). I wanted to learn how K-like languages worked, and I couldn't find that kind of documentation for oK, or for the version of k I downloaded from kx systems, so I started with Klong, even though it diverges from K. Would like to hear other suggestions.
 
@jordancurve I think Kona is fairly well-documented, but of course it isn't J or APL level documentation.
 
ngn
@jordancurve suggestion: hang out here in the orchard and ask us :)
all apl descendant languages are considered on topic
and there's nothing wrong with learning klong too, of course
 
ngn
7:20 PM
@jordancurve so those are factorials? in k you can generate them more elegantly with *\1+!12 where \ is "scan" - cumulative reduction
 
Thanks, I intend to ask more questions here, but I come from a RTFM background. I prefer to learn from well-documented systems. I spend a lot of time poring over references.
 
ngn
to rearrange them in a matrix: +4 3#. the shapes in klong seem to be reversed
@jordancurve yeah, it's sad that the best-designed programming language i've seen originates from a culture hostile to openness :(
 
My ultimate goal is to learn actual K. Just starting Klong because I found it small, approachable, and well-documented, and it claims some similarity with K.
 
ngn
but with a bit of research and reasoning it's possible to get around this
 
Q is well documented, but I didn't see a direct way to translate Q knowledge into K (though I suspect it would work that way once I learned Q well enough).
 
ngn
7:25 PM
@jordancurve did you try oK?
 
Yes, I like it, but again, I couldn't find comprehensive docs for the language it implements.
I have no prior experience with any apljk language.
 
ngn
it's got a relatively detailed manual
 
That's pretty good, I missed that. I think with what I know now, that would be enough to get me going!
 
@user456082 @user505654 If you want write access, email adam@ with the domain of www.dyalog.com
 
Oh, the other thing that discouraged me with oK is that the author doesn't seem to respond to issues on github any more.
 
ngn
7:28 PM
and you can experiment with it in your browser. there are a some sample programs too, using an oK-specific graphics api
 
Klong's author at least cares about bugs, even if his system isn't that great in a lot of ways.
 
ngn
@jordancurve i responded for him :)
 
Thanks, that's helpful. :)
 
ngn
@jordancurve that's a good thing. where is its bug tracker?
 
idk what he uses to track issues. Probably his email inbox, but that's just a guess.
 
ngn
7:32 PM
@jordancurve regarding q - it's basically k, but monadic verbs have been replaced with english words
 
Ah, so all the adverbs are the same? That doesn't sound too daunting.
 
ngn
@jordancurve yes
there are only 6 adverbs - ' / \ ': /: \:
 
Cool!
 
@ngn But they are very heavily overloaded, no?
 
ngn
@Adám yes, they do different (but related) things depending on the types of the arguments
@jordancurve keep in mind that k changes a lot between releases (every few years), and copycat implementations are often incomplete or incompatible with the original
klong is the most incompatible i've seen so far
oh... maybe kerf is in that category too
they should probably be considered completely different languages, just like how apl and j are different
 
7:48 PM
@ngn J is definitely a dialect of APL. It is basically identical to the last version of Sharp APL, just with an ASCII spelling scheme. It was originally called "APL\?".
 
ngn
@Adám "a language is a dialect with an army and a navy" ...
@Adám many primitives behave differently, no?
 
What about the air force
 
ngn
@Adám example: dyalog's ⍳2 3 generates a matrix of index vectors, j's i.2 3 is like apl's 2 3⍴⍳6
 
@ngn Those are both non-standard extensions of ISO APL.
 
ngn
@Quintec haha, idk :) it comes from yiddish maybe @Adám can answer? :)
@Adám yet, people use them
 
7:56 PM
@ngn It literally means "army and fleet", but it was stated during WWII so air forces were not so popular yet.
@user456082 Hi.
 
8:30 PM
hello! thanks for letting me chat - hopefully someday i'll have a better username.
also hello ngn, we talked a bit about my project euler k exercises on github - that project has been by the wayside for a bit now though.
by the way, are any folks here planning on going to the dyalog meetup in nyc?
 
@user456082 Try going here to change user name.
@user456082 You can ping people with an @ right before their name.
 
@Adám thanks! (@ngn, see above :) )
 
ngn
@user456082 hi! i remember. welcome to this chat :)
later i managed to solve all problems up to 100 in my impl of k
 
@ngn ah, i should look into it :)
my friend and i made j 'demos' for a demoscene party recently, which is the first time in several months i've worked with array languages.
 
ngn
8:45 PM
@feeb i'm keeping the impl private for now, but you can try it online
 
@feeb Paul Mansour visits this room occasionally. Morten Kromberg and Brian Becker peek in every once in a while too.
@feeb So you are into both J and K?
 
@Adám yes, but i have the most experience with APL.
 
@feeb Oh, really. Yeah, I'm basically an all-APLer myself, though I occasionally dip my toes in the J/K water. What is your background in general?
@feeb Btw, you can execute simple APL expressions right here in the chat room:
⎕←4+⍳2 3
 
@Adám
┌───┬───┬───┐
│5 5│5 6│5 7│
├───┼───┼───┤
│6 5│6 6│6 7│
└───┴───┴───┘
 
9:29 PM
@Adám i'm a self taught programmer, but have recently been doing much more security related work. learning apl was my way of taking a bit of a break from that, and i'm just interested in alternative models of programming/computation in general.
 
@feeb So how fluent in APL are you? Which APL flavour?
 
9:42 PM
@Adám mostly dyalog. i liked tacit composition way too much to switch to GNU APL which i think was missing that last i checked. ngn/apl is also lovely though.
@Adám i don't have many people to compare myself too, so i don't know how fluent i am relatively, but i feel quite comfortable with it, comfortable enough that i lead some introductory APL workshops at The Recurse Center.
 
@feeb Oh wow. I'd love to give introductory courses. I hosted a few weekly lessons here in this room last winter.
 
i highly recommend The Recurse Center as a programming community :) while relatively few people there were specifically interested in APL, a lot of people were curious enough that they were well-attended and fun to give. the spirit is such that anyone in the community and just go ahead and give workshops if they want.
 
@feeb Then you're probably with me in wanting even more (of J's) compositional operators added to Dyalog… I've modelled some.
 
@Adám oh, those lessons look great. i'll bookmark them and work through them. in the past when i've lurked here i've really appreciated the idioms you've posted.
 
@feeb That's really interesting. Maybe we should have people who pass through NYC be guest speakers there (if that even exists). And that may be a good place for US companies looking for potential APLers to find those willing to learn it.
 
9:57 PM
@Adám, would you like me to reach out to some of the people that run it on your behalf? (i'll cc you in if they show interest).

for the second point, definitely :) if i had any idea of how to find people looking for APLers, i would've tried to work there rather than where i am now.
 
@feeb Let me mention it to our CXO and he'll probably email you. Is that's ok?
 
@Adám, yes absolutely.
 
@feeb How flexible of location are you? A huge company is looking for someone to work in NJ. They'll provide APL training if necessary.
 
@Adám, unfortunately, in this moment i have some work linked up that i'm excited about so i'm not thinking about switching at this time.
 
@feeb Oh, sorry about that.
 
10:09 PM
if i added a built-in like but which returns all the results, should it also return the argument? i.e. should 1∘+ reps {7=⍵}⊢3 have the 1st item be 3 or 4?
 
@dzaima hm... I guess including it would be more natural, as that's what a function that does it with a normal ⍣ would do too
 
@EriktheOutgolfer the regular doesn't output the anywhere, except if ⍵⍵ is 0
alternative question: would the version with a number ⍵⍵ return an array of ⍵⍵ elements or execute the function ⍵⍵ times? you can't really have both
 
@dzaima Maybe have it take an array of number of iterations, then ⍣0 1 2 3 would return a list of four (including initial value) and ⍣3 would just be the last one, and ⍣∞ would be the fixpoint.
 
@dzaima I mean, with regular ⍣, one would alter the function so that it uses an array with previous results in as well (that is ), and each result would be appended to the previous ones, so, in the first iteration, the original (which might have already been enclosed to accomodate for the function) won't be removed just because it's the first iteration
 
@Adám that doesn't work for things like 1 ((+∘÷) reps ≡) 1
 
10:17 PM
@dzaima That's +∘÷⍣∞
 
@Adám special-casing infinity there feels very strange, I'd expect it to call ⍺⍺ infinite times
 
@dzaima Well, there would (besides for side effects) not be any way to determine that it took a shortcut and didn't call ⍺⍺ infinitely many times.
 
@Adám side-effects is exactly what I'm talking about though
 
@user118369 If you want to participate here, just drop me an email to adam@ with the domain of www.dyalog.com
 
@Adám unpingable...
 
10:21 PM
@dzaima So ⍣∞ would loop indefinitely with no way to stop?
@EriktheOutgolfer May still notice.
 
@Adám aaalso so you would expect ⍣∞ to return an array of the intermediates instead of any other number ⍵⍵
 
@dzaima Hm, I forget how J does it. I'm not sure if it is ⍣(⍳∞)
 
@Adám viewing chat while signed out? :P
 
@Adám ⍳∞ what
@Adám and either way I'd have to add a new built-in for the function ⍵⍵ case, since there's no other way to make 1∘+ reps {7=⍵}⊢3 work as expected (assuming the return condition isn't that easily calculable)
 
@dzaima That'd need cheating. OK, looked it up. J does the array thing, but has a shortcut, ⍣(⊂n) means ⍣(⍳n) and ⍣(⊂∞) means ⍣(⍳k) where k is the smallest integer which is large enough to stabilise the result.
 
10:27 PM
@Adám again, that only works if the exit condition is exactly the function , and nothing else
 
@dzaima Not true, because A f⍣g B is defined (in J) as A f⍣(A g B)⊢B so if g returns ~exitCondition you can write ⍣ExitCondition⍣(⊂∞) for all values until the exit condition is met.
Since ⍣ExitCondition becomes a no-op eventually (by g causing 0 applications of f), ⍣(⊂∞) will stop.
 
@Adám so that J's equivalent actually isn't an until/while loop? that's a whole different builtin :|
 
The reason Dyalog's isn't like that is because we have neither ⊂simpleScalar nor .
@dzaima It is very simply a repeat operator, it repeats as many times as instructed. Very simple.
 
I'm pretty sure being a while until loop is the main thing that makes my APL turing complete (besides recursion which is very limited) :p
 
@dzaima But J's provides exactly the same functionality (and more!), you just have to negate the exit condition.
 
10:34 PM
@Adám afaict it requires calculating the point of exiting, which can be a lot more complicated than the actual execution
 
@dzaima No it doesn't. APL's f⍣g B is f⍣(~g∘f⍨)⍣∞⊢B in J.
 
@Adám oh i misread your "A f⍣g B is defined" as being equivalent with a non-existent A :|
uhh so what exactly is Js f⍣g B equivalent to in regular APL?
 
1∘+⍣{7=⍵}⊢3 in Dyalog is 1∘+⍣{(1+7)≠⍵}⍣∞⊢3 in J.
@dzaima J's f⍣g B is exactly the same as Dyalog's f⍣(g B)⊢B
 
@Adám oh wait so if one of the iterations of 1∘+ would return the same value as the previous (yes, impossible here, but with side-effects it can) it'd terminate the loop early?
 
… which is great for tacit programming as Dyalog's definition makes it impossible for the original argument to influence how many times to apply f.
@dzaima Yes, because g would evaluate to 0 so f wouldn't be applied, and the right-hand would detect no change and stop.
 
10:44 PM
so if i wanted to have a side-effect-only while loop i'd be forced to make the function return a forever-incrementing value or something?
 
@dzaima Btw, J's only compares successive results. K's looks at the entire history to detect loops.
 
@Adám i remember ngn saying something about it not looking at the entire history? or was that only his impl
 
@dzaima Hm, not sure. At least you could alternate between two values.
{~⍵ ⊣ side effects}⍣∞⊢0 would run forever in J.
@dzaima I'll ask Marshall about that tomorrow.
 
heh so a regular until loop would be {(~⍣untilCondition)⍵ ⊣ whatever}⍣∞⊢0
@Adám also i personally find having to use 2 s for a simple loop strange, even more so because that requires both infinity and enclosing scalars
 
@dzaima I agree there. Btw, sometimes you need two consecutive s, did you know that?
 
10:52 PM
@Adám ... outside of that one speed-test of tables i haven't ever used f⍤A :p
 
@dzaima You should — it's enlightening. Only once you've mastered have you become a true array programmer/thinker.
 
I seem to have survived APL without it, but I couldn't say the same if I didn't have f⍣g
hmm, am i actually correct in thinking that without f⍣g and recursion, APL isn't turing-complete?
 
@dzaima Most APL's have goto (and even other control structures).
 
@Adám gotos are horrible; but you're right that having control structures for infinitable stuff makes sense
 
Without control structures or gotos or some repeat functionality or recursion, I don't think any programming language is TC.
@dzaima Btw, APL has allowed infinite recursion since day 1.
 
10:59 PM
@Adám not my APL :p
@Adám that's why i feel like that having a simple inline repeat functionality is useful, as otherwise you just can't do some things in a simple inline expression
ಠ_ಠ right i haven't even implemented for dfns
 
@dzaima Oh no! That's implementation dictating design. Biggest no-no in APL philosophy. Let the computer suffer for the programmer's bliss.
 
@Adám well between the choices of recursion and a repeat one has to be taken. Allowing writing code that requires some looping is a thing for the programmer
and personally I find a repeat builtin more understandable than recursion, it being easier for a computer is just a coincidence.
 
Gotta get some sleep ○/
 
@Adám :| me too, right..
currently I've got this, with being a random character choice. If anyone has any objections, please voice them for me to read for tomorrow. (no idea what I'll do with )
 

« first day (722 days earlier)      last day (1940 days later) »