Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Matthew Butterick
> On Sep 17, 2018, at 11:57 AM, Kevin Forchione wrote: > > In a nutshell I’m working with some hash tables whose keys are symbol and > whose values may be other keys or values such as identifiers, and I got a bit > tired of quoting all my symbols for functions and decided to use some macros

[racket-users] Fun with Physics: Racket FFI Question (Bug?)

2018-09-17 Thread Stephen Foster
I'm trying to get the Chipmunk Physics library integrated with Racket. I've made some progress (https://www.youtube.com/watch?v=GjvLaP7I0gg), but I need to ask for some input on an issue. The Chipmunk C library provides a primitive called a "cpBody" (i.e. a moving thing). A cpBody struct has

Re: [racket-users] Fun with Physics: Racket FFI Question (Bug?)

2018-09-17 Thread Matthew Flatt
At Mon, 17 Sep 2018 09:34:46 -0700 (PDT), Stephen Foster wrote: > But when I have two bodies that share the same velocity_func, I get a > segfault: The problem is that a callback is retained (by default) as long as the function that it wraps is retained, but only a single callback is retained

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Philip McGrath
It might help to know a bit more context about what you're trying to do. I think other Lisp-family languages use these terms in different ways, but in Racket it isn't usual to talk about a symbol being bound to something. A symbol is just a type of value (like an integer, a list, a vector, a

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Alexis King
> On Sep 17, 2018, at 12:21, Kevin Forchione wrote: > > That seems to be the nature of macros, and I’m not sure what the solution to > that paradox is, apart from perhaps building a symbol/function hash table as > part of a define. Presumably Racke does something like that for eva & >

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Kevin Forchione
> On Sep 16, 2018, at 10:07 PM, Matthew Butterick wrote: > > >> On Sep 16, 2018, at 2:13 PM, Kevin Forchione > > wrote: >> >> Thanks! That’s just what I wanted. Is there a way in Racket to determine if >> a quoted symbol has an associated procedure? > > > >

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Kevin Forchione
> On Sep 16, 2018, at 10:07 PM, Matthew Butterick wrote: > > #lang racket > (require rackunit) > > (define-syntax (bound-to-proc? stx) > (syntax-case stx () > [(_ 'x) > (and (identifier? #'x) (identifier-binding #'x)) > #'(procedure? x)] > [_ #'#f])) > > (define

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Matthew Butterick
> On Sep 17, 2018, at 10:21 AM, Kevin Forchione wrote: > > That seems to be the nature of macros, and I’m not sure what the solution to > that paradox is, apart from perhaps building a symbol/function hash table as > part of a define. Presumably Racke does something like that for eva & >

[racket-users] Performance for structs across typed–untyped boundaries

2018-09-17 Thread Philip McGrath
I have a fairly basic question about what checking is done when instances of structs defined in Typed Racket cross typed–untyped boundaries. For a concrete example, in the following program, I'm interested in the call to `container-append` from untyped code: #lang racket/base (module typed

Re: [racket-users] Performance for structs across typed–untyped boundaries

2018-09-17 Thread Ben Greenman
Your program is half an answer :) Here's a second half to compare: #lang racket/base (module typed1 typed/racket/base (provide (struct-out container) container-append) (define-type SymbolTree (U Null Symbol (Pairof SymbolTree SymbolTree))) (struct container ([tree :

Re: [racket-users] specialized languages

2018-09-17 Thread 'Paulo Matos' via Racket Users
If I understand correctly you want to create languages in Racket? In which case you want to read: https://beautifulracket.com/ Paulo Matos On 17/09/2018 02:22, Hendrik Boom wrote: > I'm looking for an introduction to the tools for making Racket into a > specualized language. > > I know how to