Hacker News new | past | comments | ask | show | jobs | submit | ashton314's comments login

I’ve got an HP50g that I love. I wish I could get my kids a SwissMicros calculator when they go to school but $300 is a little steep for a kid’s calculator.

(Heck, considering what TI charges for their crapulators, maybe it’s not such an outrageous price…)


There is a minimal Racket distribution which should be a lot lighter. CS has made the code base cleaner and Racket zippier.

Butterick is a sharp guy. I absolutely love one of the books he made with Pollen: Practical Typography http://practicaltypography.com/

Pollen seems like a power tool; my needs are largely met by Scribble, but I’d like to get more comfortable with Pollen.


Can it generate PDF / e-books? The author seems to be against both, at least for their own books, but my e-book reader cannot read websites conveniently.


I made a BF compiler that goes really fast. I'm in a compilers class right now and for whatever reason my professor has gotten severely nerd snipped into building the fastest BF compiler in the world.

Mine is pretty darn fast; it compiles to native ARM assembly and can generate a Mandelbrot set in less than 0.5 seconds on my M1 Pro machine. Full writeup (with links to source) here: https://lambdaland.org/posts/2024-10-22_bf_writeup/


A while ago I wrote a Zig brainfuck implementation[1] that converts Brainfuck code into an executable function at comptime. The performance is similar to transpiling the code to C and compiling it with full optimization settings.

[1] https://github.com/ginkgo/Zig-comptime-brainfuck


And written in racket!

Looks like a good learning material. Congratulations and thanks for sharing


Brandon Sanderson: scrappy protagonist discovers that they have magical powers, despite struggling from crushing depression and/or trauma. This annoying guy named Hoid smirks at everyone. The next weekend they accidentally trigger the end of the world, which they prevent in the nick of time by becoming a god.


Brandon Sanderson: Spacebar activates your special movement ability, F activates your special attack, watch your power meter--and don't miss the cutscene at the end of the final boss fight!

(From someone who loves Brandon Sanderson)


100% accurate except for the “or.”


Fabrice Bellard: A problem with several competing solutions catches your fancy. Within a week you have a gleaming, state-of-the-art solution that is flexible, reliable, and extensible—all written in pure, efficient C. Everyone begins to build on your work.

Donald Knuth: While writing your magnum opus, a minor irritation arises. You invent a new subfield of computing and spend two years developing a highly idiosyncratic language and tool system.\footnote{And several new typefaces!} Your irritation dissipates and you go back to work with your writing. Generations of academics curse your creation but have nothing better to work with. They wonder if they can get Fabrice Bellard to take a crack at it…


> Fabrice Bellard

Working on (a medium-sized team that is working on) an LTE base station in the late 2000s and then I'm introduced to his work. It was a very humbling experience. Over the decades I've met a handful of people who were, at times, within reach of Fabrice but he is truly in a league of his own.


I just started paying for the $10 = unlimited searches plan. 300/mo is just not enough for me as a researcher. Quality has been far better than Google or DDG IME.


Nice.

I recently learned about the SRP protocol [1], and I’m surprised that it’s not more widely used/mentioned: with a relatively simple protocol, you can do a ZKP and generate a session token between the server and client in one fell swoop.

[1]: https://en.wikipedia.org/wiki/Secure_Remote_Password_protoco...


Its adoption was hindered by patents.


RacketCon is going on right now at the University of Washington. It runs all day today and tomorrow. (Saturday and Sunday)


Yay! The birth of a language is a beautiful thing.

I’m curious about the macros: how are these implemented? They seem like pretty straightforward unhygienic Lisp macros, which is a little bit of a disappointment, but better some macros than none at all! Anything about the macro system that distinguishes it from the Common Lisp system? E.g. anything borrowed from Scheme or Racket? Docs are sparse here.


It’s far from new. In 2012 I worked for a shop who used an internal package named “hy”, and the introduction of this Hy made our builds break in a novel and interesting way.

(Also, use something to insure your own internal packages have a higher priority, alright? That’s a lesson I didn’t need to learn twice.)


You're right—my bad. I'm sad I hadn't heard about Hy sooner! Update then: The first stable release of a language is a beautiful thing! :)


Sparse? I got a whole chapter for ya: https://hylang.org/hy/doc/v1.0.0/macros


Yes, and it's a very nice tutorial! I'm interested in implementation details. Maybe there's no hygiene (and no scope sets etc.) to worry about—that would probably make documentation a little shorter. I'm sure the documentation will grow as people run into edge cases.

