Re: [racket-users] Highlighting non-racket code in slideshow

2016-10-03 Thread Vincent St-Amour
`codeblock-pict` should do what you want, assuming there's a
corresponding #lang (doesn't need to be a full implementation, just
needs a lexer).

Alternatively, you can use my `java-lexer` package which, despite its
name, does a decent job with much more than just Java. I've used it to
get some ok highlighting for Haskell, for example. Turns out at the
lexer level, a lot of things kind of look the same. :)

Vincent



On Mon, 03 Oct 2016 18:16:56 -0500,
C K Kashyap wrote:
> 
> Hi,
> What's a good way to syntax-highlight non-racket code within slideshow?
> I've been using pandoc so far which has support for multiple languages
> but I'd like to start using slideshow.
> Regards,
> Kashyap
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Strange Error (Take 2)

2016-10-03 Thread 'brown131' via Racket Users
On Sunday, October 2, 2016 at 10:40:46 AM UTC-5, Alex wrote:
> Hi Matthew,
> 
> > You can get the same error as DrRacket by using `raco make` before 
> > `racket` on the command line. 
> 
> So it does! Thanks for the info/advice! And Scott, sorry for temporarily 
> hijacking your thread.
> 
> Cheers,
> Alex

No problem. I'm glad that my question benefited someone else as well.

-Scott

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Strange Error (Take 2)

