Better HN
topnewbestaskshowjobs
Log inSign up

g9550684

5 karma · joined Jul 27, 2026 (4mo ago) · 3 submissions

Submissions

comment 4mo ago · link · parent

in at least Common Lisp world slinging s-expressions is considered to be a hack, at best something you do in a development environment, like swank/slime wire protocol. one of the reasons is that a readtable is both powerful, user extendable, and has all kinds of default ways in which a malicious input would be detrimental. you can remove all kinds of reader macros like #.(xyzzy), but to make a truly bulletproof s-expression reader you'd have to build a json like subset from first principles. even things like colons in symbol name package:symbol will trip you up. it's been understood since long time ago, that common internet standards, like RFCs, are the preferred method. in which case the fact that it's an s-expression versus a json is pretty much irrelevant. it's a kind of reader/writer anyway.

comment 4mo ago · link · parent

> convert tables to lists

array languages give you concepts for thinking about these problems where you can succinctly express that entire talk in a single sentence, something like "inverted tables improve cache locality and optimize for time and space, prefer them where it matters". yes, got it, also a well known conclusion in array world.

a table is a 2 dimensional data that stores your records row by row and the items of a column all have the same data type. the way an array of structs would. an inverted table is a list of original table's columns. like a struct of arrays.

so if you have a table,

     x
  ┌────┬──────┬─┬─────────┐
  │mob1│level1│0│0.0243902│
  ├────┼──────┼─┼─────────┤
  │mob2│level2│1│0.0147059│
  ├────┼──────┼─┼─────────┤
  │mob3│level2│0│0.0120482│
  └────┴──────┴─┴─────────┘
there's an idiom for converting it to an inverted table

     ]y=:(<@(>"1)@|:)x
  ┌────┬──────┬─────┬─────────────────────────────┐
  │mob1│level1│0 1 0│0.0243902 0.0147059 0.0120482│
  │mob2│level2│     │                             │
  │mob3│level2│     │                             │
  └────┴──────┴─────┴─────────────────────────────┘
you can then splice it across variables,

     'name level isactive v'=:y
     isactive
  0 1 0
so you have converted a table to lists.

comment 4mo ago · link · parent

these are obvious techniques from array world, j/k/apl, and the source of e.g. arthur's bold speed claims.

personally I've discovered it insufficient to "just" convert tables to lists, you also need to understand the rest of the array principles to then effectively manipulate your data, and just to be able to hold compute in your head. because I believe in this approach I spent time learning j and k, but the end result is that my solutions become too alien for the general practitioner. it becomes apl written in whatever host language.

this is something that is not addressed in a lot of DOD talks, what happens when you do the full realization of technique: bulk list primitives, bulk transforms, SIMD optimizations, list compression, etc. and it's also the reason people claim this only works in narrow scopes (like gamedev). in reality you can write all your code for lack of better term the apl way, you're just going to make it unreadable to non apl practitioners. I'm not quite sure how to reconcile this in general, short of forcing apl to be part of general CS curriculum.