Re: [racket] Why don't you tackle a universe-based pong game?

2015-01-19 Thread Darren Cruse
Just FYI in another thread Matthias suggested maybe I try a universe (networked) version of my pong game and I did give it a go and just posted it on my repo at: https://github.com/darrencruse/pong-world-racket If anybody cares to actually try it, I do have a "run.rkt" option to fire up the serve

Re: [racket] htdp/2e: exercise 48, drracket highlighting

2015-01-19 Thread Matthias Felleisen
I have replaced the second "occurrence" of cases with "complete conditional." Perhaps this will help a future reader. Thanks -- Matthias On Jan 19, 2015, at 7:55 AM, Daniel Bastos wrote: > Exercise 48. If you copy and paste the above function definition into the > definitions area of DrRac

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Jordan Johnson
Great! Thanks for the discussion. Best, Jordan > On Jan 19, 2015, at 5:41 AM, Alexander D. Knauth wrote: > > I managed to fix this for your example by inserting these 3 lines into > typed-racket/types/remove-intersect.rkt after line 67: > [(list-no-order (Value: (not (? hash?))) >

Re: [racket] trace: set!: cannot mutate module-required identifier - alright .. how do you do this?

2015-01-19 Thread Thomas Lynch
please note, the simple example here is to facilitate discussion. trace is being used very broadly for an entire development cycle. This isn't a one time fix issue in general. I apologize if my original post wasn't clear, but I did modify the file that included "db-lib.rkt" as such: Saw this i

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Alexander D. Knauth
Or come to think of it would generalizing value types like (-val ‘null) in this case to for instance Symbol also fix cases like this? On Jan 19, 2015, at 10:09 AM, Alexander D. Knauth wrote: > If there was a way to convert a “value” type to a more general type, for > instance convert all hash-

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Alexander D. Knauth
If there was a way to convert a “value” type to a more general type, for instance convert all hash-table value types to HashTableTop, or vector value types to VectorTop, etc. and then use (not (or (subtype t1 t2) (subtype t2 t1))) or something like that, could that catch cases like this? On Jan

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Sam Tobin-Hochstadt
On Mon Jan 19 2015 at 10:03:51 AM Benjamin Greenman wrote: > > On Mon, Jan 19, 2015 at 9:58 AM, Sam Tobin-Hochstadt > wrote: > >> hash-table-specific limitation > > > I thought this was a 'possibly-mutable data structures' limitation. > There's also that limitation, but the one Alex fixed is ju

Re: [racket] trace: set!: cannot mutate module-required identifier - alright .. how do you do this?

2015-01-19 Thread J. Ian Johnson
To be fair, trace is more than that. Vincent's solution does work, but you have to modify the file - you can't do this from the REPL. You can modify the file containing the identifier you want to trace, if changing call sites is not palatable to you. Add `(require racket/trace)` at the top, and

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Benjamin Greenman
On Mon, Jan 19, 2015 at 9:58 AM, Sam Tobin-Hochstadt wrote: > hash-table-specific limitation I thought this was a 'possibly-mutable data structures' limitation. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Sam Tobin-Hochstadt
On Mon, Jan 19, 2015 at 9:54 AM, Alexander D. Knauth wrote: > Would there be a more general solution that wouldn’t be specific to just > hash-tables? I'm not sure what you mean. The code you suggested fixes a hash-table-specific limitation in Typed Racket. If the question is could `overlap` not

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Alexander D. Knauth
Would there be a more general solution that wouldn’t be specific to just hash-tables? On Jan 19, 2015, at 9:38 AM, Sam Tobin-Hochstadt wrote: > This is a correct improvement to Typed Racket -- I'll make it shortly. > > Sam > > On Mon, Jan 19, 2015 at 8:41 AM, Alexander D. Knauth > wrote: >>

Re: [racket] trace: set!: cannot mutate module-required identifier - alright .. how do you do this?

2015-01-19 Thread Thomas Lynch
So to trace calls to the interface functions of a library I am to write a gasket for the library. I may as well put a display of the args in the gasket functions as at this point it is the same amount of code as hooking the trace. Of course then I have implemented trace. So to use trace in rack

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Sam Tobin-Hochstadt
This is a correct improvement to Typed Racket -- I'll make it shortly. Sam On Mon, Jan 19, 2015 at 8:41 AM, Alexander D. Knauth wrote: > I managed to fix this for your example by inserting these 3 lines into > typed-racket/types/remove-intersect.rkt after line 67: > [(list-no-order (Val

Re: [racket] trace: set!: cannot mutate module-required identifier - alright .. how do you do this?

2015-01-19 Thread J. Ian Johnson
Yes, racket 101 (305?) is that identifiers can only be set!'d in their defining module. This is to allow necessary optimizations such as inlining. If you want to trace `f` from a different module. you can `(define (g . args) (apply f args)) (trace g)`, use `g` wherever you use `f`. You won't get

[racket] trace: set!: cannot mutate module-required identifier - alright .. how do you do this?

2015-01-19 Thread Thomas Lynch
Saw this in another thread here, but the proposed solution didnt work, well at least the way I understood it. So .. In file db-lib.rkt I have a definition: (provide db-exec) (define (db-exec a) ...) Then in racket > (enter! "db-user.rkt") Where db-citation.rkt has (require "db-lib.rkt")

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Alexander D. Knauth
I managed to fix this for your example by inserting these 3 lines into typed-racket/types/remove-intersect.rkt after line 67: [(list-no-order (Value: (not (? hash?))) (or (? Hashtable?) (? HashtableTop?))) #f] There is probably a better solution though.

[racket] htdp/2e: exercise 48, drracket highlighting

2015-01-19 Thread Daniel Bastos
Exercise 48. If you copy and paste the above function definition into the definitions area of DrRacket and click RUN, DrRacket highlights two of the three cond lines. This coloring tells you that your test cases do not cover all possible cases. Add enough tests to make DrRacket happy. # This exerc

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Alexander D. Knauth
Since hash-tables can be mutable as far as TR knows, (HashTable Symbol String) is not a subtype of (HashTable Symbol JSExpr). To work around this, you can do this: #lang typed/racket/base (require typed/json) (: jsx JSExpr) ; <-- jsx is what I ultimately want. (define jsx (ann #hasheq((a . "