[racket-users] not a number is a number

2018-03-21 Thread Tim Jervis
I was amused to see (number? +nan.0) returns #t. Is it worth noting this in the documentation? https://docs.racket-lang.org/reference/number-types.html?q=number%3F#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29

Re: [racket-users] struct-copy question

2018-03-21 Thread Eric Griffis
On Wed, Mar 21, 2018 at 4:43 PM Alexis King wrote: > > On Mar 21, 2018, at 15:32, Eric Griffis wrote: > > > > This would be a code smell if I didn't trust that our Racket ancestors > > knew what they were doing, so the notion of "fixing" structs (or even > > struct-copy) seems misguided. > > > >

Re: [racket-users] struct-copy question

2018-03-21 Thread Alexis King
> On Mar 21, 2018, at 15:32, Eric Griffis wrote: > > This would be a code smell if I didn't trust that our Racket ancestors > knew what they were doing, so the notion of "fixing" structs (or even > struct-copy) seems misguided. > > [snip] > > I can appreciate the architectural decision that str

Re: [racket-users] struct-copy question

2018-03-21 Thread Eric Griffis
I bump into struct subtleties all the time. For example, my attempts to #:auto always degenerate into custom constructor procedures; This usually involves #:constructor-name and #:omit-define-syntaxes, which might not be a big deal if I had a solid understanding of what these flags actually do. So

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Christopher Lemmer Webber
Thanks kindly... Greg Hendershott pointed me at this before too. It may be that in the cases where you do know in advance what layers need to be more hackable and which don't that this is a good fit. It looks like it would serve the webdev case well enough at least. Alexis King writes: > I have

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Christopher Lemmer Webber
Philip McGrath writes: > Alternatively, here is a little example of how you might define lambda-box: > > #lang racket > > (struct lambda-box ([proc #:mutable]) > #:property prop:procedure > (make-keyword-procedure >(λ (kws kw-args this . by-pos-args) > (keyword-apply (lambda-box-proc

[racket-users] Re: The Racket School 2018: Create your own language

2018-03-21 Thread Zelphir Kaltstahl
I also think it would be great to have the material online at some later point in time (I guess not simultaneously). Learning how to create a language using Racket is one of the things I kept postponing so far, because I think of it to involve a lot of difficult macro magic and other difficult thin

Re: [racket-users] Using match to decompose a nested hash

2018-03-21 Thread Greg Hendershott
>> You forgot some parentheses: > And, now I feel dumb. Thanks, Jos. I've made the same mistake -- every time I haven't used `hash-table` for awhile and forget. Most recently a couple weeks ago. The `hash`/`hasheq` functions take `ht k v ... ...`, and most match patterns mirror their constru

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Philip McGrath
You can already set! top level variables (or any variables) bound to functions. $ racket Welcome to Racket v6.12. > (define (f) 1) > (f) 1 > (set! f (lambda () 2)) > (f) 2 Alternatively, here is a little example of how you might define lambda-box: #lang racket (struct lambda-box ([proc #:mutabl

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Alexis King
I haven’t actually used it myself, but Tony Garnock-Jones’s racket-reloadable library seems interesting and relevant. https://github.com/tonyg/racket-reloadable Alexis > On Mar 21, 2018, at 11:16, Christopher Lemmer Webber > wrote: > > Hi Sam! I wasn't familiar with racket/load and it see

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Christopher Lemmer Webber
Hi Sam! I wasn't familiar with racket/load and it seems neat. But it either seems too hopeless, or not hopeless enough: Since all forms within a racket/load module are evaluated in the top level, bindings cannot be exported from the module using provide. This seems like a bit too much unfort

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Sam Tobin-Hochstadt
You might find the racket/load language useful for this. Sam On Wed, Mar 21, 2018, 12:49 PM Christopher Lemmer Webber < cweb...@dustycloud.org> wrote: > Just curious. I have my reasons... for instance, I wrote a multiplayer > game in Guile where you could change the world while players are in i

[racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Christopher Lemmer Webber
Just curious. I have my reasons... for instance, I wrote a multiplayer game in Guile where you could change the world while players are in it without kicking them out. I don't think you can do that while having a toplevel that's as fixed as Racket's is. I've read the emails from Matthew Flatt ab

Re: [racket-users] error during prompt calculation: path->string: contract violation

2018-03-21 Thread Kieron Hardy
On Wed, Mar 21, 2018 at 6:52 AM, Matthew Flatt wrote: > > Use `(find-system-path 'init-file)` to get the actual path, and see the > docs for `path-system-path` for how it's computed. A search in the docs for `path-system-path` did not return anything; however, there does seem to be the relevant

Re: [racket-users] error during prompt calculation: path->string: contract violation

2018-03-21 Thread Matthew Flatt
That `WINDOWS_INIT_FILENAME` definition is only used in `--help` output, and it's out of date. I'll fix that. Use `(find-system-path 'init-file)` to get the actual path, and see the docs for `path-system-path` for how it's computed. Although `HOMEDRIVE` and `HOMEPATH` may be eventually consulted,

Re: [racket-users] Prefab and contracts

2018-03-21 Thread 'Paulo Matos' via Racket Users
On 21/03/18 08:46, 'Paulo Matos' via Racket Users wrote: > Thanks for pointing that out. I hadn't noticed that. It certainly sounds > like an issue to me. > Opened #2001: https://github.com/racket/racket/issues/2001 -- Paulo Matos -- You received this message because you are subscribed to t

Re: [racket-users] Prefab and contracts

2018-03-21 Thread 'Paulo Matos' via Racket Users
On 20/03/18 16:25, Daniel Feltey wrote: > The same behavior occurs with vectors, the program > >   (define v (vector 1 2)) >   (define/contract vc (vectorof integer?) (vector 1 2)) >   (place-message-allowed? v) >   (place-message-allowed? vc) > > Produces: > > #t > #f > > I think the issue h