pierre
2019-4-4 09:11:42

wow, thanks!


pierre
2019-4-4 09:12:01

(although nw, my server side code is untyped, keeping the bookmark around)


pierre
2019-4-4 09:12:05

:bow:


oldsin
2019-4-4 12:05:21

Is there a way to add numbered captions (or ‘counters’) with a frame to the source code (using codeblock) in scribble? (The effects I want is just like the picture shown below)


jerome.martin.dev
2019-4-4 12:08:21

I guess you could wrap the codeblock call in your own function with a counter in scope


pocmatos
2019-4-4 12:09:37

@oldsin i think what @jerome.martin.dev is getting to is that it’s possible but you don’t get it out of the box.


oldsin
2019-4-4 12:10:56

Yes I see. I just thought there might be some high level API that gave me this ability.


pocmatos
2019-4-4 12:12:17

@oldsin wish there was. I think everyone has their own features for their scribble documents - some have made it into pkgs but there has not been, afaik, a concerted effort to have a scribble-extras library to do these things.


jerome.martin.dev
2019-4-4 12:15:19

Something like this (except I don’t remember the exact use for codeblock, this might be wrong but you get the idea): (define numbered-codeblock (let ([counter 0]) (lambda (title code-text) (set! counter (add1 counter)) (codeblock #:title (format "Listing ~a: ~a" counter title) code-text))))


jerome.martin.dev
2019-4-4 12:17:48

Obviously, if such feature is really interesting to a lot of people, somebody can make a Pull Request and add it to the standard, but as @pocmatos said, a scribble-extra lib might be a good experimenting ground too!


oldsin
2019-4-4 12:20:08

Appreciate for your detailed source!


jerome.martin.dev
2019-4-4 12:23:51

You’re welcome :slightly_smiling_face: It’s obviously going to crash as codeblock is not used like this, but anyways…


jerome.martin.dev
2019-4-4 12:28:35

Also, my code is a global state. Using the function in different scribble modules is gonna continue counting up from where it was in the previous document. If one needs a per-document counter, we need to make something a bit more complex, I guess with a syntax-parameter.


samth
2019-4-4 14:07:35

You should copy this conversation into a blog post


krismicinski
2019-4-4 14:26:57

Agreed! I started taking down some notes but there are enough questions I still have at the boundary that it would take some time to absorb.


samth
2019-4-4 14:27:25

Really I think just copy-and-paste would make an illuminating post


lexi.lambda
2019-4-4 14:48:55

I realized I never answered this. identifier-transformer-binding is just identifier-binding at phase 1 (rather than phase 0).


krismicinski
2019-4-4 14:50:13

Yeah! I saw this last night. I only have vague intuition about phases as “eh, they stratify expansion passes.” As you know (for anyone following along) there’s really readable documentation here: https://docs.racket-lang.org/guide/phases.html


krismicinski
2019-4-4 15:04:11

I’m working on this along with annotating it with some more examples


philip.mcgrath
2019-4-4 17:45:56

FYI (with thanks to @ben for bringing the existence of typed/web-server/http to my attention), some of its types were out-of-date, particularly for cookie-related functions. I’ve made updates in https://github.com/racket/typed-racket/pull/817


krismicinski
2019-4-4 18:39:55

Also, apparently I didn’t read this: > More specifically, the typesetting of identifiers in the above grammar is significant. For example, the second case for expr is a syntax-object list whose first element is an identifier, where the identifier’s lexical information specifies a binding to the #%plain-lambda of the racket/base language (i.e., the identifier is free-identifier=? to one whose binding is #%plain-lambda).


krismicinski
2019-4-4 20:53:36

One thing I wish I could assemble would be a systematic history of the development of the Racket macro system (dating back to Scheme, I suppose) with each different feature in boxes and links to the corresponding mailing list posts, papers, blog posts, commits, etc…


jesse
2019-4-5 05:00:59

@philip.mcgrath ack, I fell behind with your work in web-server — I made some changes to the various response-generating functions, too (not the same as your changes) and ran into conflicts