(I'm also probably a little spoiled with documentation coming from Racket which has like 4 big chapters dedicated to different aspects of macros scattered around the docs, plus some associated papers. Forgive me—I'm not trying to dunk on Hy; I just like reading docs.)


Admittedly, I've tried not to document the implementation. Yeah, they're pretty much simple dirty Common Lisp macros. Internally, they're functions that are called with the arguments converted to models (via `hy.as-model`), and then the return value is converted to a model. If a macro's first parameter is named `_hy_compiler`, it gets access to the current compiler object; this is undocumented since it's only meant for internal use. Reader macros have no parameters, but can access the current reader object as `&reader`. When it's defined, a reader macro is added to the current reader's dispatch table.


There's nothing wrong with CL macros.

Quite the opposite, they are more powerful than the alternatives.

Macros are power tools, dumbing them down for safety is missing the point.


I have a hard time trusting the CL macros I write because of unexpected interactions with the context that I use them in. While it is the case that CL macros are more powerful than the R6RS macros-by-example system, Racket’s system (and some other newer languages that have adopted things pioneered by Scheme and Racket, such as Elixir) give you hygienic macros without sacrificing expressive power.

I want my macros to be easy to write correctly. That can only happen when the system has proper hygiene.


They are not unexpected though.

If you put your own symbols into generated code you better have a damn good idea what you're doing.

It's a power tool.


Table saws were only improved by the addition of an emergency stop to prevent people from maiming themselves. Power tools don’t have to be dangerous.

If you are wanting to introduce variable capture you better be really explicit about when you want it.

If there’s no hygiene, I have to know everything about how the macro is implemented in order to trust it and use it confidently. Might be fine for small shorthand, but that won’t scale. You need non-leaky abstractions to build on them.

Racket’s `syntax-parse` and “syntax parameters” show that you can have it both ways: procedural macros that are hygienic by default, but with an explicit escape hatch when you do want to introduce new bindings into the macro call site. It also gives you much much better errors.

CL macros are about as dangerous as malloc/free, but without years of experience and tools like Valgrind to debug. They’re hard to trust and get right.

Racket macros are like GC/affine typing: everything is correct by construction.


I've used table saws, with and without protection. They're all dangerous as fck, because removing the chance of getting hurt means converting it to a completely different kind of tool. Chain saws, same thing. Power tools.

Of course we want them to be as safe as possible, but that's a different discussion. All attempts I've seen so far have dropped functionality to get there.


> All attempts I've seen so far have dropped functionality to get there.

Well, then I recommend you take a look at Racket's macro system: Racket gives you hygienic macros without any loss of power. (It's actually more powerful and expressive than CL macros.)


So they allow you to introduce arbitrary symbols in expansions? Doesn't that mean we're back to regular CL macros?


The way you phrased that suggests you're only familiar with CL-style macros, where arguments to macros are nested lists of symbols a function or variable is known by it's name (a symbol) and nothing more.

Racket's model is much more sophisticated and powerful. The input to a macro in Racket is a syntax object [1], which combines the CL-like quoted expression with additional source and lexical binding information. This means that in Racket, unlike CL, a variable is not just it's name—it's also all this other information. Racket uses scope sets to track binding information in a sane and hygienic manner across different macros and functions.

So, if you want to introduce an identifier that the macro caller can interact with (note: I said an identifier—you can introduce any symbols you want but they'll be different identifiers because their scope sets will be different) you need to explicitly state that you would like to create an identifier with a particular scope set. [4]

But that's the old, dumpy, clunky way of doing things. Thanks to recent research, we have much better ways of introducing identifiers in a sane, hygienic way. Gregg Hendershott's excellent "Fear of Macros" walks through making the `aif` macro using syntax parameters [3] which let you cleanly introduce new bindings. (See the paper "Keeping it Clean with Syntax Parameters" he's linked to in his post.)

So, in short, no, we're not back to regular CL macros because Racket prevents us from accidental variable capture but gives us an easy way to do 99.999% of the use cases for breaking hygiene (syntax parameters) and then one more way (`datum->syntax`) just in case we really need to do something out of the ordinary. In either way, Racket lets you express your intent with macros better and more precisely than CL.

[1]: Racket syntax objects: https://docs.racket-lang.org/guide/stx-obj.html

[2]: Syntax model, scope sets: https://docs.racket-lang.org/reference/syntax-model.html

[3]: "Fear of Macros", writing the `aif` macro: https://www.greghendershott.com/fear-of-macros/Syntax_parame...

[4]: Reddit thread on making an unhygienic macro: https://www.reddit.com/r/Racket/comments/tpgaa4/is_there_a_w...


Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: