« first day (1488 days earlier)      last day (218 days later) » 

1:30 AM
Hi! This is pretty basic, but I've been trying to port some APL examples I've found to BQN, and was wondering if someone had advice on improving this FizzBuzz example I've been playing with. I know the APL solution managed to avoid map, but haven't figured out the BQN version that does the same.

(⊐{0=15‿3‿5‿50 | 𝕩}¨(1+↕100))⊏⟨".", "Fizz", "Buzz", "FizzBuzz", "."⟩
 
1:49 AM
What's the channel name on FreeNode that the 'bot bridges to?
(/me has an IRC client that 'lives' on FreeNode, so I can join there, too...)
 
<moon-child> #apl
 
@Adám working on it now
 
2:09 AM
Thank you, moon-child!
 
2:19 AM
@LukasHermann (Is there a reason today's BQN question day?) Hm, I definitely wouldn't want to use Classify in my ultimate solution. If things change a little, the ordering could break completely. But the way I'd get rid of Each is to use Table, replacing {0=15‿3‿5‿50 | 𝕩}¨ with {0=⍉15‿3‿5‿50|⌜𝕩}. That gives you a shape 100‿4 array instead of a list of lists.
You can remove 15 from the list of divisors since 15|𝕩 is determined by 3|𝕩 and 5|𝕩 (the Chinese remainder theorem). 50 can't be removed without changing the behavior, but what it's doing is to change the result entries for 50 and 100 from "Buzz" to ".", which isn't standard FizzBuzz. I don't know if that's intended.
 
@Marshall Thanks! The reason I'm asking is partially because I've managed to get BQN running in Observable notebooks and was looking for example problems to throw at it
 
@LukasHermann Oh, that's pretty cool. Share a link if/when you can!
 
@Marshall Will do! I'm hoping to release the notebook by the end of the weekend. It's fun to mix the HTML parts of JS with BQN's goodness. (example) snpy.in/T1djCR
 
2:41 AM
@LukasHermann Why the backslash encoding? Definitely nice to have everything working together seamlessly. I spent a short while thinking about how I might expose back and forth interop with BQN before realizing that closures are all you'll ever need. Pass a JS function to BQN, or make a BQN function and call it wherever you want, it should all just work.
The one medium-sized annoyance being that functions with two arguments take 𝕩,𝕨 in JS. Consistent with the one-argument form but easy to confuse.
 
@Marshall It was mainly as a way to avoid using the bookmarklet when I use observable on my phone, hahaha
I should note it's literally the parser script from bqn.js completely unchanged, so whatever works with that will work with this
 
@LukasHermann Oh, that's understandable.
 
@Marshall Just to see if I understand (since I haven't delved too deeply into it), does that mean that BQN can consume the outputs of other bqn functions?
for example my hacky mapping to string vs being able to directly feed it
I also made a formatter method that converts backslash notation to BQN strings in the notebook for when I want to write something quickly and see it pretty printed
 
@LukasHermann The way to pass in a value is to call bqn and get a function out, then call that function on arguments. So (bqn`{2+𝕩}`)(3) or something like that.
 
@Marshall Oh! That will be fun to use in a notebook context for sure
 
2:51 AM
There's no verification that the arguments are valid BQN values, so you'll have to pass in outputs from other BQN computations, or know how BQN values are encoded in JS, which is pretty simple.
Numbers are numbers, characters are one-character strings, arrays have the elements in index/Deshape order as a JS list plus a sh property giving the shape, and functions are JS functions with one or two arguments, 𝕩 first.
Modifiers are also functions (taking 𝕗 first, so it does follow BQN order), but with the .m property set to 1 for a 1-modifier and 2 for a 2-modifier.
I should probably just make a page on this in the documentation.
 
Ah I see, thanks for the tips! I'm having a blast playing around with this stuff
 
 
6 hours later…
8:51 AM
@Adám So funny that you mentioned that video, I just stumbled across it a couple of days ago. Lately I’ve been really impressed with the expressivity that Haskell’s algebraic types and extensive type classes allow. Especially for math, it makes working with all sorts of structures from abstract algebra, and occasionally even from category theory, lots of fun.
I haven't had a chance to watch the video end-to-end, so maybe a piece of it was addressed there. But my sense was that it addresses boring old type systems for boring old reasons, eg. compiling & correctness. Does anyone have any thoughts on a dialect of APL with a type system a la Haskell focused solely on expressivity? (With any other benefits being happy accidents.)
I’m really curious as to how one deals with those abstractions in APL. So the other prong to the question is whether there any papers, dfns, libraries, or other resources I could look over for to see how those things might be done as is. (I know it’s a bit vague, I’ll be happy to give some concrete examples.)
@Marshall This is all yours, too! Any ideas/plans for how BQN might handle abstractions?
 
<moon-child> @AviFS haskell's type system isn't less about compilation and correctness than other language's type systems, it just lets you express more in the type system and get more performance and correctness guarantees than you would from other languages
<moon-child> wrt apl, I recommend looking into dependent types
 
@DyalogAPL Absolutely. And many, if not most, Haskellers care about it for what I'll call the 'boring' reasons that I mentioned. But the expressiveness is why I like it and am thinking about a dialect in the family that would focus on a type system with nothing more than enhancing APL's notation as tool of thought motto in mind.
@DyalogAPL Definitely! There's all sorts of even more expressive and sophisticated type systems. Dependent types would be even cooler
Is there a reason you recommend them specifically for APL?
@ngn Hey! Long time no see. Having put together an APL from scratch (not forgetting dzaima), do you have any thoughts?
 
9:06 AM
I know this comparison is a bit unfair, and I'm cherry picking here, but dfns are really slow in Dyalog.
The following runs in 4 seconds on my machine on Dyalog: {⍺+⍵}/⍳10000000
Plain KAP with everything boxed (before my optimisation work to support types arrays), the same took: 0.847 seconds.
When I try it in the version of KAP with specialised arrays, the same takes 0.01 seconds.
Why is it so slow in Dyalog?
 
<moon-child> @AviFS you need dependent types to describe array shapes, and relationships between array indices and the arrays they index
 
ngn
@AviFS i like haskell a lot, but i'm sceptical about the practical value of static typing in apl
@AviFS have you seen anders' talk?
 
ngn
9:34 AM
@EliasMårtenson don't say that in this chat or else someone from dyalog may start feeling personally attacked again :)
 
9:52 AM
@ngn Well, I did prefix my question with the point that I'm cherry picking.
Also, I do think I know why it's slow, and that there may be less opportunities to make it fast in Dyalog's case. I personally think it's because dfns needs to be re-parsed for ever call.
KAP gets away with this because it doesn't allow redefinitions of functions inside a statement.
But I'm wondering if there is any other reason.
 
ngn
@EliasMårtenson you mean re-tokenized for every call? (apl can't be parsed statically) i think that's done only once
 
@EliasMårtenson where is KAP? can we try it?
 
@DyalogAPL You do? You mean that, for instance given m←2 2⍴⍳4 then a⌹m yields a valid type iff ⍴a=2?
 
<moon-child> @AviFS yeah, except that ⍴a and ⍴m don't have to be known at compile time. Dependent typing lets you prove that the relationship between the two shapes will be such that a⌹m is valid
 
10:04 AM
@ngn did you try it? is it complicated to build?
 
@ktye there's also this at the bottom of the readme
 
@ngn Not even sure about the level to which it'd need to be enforced, or anything. And certainly not sure it has to be static. My interest is in making it more expressive and more natural to do some fun things. Not making large codebases more maintainable, correct or fast.
 
ngn
@ktye i haven't tried to build it but there's the "try online" link dzaima mentioned
 
@dzaima thanks. i've seen it. but thought a native version is better suited to check it's speed.
 
I'm appealing to the zany, experimental, childlike side. Not the pragmatic adult side ; )
 
10:08 AM
<moon-child> @ngn doesn't ngn/apl do static parsing? ;) It should be possible in the absence of ⍎, if you force name classes to be static
 
@ktye for building, iirc it was just the ./gradlew build in the readme, with java 8
 
@DyalogAPL The second sentence makes me think we're on the same page. But the 'except' bit implies we're not. Mind clarifying the first sentence for me?
 
ngn
@DyalogAPL <moon-child> ngn/apl doesn't exist anymore but yes, it used to impose certain restrictions in order to be able to parse statically
@DyalogAPL <moon-child> if ⍎ executes in the global scope and never returns functions, it should be ok too
 
@ngn no, KAP is properly statically parsed, just like ngn/apl
 
<moon-child> @AviFS say I have vectors X and Y (ignoring rank poly for the moment to keep things simple). The expression X⍳Y has shape ⍴Y and its elements are integers refined by the condition <∘(1+⍴X). That means that (X,0)[X⍳Y] is known at compile time to be type safe, and we can have no idea what the actual shapes of X and Y are until runtime
 
10:17 AM
@ngn Well, that's my point. I believe the speed difference comes from the fact that Dyalog (being APL) cannot be parsed statically, while KAP can, and can therefore benefit in this particular case.
 
@EliasMårtenson For some reason I remember Dyalog's dfns being 100x+ faster than dzaima/APLs, but dzaima/APL is only ~2x slower than Dyalog for that (7x for {-⍵}¨⍳1000000, but still not 100x)
 
@ktye There are three versions: JVM, native and JS. Native is roughly 10-20 times slower than JVM. JS is about 100 times slower than JVM.
 
@EliasMårtenson is native a distinct implementation, or generated by kotlin?
 
@ktye It's compiled using Kotlin Native.
And Kotlin Native is kinda slow.
 
@DyalogAPL Sorry, that took me a moment to parse! Understood. The 'yeah, except' wasn't undoing what I said; you were extending it. In other words, dynamic typing does take care of when we know ⍴m=2... but it doesn't even have to know that at compile time. It can infer the validity without knowing the precise dimensions at compile time. Did I follow?
Sorry for my slowness. Today was the Putnam and it's past 2 AM on top of it! Be back tomorrow
 
10:23 AM
<moon-child> heh, past 2am for me too. SHould go to bed...
 
But did you take the Putnam : p
 
<moon-child> well, no
 
I win! We should still go to bed, though ⍥/
 
Wait where is it 02:00 now?
 
<moon-child> pst
 
10:26 AM
I have no idea what PST is... Which probably means it's in the US :-)
 
Pacific Standard Time. UTC-8, iirc.
 
@dzaima hm, now it's complaining about some jansson.h file not existing. ./gradlew gui:run works fine though
 
@dzaima You only need the native libraries if you build the native version.
The JVM version should run without any dependencies, just run gradlew gui:run
@dzaima On debian or ubuntu you need to install these packages to get the native version to run: libicu-dev libcurl4-openssl-dev libjansson-dev
 
what's the way to time things in KAP?
 
@dzaima time:measureTime { ... }
The version is master doesn't have support for specialised arrays. That's still in a separate branch as it's still pretty broken.
measureTime is just a library function by the way, it's implemented in terms of time:timeMillis: github.com/lokedhs/array/blob/master/array/standard-lib/…
 
10:47 AM
ForcedElementTypeArray is apparently the only things that complains about making APLValue a class, with its : APLValue by inner
 
@dzaima Yes. I changed that, and tested it today actually.
There was no measurable performance difference.
ForcedElementTypeArray however is part of the specialised-arrays branch, it shouldn't be in master.
 
well, back to master, where it apparently compiles
 
In any case ForcedElementTypeArray is only used by test cases (to ensure that an array is specialised or not). So you could just remove it :-)
It's just an array that overrides the specialisation
In fact, now that I think about it, that class probably belongs in the test module instead of the main code.
 
@dzaima i see no performance difference for {+/{+/{÷-⍵}¨⍳1000000}¨⍳10}, and am too lazy to find anything better to test. ¯\_(ツ)_/¯
i guess the jvm really is just pure magic
well, back to work on singeli (and killing the few gigabyte RAM usage of gradle)
 
ngn
11:03 AM
hah, java
 
@dzaima Thanks for the experimentation. :-)
@ngn The JVM has given me some reparakable performance in some cases where I would never have expected it.
However, primitive types are a nightmare, and without a macro system in Kotlin, implementation of specialised arrays is very, very ugly.
 
ngn
@RGS touches c at a low level. wait what..
 
@dzaima (no clue how gradle manages to use so much RAM for cache apparently and still compile KAP slower than dzaima/BQN does (both are of roughly the same size))
 
ngn
@EliasMårtenson but you have no control over how things are laid out in memory, when they are gc-ed, which loops are vectorized..
 
@ngn i mean, you don't have control over which loops are vectorized in C too
 
ngn
11:12 AM
@dzaima right, but there are language extensions for that
 
11:34 AM
@MortenKromberg SE.Link.Version says 2.0.3
      ]link.import # .
