frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Kent Dybvig's Scheme Machine in 400 Lines of C (Heap-Memory Model)

https://gist.github.com/swatson555/8cc36d8d022d7e5cc44a5edb2c4f7d0b
115•swatson741•2h ago

Comments

lambdaone•1h ago
Amazing, and you could see how this could be translated into perhaps a couple of thousand lines of assembly code to boostrap Scheme almost from the bare metal, similar to the early IBM 709 LISP.

A thought: I wonder if an LLM would be up to the job of writing the assembly code from this?

nostrademons•1h ago
You could just use a C compiler to write the assembly code from this, and it'd be far less buggy.

Before there were LLMs, there were about 65 years of other program-writing-programs to save labor.

f1shy•10m ago
As simple as

gcc -S heap-lisp.c

listeria•1h ago
> I wonder if an LLM would be up to the job of writing the assembly code from this?

I could see a compiler doing that.

lambdaone•1h ago
I'm quite aware of the existence of compilers, having worked on bootstrapping a production LISP compiler in the past. My point being that this would be an interesting experiment to do this "naïvely", given how close C is to (for example) PDP-11 assembly code.
tgv•44m ago
If it's speed you're after, much more analysis (and thus code) is needed. See V8.
swatson741•41m ago
A C compiler can output fairly readable code if you turn off optimizations, and it's definitely not going to take thousands of lines to do this in modern assembly. It may be only just barely a thousand lines to do this in aarch64, and the LLM can probably do it.

From what I've seen the LLM do it can definitely enhance these programs if you know what to ask, and it can explain how any piece this code works. It may even be able to add garbage collection to the evaluator since the root registers are explicit, and the evaluator only acts on static memory.

dannyobrien•2m ago
This is the path that the GNU Mes and Guix folks are taking: https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-...