2016-10-03 Thread 'brown131' via Racket Users
On Sunday, October 2, 2016 at 7:40:10 AM UTC-5, Matthew Flatt wrote:
> Hi Scott,
> 
> I didn't realize that you had deleted the old post, so I responded to
> it after all. I'm happy to update that reply in this thread.
> 
> I think that you're seeing a bug in the current expander's marshaling
> of information for a compiled module. In your original program, the
> problem affects the "metadata.rkt" module that supplies
> `racquel-namespace`.
> 
> As you note, the bug was introduced in recent versions. Specifically,
> it was introduced in v6.3 with the set-of-scopes expander. Happily, a
> re-implementation of the expander doesn't have the bug, but the
> re-implementation isn't quite ready to replace the current expander.
> 
> I'll fix the bug as soon as I can. Meanwhile, if you'd like a
> workaround for your original program:
> 
> The conflicting "lifted.0" is created in "metadata.rkt" by the contract
> system's expansion of `~a`. You can work around the problem by changing
> 
>   (~a col-fld)
> 
> to
> 
>   (format "~a" col-fld)
> 
> In your smaller version below, something similar should happen with
> `query-rows`. Even though the function is never called, the
> `query-rows` call syntactically triggers a contract expansion that
> introduces "lifted.0".
> 
> More generally, the workaround is to use `define-namespace-anchor` in a
> module that does not call any functions with a contract via
> `racket/contract` (which is, of course, something you generally should
> not have to know or worry about).
> 
> Matthew 
> 
> At Sat, 1 Oct 2016 21:01:05 -0700 (PDT), "'brown131' via Racket Users" wrote:
> > I am getting strange error in my Racquel package unit tests. I'm not sure 
> > what 
> > Racket release it started appearing in, but certainly 6.6 or 6.5. A couple 
> > of 
> > days ago, I posted the all of code that was causing the error, but there 
> > was 
> > too much going on for anyone to make sense of it (including me) and so I 
> > deleted the post. Now I've spent a few hours and reduced the bug to the 
> > minimum code required to reproduce it.
> > 
> > The error I'm seeing in my tests is:
> > 
> > define-values: assignment disallowed 
> > cannot re-define a constant
> >   constant: lifted.0
> > 
> > This error is rather obtuse and I have no I idea what it trying to 
> > communicate 
> > given that the code in question has no constant named "lifted". I can only 
> > assume that it is some internal error related to syntax lifting.
> > 
> > Below are the two modules needed to reproduce the error. What makes this 
> > error 
> > particularly strange is that the error occurs until the foobar function in 
> > bug2.rkt is commented out. This function is not even called anywhere!
> > 
> > Interestingly it must call query-rows. If foobar calls anything else, the 
> > bug 
> > goes away. This may mean that there is an error somewhere in the db package.
> > 
> > When the foobar function is commented out, everything works fine. In this 
> > example, for the sake of brevity, it will give an error that error-me% is 
> > undefined. I could have defined it and the other classes, and it would have 
> > ran with no errors.
> > 
> > The problem is that in the real version of the code, the foobar function is 
> > used and necessary. I can't just comment it out. Until I know what's going 
> > on 
> > here, I can't even devise a workaround. 
> > 
> > bug.rkt:
> > #lang racket
> > 
> > (require "bug2.rkt" (for-syntax racket/syntax syntax/parse "bug2.rkt"))
> > 
> > (define-syntax (data-class stx)
> >   (syntax-parse stx 
> > [(_ base-cls:id (i-face:id ...) elem:data-class-element ...) 
> >  (with-syntax ([m-data (generate-temporary)])
> >#'(let* ([m-data (new error-me%)])
> >(class* base-cls (bar% i-face ...) 
> >  elem.cls-expr ...
> >  (inspect #f]))
> > 
> > (define (gen-data-class) 
> >   (let* ([cls-nm 'cls-nm]
> >  [stx #`(data-class object% (foo%) (super-new))])
> > (eval-syntax stx bug-namespace)))
> > 
> > (define fred% (gen-data-class))
> > 
> > bug2.rkt:
> > #lang racket
> > 
> > (require syntax/parse db (for-syntax racket/syntax syntax/parse))
> > 
> > (provide (all-defined-out))
> > 
> > ;;; Until this is commented-out the error persists.
> > (define (foobar con) (query-rows con ""))
> > 
> > (define-namespace-anchor bug-namespace-anchor)
> > (define bug-namespace (namespace-anchor->namespace bug-namespace-anchor))
> >  
> > (define-syntax-class data-class-element
> >   #:attributes (cls-expr)
> >   (pattern (x:expr ...)
> >#:attr cls-expr #'(x ...)))

Thanks for the help! I'm impressed that you were able to find the issue so 
quickly. I'm pretty sure that I wouldn't have found the answer, let alone have 
known that the work around was so simple.

-Scott

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

[racket-users] DrRacket Debugger pause on error?

2016-10-03 Thread Charles Rich
Hi all, Is there a way to get the DrRacket debugger to pause when then is an 
error, so that one can inspect the values of variables?   

Since this debugger otherwise has similar capabilities to other common 
debuggers, such as in Eclipse, it seems like there ought to be a way, but I 
could not find it with documentation or experimentation.

Thanks, -CR

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Highlighting non-racket code in slideshow

2016-10-03 Thread C K Kashyap
Hi,
What's a good way to syntax-highlight non-racket code within slideshow?
I've been using pandoc so far which has support for multiple languages but
I'd like to start using slideshow.
Regards,
Kashyap

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How to get non-prefab struct values from manually-expanded syntax?

2016-10-03 Thread Jack Firth
So I'm reading a file in as code and expanding it, then looking for values in a 
certain
syntax property that macros in the expanded code attach. This works fine for 
prefab
structs, but I can't seem to get it to work with transparent structs. The issue 
is that
the struct values can be extracted just fine, but they don't satisfy the struct 
predicate
because a different module instance is used to construct them during expansion 
from
the one I use to analyze the extracted values. I found 
`namespace-attach-module`,
but there's a phase-difference involved because I'm trying to get expansion-time
constructed structs and manipulate them at runtime. I could just leave the 
struct as
prefab, or define it in a cross-phase-persistent module, but then I don't get 
to do
things like implement the gen:custom-write interface. What can I do?

-- 
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.
For more options, visit https://groups.google.com/d/optout.