INDEX ERROR
Run[25] ⎕SE.SALTUtils.c.Link.(RSLT←OPTS(⎕SE.Link⍎CMD)ARGS) ⍝ dot our way home
                                       ∧
 
@ngn True, but even if I did, with lazy evaluation it'd be hard to take advantage of it.
And if I wanted to, with specialised arrays I could do specific memory layout by usin gnative arrays.
It's not really part of my todo-list though.
@dzaima Well, first and foremost: Gradle is absolute garbage.
Secondly, Kotlin compiles slower than Java.
Thirdly, it used to be a lot worse. Now it compiles and runs the GUI in 10 seconds with a clean build.
 
@EliasMårtenson maven gang :)?
 
@KamilaSzewczyk Maven was my most hated piece of Java technology together with Spring. Well, until I discovered Gradle that is.
 
11:50 AM
i feel you, i hate computers too.
 
RGS
Watching these discussions is soo entertaining 🍿🍿
 
lol yeah
 
ngn
@EliasMårtenson you hate spring? have you tried ejb-s? :)
 
@ngn I have. It's remarkably less horrific than Spring, believe it or not. Either that, or working for Sun made me less critical.
But yeah, now that I think about it, I followed the development of EJB's from 1.0 (you know, back when configuration was a serialised Java class), via version 1.2 or so when you configured it using XML files until 2.0 when it switched to using Java annotations.
 
