logoalt Hacker News

I keep bouncing off the Scheme language

101 pointsby ingvelast Friday at 8:32 AM35 commentsview on HN

Comments

senkoratoday at 2:58 PM

I think that it helps a lot to have a daily practice of using a language for small things.

In much that same way that many people do the daily wordle or crossword, I do the daily leetcode.

I flip a coin and solve it first in either C++ or Python, then re-write my solution in the other one.

Usually it takes me around 20 minutes to solve it in either language, and 5 minutes to re-solve it in either language.

Recently I decided to start learning emacs lisp. This is an imperative lisp dialect that’s pretty different from scheme, but I think that the particular language doesn’t matter much for this process. I could a bit biased because I do have prior experience with SML and scheme.

I started re-solving the problems a third time in emacs lisp. And I’m still learning but I’ve felt my comfort with the language increase over time, and I expect that if I continue doing this then I will eventually reach parity with C++ and Python.

Currently it takes me about 20 minutes to re-solve a problem in emacs lisp, because I usually have to read documentation and/or look up something new.

show 3 replies
vnorilotoday at 5:00 PM

If solutions come naturally to you in OOP, why not just roll with it?

Personally I find it easiest do design data flows: think about what we need in order to compute the result. The less I have to think about state the better. Functional patterns fall out and it feels simple and easy to me, so I do it. I'm way over the phase I thought that's somehow cooler than the OOP folks, however.

funkastertoday at 5:44 PM

I've been forcing myself to stay within the CHICKEN ecosystem for the past 6 months. So far, the whole ecosystem moves really slow, but CHICKEN is such a good design that adding/rolling your own library for whatever you need is so simple. I ended up creating a bunch of eggs (CHICKEN libs) and even rolling my own web framework with its own ORM and background job processing that I rolled out to prod (1000+ users for the past 6 months or so, not a huge demo but it proved that it can scale/be good enough for my projects).

Best of all, is that the syntax grammar is so simple, that a simple CLAUDE.md + a few review agents lets me move super fast using AI. I spend most of my time anchoring on the design/plan and let AI write the implementation for most of the code.

twoodfintoday at 2:32 PM

Scheme was invented as a consequence of Sussman & Steele’s discovery that lexical closures in the lambda calculus had essentially an identical implementation to a fully elaborated version of Hewitt’s actor model.

I do wonder what a language with the same “taste” and minimalism as Scheme but embracing the actor model would look like. Erlang?

Even better if someone could figure out how to harmonize them in the same language: “There are exactly two ways to do it, and they’re interchangeable.”

show 2 replies
iainctduncantoday at 2:54 PM

Strange that the post makes no mention of the Little Schemer series, because teaching you to "think Scheme" is exactly what those books do. Some people are put off by the weird style (combination of children's book visuals and socratic logic problem presentation), but they work!

show 1 reply
gus_massalast Friday at 7:17 PM

You may like Rhombus, all the power of Racket in a Python-like syntax

Official docs: https://docs.racket-lang.org/rhombus/index.html

Collection of small examples: https://github.com/racket/rhombus/blob/master/demo.rhm

Smalltalker-80today at 2:58 PM

I studied Scheme in CS around 1990, but also found it hard to grasp and to apply to real world problems. And all those parethesis, brrr... :) The idea that "everying is an object and classes are nothing special" is neat, but it does not fit the way people (okay, I) think about real world problems. So I stuck with Smalltalk/OOP and am stil there :-).

ulbutoday at 3:27 PM

scheme is great, but the dx of some implementations is not. i’m on guile scheme due to guix, and frankly, i’m hating it a quite bit.

stack traces are esoteric and error messages entirely unhelpful,

documentation masquerades as deep but is indeed inconsistent and prosaic, mixing styles of reference, explanation, and how-to willy-nilly, (compare with Dybvig’s The Scheme Programming Language, which is focused and consistent, and it takes no time to get your answers; there’s just no method to guile and guix manuals), i hate it big time,

there’s big gaps in documentation (especially with Guix – there’s literally zero information about `define-record-type*` which is used everywhere in its codebase; admittedly, not scheme related, but still),

the cli requires too much memorization,

most modules are not named, but numbered, ie, instead of something like `(base list)`, you get `(srfi srfi-1)`, so you need to either memorize, or go through the info pages for each procedure you need to import, which means you also need to know the exact names for the procedures you need beforehand,

there’s like 4 ways to define a record, each with a different feature set and incompatibilities,

etc.

these are the reasons i find it hard to use.

to respond to the content of the article, the different neurotype idea is off, because scheme allows you very well to express sequences of operations; the ecosystem of APIs may not cater to this tho. although if it was rephrased into “scheme emphasizes symbolic manipulations, as opposed to operating a machine”, i would agree

show 2 replies
kayo_20211030today at 2:36 PM

I understand the challenge, but is Graham (OP?) getting too caught up in how the code ought to look, rather that what it ought to do. I don't think it matters much initially how a piece of work looks as long as it does what's intended. Afterwards it does; particularly if you need to involve other developers, and to them, the idioms looks "strange". I'm not convinced that there's an ALGOL neurotype that's distinct from a LISP(?) neurotype. I think it's a bit of a spectrum like everything else.

