Re: [racket-users] how to use union types

2019-02-28 Thread Brian Craft
t to a List type checks all the elements of the list. > There's no way to tell if every element of list is a string in less > than O(N) time -- that information just isn't available anywhere. > > Sam > > On Thu, Feb 28, 2019 at 3:52 PM Brian Craft > w

Re: [racket-users] how to use union types

2019-02-28 Thread Brian Craft
son -- there's no way around it. > > Sam > > On Thu, Feb 28, 2019 at 2:04 PM Brian Craft > wrote: > > > > I would think there'd be a large performance issue, as well, due to > needing an O(N) walk of the data. I'm having type checker issues with >

Re: [racket-users] performance, json

2019-02-28 Thread Brian Craft
ance that isn't yet in the docs. Are there any other resources on performance? On Friday, February 22, 2019 at 10:36:23 AM UTC-8, johnbclements wrote: > > > It would be interesting to see how much faster (if at all) it is to run > the TR version of this code. > > John >

Re: [racket-users] how to use union types

2019-02-28 Thread Brian Craft
gt;> >> - A list >> - A hash with symbol keys >> - A number >> - A string >> - A boolean >> - Null >> >> The (andmap string?) approach implicitly assumes you're giving it a list. >> But it might be something else instead, so you

Re: [racket-users] type annotation example

2019-02-28 Thread Brian Craft
sing version 6.0? Was it automatically available > to you somewhere, or did you install it? > > Sam > > On Mon, Feb 25, 2019 at 1:46 PM Brian Craft > wrote: > > > > yeah, maybe version. Has this changed since 6.0? > > > > On Monday, February 25, 201

Re: [racket-users] how to use union types

2019-02-25 Thread Brian Craft
s) On Monday, February 25, 2019 at 3:22:12 PM UTC-8, Sam Tobin-Hochstadt wrote: > > I think (andmap string? ...) is probably the easiest way to check that. > > Sam > > On Mon, Feb 25, 2019, 6:20 PM Brian Craft > wrote: > >> In typed racket, parsing a string list gives

[racket-users] how to use union types

2019-02-25 Thread Brian Craft
In typed racket, parsing a string list gives me a JSExpr, which is a union. I need to pass it to functions that operate on string lists, but can't figure out how to please the type checker. Maybe with occurrence typing? But I don't know how to assert "this is a list of strings". -- You receive

Re: [racket-users] type annotation example

2019-02-25 Thread Brian Craft
cket/base) > > (: fn (-> String Symbol)) > (define (fn str) 'foo) > hardy:/tmp clements> racket foo > hardy:/tmp clements> > > I can’t honestly guess what the problem is. Wrong version of racket? > > John > > > > On Feb 25, 2019, at 10

[racket-users] type annotation example

2019-02-25 Thread Brian Craft
Doing a cut & paste from the typed racket docs, I'm getting a compile error. Input file: #lang typed/racket (require typed/racket/base) (: fn (-> String Symbol)) (define (fn str) 'foo) 'fn' taken from this page: https://docs.racket-lang.org/ts-guide/more.html#%28part._when-annotations~3f%29

[racket-users] performance, json

2019-02-22 Thread Brian Craft
I'm doing a few performance tests, just to get an idea of racket performance. The following result surprised me a bit. Parsing 1M strings from a json array, like (define samples (time (read-json (open-input-file "test.json" running with 'racket test.rkt' Comparing to js, java, and clojure:

[racket-users] carmack s-expression tweet

2015-03-27 Thread Brian Craft
Was this a reference to a particular racket lib? And if so, which one? https://twitter.com/ID_AA_Carmack/status/577878167542734848 -- 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,

Re: [racket] place-image winking effect with low y coord

2014-10-06 Thread Brian Craft
) to the big-bang > expression, similar to what Matthias did in his example ] > > Also do you see the same behavior if you change the initial state to be > 100? > > —Spencer > > > > On Mon, Oct 6, 2014 at 10:05 AM, Brian Craft > wrote: > >> If I record

Re: [racket] place-image winking effect with low y coord

2014-10-06 Thread Brian Craft
onto-an-empty-scene) ;; when the state > changes, draw ... > (stop-when state-is-300))) ;; when the UFO's y > coordinate is 300, stop. > > > > The animated gif is here: > > http://www.ccs.neu.edu/home/matthias/Tmp/UFO/i-animated.gif > >

Re: [racket] place-image winking effect with low y coord

2014-10-05 Thread Brian Craft
ng it on ubuntu. On Sun, Oct 5, 2014 at 6:13 PM, Matthias Felleisen wrote: > > Can you send the full program please? Thanks -- Matthias > > > > On Oct 5, 2014, at 8:52 PM, Brian Craft wrote: > > > Hello -- Newbie here. I'm going through "Realm of Racket"

[racket] place-image winking effect with low y coord

2014-10-05 Thread Brian Craft
Hello -- Newbie here. I'm going through "Realm of Racket". I'm seeing an odd effect when using this to-draw handler in big-bang: (define (draw-a-ufo-onto-an-empty-scene game) (let ([pos (game-pos game)]) (place-image IMAGE-of-UFO (round (vec-x pos)) (round (vec-y pos)) (empt