ngn
ejb2 was horrible. ejb3 less so - it was influenced by spring.
 
11:59 AM
The 1.0 style was a serious "what were they thinking" moment.
 
ngn
@EliasMårtenson weren't the annotations introduced in ejb3? i might be misremembering
 
@ngn didn't know you as a java guru!
 
ngn
@ktye sometimes we all have to do stupid things for money :/
 
12:25 PM
I wonder what java written by whitney would look like
Is there even any way to not make java so verbose?
 
@rak1507 pass source through the C preprocessor :)
 
lol
there aren't any macros or anything right?
 
@rak1507 right
@dzaima (which is something i at one point really considered just doing for dzaima/BQN. but at that point i could also just make a DSL with proper-er code generation, but that's much more difficult, so i ended up doing nothing :P)
 
I wonder if anyone has ever used the C preprocessor for java, I didn't even think about that but it would work in theory... right?
Would probably be somewhat of an abomination
 
oh, probably some template, going the "proper DSL" path
 
12:32 PM
I think you posted it here before, what was that website that you could use for searching git repos?
 
(search; way too many cases of C code in comments for that to be properly searchable)
 
That's the one!
yeah, too many comments :(
 
It's week #100 of the Perl Weekly Challenge, so I'm gonna live stream at 14:30 UTC twitch.tv/rikedyp - if there's time I'm thinking of tinkering with multi-line TryAPL input as well
 
I was thinking of twitching implementation of a delayed status message, i.e. begin process, and if more than 1 sec has elapsed and we're not done yet, print "processing…" and later "done".
Maybe Tuesday or Wednesday at 16:00 UTC.
 
12:50 PM
that sounds interesting
 
Which day is better for you?
 
none of them lol
 
:( tuesday works better for me I think
I will technically be in an online maths lesson at 4 on wednesday but that wouldn't necessarily stop me from watching
 
@Razetime Too late at night?
 
a bit late
that's not a problem
the problem is I have exams
 
12:58 PM
@ngn I think you're right. It's been a while :-)
 
@Moonchild where did he mention that, do you mean in the 'does apl need a type system' video that Adám linked?
 
yes
 
ok will listen to it
 
1:25 PM
@user41805 I watched the video. I don't recall him going into any more detail other than saying it was many times the length of the code, so it wasn't useful. He also mentioned that it was still not expressive enough,
 
I can ask him to come here and discuss it all.
 
that'd be great!
 
Request sent.
 
rewatching that talk, I can't help but feel like there's a conflict between what he says about being able to delete code and stuff and the fact that it seems historically no one has actually taken that attitude towards production APL
 
@rak1507 I've always had that attitude when I have been systems architect.
However, in practice it does take discipline.
 
ngn
1:37 PM
hey, inspired by aaron's talk and the earlier discussion here, i've written a paper about type systems in apl - check it out :)
4
 
lmao
 
ngn
you're welcome. use these 50 minutes of your life wisely :)
 
@ngn Impostor! Who are you, and what did you do to ngn? He'd never use that many capital letters or superfluous periods.
 
@Adám and the source has newlines and even a bit of indentation!
 
ngn
@Adám it's an academic paper, i would even wear a suit when presenting it :)
(only the upper half if presenting online)
 
1:43 PM
lol
 
@ngn I love the mixture of obedient HTML5 (charset) and deprecated features (<center>)
 
ngn
@Adám the charset is from my template. i used center because couldn't be bothered with css
hm, i should ask aaron if he wants to add mutual references, to increase our academic scores
 
increase your erdos number
or decrease rather
 
ngn
@rak1507 what's his erdos number?
 
no idea
 
2:31 PM
@RikedyP starting now?
@ngn impressive write up
 
ngn
@Razetime thank you. so the years of research that made this publication possible have not been wasted
 
technical difficulties
starting in 10 or so
@Razetime ^
 
yay
 
actually gotta make tea so i'mma round it up
 
 
1 hour later…
ngn
3:49 PM
to comply with the APL Implementations Act of 2021, i kindly ask all implementers to fill in this form
5
 
4:03 PM
'Expressivity (choose this if you have no idea what you're doing)' lol
 