matheusmoreiratoday at 4:10 PM

I bounced off Scheme so many times I just created my own lisp instead. At some point I just accepted that I wouldn't ever be comfortable in any language other than the one I made myself. I too have the ALGOL neurotype...

chuckadamstoday at 3:14 PM

You can write entirely imperative OO code in Scheme, it just has syntax that's weirder than you're used to. Not everything has to be functional abstractions, syntax macros, or twisty mazes of call/cc. If SICP is too abstruse, give HTDP a try, but if you know other languages, you already know most of scheme.

pfdietztoday at 4:33 PM

You might try Common Lisp instead.

varjagtoday at 2:33 PM

I think it's the symptom of inadequate practice rather than some "language neurotype". Consider writing (yeah 2026 I know) a substantial project in Scheme from scratch.

show 1 reply
SilentM68today at 6:40 PM

I've had a similar problem. I originally started learning programming with BASIC, assembly, procedural, event-driven, languages, found OOP bloated and thus counter productive, time consuming, still do. Have tried to focus on functional languages, but for some reason none stick. Not sure if it is my brain, or haven't found the right language that will work with my head. I'm trying my luck at Odin to see if that can stick with me.

tmtvltoday at 2:57 PM

There's something very ironic about an article about bouncing off Scheme on a website called 'SICPers'. OT: I think I'm pretty decent at thinking in Scheme, although I don't quite have the hang of continuations. That said, because I like type declarations I use Common Lisp, which allows me to bounce between a more Scheme-like style and a more Assembly-like style however I see fit.

neilvtoday at 3:44 PM

> Obviously an LLM generated the code, but I felt comfortable following along and understood what it was doing, reading and Trusting the Tests. [...] My difficulty is with thinking the way that lets me write Scheme.

There's your problem, right there. Vibe-coding is sabotaging learning before you even start.

You can learn some things by reading good code, but there's no substitute for the exercise of thinking through problems yourself. (Also, an LLM won't necessarily give you good code.)

First learn paint fence, Daniel-san. Not watch third-hand videos spliced together of other people painting the fence, and thinking you'll understand much of anything about it.

> I have the ALGOL neurotype.

Good news! Scheme started as a block-structured imperative "algorithmic" language in the spirit of ALGOL. Just with more parentheses.

Write as if in ALGOL, but using Scheme's comparable syntax and language features. And lots of parentheses.

Don't get confused by CS professors showing you pure-functional features, the metacircular evaluator, recursive programming, syntax extension and language-oriented programming, etc. You can come back to that.

Just start coding ALGOL-style in Scheme. You'll accomplish something in an hour.

Once you see it's easy, and are comfortable with that part, then the next thing you do, to get more idiomatic is one of the following, then do the other one:

* Try to get more functional, by eliminating some of the mutations of variables in your code. For example, if you're using `set!` a lot, can you eliminate them by, for example, making them arguments in a named-`let` recursion. (Or, instead of named-`let`, spell out the recursive functions, like some intro CS professors will want you to do, but that can obscure things that are obvious once you see the named-`let` lexical structure.)

* Try to get more language-oriented, by making a little domain-specific language, maybe with `syntax-rules`, `syntax-case`, or `syntax-parse`.

One more tip, for anyone coming from C, C++, Rust, etc., who may like trying to know the cost of everything: If you get hung up on high-level language features like GC, and not knowing which of a number of ways of doing something, is the right (performant) way, try not to. But if you want an intuition (that might be a lie), imagine that needless mutations or allocations may be more expensive than finding a different way to do it. And each FFI call has very expensive overhead. At one point that I had to make highly performant code, I made a little tool, to help confirm my intuitions: https://www.neilvandyke.org/racket/shootout/ There's also a statistical profiler in Racket now, and you can even (with work) rig it up in production systems, for measuring real-world workloads, which I used to guide optimizing performance of a large and complicated system.

throw310822today at 5:59 PM

I've had to go through my Scheme labs when I was studying CS. Even as a hobbyist with a decade of experience in various languages and a decent intuition for coding, I couldn't get my head around it. It's quite telling that a language that is hard to read, unfit for most purposes and that even proficient coders never seem to fully grasp, was chosen as a tool to introduce beginners to coding.

wellpasttoday at 4:04 PM

> When I think about a programming problem, I think in terms of the sequence of instructions I need the computer to do, and the memory locations that can hold the information the computer needs to track.

You’re almost there. Just stop thinking about the sequence of instructions. Focus on the information half (the values) that you need to produce.

Pay08today at 2:35 PM

I was the same way (and still am somewhat, I can't get hygenic macros into my head) but due to the differences between Scheme and Common Lisp. What helped me was writing imperative code that Scheme people would surely scoff at, and gradually using more and more Scheme features as I kept writing. Then I refactored the whole codebase to look like the final few hundred lines.

show 1 reply
leecommamichaeltoday at 3:00 PM

Do what works for you.

veltastoday at 2:25 PM

Is it possible you're too stupid to write scheme? Because that's where I think I am, I've also tried and failed to write it a few times.

show 2 replies