soegaard2
2019-5-23 09:39:44

@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).


sydney.lambda
2019-5-23 12:34:28

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


sydney.lambda
2019-5-23 12:34:59

(define (quoted? exp) (tagged-list? exp ’quote))

(define (text-of-quotation exp) (cadr exp))


sydney.lambda
2019-5-23 12:35:19

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


rokitna
2019-5-23 12:38:17

@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.


rokitna
2019-5-23 12:40:56

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.


rokitna
2019-5-23 12:45:10

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.


rokitna
2019-5-23 12:56:03

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.


soegaard2
2019-5-23 13:47:34

@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


samth
2019-5-23 20:14:14

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


lexi.lambda
2019-5-23 20:15:22

@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.


samth
2019-5-23 20:17:07

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


lexi.lambda
2019-5-23 20:20:04

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.


alexknauth
2019-5-23 20:21:36

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


greg
2019-5-23 20:25:47

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


lexi.lambda
2019-5-23 20:32:52

Yeah, it’s that.


greg
2019-5-24 03:29:56

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


joelmccracken
2019-5-24 05:17:55

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


lexi.lambda
2019-5-24 05:18:52

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


joelmccracken
2019-5-24 05:19:16

ah ic


dan
2019-5-24 05:19:17

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


lexi.lambda
2019-5-24 05:19:58

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


joelmccracken
2019-5-24 05:20:06

oh now it shows “jump to definition”


joelmccracken
2019-5-24 05:20:13

huh


lexi.lambda
2019-5-24 05:20:21

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


joelmccracken
2019-5-24 05:20:40

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


joelmccracken
2019-5-24 05:20:47

TY good to know


lexi.lambda
2019-5-24 05:21:09

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”


joelmccracken
2019-5-24 05:21:20

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


lexi.lambda
2019-5-24 05:21:36

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


joelmccracken
2019-5-24 05:21:37

yeah that would