'1287' lol
 
I don't get it, what's that a reference to
 
@rak1507 ⎕FR, presumably making fun of APL impls loving random number constants for things
 
ahh
 
@dzaima I was thinking ⋄ ⎕DR 1e1000
@DyalogAPL Hello?
 
4:07 PM
lol an array language in prolog would be.. interesting
 
@ngn This is so good, but could be so much better…
 
lmao when you hit send you get 'syserror 999'
 
Why is there no "I would like to make a: [ ] blockchain…`
@rak1507 Hah, I didn't even try. And rebuilding ucmd cache :-)
 
yeah
this should go on the humour part of the APL wiki
 
Yeah, where are we holding with creating that page?
Plenty of ready material for it
 
4:09 PM
@rak1507 i had actually been thinking of writing the typed apl in prolog ha
 
@user41805 oh wow lol
prolog doesn't have 'real' arrays right? is there any way to get any speed out of it?
 
i don't know how arrays work under the hood
> The list '.'(a, '.'(b, '.'(c, []))) can also be written as [a,b,c]. - metalevel.at/prolog/data
 
ngn
@Adám "blockchain" - that's a good one! the ministry of vectorization will be happy to implement everyone's ideas after a tea break
 
@user41805 yeah, exactly, so as far as I know that won't be contiguous in memory and allow for o(1) lookups and things
I could be wrong though I don't know how it's implemented
 
