8/22/2026 at 7:05:30 PM
> no special syntax for anything. (list '(1. . #\#)
-5/6+7.s-8i
`(1 ,@2)
1@1 ;hmmm, no unquote splicing comma ;-)
10# ;surprised?
(list #i+1 +1i 1+i) ;complicated or complex?
#e-1e10i ;Old MacDonald?
"(* 9 10)" #())
by GregBuchholz
8/22/2026 at 8:27:33 PM
Yeah - the number syntax is pretty cool. #i is the prefix for inexact
#e is the prefix for exact
So `#e0.1` is exact 0.1 which means it will be read as an exact fraction 1/10
and `#i0.1` will be read as a floating point number.The `i` in `8i` is the imaginary unit. The `1@1` is the polar notation for complex numbers.
The `10#` is a compatibility remain (the Scheme authors wanted a way to see how many signifant digits were known. In `10#` there 2. So `#` stands for "some digit". In most implementations this is read as 0. More details at [1]
An `#` followed by a list datum is read as a vector. Thus `#()` is an empty vector and `()` is an empty list.
[1] https://stackoverflow.com/a/10936403/23567
Complicated? Well, to support both inexact (floating point) and exact numbers (bignums and fractions) it makes sense to have `#i` and `#e` to explicitl choose. The default is (more or less): numbers with . are inexact the others are exact.
by soegaard
8/22/2026 at 8:30:51 PM
At first I was frustrated by this comment, having a fair amount of Lisp experience failing to grok the examples. In less than one minute I was able to locate, download and install the latest Racket and was in a REPL. There really are no excuses.This was a wild ride. I'm torn on whether this feels like the Reader is bloated/polluted or whether this is the coolest numerical parser I've ever used. You can really do a lot to coerce the these numbers just by inserting an {o,s,e,i,b,#} into the number, with different semantics depending on the position of the character.
Somewhat overwhelming, I can only hope there's some elegance underlying it all...
by Syntonicles
8/22/2026 at 7:48:08 PM
It looks more like a "program" for an HP15c pocket scientific calculator.Not necessarily a bad thing but also not exactly what I would call "expressive".
You may be able to build anything you want --- which may be efficient when communicating with the machine. But I wonder about now well this would communicate with other programmers.
by jqpabc123
8/22/2026 at 8:14:05 PM
It's not a program, it is (obviously) a totally unrealistic hodgepodge expression for a list of constant values that simply demonstrates the literal syntax for a variety of types of values (real numbers, dotted pairs, rational numbers, complex numbers, polar coordinates, etc. -- Racket is unusually expressive in the types of literals). Your comment demonstrates something typical of HN, and it's not a good thing. It's as if in a discussion about C someone posted, without explanation, an entry from the Obfuscated C contest and then someone else, making zero effort to understand what was posted, said that it looked like line noise and questioned whether C is conducive to communication between programmers.by jibal
8/23/2026 at 9:18:51 AM
I think in this case it is probably justified, as the claim of "no special syntax" is unfortunately not true. To convey the amount of special syntax, it got crammed into one brief example snippet.Still, far less than most other programming languages, virtue of having parentheses making things unambiguous. Outliers are Smalltalk and maybe (?) Forth.
by zelphirkalt
8/25/2026 at 12:21:20 AM
Aren't reader macros just a convenient shorthand?by so-cal-schemer
8/23/2026 at 5:03:29 PM
> I think in this case it is probably justifiedWhat is "it"? The GP clearly doesn't understand that code and utterly misconstrues its nature and the nature of the Racket/Scheme/LISP language. If someone has zero knowledge of the topic at hand (even when it's a seminal programming language that's been around for nearly 70 years), they have an obligation to at least glance at TFA before commenting.
> the claim of "no special syntax" is unfortunately not true
That's a completely different issue than the one I addressed. (And I really don't think the point is made in good faith--the sense in which that phrase was meant is well understood, certainly by the GGP who is so very familiar with Racket's token syntax and quasiquotes.)
I won't respond further.
by jibal
8/23/2026 at 8:37:13 AM
First time dealing with developers I see. I’m sorry.by euduhdhbene
8/23/2026 at 5:05:10 PM
Nonsensical non sequitur ad hominem. (FWIW I've been a software developer for 60 years and have dealt with many of them.)I won't respond further.
by jibal
8/24/2026 at 9:13:40 AM
Apologies sir, it was uncalled for. The plebeian in me couldn’t resist.I am deeply jaded by my experience, but as you seem to imply your experience is different I am glad for you.
by euduhdhbene
8/23/2026 at 9:02:39 AM
I actually wrote an audio sequencer in HP RPL as a kid.It was far less complex to code, and human readable. Unicon was pretty cool also, but never became popular. Erlang/Elixir will probably become more relevant as people move into massively parallel constraint solvers.
The monolith centric languages are simply no longer appropriate for many classes of problems. =3
by Joel_Mckay
8/23/2026 at 1:50:15 PM
Unicon was pretty cool also, but never became popular.Like it or not, popularity is a significant attribute if you have to work with others.
by jqpabc123
8/23/2026 at 9:14:07 PM
>popularity is a significant attribute if you have to work with othersNot sure why people buried your comment, but there is a good argument for long term support.
NodeJS is probably the worst to maintain if you cater to the lowest common denominator. Easy to show quick results with a low skill team, but generally anyone that can't be bothered to use other languages is going to cause reliability problems sooner or later. Ecosystems like pip/Cargo/Go-flavor-of-the-year/npm that run out-of-band dependency management will have deferred perpetual IT costs. =3
by Joel_Mckay
8/22/2026 at 8:22:50 PM
Curious, how would look that in Python?by nilslindemann
8/23/2026 at 9:10:02 AM
Would need some imports: import cmath
from fractions import Fraction
And then have to write numbers as strings to input them. From their examples: >>> Fraction('1.414213 \t\n')
Fraction(1414213, 1000000)
>>> cmath.sqrt(-2-0j)
-1.4142135623730951j
Not really great, but workable. I don't like having to import things for basic math stuff like exact numbers, but having a lot of special syntax is maybe also not that great. I am guessing except for maybe macros, there is no other way, if one wants to take input (code) literally as exact numbers in all cases. If one were to just write down a number like `1.414213562373`, and expect it to be exactly represented in the program, then it cannot be read as a floating point number first and then converted into an exact number internally, because reading it as floating point number could already lose precision. So this kind of logic to interpret exact numbers would have to live somewhere before that. So it is in the reader. I am not sure how one could employ a macro instead, and then maybe access the digits of a written number, or whether that is possible. I think it should be possible. If it is, then of course things could be made into macros, after which one could use something like: (exact 1.4142135623730951)
[1]: https://docs.python.org/3/library/cmath.html
[2]: https://docs.python.org/3/library/fractions.html
by zelphirkalt
8/24/2026 at 6:58:20 AM
[dead]by nilslindemann
8/23/2026 at 4:50:46 AM
that look*by nilslindemann
8/23/2026 at 1:05:31 PM
Isn't at least one of them undefined? `(1 ,@2)It's always surprising to me how many things Scheme leaves undefined. Other examples are evaluation order (in some rather surprising places) or the value of: (make-bytevector 4)
by fweimer
8/23/2026 at 11:54:33 PM
Racket defines an evaluation order for function arguments (left to right).by shawn_w
8/24/2026 at 12:17:18 AM
Specifically section 4.3.1https://docs.racket-lang.org/guide/application.html#(part._....
by GregBuchholz
8/23/2026 at 1:51:28 PM
> `(1 ,@2)
'(1 . 2)
This is a pair. The notations is called "dotted pair".
by soegaard
8/23/2026 at 3:11:52 PM
Looks like fweimer is correct for scheme. I admit to being very surprised. Here is the verbiage from various rXrs:r3rs, r4rs & r5rs (section 4.2.6):
https://standards.scheme.org/official/r3rs.pdf
https://standards.scheme.org/official/r4rs.pdf
https://conservatory.scheme.org/schemers/Documents/Standards...
"If a comma appears followed immediately by an at- sign (@), then the following expression must evaluate to a list;"
r6rs (section 11.17):
https://standards.scheme.org/official/r6rs.pdf
"If an (unquote-splicing 〈expression〉 . . . ) form appears inside a〈qq template〉, then the〈expression〉s must evaluate to lists;"
r7rs (4.2.8):
https://standards.scheme.org/official/r7rs.pdf
"If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list;"
by GregBuchholz
8/23/2026 at 3:14:28 PM
You need to use the Racket documentation.by soegaard
8/23/2026 at 3:06:22 PM
But 2 isn't a list, and the argument to unqoute-splicing must be a list:> If an (unquote-splicing <expression> ...) form appears inside a <qq template>, then the <expression>s must evaluate to lists; the opening and closing parentheses of the lists are then “stripped away” and the elements of the lists are inserted in place of the unquote-splicing form.
by fweimer
8/23/2026 at 3:13:47 PM
See https://docs.racket-lang.org/reference/quasiquote.html#%28fo...by soegaard
8/23/2026 at 9:26:56 AM
I think you clearly exposed one of the things that I couldn't never describe why I wasn't dragged into Racket/scheme. It's not only annoying is hard to remember all these differences.Obviously the more you use the language these go away but still at least to me it doesn't seem to be a coherent syntax.
by liendolucas
8/23/2026 at 3:28:41 PM
Well, to be fair, many/most programs aren't using complex numbers, or concerned with inexact vs. exact numbers, significant digits, or really even scientific notation.by GregBuchholz
8/22/2026 at 10:55:05 PM
You forgot hash table and regular expression literals.by shawn_w
8/22/2026 at 11:11:26 PM
It looks like Racket nerfed the shared-structure / "Datum Labels" for circular lists and the like (I see it is still in section 2.4 of r7rs): '#0=(0 . #0#)
...and I should have included `#|block comments|#`, datum `#;comments`, and probably `|symbols with spaces|`. (let ((|1 + 2| (+ 1 2)))
(display |1 + 2|))
by GregBuchholz
8/22/2026 at 11:21:50 PM
That has been in Racket for a long time.by soegaard
8/22/2026 at 11:46:50 PM
I tried: #lang racket/base
(let ((a '#0=(0 . #0#)))
(display (car a)))
...over athttps://onecompiler.com/racket
...and it didn't compile, complaining:
read-syntax: `#...=` forms not enabled for `read-syntax` mode
...maybe there is a switch needed to enable it?
by GregBuchholz
8/23/2026 at 12:01:08 AM
I am not 100% sure what's going on, but you can use `read` mode this way: #lang racket
(let ((a (read (open-input-string "#0=(0 . #0#)"))))
(display (car a)))
I think the problem is that `read` / `write` support shared data constructed using `shared`. But programs (read by `read-syntax` are not allow to have cycles.
by soegaard
8/23/2026 at 12:16:57 AM
Yeah, there's a toggle for it in read-syntax mode.https://docs.racket-lang.org/reference/Reading.html#%28def._...
by shawn_w
8/23/2026 at 12:29:31 AM
How do you get that to work? #lang racket
(read-syntax-accept-graph #t)
(let ((a '#0=(0 . #0#)))
(display (car a)))
...which of course doesn't work, because `(read-syntax-accept-graph)` is a run-time thing, and the circular-list structure is a `read`-time thing.I couldn't figure it out with this either:
https://stackoverflow.com/questions/51942188/read-syntax-for...
...just to make sure I wasn't going crazy, this:
(let ((a '#0=(0 . #0#)))
(display (car a)))
...does work as expected with this online scheme interpreter:
by GregBuchholz
8/23/2026 at 9:21:52 AM
It's ugly and probably fragile and prone to break, but I found a way. Added it as an answer on that Stack Overflow question: https://stackoverflow.com/a/79997503/9952196by shawn_w
8/23/2026 at 3:52:23 AM
It might take a custom #lang. I'll play around with it when I have some free time...That read-syntax doesn't just accept everything accepted by plain read is one of my biggest annoyances with Racket.
by shawn_w
8/23/2026 at 8:42:53 AM
How did it manage the feat of being more baroque than CL? Why that #e madness instead of https://www.lispworks.com/documentation/HyperSpec/Body/f_rat... ?by BoingBoomTschak