[racket-users] Impersonating a 0-arity function
I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt -- this even possible? #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () ;;(values ;; -- this will run, but it doesn't wrap the result like I'd like. (values (lambda (r) (wrap r)) (values) (create-wrap) ;; Error! result arity mismatch: expected 1, got 0. -- 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] macro-generate attribute access?
Is there a way to access an attribute, other than with the . syntax? For example, the following example does not work: #lang racket (require (for-syntax syntax/parse)) (define-syntax (define-stuff stx) (syntax-parse stx [(_ attr-name macro-name) #'(begin (begin-for-syntax (define-syntax-class C (pattern any #:attr attr-name #'any))) (define-syntax macro-name (syntax-parser [(_ (~var c C)) #'c.attr-name])))])) (define-stuff an-attr a-macro) (a-macro 1) I've also tried various format-id's which I also can't get to work. Is there an alternate way, in the spirit of ~var vs :, to get an attribute's value? -- 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] specifying extra compiled collection paths with info.rkt?
The docs for `compile-collection-zos` [1] say that all files with the extension .rkt, .ss, or .scm in a collection are compiled and that within info.rkt, one can specify paths to omit with `compile-omit-paths`. Is there way to go the opposite direction — specify *extra* files that should be compiled — because they are bytecode-able, but don't use the three magic extensions? [1] http://pkg-build.racket-lang.org/doc/raco/API_for_Raw_Compilation.html?q=compile-collection-zos#%28def._%28%28lib._compiler%2Fcompiler..rkt%29._compile-collection-zos%29%29 -- 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] specifying extra compiled collection paths with info.rkt?
I've been bumping into variants of this problem — namely, difficulty using special source extensions — across the Racket ecosystem. In addition to this one, [2] Adding file types to `raco test` [3] Persuading DrRacket to handle special source-file extensions Is the underlying problem that I'm fighting the Racket gravitational field? Should I just dump my file extensions and use 'rkt'? I haven't done it yet because I've figured that others who have deployed DSLs with Racket have used special file extensions, and thus there must be an approved way of handling it. But maybe I'm the one who's doing it wrong. (I try to do something wrong every day. I usually succeed.) [2] https://groups.google.com/d/msg/racket-users/9e7Eqg2-PdE/636NjwhMq3cJ [3] https://github.com/mbutterick/pollen/issues/34 On Fri, Aug 21, 2015 at 11:42 AM, Matthew Flatt mfl...@cs.utah.edu wrote: It looks like there's not a way currently, although I think it would make sense to add one. For file extensions generally, I think there should be an info.rkt field to add extensions that are recognized by all tools that apply to all collections. That's a larger project, but it's on my near-term list of things to do. At Fri, 21 Aug 2015 09:51:08 -0700, Matthew Butterick wrote: The docs for `compile-collection-zos` [1] say that all files with the extension .rkt, .ss, or .scm in a collection are compiled and that within info.rkt, one can specify paths to omit with `compile-omit-paths`. Is there way to go the opposite direction — specify *extra* files that should be compiled — because they are bytecode-able, but don't use the three magic extensions? [1] http://pkg-build.racket-lang.org/doc/raco/API_for_Raw_Compilation.html?q=compile -collection-zos#%28def._%28%28lib._compiler%2Fcompiler..rkt%29._compile-collecti on-zos%29%29 -- 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] Impersonating a 0-arity function
At Fri, 21 Aug 2015 12:44:08 -0400, Benjamin Greenman wrote: I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt -- this even possible? #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () ;;(values ;; -- this will run, but it doesn't wrap the result like I'd like. (values (lambda (r) (wrap r)) (values) (create-wrap) ;; Error! result arity mismatch: expected 1, got 0. Just return the result-wrapping function, since that's one result (i.e., one more than the zero results for zero arguments): #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () (lambda (r) (wrap r) (create-wrap) -- 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] Impersonating a 0-arity function
Thank you! On Fri, Aug 21, 2015 at 2:38 PM, Matthew Flatt mfl...@cs.utah.edu wrote: At Fri, 21 Aug 2015 12:44:08 -0400, Benjamin Greenman wrote: I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt -- this even possible? #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () ;;(values ;; -- this will run, but it doesn't wrap the result like I'd like. (values (lambda (r) (wrap r)) (values) (create-wrap) ;; Error! result arity mismatch: expected 1, got 0. Just return the result-wrapping function, since that's one result (i.e., one more than the zero results for zero arguments): #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () (lambda (r) (wrap r) (create-wrap) -- 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] specifying extra compiled collection paths with info.rkt?
It looks like there's not a way currently, although I think it would make sense to add one. For file extensions generally, I think there should be an info.rkt field to add extensions that are recognized by all tools that apply to all collections. That's a larger project, but it's on my near-term list of things to do. At Fri, 21 Aug 2015 09:51:08 -0700, Matthew Butterick wrote: The docs for `compile-collection-zos` [1] say that all files with the extension .rkt, .ss, or .scm in a collection are compiled and that within info.rkt, one can specify paths to omit with `compile-omit-paths`. Is there way to go the opposite direction — specify *extra* files that should be compiled — because they are bytecode-able, but don't use the three magic extensions? [1] http://pkg-build.racket-lang.org/doc/raco/API_for_Raw_Compilation.html?q=compile -collection-zos#%28def._%28%28lib._compiler%2Fcompiler..rkt%29._compile-collecti on-zos%29%29 -- 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.
[racket-users] DrRacket crashing?
I have no idea what's been happening, but in the past half hour or so DrRacket has crashed on me (I think) 6 times. I don't know if this will help but here is what was in the error window that my computer gave me: Process: DrRacket [20469] Path:/Applications/Racket/*/DrRacket.app/Contents/MacOS/DrRacket Identifier: org.racket-lang.DrRacket Version: 6.2.900.10 (6.2.900.10) Code Type: X86-64 (Native) Parent Process: launchd [165] Responsible: DrRacket [20469] User ID: 502 Date/Time: 2015-08-21 20:00:33.149 -0400 OS Version: Mac OS X 10.9.5 (13F1096) Report Version: 11 Anonymous UUID: 8ABEA743-D90C-CA8D-137C-2A4F0679E863 Sleep/Wake UUID: 09B771D9-37AF-4A41-A852-C8AC90205883 Crashed Thread: 7 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0008 VM Regions Near 0x8: -- __TEXT 00010211e000-000102126000 [ 32K] r-x/rwx SM=COW /Applications/Racket/*/DrRacket.app/Contents/MacOS/DrRacket Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7fff9039da1a mach_msg_trap + 10 1 libsystem_kernel.dylib 0x7fff9039cd18 mach_msg + 64 2 com.apple.CoreGraphics 0x7fff8e73a74b _CGSSynchronizeWindowBackingStore + 97 3 com.apple.CoreGraphics 0x7fff8e6bc24c _CGSLockWindow + 3765 4 com.apple.CoreGraphics 0x7fff8e6bb15f CGSDeviceLock + 240 5 libRIP.A.dylib 0x7fff8daf3487 ripd_Lock + 43 6 libRIP.A.dylib 0x7fff8daf3027 RIPLayerBltShape + 463 7 libRIP.A.dylib 0x7fff8daf1468 ripc_Render + 304 8 libRIP.A.dylib 0x7fff8daed3b9 ripc_DrawRects + 399 9 com.apple.CoreGraphics 0x7fff8e6b7afa CGContextFillRects + 96 10 com.apple.AppKit0x7fff94b52d46 NSRectFillUsingOperation + 299 11 com.apple.AppKit0x7fff94c0f0bd NSDrawWindowBackground + 253 12 com.apple.AppKit0x7fff94b31d04 -[NSThemeFrame drawWindowBackgroundRect:] + 129 13 com.apple.AppKit0x7fff94b315d0 -[NSFrameView drawThemeContentFill:inView:] + 293 14 com.apple.AppKit0x7fff94c0e715 -[NSFrameView drawRect:] + 1124 15 com.apple.AppKit0x7fff94c0e28a -[NSThemeFrame drawRect:] + 302 16 com.apple.AppKit0x7fff94b2d0b1 -[NSView _drawRect:clip:] + 3846 17 com.apple.AppKit0x7fff94b2a03c -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 3199 18 com.apple.AppKit0x7fff94b28eb1 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 314 19 com.apple.AppKit0x7fff94b25e9f -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2828 20 com.apple.AppKit0x7fff94b052da -[NSView displayIfNeeded] + 1680 21 Racket 0x00010249ef5c ffi_call_unix64 + 76 22 Racket 0x00010249f82d ffi_call + 973 23 Racket 0x00010248b460 ffi_do_call + 2192 24 Racket 0x00010248abac ffi_do_call_after_stack_check + 268 25 ??? 0x0001035eb959 0 + 4351506777 26 Racket 0x000102191d20 scheme_do_eval + 13360 27 Racket 0x00010219286c _scheme_apply_multi_from_native + 364 28 ??? 0x00010357f01e 0 + 4351062046 29 ??? 0x00010358123d 0 + 4351070781 30 ??? 0x00010358123d 0 + 4351070781 31 Racket 0x000102191d20 scheme_do_eval + 13360 32 Racket 0x0001021c87ff scheme_finish_apply_for_prompt + 639 33 Racket 0x0001021c8b80 scheme_apply_for_prompt + 112 34 Racket 0x0001021b8e94 call_with_prompt + 2532 35 ??? 0x0001035741d5 0 + 4351017429 36 Racket 0x000102191d20 scheme_do_eval + 13360 37 Racket 0x0001021c87ff scheme_finish_apply_for_prompt + 639 38 Racket 0x0001021c8b80 scheme_apply_for_prompt + 112 39 Racket 0x0001021b8e94 call_with_prompt + 2532 40 ??? 0x0001035741d5 0 + 4351017429 41 ??? 0x0001035816eb 0 + 4351071979 42 Racket 0x000102191d20 scheme_do_eval + 13360 43 Racket
Re: [racket-users] specifying extra compiled collection paths with info.rkt?
No, not as long as you're willing to push the envelope here. Goes without saying. FWIW the Pollen file extensions are not purely cosmetic. The Pollen renderer consumes Pollen source files and uses the extension (pm, pmd, pp, etc) to determine what kind of rendering is necessary. Of course this could be signaled from within the source file, but then I'd have the bootstrapping cost of having to load a file to find out how to render it, and then reload it to do the actual rendering. Whereas reading a file extension is simple and cheap. -- 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.