but i don't care about speed, it'd be just for experimentation's sake
and to learn prolog
 
4:15 PM
fair enough
 
@ngn Other implementation languages to list: COBOL, PHP
 
@ngn I hope this form actually submits
 
click submit and see
 
yeah I hope it still submits after that popup
 
nah it doesn't I don't think
what's 'MXCSR'
oh it's a register
 
4:19 PM
@rak1507 some x86 register
 
yea
 
@ngn Additional languages one might want to implement:
( ) K
( ) K
( ) K
( ) K
( ) K
( ) K
( ) K
( ) K
( ) K
 
this form makes me want to make a crappy APL implementation in Prolog
 
@ngn Character set: ( ) EBCDIC, ( ) Proprietary
 
( ) unprintables only
 
4:22 PM
@Adám if there's EBCDIC, maybe it's worth removing ASCII-only? you don't need both :)
 
add 'backwards compatibility' to the purpose section
 
@rak1507 that's pretty much what "Compatibility" there is, no?
 
facepalm, yes
 
"[ ] garbage-collected", maybe
 
( ) I am bored
 
4:25 PM
purpose: ( ) rake points with a show hn
 
@ngn The types' list needs "[ ] statically parseable"
@ngn Why only syserrors on submit? That's unfair. You need some `nyi too.
 
ngn
ooh, this turned out more popular than i expected
 
@ngn Missing section: Target platform: Solaris, MacOS 9, Palm, Blackberry, System/Z, whatever OS people I learned about yesterday.
 
