[racket-users] Re: [scribble] code:hilite for binders

2020-08-23 Thread Ryan Kramer
You might also be able to use make-element-id-transformer 

 
like this

#lang scribble/manual

@(begin
   (require scribble/racket
scribble/eval
(for-syntax racket/base))

   (define-syntax FOO (make-element-id-transformer
   (lambda arglist #'(racket (code:hilite foo)
   (interaction
(let ([FOO 41])
  (add1 FOO


On Saturday, August 22, 2020 at 5:15:17 PM UTC-5, Éric Tanter wrote:
>
> Hi, 
>
> From the doc: `(code:hilite datum)` typesets like `datum`, but with a 
> background highlight. 
> However, it does not work to highlight a binder, eg: `(letrec 
> ([(code:hilite self) …]) …)` 
> Is there another way to highlight a binder? 
>
> Thanks, 
>
> — Éric 
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a4bb9d79-5f2a-4317-82f9-0d4de630af10o%40googlegroups.com.


Re: [racket-users] [scribble] code:hilite for binders

2020-08-23 Thread Éric Tanter
I was expecting (fearing?) such an answer ;-)
If by any chance you have that macro lying around, I would happily reuse it. It 
might make sense to include such a facility in scribble anyway.

-- Éric

> On 23-08-2020, at 10:27, Robby Findler  wrote:
> 
> 
> I think I've run into this too (but my memory is foggy) and what I did was 
> have a macro that expands into `code` and also expands into the actual code 
> but walks over the code and drops things like code:hilite and code:comment.
> 
> Robby
> 
> 
>> On Sun, Aug 23, 2020 at 9:23 AM Éric Tanter  wrote:
>> Ok, I “solved” my problem.
>> 
>> The `(define (code:hilite v) v)` is a hack to be able to use `code:hilite` 
>> in blocks that are executed, not just displayed, but of course that does not 
>> work when highlighting binders.
>> 
>> The solution is to separate the display from the execution, with a separate 
>> evaluation in the corresponding evaluator.
>> 
>> The downside is that this forces a duplication of the code (once to display 
>> with highlight, once to evaluate). I’m still interested in knowing if 
>> there’s a duplication-free solution to this, but meanwhile I’ll just live 
>> with it.
>> 
>> — Éric
>> 
>> 
>> 
>> 
>> > On Aug 22, 2020, at 6:25 PM, Éric Tanter  wrote:
>> > 
>> > Just to complement: I’m editing some scribble I wrote years ago and I 
>> > completely forgot why I was doing that, but to be able to use 
>> > `(code:highlight …)` in code blocks, I had to add the following line 
>> > (where `ex-eval` is my base evaluator):
>> > ```
>> > @interaction-eval[#:eval ex-eval (define (code:hilite v) v) ]
>> > ```
>> > 
>> > sorry if that’s confusing, but I’m confused ;-)
>> > 
>> > I just want a way to highlight any bits in a code block, in order to bring 
>> > the reader’s attention to specific places (could be binders, whole 
>> > expressions, etc.).
>> > 
>> > Thanks!
>> > 
>> > — Éric
>> > 
>> > 
>> > 
>> > 
>> >> On Aug 22, 2020, at 6:15 PM, Éric Tanter  wrote:
>> >> 
>> >> Hi, 
>> >> 
>> >> From the doc: `(code:hilite datum)` typesets like `datum`, but with a 
>> >> background highlight.
>> >> However, it does not work to highlight a binder, eg: `(letrec 
>> >> ([(code:hilite self) …]) …)`
>> >> Is there another way to highlight a binder?
>> >> 
>> >> Thanks,
>> >> 
>> >> — Éric
>> >> 
>> >> 
>> >> 
>> >> 
>> >> -- 
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "Racket Users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send an 
>> >> email to racket-users+unsubscr...@googlegroups.com.
>> >> To view this discussion on the web visit 
>> >> https://groups.google.com/d/msgid/racket-users/32CE30FE-9724-4421-9A8B-63780A403A5A%40dcc.uchile.cl.
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google Groups 
>> > "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to racket-users+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/racket-users/09CDBBC0-8A5B-4573-9CC6-DA41B3DE53C1%40dcc.uchile.cl.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/1BE55C14-6B08-4FFC-85EA-C6590D84C1E0%40dcc.uchile.cl.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAL3TdOPLXFp1%2B%2BaqPS3nEbLE3kiF%2BO-%2BVSei2vJcb-8Ju5Mz1g%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/045168BA-B482-466D-97B7-D89EDA1917E4%40dcc.uchile.cl.


[racket-users] Re: [racket-dev] Does the Guide need to mention syntax parse & does the Style guide need to provide guidance?

2020-08-23 Thread Sorawee Porncharoenwase
The guide seems to be for the Racket code base (https://github.com/racket)
rather than general Racket code, so I don't think it should say "prefer
syntax-parse over syntax-case".

I do think there should be a style guide for general Racket code (which
could very well be based on the style guide for the Racket code base), and
for this guide, it would make sense to say "prefer syntax-parse over
syntax-case".

On Sun, Aug 23, 2020 at 10:51 AM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Hi
>
> With reference to this discussion on reddit/r/racket :
>
>
> https://www.reddit.com/r/Racket/comments/ie8rlf/when_creating_macros_is_syntaxparse_preferred_to/?utm_source=share&utm_medium=ios_app&utm_name=iossmf
>
>
> Does
> https://github.com/racket/racket/blob/master/pkgs/racket-doc/scribblings/guide/macros.scrbl
> need to be updated to link to the syntax parse introduction
> https://docs.racket-lang.org/syntax/stxparse-intro.html ?
>
> What should it say?
>
> > Robust macros can be written with syntax-parse and syntax classes.
>
> Does the Style Guide need a section for when to use syntax-rules, -case
> or -parse?
>
> What should it look like?
>
> (in the spirt of
> https://docs.racket-lang.org/style/Choosing_the_Right_Construct.html#%28part._.Functions_vs_.Macros%29
> )
>
> Kind regards
>
> Stephen
>
> --
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-dev/CAGHj7-J6XdT%3DzGtt5aVA8M6ZgJX2%3D0G-6ZnR%2BUYRBTQsLczKnw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegtrKBM3DMju1CiT-qX9%3DW9ujypPDTEn1JkFKL9TQre7zg%40mail.gmail.com.


[racket-users] Does the Guide need to mention syntax parse & does the Style guide need to provide guidance?

2020-08-23 Thread Stephen De Gabrielle
Hi

With reference to this discussion on reddit/r/racket :

https://www.reddit.com/r/Racket/comments/ie8rlf/when_creating_macros_is_syntaxparse_preferred_to/?utm_source=share&utm_medium=ios_app&utm_name=iossmf


Does
https://github.com/racket/racket/blob/master/pkgs/racket-doc/scribblings/guide/macros.scrbl
need to be updated to link to the syntax parse introduction
https://docs.racket-lang.org/syntax/stxparse-intro.html ?

What should it say?

> Robust macros can be written with syntax-parse and syntax classes.

Does the Style Guide need a section for when to use syntax-rules, -case or
-parse?

What should it look like?

(in the spirt of
https://docs.racket-lang.org/style/Choosing_the_Right_Construct.html#%28part._.Functions_vs_.Macros%29
)

Kind regards

Stephen

-- 


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-J6XdT%3DzGtt5aVA8M6ZgJX2%3D0G-6ZnR%2BUYRBTQsLczKnw%40mail.gmail.com.


Re: [racket-users] [scribble] code:hilite for binders

2020-08-23 Thread Robby Findler
I think I've run into this too (but my memory is foggy) and what I did was
have a macro that expands into `code` and also expands into the actual code
but walks over the code and drops things like code:hilite and code:comment.

Robby


On Sun, Aug 23, 2020 at 9:23 AM Éric Tanter  wrote:

> Ok, I “solved” my problem.
>
> The `(define (code:hilite v) v)` is a hack to be able to use `code:hilite`
> in blocks that are executed, not just displayed, but of course that does
> not work when highlighting binders.
>
> The solution is to separate the display from the execution, with a
> separate evaluation in the corresponding evaluator.
>
> The downside is that this forces a duplication of the code (once to
> display with highlight, once to evaluate). I’m still interested in knowing
> if there’s a duplication-free solution to this, but meanwhile I’ll just
> live with it.
>
> — Éric
>
>
>
>
> > On Aug 22, 2020, at 6:25 PM, Éric Tanter  wrote:
> >
> > Just to complement: I’m editing some scribble I wrote years ago and I
> completely forgot why I was doing that, but to be able to use
> `(code:highlight …)` in code blocks, I had to add the following line (where
> `ex-eval` is my base evaluator):
> > ```
> > @interaction-eval[#:eval ex-eval (define (code:hilite v) v) ]
> > ```
> >
> > sorry if that’s confusing, but I’m confused ;-)
> >
> > I just want a way to highlight any bits in a code block, in order to
> bring the reader’s attention to specific places (could be binders, whole
> expressions, etc.).
> >
> > Thanks!
> >
> > — Éric
> >
> >
> >
> >
> >> On Aug 22, 2020, at 6:15 PM, Éric Tanter  wrote:
> >>
> >> Hi,
> >>
> >> From the doc: `(code:hilite datum)` typesets like `datum`, but with a
> background highlight.
> >> However, it does not work to highlight a binder, eg: `(letrec
> ([(code:hilite self) …]) …)`
> >> Is there another way to highlight a binder?
> >>
> >> Thanks,
> >>
> >> — Éric
> >>
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/32CE30FE-9724-4421-9A8B-63780A403A5A%40dcc.uchile.cl
> .
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/09CDBBC0-8A5B-4573-9CC6-DA41B3DE53C1%40dcc.uchile.cl
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/1BE55C14-6B08-4FFC-85EA-C6590D84C1E0%40dcc.uchile.cl
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOPLXFp1%2B%2BaqPS3nEbLE3kiF%2BO-%2BVSei2vJcb-8Ju5Mz1g%40mail.gmail.com.


Re: [racket-users] [scribble] code:hilite for binders

2020-08-23 Thread Éric Tanter
Ok, I “solved” my problem.

The `(define (code:hilite v) v)` is a hack to be able to use `code:hilite` in 
blocks that are executed, not just displayed, but of course that does not work 
when highlighting binders.

The solution is to separate the display from the execution, with a separate 
evaluation in the corresponding evaluator.

The downside is that this forces a duplication of the code (once to display 
with highlight, once to evaluate). I’m still interested in knowing if there’s a 
duplication-free solution to this, but meanwhile I’ll just live with it.

— Éric




> On Aug 22, 2020, at 6:25 PM, Éric Tanter  wrote:
> 
> Just to complement: I’m editing some scribble I wrote years ago and I 
> completely forgot why I was doing that, but to be able to use 
> `(code:highlight …)` in code blocks, I had to add the following line (where 
> `ex-eval` is my base evaluator):
> ```
> @interaction-eval[#:eval ex-eval (define (code:hilite v) v) ]
> ```
> 
> sorry if that’s confusing, but I’m confused ;-)
> 
> I just want a way to highlight any bits in a code block, in order to bring 
> the reader’s attention to specific places (could be binders, whole 
> expressions, etc.).
> 
> Thanks!
> 
> — Éric
> 
> 
> 
> 
>> On Aug 22, 2020, at 6:15 PM, Éric Tanter  wrote:
>> 
>> Hi, 
>> 
>> From the doc: `(code:hilite datum)` typesets like `datum`, but with a 
>> background highlight.
>> However, it does not work to highlight a binder, eg: `(letrec ([(code:hilite 
>> self) …]) …)`
>> Is there another way to highlight a binder?
>> 
>> Thanks,
>> 
>> — Éric
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/32CE30FE-9724-4421-9A8B-63780A403A5A%40dcc.uchile.cl.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/09CDBBC0-8A5B-4573-9CC6-DA41B3DE53C1%40dcc.uchile.cl.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1BE55C14-6B08-4FFC-85EA-C6590D84C1E0%40dcc.uchile.cl.