
@todo If you are using DrRacket you can change the printing mode in the “Languages” menu. Under “Choose Language” click the “Advanced” button and then change the printing mode (note: this was written by memory, so menu items might have different names).

SICP covers regular quoting on this page https://xuanji.appspot.com/isicp/4-1-metacircular.html

(define (quoted? exp) (tagged-list? exp ’quote))
(define (text-of-quotation exp) (cadr exp))

It’s not “much” but it’s code. No quasi or splicing or anything, though, as far as I’m aware.

@todo
Generally, quote
has just about the least amount of behavior an expression can have, and since few (if any) other features of a language have the ability transport a value from compile time to run time, quote
tends to be built in.
Maybe think of it this way: How does a variable reference work? It looks up the value by name from the lexical environment. How does a quote
expression work? It looks up a value from its own expression.
Expressions are a concept that usually makes more sense before macroexpansion than after, and the way quote
transports a value from compile time to run time can be nontrivial. A compiled language like Racket will have to implement this transportation by serializing the quoted s-expression as part of the compiled code and then reconstructing it when the code is loaded. On the other hand, if the program isn’t compiled, then the transportation can be as simple as running the macroexpander and the resulting program in the same memory space, where they can both refer to the same value.

As for quasiquote
, it can usually be implemented as a macro that expands into uses of cons
, append
, quote
, but other than that, it doesn’t typically interact with quote
at all.

The behavior of quasiquote
walks the input, usually translating cons cells into cons
calls and symbols x
into (quote x)
. It goes into some special cases if it encounters (unquote ...)
, (unquote-splicing ...)
, or (quasiquote ...)
, but (quote ...)
isn’t one of the special cases.

The reason quasiquote
goes into a special case if it encounters another (quasiquote ...)
is out of a motivation similar to balancing parentheses: The second quasiquote
is metaphorically another open paren, and the next closing paren (unquote
) that appears afterward will match up with that nearest quasiquote
, not the outer one.
Since quote
doesn’t have a matching counterpart like quasiquote
’s unquote
, it’s not like a paren in this metaphor. It’s just another piece of content in between the parens, so quasiquote
handles it adequately even without having a special case for it.

@todo Wrt to quotation and quasiquotion: Bawden has a thorough paper on the subject: https://3e8.org/pub/scheme/doc/Quasiquotation%20in%20Lisp%20(Bawden).pdf

@lexi.lambda do you have an example of the poorly-performing code you mentioned?

@samth Not in any form that’s probably very interesting/useful. I am writing a (CPS’d) parser, though, which was one of the things you mentioned that the tracing JIT is less likely to be good at.

well if you have the sequence code you mentioned I’d be interested to try it

I have put it aside for a moment, but I’ll certainly send it to you if I return to working on it and can get it to a good place where you could easily run it.

Is that the first-class pattern parser that supports cut and delimit-cut like syntax-parse, or is it something else?

I like that the PDF was “Manufactured in The Netherlands”

Yeah, it’s that.

Updated guide and reference for Racket Mode at its own domain: https://www.racket-mode.com/

It seems a bit strange that if i right click on a symbol, i can jump to prev/next occurrence, and open defining file, but cant jump to the definition

If the binding is defined by a macro that doesn’t set up source locations in a nice way, sometimes Check Syntax can’t figure out where the original definition is supposed to be

ah ic

@joelmccracken isn’t “jump to binding occurrence” what you want?

I think @joelmccracken is talking about an identifier defined in another file, in which case jump to binding occurrence will just go to the require
, but I could be misinterpreting

oh now it shows “jump to definition”

huh

oh, yeah, you also have to wait for the other file to be expanded by background expansion

(yes, you are right @lexi.lambda, jump to binding occurrence just jumps to the require line)

TY good to know

it would be nice if DrRacket had an option to say “open the defining file and jump to the definition as soon as you’re done expanding it”

fwiw the fn in question is defined via a define+provide

but currently you just have to click “open defining file”, wait for background expansion to finish, then do “jump to definition” once it’s done

yeah that would