Similarly - 80 line LISP interpreter with integers, lexical scope, first class functions
HN user
leontrolski
https://leontrolski.github.io/
Neat.
I'm trying to compress recipes into little schematics https://leontrolski.github.io/recipes.html
What would be the equivalent to this in Haskell (with or without lens):
cat = Cat(age=3)
l = [1, [2, cat], 4]
alt l[1][1].age.=9
That would give us l equal to: [1, [2, Cat(age=9)], 4]This is surprising to me:
l[1][1].age:9
# (1,(2,{"age":9}),4)
How come it doesn't return just: {"age":9}
Or is there something totally different going on with references here? As in, how is this different to: l_inner = l[1][1]
l_inner.age:9Yes, AI or no AI, tell me about something actually interesting that you're working on.
Currently it feels a bit like everyone is talking about what new editor they're using. I don't care about that type of developer tooling very much. AI isn't coming up with some exciting new database, type system, etc etc.
"Look at how I'm able to web dev x% faster" because of LLMs is boring.
Ditto, another Upset blog post - https://leontrolski.github.io/upset.html
Lovely writeup!
Pascal did not have sum types because Wirth thought they were less flexible than untagged unions
I'm not sure whether my dream language would have tagged or untagged unions (Scala 3 has both it seems). I'd be interested if anyone has any further points of comparison beyond:
Tagged unions, eg. in Rust: enum Tagged {A(i64), B(String), C(f64)} Untagged unions, eg. in typed Python: Tagged = int | str | float
Tagged unions are better as you can represent duplicated types and types with no data, eg: enum Tagged {A, B(f64), C(f64)}
Untagged unions are better as you can willy nilly create new subsets and intersections of types. I find often in AST-ish work I want to express eg: def f(x: A | B | C) -> A | B
A reminder of all the features available right now with PWAs - https://whatpwacando.today
also fast when transactions are held open
In my linked example, on getting the item from the queue, you immediately set the status to something that you're not polling for - does Postgres still have to skip past these tuples (even in an index) until they're vacuumed up?
I'd be interested as to how dumb-ol' polling would compare here (the FOR UPDATE SKIP LOCKED method https://leontrolski.github.io/postgres-as-queue.html). One day I will set up some benchmarks as this is the kind of thing people argue about a lot without much evidence either way.
Wasn't aware of this AccessExclusiveLock behaviour - a reminder (and shameless plug 2) of how Postgres locks interact: https://leontrolski.github.io/pglockpy.html
I plan on using it for semi throw away UIs for things where I don't want the user to have to spin up a Web server. Right now there's no canvas support, but there is that kind of thing in the Tk/Tcl docs (linked in the project). I probably need to add a way to reference a specific Widget so you can access the raw name and run taw Tcl against it.
Well that was dumb - fixed, sorry
33 line React https://news.ycombinator.com/item?id=22776753
For those of you from a Python background - this is basically "Pydantic for Typescript". See also trpc - cross client/server typing using zod under the hood - https://trpc.io/
Here's a nice modern Python library in this space that claims to take influence from Temporal and Chrono - https://github.com/ariebovenberg/whenever
If like me, you've ignored poetry and friends and stuck with pip-tools (congrats!), uv (used by rye internally) is a drop in replacement.
IMHO pip-tools was always the far nicer design than poetry, pipenv etc as it was orthogonal to both pip and virtualenv (both of which have been baked into Python for many years now). I would argue Rye is the iterative, standards compliant approach winning out.
Beyond the speedups from Rust, it's nice to have some opinionated takes on where to put virtualenvs (.venv) and how to install different Python versions. It sounds small, but since wheels fixed numpy installs, sane defaults for these and a baked in pip-tools is basically all that was missing. Talking of which, what has been the point of anaconda since binary wheels became a thing?
For what it's worth, there are some benchmarks of kdb+ (the database built on k) here - https://tech.marksblogg.com/billion-nyc-taxi-kdb.html (it's overall a fantastic series of blog posts).
I'm always excited by the idea of rendering jsx from Python in the same process. Mostly as a bridge between eg. an existing Django app and full SPA React land. You'd swap out the scrappy Django string templating with jsx, then once a page passes some frontend interaction complexity threshold shift it over entirely (with shared components between both). Could this project help achieve this or are imports/build processes etc too much of an impediment?
Thanks for the comprehensive reply, does the following argument stand up at all? (Going on the assumption that LISTEN is one more concept and one less concept is a good thing).
If I have say 50 workers polling the db, either it’s quiet and there's no tasks to do - in which case I don't particularly care about the polling load. Or, it's busy and when they query for work, there's always a task ready to process - in this case the LISTEN is constantly pinging, which is equivalent to constantly polling and finding work.
Regardless, is there a resource (blog or otherwise) you'd reccomend for integrating LISTEN with the backend?
Ahh, I see you're a cofounder at feldera :)
I have a couple of dbsp questions if you're feeling generous and have 10mins free - reach out ojhrussell at gmail
I didn't - I wanted to build something I could understand, and the rust implementation comes with a load of (reasonable) complexity, some resulting from the execution model, some from performance requirements.
stepping has 3 Zset implementations - in memory, sqlite and postgres. Currently considering whether to write a small rust one.
There's some more details here: https://stepping.site/docs/internals/how-it-works/
I've been playing around with writing an application-orientated Incremental View Maintenance library along these lines:
It's based off of the DBSP paper, which counts Materialize's Frank McSherry as an author. Definitely not ready for the prime time, but any feeback welcome!
See also "What if we'd had better html-in-js syntax all along?" https://leontrolski.github.io/dom-syntax.html
It's still possible to get furniture made in the area - https://www.untothislast.co.uk have a workshop at the top of Brick Lane that you can visit. They also deliver by cargo bike which can look pretty impressive for the larger items.
I wrote a short guide for confused node developers at work a while ago https://leontrolski.github.io/virtualenvs-for-node-devs.html
It has been pointed out that this is apparently similar to Djikstra's algorithm although when it was written the author wasn't aware of that.
The inspiration for the algorithm comes from a solution to a problem set in a mid 1980s edition of A&B Computing magazine.How about just nudge json a couple more notches towards js? https://github.com/leontrolski/dnjs
I've always used snakeviz with the stdlib profiler https://jiffyclub.github.io/snakeviz/
In prod, the pyinstrument profiler has worked well for me https://pyinstrument.readthedocs.io/en/latest/guide.html#pro...
A great walkthrough mucking around with deep Python internals, love it!
A really nice collection of examples in their original and their refactored form - nice work. I'm similarly in two minds about the feature, it's cute, but is it worth it?
I think it's indicative that the nicest use is in AST processing. As someone that works on the occasional parser-y side project it looks pretty cool, but also, 97% of professional Python development is in data-science/application development. I suspect this is a case of the core language devs having a bias towards features that are useful to them as opposed to the community as a whole.