(sans LLMs -- I believe they have a Scheme (GNU Mes) that can be compiled from their 357 byte bootloader, and that Scheme can run a C compiler that can compile tinycc, and I think there's a path from tinycc to compiling gcc. I'm not sure how far it can get after that -- this blog post[1] implies that you still need a binary of guile to run Gash, which is a POSIX shell written in Scheme. I'm guessing the plan is to either simplify Gash or complexify Mes to be able to remove Guile as a dependency.

[1] https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-...

glouwbug•1h ago
I believe MIT Scheme compiled directly to C by intermingling switch statements and gotos to emulate its call stack. Problem was, as programs grew, compile times weren't linear. I gave it a shot once, it was a somewhat spiritual experience:

https://github.com/glouw/switch

kkylin•20m ago
Thanks! Do you mean MIT Scheme's C backend? I've used MIT Scheme on and off for a long time and have never touched the C backend & have no idea how it works, so this is interesting.

(MIT Scheme also has a native code compiler for Intel CPUs, which seems to be what most users of MIT Scheme (an admittedly small community) actually use.)

f1shy•9m ago
I think a very rudimentary implementation (which is easy to understand) is in the SICP book
fanf2•1h ago
Instead of representing atoms as string literals, you can represent them as global variables, eg

    const char conti[] = "conti";
Then you can use pointer comparison instead of strcmp().
swatson741•58m ago
You'll still probably need the `strcmp` because the pointers won't be the same unless you check for them and make them the same.

You may be thinking about how `eq?` (reference equality) works in scheme. That's usually done by hashing the identifier string. Which is the more general solution to this equality problem.

fanf2•47m ago
The atoms strcmp()ed by the interpreter are all created by the compiler so you can ensure the pointers are equal by construction.
swatson741•15m ago
You're right `virtmach` only works on things that are output from `compile` and maintaining the invariant that virtmach lisp uses those pointers isn't difficult to do in with how the evaluator is presented.

It gives virtmach lisp and scheme different ontology, but I can't think of any practical reason why that would matter other than it makes things a little bit more complicated. But, then again if I'm thinking practically scheme should be using hashed identifiers, and then there's no reason for them to have different ontology and conceptually we're right back where we started with virtmach lisp and scheme using identifiers as objects.

ashton314•35m ago
Kent Dybvig also wrote Chez Scheme [1] which on most benchmarks is far-and-away the fastest [2] Scheme implementation.

Racket recently got rewritten to be based off of Chez [3] and I have it from the maintainer of Racket himself that it’s paid off well: better performance and a smaller, more maintainable codebase.

1: https://github.com/cisco/ChezScheme (also, pronounced “Shay Scheme”)

2: https://ecraven.github.io/r7rs-benchmarks/

3: https://m.youtube.com/watch?v=s3Q3M2wZ7rI&pp=0gcJCRsBo7VqN5t...

saltcured•10m ago
Since these seems to be turning into an opportunity to shout out for other Scheme implementations...

I was a happy use of VSCM by Matthias Blume, doing a bunch of my university assignments with it on my Linux PC in the early 90s.

Apple Screwed Up Again [video]

https://www.youtube.com/watch?v=p89cGm6X8i4
1•behnamoh•4m ago•0 comments

Saving My Commit With `jj evolog`

https://landaire.net/jj-evolog/
1•todsacerdoti•4m ago•1 comments

I used all the math I know to go from 352M to 12M CPU years

https://www.reddit.com/r/hacking/s/IiRNW9PTzC
1•keepamovin•6m ago•0 comments

Show HN: Photowand – Turn selfies into professional photos with AI

https://photowand.ai
1•fengjiabo2400•6m ago•0 comments

An Efficient Vision-Language-Action Model for Combat Tasks in 3D Action RPGs

https://arxiv.org/abs/2503.09527
1•mikhael•6m ago•0 comments

A Bio-Inspired Hexapod for Adaptive Terrain Navigation and Object Detection

https://arxiv.org/abs/2509.15264
1•PaulHoule•8m ago•0 comments

Multi-Platform Video Uploads: Using Identity Provider Links

https://fusionauth.io/blog/using-identity-provider-links
1•mooreds•8m ago•0 comments

How to Implement a Successful Technical Writing Process

https://www.wizardondemand.com/post/how-to-implement-a-successful-technical-writing-process
1•mooreds•9m ago•0 comments

Sora, AI Bicycles, and Meta Disruption

https://stratechery.com/2025/sora-ai-bicycles-and-meta-disruption/
1•feross•10m ago•0 comments

What's Coming in ESLint 10

https://eslint.org/blog/2025/10/whats-coming-in-eslint-10.0.0/
1•bpierre•12m ago•0 comments

The Content Crafters

https://craftercontent.blogspot.com/
1•arianmarry•12m ago•0 comments

OpenAI Guardrails: A Framework to Keep LLM Apps Safe and Reliable

https://openai.github.io/openai-guardrails-python/
1•meetpateltech•14m ago•0 comments

Interactive On-Device Segmentation in Snapseed

https://research.google/blog/towards-better-health-conversations-research-insights-on-a-wayfindin...
2•tmoertel•18m ago•0 comments

"Be Different" doesn't work for building products anymore

https://iamcharliegraham.substack.com/p/be-different-doesnt-work-for-building
12•grahac•18m ago•6 comments

Geometry of Motion

https://rishit-dagli.github.io/2025/10/05/geometry-of-motion.html
2•dagli•20m ago•0 comments

Solving the Mind-Body Problem: Dualism vs. Searle, Part 1

https://www.betonit.ai/p/solving-the-mind-body-problem-dualism
1•paulpauper•21m ago•0 comments

The Tariff Exemption Behind the AI Boom

https://www.apricitas.io/p/the-tariff-exemption-behind-the-ai
2•paulpauper•21m ago•0 comments

We Act Before We Understand

https://www.robkhenderson.com/p/we-act-before-we-understand
1•paulpauper•21m ago•0 comments

Show HN: Phone formatter I built for my mom to call home

https://callint.info
1•soelost•21m ago•0 comments

Bari Weiss named editor in chief of CBS News

https://www.washingtonpost.com/business/2025/10/06/bari-weiss-cbs-paramount/
6•geox•21m ago•1 comments

O'Briens Policeman – Why I built my AI Twin

https://markgreville.ie/2025/10/06/obriens-policeman-why-i-built-my-ai-twin/
1•gHeadphone•22m ago•0 comments

Show HN: Stat – a social platform where everything is a poll

https://stat-beta.netlify.app
1•kyryl_shulga•25m ago•1 comments

The product of the railways is the timetable

https://springbett.substack.com/p/the-product-of-the-railways-is-the
1•NaOH•25m ago•0 comments

Steve Eisman: U.S. Consumers Are Collapsing: Cars, Credit, & the Chaos Ahead [video]

https://www.youtube.com/watch?v=Qd7akdDtPXA
3•jameslk•25m ago•0 comments

Apple Faces French Investigation over Siri Voice Recordings

https://www.bloomberg.com/news/articles/2025-10-06/apple-faces-probe-in-france-over-voice-recordi...
4•c420•25m ago•1 comments

OpenZL: An Open Source Format-Aware Compression Framework

https://engineering.fb.com/2025/10/06/developer-tools/openzl-open-source-format-aware-compression...
4•terrelln•26m ago•0 comments

Renewing Our Open Source Pledge for 2025

https://blog.platformatic.dev/renewing-our-open-source-pledge-for-2025
2•feross•26m ago•0 comments

Show HN: Turn Text Prompts into Complete Figma Designs

https://www.figma.com/community/plugin/1545618089212283719/klana
1•joezee•26m ago•0 comments

An Open Letter to Llms.txt

https://olshansky.info/posts/2025-10-05-an-open-letter-to-llms-txt
2•Olshansky•28m ago•0 comments

Sharpie Found a Way to Make Pens More Cheaply–By Manufacturing Them in the U.S.

https://www.msn.com/en-us/money/companies/sharpie-found-a-way-to-make-pens-more-cheaply-by-manufa...
2•CGMthrowaway•28m ago•0 comments