Show HN: Metapict – TikZ like figures using Racket
soegaard.github.io
soegaard.github.io
https://github.com/soegaard/metapict - code
https://soegaard.github.io/docs/metapict/metapict.html - docs
One advantage of tikz though is that you can directlt embed it in latex.
Thanks for the compliment. It's not my first Racket macro :-)
> One advantage of tikz though is that you can directlt embed it in latex.
Its greatest strength and greatest weakness at the same time.
I never quite made it to the perfect fluency I had in Ruby. And it lacks some of the raw power I feel when I write Rust. Still, perhaps it could be a good time to return.
It's hard to maintain perfect fluency in many languages at once, and it's also very valuable to learn multiple languages, so I'm somewhat torn.
Just looking at the clarity and brevity of these example drawings brings me back a sense of calm and collectedness I don't often feel anymore.
Since using Scheme/Racket heavily, I've used three major popular languages, and each has a lot of painful problems, that feel like regressions:
* Major Language X was obviously intended for much simpler needs, but kept getting extended to get closer to what was already known from other languages when it was created, the official docs often seem written as if with no awareness of a reader, and a Web search results are mostly maddening SEO by people who don't seem to understand much about the subject matter.
* Major Language Y has some merits, but a key DSL seems fundamentally wrong in execution, like a kludge that doesn't reflect what was already known decades ago, and they basically just didn't do documentation yet, and I had to do heroics to work around implementation and design flakiness in a key framework and an important library.
* Major Language Z actually shows a lot of positive signs, including cross-pollination in many small details, but at some point there was a breakdown of coherent design for a while, and some poor decisions made, which would be a lot easier to look past were it legacy from much longer ago than it was.
That said, Scheme and Racket also have their technical and community drawbacks. Also, more pragmatically, too often lately I've seen hiring situations where they really-really need some engineering magic done... but they're hung up on filtering resumes for ThisYearsPopularFramework2, and believe that's the most important qualification. So, lately, I also use the currently popular tools, even when it's incarnation #23 of something I've seen before (not done as well #4, #5, #7, and #16), and make it work despite/because I'm painfully aware of the weaknesses.
(I was speaking of specific language platforms, but not calling them out by name makes it easier to be candid about the kinds of problems I saw, which was the only point here.)
This blog material reminds me of the Beautiful Racket [1] writing system, even though it is of course different.
You have a sharp eye. Beatiful Racket was written with Butterick's own Pollen system. The Pollen system was inspired by `Scribble` which is used to produce the Racket documentation (among other things).
I am using my own `mathscribble` (better name is needed) also inspired by Scribble. I am using a different representation of both the decoded input text and of the produced html. It is geared towards texts with mathematical contents.
All systems use the at-expr syntax for the input.
$ time racket -e '(display "hello")'
hello
real 0m0.721s
user 0m0.598s
sys 0m0.119s
This basically rules out using it for command line scripts, which is a major class of uses for me. $ time racket ~/tmp/bd.rkt
hello
Times: 0.12s user 0.04s system 94% cpu 0.176 total
The file used $ cat ~/tmp/bd.rkt
#lang racket/base
(displayln "hello")
Also use `raco make` to compile your scripts before running them.My understanding is that Racket has been doing a lot of work on overhauling its interpreter and internals recently, so I'm hopeful this will improve somehow, but it's unclear to me if they're aware of this issue or consider it a problem.
If I understand correctly part of the problem is the number of modules that needs to be loaded from disk at startup. On my computer the first run is slower than subsequent runs due to caching. Maybe an "compile several modules into a single file" approach might improve things - but it's not trivial project.