Re: [racket-users] Re-defined constant when dynamically evaluating module forms

2021-05-12 Thread Matthew Flatt
I think the problem here is that you're re-defining a module. The `lifted/4` binding is probably a generated one in the module, and redeclaring the module would require changing `lifted/4` --- and probably other bindings that you would recognize, but `lifted/4` happens to be hit first. To avoid

[racket-users] Re-defined constant when dynamically evaluating module forms

2021-05-12 Thread Sage Gerard
I have a program that takes a (trusted) module form as a list and then pulls out a provided value using this method. I used syntax/modread and generate a pseudorandom id for each value of `trusted` here. (define-namespace-anchor anchor) (define module-namespace (namespace-anchor->namespace

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread kamist...@gmail.com
p.s: scale-to-fit might be interesting for you and if you don't care about extra options (for background/alpha etc.) you can construct the pict with (bitmap path) directly instead of (bitmap (make-object bitmap% ...)) p.p.s: I think there was also a way to convert/use images within picts or the

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread Ben Greenman
On 5/12/21, Robert Haisfield wrote: > Daniel, that's awesome. How would I filter down this list according to the > regex? > > (define list-of-files (map path->string (directory-list starting-path))) You can wrap it in a filter: (define list-of-files (filter (lambda (str) (regexp-match?

Re: [racket-users] Redirecting shared lib stdout

2021-05-12 Thread Jon Zeppieri
Can you use BinaryenModuleWriteText instead? It looks like it was added to address your use case. -J On Wed, May 12, 2021 at 3:49 AM Paulo Matos wrote: > > Hi, > > I have a shared library for which I am creating some bindings: > https://github.com/pmatos/racket-binaryen > > There's a function

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread Robert Haisfield
Daniel, that's awesome. How would I filter down this list according to the regex? (define list-of-files (map path->string (directory-list starting-path))) On Tuesday, May 11, 2021 at 6:57:03 PM UTC-6 daniel@gmail.com wrote: > Hi Robert > > > > Even better if I could point the function at a

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread kamist...@gmail.com
Personally I use pict and racket/draw instead of htdp/image, because save-image is png only. Pict to transform or load the image, racket/draw's bitmap% to save and/or load the image (sidenote: in general I find pict more pleasant to work with, but that may be subjective): (require pict

[racket-users] Error in DrRacket "Couldn't find a browser"

2021-05-12 Thread Chae Cramb
I'm new to Racket and have just started working through the "How to Code" course on edX. When I right-click on a primitive in DrRacket and try to search for it in the Help Desk I get the following error: send-url: Couldn't find a browser to open URL:

Re: [racket-users] Redirecting shared lib stdout

2021-05-12 Thread Sage Gerard
I ran into this issue with rsound. I'm not sure how standard output can be directly captured from a lower-level language in a Racket context when that language can freely ignore the Racket printer and write directly to STDOUT within the same operating system process. I'd hate to just add a "me

Re: [racket-users] Injecting local contracts for prefab constructors

2021-05-12 Thread David Storrs
If you're willing to accept a low tech solution, might I suggest this: $ perl -i.bak -lpe 's/\(foo/\(make-foo/g' *.rkt Also, I'll self-plug and point you towards this: #lang racket (require struct-plus-plus ) (struct++ foo ([a real?]) (#:omit-reflection) #:prefab) (define checked (foo++ #:a

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread Robert Haisfield
Dan, that's awesome. Thank you. Martin, I would love some way to extract the image metadata from each of the files outputted by Dan's function. All my function does is take the current width and height and apply some math to return some new values, so right now I'm just manually going into

[racket-users] Redirecting shared lib stdout

2021-05-12 Thread Paulo Matos
Hi, I have a shared library for which I am creating some bindings: https://github.com/pmatos/racket-binaryen There's a function BinaryenModulePrint that prints a WebAssembly module to stdout. When I wrap it in racket, if I do something like: (define mod ...) (with-output-to-string (lambda ()