purpose ( ) I want more builtins
 
@Adám plan9
 
4:31 PM
@Adám that one linux distribution all the cool kids are using
 
Yes, that.
 
PDP-7
 
@Adám SteamOS
 
FirefoxOS.
@ngn Keyboard layout: Dvorak, Colemak, Alphabetical, I'll roll my own
 
Dvorak is the only valid kb layout
 
4:34 PM
@ngn Order of execution: ( ) Right-to-Left, ( ) Bottom-to-Top
 
( ) determined by unicode arrows (who needs take and drop anyway)
 
Unicode entry key: ctrl, altgr, enter, foot pedal, neuralink signal
 
DDR pad
 
lol yes
 
@rak1507 Spacebar, Shift
 
4:36 PM
power button
 
lmao
 
Windows key
@rak1507 Backslash!
 
if you have a keyboard with controllable lighting the APL key becomes a random key on your keyboard and to activate it you have to navigate to it like a game of snake
 
ngn
@Adám is that funny? people still use some of those
 
@Adám Android
 
4:38 PM
symbian
 
⊃ and ↑ should:
[] be like dyalog
[] be like GNU
[] use ⎕ML to decide
[] pick a functionality at random
[] transpose a matrix
[] rickroll the user
 
@ngn True. It needs rak1507's punch line to be funny.
Index origin:
( ) 0
( ) 0.5
( ) 1
( ) User-configurable
( ) Something else - please specify: [___]
 
I feel like they should go in order of weirdness so 0 (it is ngn after all), 1, user config, 0.5
 
ngn
@Adám that's not a fair joke - k3..k6 were converging. k9 is the very different one.
 
@ngn Do jokes have to be fair now‽ Feel free to add APL1, APL2, APL3, … ;-)
 
4:50 PM
what about
( ) K0
( ) K1
( ) K2
( ) K3-6 (add a slider)
( ) K7
( ) K8 (grey out)
( ) K9
 
@rak1507 K0?
 
oh does that exist
sure
 
ngn
@Adám i mean, to maximize hilarity, there must be truth in the joke
 
@ngn Well, there is, isn't there?
 
@Adám K is zero indexed right
 
4:52 PM
yes
 
ngn
@Adám the primitives in k5 and k6 are almost identical, and i think the only one that's totally changed meaning in every version before that was ^
@Razetime of course
 
then K0 must exist
 
ngn
then java0 and python0 and ecmascript0 must exist too :)
 
@ngn Doesn't matter for the joke, imo, but a single entry with a slider would be fun too:
> [ ] K: 0---|---9
 
ngn
yeah, true, a slider would be funny :)
how do i make a slider in html? i forgot
 
4:55 PM
the existence of array languages implies the existence of disarray languages
 
@ngn an input type iirc
 
@ngn type="range"
 
ngn
ah
thanks
 
@Razetime PHP
 
@ngn Reminds me of this.
 
4:59 PM
lol 'Misc. Third World countries'
 
petition to put the form on dyalog homepage
 
ngn
there used to be such a form for programming languages (not just apl) - i got the idea from there. but i couldn't find it now.
anything about ⎕ct?
 
what is ⎕ct
@ngn aaaa I can't find the link
 
ngn
@Razetime comparison tolerance
 
huh.
oh wow
this is.. a thing.
 
5:07 PM
@Razetime yep
 
@Marshall here's the published BQN notebook :) observablehq.com/@lsh/bqn
 
@LukasHermann That's great!
Note that the fmt function from bqn.js converts a BQN value to a string for printing.
 
Anyone know how you do a ×⍤0 1 ⊢ b in numpy where 2 2 3≡⍴a and 2 2≡⍴b
 
5:25 PM
@LukasHermann I'm also wondering if for the uvs and matrix lines if it's possible to define the function in one part and just call it again to pass in a new argument. That should be much faster.
 
@Marshall I'm playing with an idea based on that to use observable's viewofoperator, which lets you choose a custom preview and a related value
that way I can use the internal fmt function to format the output
and call the results on the next input
 
@LukasHermann Oh, that would be pretty nice.
 
6:10 PM
@Marshall I settled on making a view function that can pretty print results. It seemed like the cleanest result (same url: observablehq.com/@lsh/bqn)
 

« first day (1488 days earlier)      last day (218 days later) »