home.social

#bqn — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #bqn, aggregated by home.social.

fetched live
  1. Revised Game of Life implementation in #BQN

  2. How easy it is to construct an APL or K-like programming language

    (by Mohammed Jamal Alrujayi)

    This was an amazing article I found on the orange site published just last week. He notes that although APL and K are of the Harvard school of languages, while Lisp is of the MIT school, they are fundamentally related in their minimalism and in how the languages are structured around a single data type: Lists for Lisp, and vectors/matrices for APL. The two schools of thought were unified in the K programming language by Arthur Whitney:

    On kparc.com (his personal website) he listed K’s lineage simply as “lisp and apl,” linking to Iverson’s Turing paper and Perlis’s lyrical programming.

    I didn’t know much about Iverson’s family of languages (#APL, J, #BQN, K, and so on), but seeing it embedded in just a few lines of code in a high-level language like #Python suddenly makes it so much easier to understand. The syntactic keywords are basically composed of either infix operators of mapping operators, the data (constants or variables) are like leaves of the syntax tree. So all you need are three lambdas: “atom” checks if it’s argument is a number, monad serves as apply or map depending on the type of it’s arguments and abstracts it into a lambda, and “dyad” constructs an infix operator abstracted into a curried lambda. You only need those three rules!

    atom = lambda x: isinstance(x, (int, float, str))
    monad = lambda f: lambda x: f(x) if atom(x) else list(map(monad(f), x))
    dyad = lambda f: (lambda x, y: f(x, y) if atom(x) and atom(y)
      else list(map(lambda yi: dyad(f)(x, yi), y)) if atom(x)
      else list(map(lambda xi: dyad(f)(xi, y), x)) if atom(y)
      else list(map(lambda xi, yi: dyad(f)(xi, yi), x, y)))
    

    Now I definitely want to try this as Scheme macros!

    #tech #software #Lisp #APL #KProgrammingLanguage #JProgrammingLanguage #ProgrammingLanguages #PLT

  3. How easy it is to construct an APL or K-like programming language

    (by Mohammed Jamal Alrujayi)

    This was an amazing article I found on the orange site published just last week. He notes that although APL and K are of the Harvard school of languages, while Lisp is of the MIT school, they are fundamentally related in their minimalism and in how the languages are structured around a single data type: Lists for Lisp, and vectors/matrices for APL. The two schools of thought were unified in the K programming language by Arthur Whitney:

    On kparc.com (his personal website) he listed K’s lineage simply as “lisp and apl,” linking to Iverson’s Turing paper and Perlis’s lyrical programming.

    I didn’t know much about Iverson’s family of languages (#APL, J, #BQN, K, and so on), but seeing it embedded in just a few lines of code in a high-level language like #Python suddenly makes it so much easier to understand. The syntactic keywords are basically composed of either infix operators of mapping operators, the data (constants or variables) are like leaves of the syntax tree. So all you need are three lambdas: “atom” checks if it’s argument is a number, monad serves as apply or map depending on the type of it’s arguments and abstracts it into a lambda, and “dyad” constructs an infix operator abstracted into a curried lambda. You only need those three rules!

    atom = lambda x: isinstance(x, (int, float, str))
    monad = lambda f: lambda x: f(x) if atom(x) else list(map(monad(f), x))
    dyad = lambda f: (lambda x, y: f(x, y) if atom(x) and atom(y)
      else list(map(lambda yi: dyad(f)(x, yi), y)) if atom(x)
      else list(map(lambda xi: dyad(f)(xi, y), x)) if atom(y)
      else list(map(lambda xi, yi: dyad(f)(xi, yi), x, y)))
    

    Now I definitely want to try this as Scheme macros!

    #tech #software #Lisp #APL #KProgrammingLanguage #JProgrammingLanguage #ProgrammingLanguages #PLT

  4. @tmcfarlane @rsc
    □↯[3 3]□↯[3 3]⇡9 #Uiua
    <3‿3⥊<3‿3⥊↕9 #BQN
    ,3 3#,3 3#!9 #K
    <3 3$<3 3$i.9 #J
    (⊂3 3∘⍴)⍣2⍳9 #Dyalog #APL

  5. @tmcfarlane @rsc
    □↯[3 3]□↯[3 3]⇡9 #Uiua
    <3‿3⥊<3‿3⥊↕9 #BQN
    ,3 3#,3 3#!9 #K
    <3 3$<3 3$i.9 #J
    (⊂3 3∘⍴)⍣2⍳9 #Dyalog #APL

  6. Reading about trains in the #bqn documentation in preparation for #adventofcode tomorrow feels like

    youtube.com/watch?v=eKpVQm41f8Y

  7. 🐍🐒 Behold, the "Zoo of Array Languages," where letters and numbers come to frolic in a chaotic code safari! 🦓🌪️ #APL360, #BQN, and friends are here to remind you that your keyboard is a weapon, and syntax is just a suggestion. 🤪👾
    ktye.github.io/ #ZooOfArrayLanguages #CodeSafari #SyntaxFun #ProgrammingAdventure #HackerNews #ngated

  8. 🐍🐒 Behold, the "Zoo of Array Languages," where letters and numbers come to frolic in a chaotic code safari! 🦓🌪️ #APL360, #BQN, and friends are here to remind you that your keyboard is a weapon, and syntax is just a suggestion. 🤪👾
    ktye.github.io/ #ZooOfArrayLanguages #CodeSafari #SyntaxFun #ProgrammingAdventure #HackerNews #ngated

  9. हवाई अड्डाRafael Hernandez में Aguadilla (पुएर्तो रिको) का विमानन मौसम है “TJBQ 161350Z 09014G21KT 10SM SCT021 31/24 A3008” : पर देखें इसका क्या मतलब है bigorre.org/aero/meteo/tjbq/hi #aguadilla # #rafaelhernandez #tjbq #bqn #metar #aviation #विमाननमौसम #avgeek vl

  10. Aviation weather for Rafael Hernandez airport in Aguadilla area (Puerto Rico) is “TJBQ 291250Z 10012KT 10SM SCT030 29/23 A3006 RMK LTG DSNT N AND SE” : See what it means on bigorre.org/aero/meteo/tjbq/en #aguadilla #puertorico #rafaelhernandezairport #tjbq #bqn #metar #aviation #aviationweather #avgeek #airport vl

  11. Marshall Lochbaum has a great five year retrospective on the design of his #BQN language. I wish that we could all have the clarity, objectivity and honesty about our work that Marshall has about his.

    mlochbaum.github.io/BQN/commen

  12. Marshall Lochbaum has a great five year retrospective on the design of his #BQN language. I wish that we could all have the clarity, objectivity and honesty about our work that Marshall has about his.

    mlochbaum.github.io/BQN/commen

  13. I have been blogging for a while now using the #BQN programming language. I write mostly about #computationalsciences and sometimes #competitiveprogramming. But the most important aspect is the array/functional approaches used for all problems. Any feedback welcome.

    panadestein.github.io/blog/

  14. @ctietze I think of #BQN as the answer to the question "what if an array language like #APL or J was also a normal programming language with lexical scope, first class functions, object-oriented programming with mutable state, and acceptable performance for scalar code?" (Scalar code means code with while loops and if statements, which is how you write procedural code in most languages and which is traditionally very slow in array languages.)

    This normalcy of BQN makes it feel to me more general purpose than other array languages and it's pretty convenient as a go-to language that you use by default for most things.

  15. @ctietze I think of #BQN as the answer to the question "what if an array language like #APL or J was also a normal programming language with lexical scope, first class functions, object-oriented programming with mutable state, and acceptable performance for scalar code?" (Scalar code means code with while loops and if statements, which is how you write procedural code in most languages and which is traditionally very slow in array languages.)

    This normalcy of BQN makes it feel to me more general purpose than other array languages and it's pretty convenient as a go-to language that you use by default for most things.

  16. Scratched a small itch: I often need to lookup math journals in Scimago's Journal Rankings (not because I believe in those rankings, but for bureaucratic reasons which I hope will change someday). The website does not offer any help in typing journal titles despite it obviously having a list of titles somewhere, so I wrote some code¹ to download the data locally, and a little UI in #Emacs to lookup journals with completion. Since I use the fancy Orderless² completion style, I can search for word fragments in any order, or use regular expressions, etc.

    To download the Scimago data I first googled to find out if it is possible and found a couple of R packages that do it and just copied the URLs they use. Then I wrote a little script to download one CSV file per year, filter out the non-math journals (to have less data for speed, no other reason), and then write out a file with the data in #Lisp s-expressions. This script doesn't need to be in any particular language since you just need to be able to run external programs (wget, in this case), and to parse CSV files both of which are widely available. I choose the #BQN array language just because I like it a lot and use it for most programming tasks these days. I guess it might have made more sense to write the script in Emacs Lisp too. 😅

    ————

    ¹ github.com/oantolin/scimago Offered as-is —in particular, to find out how to use the BQN code... just read it. 😬

    ² github.com/oantolin/orderless. I wrote this for personal use, but I think it has become fairly popular.

  17. Scratched a small itch: I often need to lookup math journals in Scimago's Journal Rankings (not because I believe in those rankings, but for bureaucratic reasons which I hope will change someday). The website does not offer any help in typing journal titles despite it obviously having a list of titles somewhere, so I wrote some code¹ to download the data locally, and a little UI in #Emacs to lookup journals with completion. Since I use the fancy Orderless² completion style, I can search for word fragments in any order, or use regular expressions, etc.

    To download the Scimago data I first googled to find out if it is possible and found a couple of R packages that do it and just copied the URLs they use. Then I wrote a little script to download one CSV file per year, filter out the non-math journals (to have less data for speed, no other reason), and then write out a file with the data in #Lisp s-expressions. This script doesn't need to be in any particular language since you just need to be able to run external programs (wget, in this case), and to parse CSV files both of which are widely available. I choose the #BQN array language just because I like it a lot and use it for most programming tasks these days. I guess it might have made more sense to write the script in Emacs Lisp too. 😅

    ————

    ¹ github.com/oantolin/scimago Offered as-is —in particular, to find out how to use the BQN code... just read it. 😬

    ² github.com/oantolin/orderless. I wrote this for personal use, but I think it has become fairly popular.

  18. and programmers must be just salivating over this year's

  19. #APL and #BQN programmers must be just salivating over this year's #AdventOfCode

  20. @dcz Ah yeap damn, does #BQN do gpu compute yet?

  21. @dcz Ah yeap damn, does #BQN do gpu compute yet?

  22. Hab mir jetzt mal einen #Peertube Account eingerichtet. Viel geplant ist dafür noch nicht, aber das wird mein Ablageort für Aufzeichnungen von Präsentationen, wenn ich mal wieder was zu irgendeinem Thema erzähle.

    Den Anfang macht eine Präsentation über Array Programming und #BQN aus 2022:
    tube.tchncs.de/videos/watch/75

  23. I'm going to regularly tackle the Perl Weekly Challenge to sharpen my knowledge of #uiua and eventually #bqn.

    This week's problems are "Split Strings" and "Weakest Row".

    SplitStrings ← /⊔⊂≡(□⊜□⊔(≠,))
    WeakestRow ← ⍏≡/+

    The only complexity around the split strings solution was boxing and unboxing to handle the jagged arrays, whereas bqn is perfectly happy to have arrays of different length strings.

    Rise () makes Weakest Row absolutely trivial because the question wants the locations of entries in a sorted list, not the sorted list itself.

  24. Dipping into array languages for the first time recently has reinforced the topic of one of the discussions that I had at SoCraTes UK earlier this year.

    Readability is not a property of the artifact, in this case the code, but instead a property of the relationship between the reader and the artifact.

    Before I started looking at #uiua and #bqn I thought they were only a series of squiggles. Now, I'm getting to grips with just how expressive and beautiful the languages can be.

    The language, the artifact, hasn't changed. I have.

  25. @sanityinc I used something like this in #BQN the last two years too! I don't know uiua so I don't know exactly what this does, but in BQN I would join an element from the left, transpose, reverse, repeat 4 times. The ability to get windows at the end is really really cool.

  26. @badtuple #k has 26 verb and adverb symbols, they're heavily overloaded though so it's probably somewhere between #bqn and #j in terms of primitive count
    k.miraheze.org/wiki/Primitives

  27. Unless I missed something in the documentation #BQN has 61 which is much smaller!