Re: [racket-users] exn-string
A new module sounds right to me. I was thinking `racket/exn-to-string` for just this function, but `racket/exn` sounds fine and maybe better. At Sun, 24 May 2015 08:01:23 -0400, Jay McCarthy wrote: I think it's a good idea. Where to though? A new racket/exn module? Jay On Sat, May 23, 2015 at 11:48 AM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Hi all, I find myself using exn-string from web-server/private/util *a lot* in many of my packages. (I just counted eight!) Should we move it to core Racket, so I don't need to depend on a private subcollect of the web-server-lib package everywhere? It seems like something many programs, not just mine, will want to do. Tony -- 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. -- Jay McCarthy http://jeapostrophe.github.io Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great. - DC 64:33 -- 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] racket-explorer now deals with cyclic/mutable data
Works like a charm now! Thanks! Vincent At Fri, 22 May 2015 16:52:10 -0400, Tony Garnock-Jones wrote: Hi all, I've updated racket-explorer (https://github.com/tonyg/racket-explorer) to handle cyclic (and mutable) data by lazily (and repeatedly) unfolding children only when the triangle next to an item is opened (and every time it is opened). If you've tried it before and been discouraged at its handling of large, mutable, or infinite structures, please have another go and file bug reports using GH issues! (https://github.com/tonyg/racket-explorer/issues/new) Thanks, Tony -- 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] exn-string
I think it's a good idea. Where to though? A new racket/exn module? Jay On Sat, May 23, 2015 at 11:48 AM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Hi all, I find myself using exn-string from web-server/private/util *a lot* in many of my packages. (I just counted eight!) Should we move it to core Racket, so I don't need to depend on a private subcollect of the web-server-lib package everywhere? It seems like something many programs, not just mine, will want to do. Tony -- 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. -- Jay McCarthy http://jeapostrophe.github.io Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great. - DC 64:33 -- 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] flipping z-order of (send table add-cards)?
Michael's Flower Garden inspired me to play with the games/cards, but...the z-ordering of add-cards is backwards for every use that I've been able to think of. I want the first card to be on the bottom, as if I were dealing cards. For now I have defined a function which reverses the card list and inverts the indices: (define (add-cards-to-table t d x y [off (lambda (i) values 0 0)]) (define n (length d)) (define (o i) (off (- n i 1))) (send table add-cards (reverse d) x y o)) But then I have to remember to invoke it differently than any other table method, which is annoying. So how should I go about overriding that method so that I have a table where (send table add-cards ...) uses the opposite z-ordering, without messing with the game/cards source? I was thinking that I could sub-class table and override the method, but...then game/cards doesn't export table%, only a make-table function and the interface. And I couldn't figure out how to make a sub-class given just an interface or an interface and an object. --Josh -- 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] racket-explorer now deals with cyclic/mutable data
On May 22, 2015, at 1:52 PM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Hi all, I've updated racket-explorer (https://github.com/tonyg/racket-explorer) to handle cyclic (and mutable) data by lazily (and repeatedly) unfolding children only when the triangle next to an item is opened (and every time it is opened). If you've tried it before and been discouraged at its handling of large, mutable, or infinite structures, please have another go and file bug reports using GH issues! (https://github.com/tonyg/racket-explorer/issues/new) I think I’ve been waiting for this for a long time. Many *extra* thanks for putting a screenshot in the github README; that’s often the make-or-break point in whether I’m going to try something out. John Clements -- 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] Typed racket equivalent of Haskell newtype?
Also opaque types might help you: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29 http://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.Opaque%29%29 If you wanted sub-typing too, then refinement types would help, except I don’t think they work yet. An example of using them for radians and degrees: untyped-radians-degrees.rkt: #lang racket/base (provide radians? real-radians radians-real degrees? real-degrees degrees-real radians-degrees degrees-radians) (require racket/math) (define (radians? v) (real? v)) (define (real-radians x) x) (define (radians-real x) x) (define (degrees? v) (real? v)) (define (real-degrees x) x) (define (degrees-real x) x) typed-radians-degrees.rkt: #lang typed/racket/base (require/typed/provide untyped-radians.rkt [#:opaque Radians radians?] [real-radians [Real - Radians]] [radians-real [Radians - Real]] [#:opaque Degrees degrees?] [real-degrees [Real - Degrees]] [degrees-real [Degrees - Real]] [radians-degrees [Radians - Degrees]] [degrees-radians [Degrees - Radians]]) try-radians-degrees.rkt: #lang typed/racket/base (require typed-radians-degrees.rkt) (: d-90 : Degrees) (define d-90 (real-degrees 90.0)) ; type mismatch! (: r-PI : Radians) (define r-PI (real-degrees 180.0)) On May 23, 2015, at 11:34 PM, Stuart Hungerford stuart.hungerf...@gmail.com wrote: On Sunday, 24 May 2015 12:50:48 UTC+10, Matthias Felleisen wrote: Stuart, would a predicated refinement type work for you: -- http://docs.racket-lang.org/ts-reference/special-forms.html?q=define-predicate#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._make-predicate%29%29 Looking into that now--many thanks. Stu -- 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] Generic collections in Racket
Thanks for the feedback! To start out with, let me address your initial three points. With regards to the error messages and tooling, I agree completely, and I actually think this is one of the areas where Racket can blow Clojure out of the water. Contracts alone are pretty expressive, and I'd absolutely like to try and make the system a little less opaque than Clojure's. As for use of persistent data structures, I think it's a good design decision, but as I mentioned above in my response to Greg's email, Racket's data structures, mainly its vectors, aren't quite up to snuff to handle that model just yet. Getting good persistent vectors is a high priority. With that said, let me address your other points. So I see what you're doing as exciting, but would appreciate a bit more about where you're aiming to take this in your introduction. If you could outline your criteria / aims that would be clarifying. Are you aiming for consistency with Clojure or making a judgement call on an intermediate style (c.f. Greg's #lang rackjure)? I'm aiming to make a library that would feel at home in Racket if backwards-compatibility were not an issue. I want this library to feel like Racket, not Clojure, but I'm also willing to override some of Racket's primitives to implement those ideas. Consider it an experimental proposal for #lang racket2. I really, really want to maintain the simplicity that the library currently provides, especially with the implementation of new user-defined data structures. Having a few interfaces with a handful of functions apiece is nice. The trick is figuring out how to provide enough capability for optimization hints to keep everything fast with such a small interface (something that I think is absolutely doable). (take 5 (range 10)) #lazy-sequence (drop 5 (range 10)) '(5 6 7 8 9) Alright, let's talk about this. Consider the producer/consumer point I laid out above. This library is heavily optimized with the idea that once you start manipulating a sequence, it's better to force it into read-only mode instead of performing an expensive copy. For a list, dropping elements from the front requires no copying at all, so it just returns a list. On the other hand, taking elements from the front would require allocating a new list, so instead, you get a special kind of sequence that doesn't need to do any copying. (take 5 #(0 1 2 3 4 5 6 7 8 9)) #lazy-sequence (drop 5 #(0 1 2 3 4 5 6 7 8 9)) #random-access-sequence This is the same sort of idea, but here, even dropping elements would require a new vector to be allocated. Slow and unnecessary if you're only reading! So instead you get a view on the vector as a sequence. If you want to modify it, make sure you have the representation you need first. Do (extend #() (drop 5 #(0 1 2 3 4 5 6 7 8 9))), then modify. As for printing these sequences... yes, printing as #lazy-sequence sucks. Currently you can always force a sequence with sequence-list, but that's annoying. Clojure takes the approach of making printing lazy sequences force them. This is okay, but it also can be incredibly confusing when side effects get evaluated in the REPL but not in code. I'm unsure about what to do about that particular problem. I'd like to maybe add a nicer printer for sequences, but I'm not completely sure what the best way to do that is, yet. (take 5 (list-vector (range 10))) take: contract violation Ahh, then there's this. This absolutely needs a better error message. See, list-vector gives you a mutable vector, and sequence operations only work on immutable vectors. I consider this a flaw with Racket's vectors, also something I'd hope could be alleviated by a better vector library, but for now, it would make sense to add some special error messages for mutable vectors and mutable hashtables, which would otherwise just seem to fail mysteriously. Just for the sake of that example, though, this works: (take 5 (vector-immutable-vector (list-vector (range 10 #lazy-sequence -- 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] Generic collections in Racket
Hi Alexis Nice! I've been playing with Clojure a bit recently and I 1. several aspects (like the generic operations, concise destructuring, etc.), 2. am frustrated with others (e.g. error messages and tooling), 3. are intrigued by some of the other design choices (e.g. pervasive use of persistent data structures) So I see what you're doing as exciting, but would appreciate a bit more about where you're aiming to take this in your introduction. If you could outline your criteria / aims that would be clarifying. Are you aiming for consistency with Clojure or making a judgement call on an intermediate style (c.f. Greg's #lang rackjure)? * * * Some inconsistent-feeling behaviors: (take 5 (range 10)) #lazy-sequence (drop 5 (range 10)) '(5 6 7 8 9) (take 5 #(0 1 2 3 4 5 6 7 8 9)) #lazy-sequence (drop 5 #(0 1 2 3 4 5 6 7 8 9)) #random-access-sequence (take 5 (list-vector (range 10))) take: contract violation Dan -- 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] Generic collections in Racket
Thanks for the detailed response! One part I'm not sure about is `conj`. I understand sometimes whichever end is optimal matters more than the order. But: Indeed, you are correct. Order does matter, and currently the only way to do that sort of thing is with `append`. 1. What if you do care about the order? IOW should there also be generic cons and snoc? Having a generic cons is a good idea, and I will consider a good way to incorporate it. However, there are lots of tradeoffs in various approaches, so let me try and outline those quickly. 1. The smaller the actual interface, the better. Right now, gen:sequence only contains five functions in it. This is fantastic for keeping code complexity down, and it heavily reduces the burden for implementing new collections. 2. The tradeoff, of course, is that adopting a one size fits all model loses possible optimization that can come out of more specific implementations. Maintaining efficiency in this case loses accuracy, as you've described. Clojure's library, and therefore mine as well, draws the line between production and consumption of sequences. The idea is that, usually, collections are produced in the place that knows what their representation should best be, and client code just blindly reads the data without caring how it's stored. Usually, if you care specifically about prepending or appending, you need to know about what the data structure is, anyway (that sort of operation wouldn't make any sense on sets, for example), so most operations that produce sequences and type-specific, while operations on sequences are type-agnostic. Of course, this is partially because Clojure's data structures are just better than Racket's, which brings me to your next point... 2. With ordinary Racket immutable vectors, is the tail really faster? I don't think snoc (vector-append original-vector (vector new-item)) is faster than cons (vector-append (vector new-item) original-vector)? Nope! You're right, it isn't. Currently, `conj` on vectors copies an entire vector, which is pretty awfully slow. Clojure uses 32-way bitmapped tries for persistent vectors, and those are far, far more efficient for use as a persistent data structure. The whole tree doesn't need to be copied for each new vector (in fact, most of it can remain the same), so vectors are fast and cheap, while still maintaining effectively O(1) lookup. Furthermore, Clojure provides an additional optimization on its persistent vectors that makes additions to the tail of the vector especially fast. This behavior means the appending style of `conj` makes sense. Racket does not have good persistent vectors. This library is designed with the hope that a good persistent vector library will arise. Some work has been done on implementing rrb-tree vectors in Racket, but they're not done, and I don't believe they're currently being worked on. (This train of discussion could probably be an entirely new thread, but I'll leave it at this for now.) Also, in my (admittedly limited) time so far with Clojure, I've sometimes been confused when eager collections automagically change into lazy sequences. If I add side effects (like debugging printfs) to code I don't realize is lazy, I utter many WTFs. I'm not sure to what extent that can happen with your library, but if it can, this might be good to point out in margin notes and examples. Yes, this is something I hope to probe out some more with user feedback. If someone uses it and runs into something really WTF-worthy, I'll certainly try and figure out what the right way to handle it is. Currently, everything that can return lazy sequences is noted in the API reference, but making it more prominent is a good idea. As for why the laziness is required to begin with, it's mostly just because lazy sequences are a very effective way of effectively implementing iterators without needing iterators. A lazy sequence can be turned into a concrete sequence with `extend`, and it doesn't need to allocate an entire intermediate sequence, which is quite appealing. -- 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] Generic collections in Racket
Also, in my (admittedly limited) time so far with Clojure, I've sometimes been confused when eager collections automagically change into lazy sequences. If I add side effects (like debugging printfs) to code I don't realize is lazy, I utter many WTFs. I'm not sure to what extent that can happen with your library, but if it can, this might be good to point out in margin notes and examples. You do discuss in the Introduction that map etc. can return lazy sequences. If anyone skips that and goes directly to the API reference, they might miss how different this `map` is. I suppose this is just RTFM, and really I'm just relating my experience getting confused. -- 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] Typed racket equivalent of Haskell newtype?
On Monday, 25 May 2015 02:43:58 UTC+10, Alex Knauth wrote: Also opaque types might help you: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29 http://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.Opaque%29%29 If you wanted sub-typing too, then refinement types would help, except I don’t think they work yet. An example of using them for radians and degrees: Also many thanks for pointing this out. Stu -- 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] test amazes me
Look at what this does: #lang racket (require test-engine/racket-tests) (check-expect 1 1) (check-expect 2 2) (check-expect 3 3) (check-expect (displayln hello) (displayln world)) (test) (test) Welcome to DrRacket, version 6.2.0.3--2015-05-17(542b960/a) [3m]. Language: racket [custom]; memory limit: 8182 MB. world hello All 4 tests passed! world hello All 8 tests passed! The test expressions are each evaluated twice, and each test passes a second time. I imagine this could be considered useful if for instance the tests depended on a mutable value and that value was mutated in between the runs of test, but was that the intention? I don’t know. Also it appears to evaluate the second expression first and the first expression second. Weird. On May 24, 2015, at 6:42 PM, Jos Koot jos.k...@gmail.com wrote: #lang racket (module a racket (require test-engine/racket-tests) (check-expect 1 1) (test)) (module b racket (require test-engine/racket-tests) (check-expect 2 2) (test)) (require 'a 'b) This gives me: Welcome to DrRacket, version 6.2.900.3--2015-05-16(e8b52f6/a) [3m]. Language: racket [custom]; memory limit: 2000 MB. The only test passed! All 3 tests passed! Apparently test does not clear the list of tests already done. But even then I am surprised by seeing THREE tests passed. Without clearing the accumulated tests, I would expect: All TWO tests passed! Should test not eliminate the tests already done from the list of tests to be gathered in future? And how come (require 'a 'b) does THREE tests, not TWO? Is is not a big problem. I am just curious. Thanks, Jos -- 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] Generic collections in Racket
This is really exciting and you've obviously put a lot of time and thought into it! One part I'm not sure about is `conj`. I understand sometimes whichever end is optimal matters more than the order. But: 1. What if you do care about the order? IOW should there also be generic cons and snoc? 2. With ordinary Racket immutable vectors, is the tail really faster? I don't think snoc (vector-append original-vector (vector new-item)) is faster than cons (vector-append (vector new-item) original-vector)? Also, in my (admittedly limited) time so far with Clojure, I've sometimes been confused when eager collections automagically change into lazy sequences. If I add side effects (like debugging printfs) to code I don't realize is lazy, I utter many WTFs. I'm not sure to what extent that can happen with your library, but if it can, this might be good to point out in margin notes and examples. -- 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] Generic collections in Racket
On Sun, May 24, 2015 at 7:43 PM, Alexis King lexi.lam...@gmail.com wrote: As for printing these sequences... yes, printing as #lazy-sequence sucks. Currently you can always force a sequence with sequence-list, but that's annoying. Clojure takes the approach of making printing lazy sequences force them. This is okay, but it also can be incredibly confusing when side effects get evaluated in the REPL but not in code. Depending on other design decisions, it make make sense to consider this an IDE issue. That is, maybe the best thing is to have some kind of interactive value in the REPL that lets the user have control over the effects. (And this doesn't just have to be via some kind of simplistic mouse clicking -- I think there is a lot of unexplored UI space here). Robby -- 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] test amazes me
#lang racket (module a racket (require test-engine/racket-tests) (check-expect 1 1) (test)) (module b racket (require test-engine/racket-tests) (check-expect 2 2) (test)) (require 'a 'b) This gives me: Welcome to DrRacket, version 6.2.900.3--2015-05-16(e8b52f6/a) [3m]. Language: racket [custom]; memory limit: 2000 MB. The only test passed! All 3 tests passed! Apparently test does not clear the list of tests already done. But even then I am surprised by seeing THREE tests passed. Without clearing the accumulated tests, I would expect: All TWO tests passed! Should test not eliminate the tests already done from the list of tests to be gathered in future? And how come (require 'a 'b) does THREE tests, not TWO? Is is not a big problem. I am just curious. Thanks, Jos -- 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] test amazes me
I didn't implement test-engine but worked with Kathy to design and occasionally add features and/or maintain it. As you may know, in *SL the test-engine library runs (test) automatically when a programmer runs a program. That works out perfectly. I never imagined this library used for plain racket (though I do, knowing of its shortcomings) and I conjecture that Kathy factored the collection as an after-thought. So I wouldn't read too much into this -- Matthias On May 24, 2015, at 9:06 PM, Alexander D. Knauth wrote: Look at what this does: #lang racket (require test-engine/racket-tests) (check-expect 1 1) (check-expect 2 2) (check-expect 3 3) (check-expect (displayln hello) (displayln world)) (test) (test) Welcome to DrRacket, version 6.2.0.3--2015-05-17(542b960/a) [3m]. Language: racket [custom]; memory limit: 8182 MB. world hello All 4 tests passed! world hello All 8 tests passed! The test expressions are each evaluated twice, and each test passes a second time. I imagine this could be considered useful if for instance the tests depended on a mutable value and that value was mutated in between the runs of test, but was that the intention? I don’t know. Also it appears to evaluate the second expression first and the first expression second. Weird. On May 24, 2015, at 6:42 PM, Jos Koot jos.k...@gmail.com wrote: #lang racket (module a racket (require test-engine/racket-tests) (check-expect 1 1) (test)) (module b racket (require test-engine/racket-tests) (check-expect 2 2) (test)) (require 'a 'b) This gives me: Welcome to DrRacket, version 6.2.900.3--2015-05-16(e8b52f6/a) [3m]. Language: racket [custom]; memory limit: 2000 MB. The only test passed! All 3 tests passed! Apparently test does not clear the list of tests already done. But even then I am surprised by seeing THREE tests passed. Without clearing the accumulated tests, I would expect: All TWO tests passed! Should test not eliminate the tests already done from the list of tests to be gathered in future? And how come (require 'a 'b) does THREE tests, not TWO? Is is not a big problem. I am just curious. Thanks, Jos -- 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. -- 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] Generic collections in Racket
Depending on other design decisions, it make make sense to consider this an IDE issue. That is, maybe the best thing is to have some kind of interactive value in the REPL that lets the user have control over the effects. (And this doesn't just have to be via some kind of simplistic mouse clicking -- I think there is a lot of unexplored UI space here). I'd definitely be curious to see what you have in mind beyond some simplistic mouse clicking. It would be cool to convey more information about sequence values via DrRacket's capability to render snips. As for Daniel's point about the contract violation, I've pushed a change that makes `sequence?` into a custom flat contract, so that example now gives a more useful error message: (take 5 (list-vector (range 10))) take: contract violation expected: (and/c immutable? sequence?) given: '#(0 1 2 3 4 5 6 7 8 9), which is mutable However, this only works when the contract is used alone in a first-order way. It doesn't give a helpful error message when used with `first`, for example: (first (vector 0)) first: contract violation expected: (and/c sequence? (not/c empty?)) given: '#(0) which isn't: sequence? It would be possible in this case, of course, to create a `nonempty-sequence?` contract, but it still wouldn't work in other cases. Robby, do you know of any way I could provide this extra error reporting in more cases while still keeping `sequence?` a flat contract? -- 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] typed/rackunit and test-case
When using typed/rackunit, I find that using test-case doesn't seem to want to work properly. The code (test-case foo (check-true (string=? foo foo))) gives me several Type Checker errors that give me information I don't know what to do with. Is this something I need to require/typed for? -- 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] How to check for existing definitions
I'm used to check for the presence of a definition of a given symbol with (defined? symbol) Probably I still remember that from GNU Guile Scheme but I was not able to find an equivalent in Racket. I need something like that to check during runtime or at least at start-up for the existence of a definition before using it. In particular I will need to check for the presence of a given field or method by name/symbol in an interface / class definition imported via require. Any ideas on how to do this with Racket? Then I'm afraid that Racket is going to lament the usage of an undefined symbol even though that part of code might never be reached because I had already checked for the presence of its definition. Example: In version 6.7 the /card-table/ class features a flag /call-handlers-after-snap-back/ but version 6.5 does not have that flag. When the flag and its corresponding accessors are available it should use them, i.e. branch into parts of the code that can use them. If not they're not available it should ignore some parts / branches of the code. I can of course use /version/ to check for Racket's version but this doesn't take patches or third party libraries/modules into account. -- 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] Flower Garden: Open Flowers
Il giorno 23/mag/2015, alle ore 19.28, Matthias Felleisen ha scritto: Why don't you put this into github and register it with the package server? Thanks for the advice! I was somehow searching for that package repository right from the start. But I'm going to read the manual first. -- 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] How to check for existing definitions
This may be of interest to you: http://stackoverflow.com/questions/20076868/how-to-know-whether-a-racket-variable-is-defined-or-not For methods, you can use this instead: http://docs.racket-lang.org/reference/objectutils.html?q=method-in#%28def._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._method-in-interface~3f%29%29 For fields you can use: http://docs.racket-lang.org/reference/objectutils.html?q=method-in#%28def._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._field-names%29%29 On the contrary to undefined identifiers, using an inexistant method will not cause any error until it is called. Laurent On Sun, May 24, 2015 at 8:20 AM, Michael Tiedtke michael.tied...@o2online.de wrote: I'm used to check for the presence of a definition of a given symbol with (defined? symbol) Probably I still remember that from GNU Guile Scheme but I was not able to find an equivalent in Racket. I need something like that to check during runtime or at least at start-up for the existence of a definition before using it. In particular I will need to *check for the presence of a given field or method by name/symbol* in an interface / class definition imported via require. Any ideas on how to do this with Racket? Then I'm afraid that Racket is going to lament the usage of an undefined symbol even though that part of code might never be reached because I had already checked for the presence of its definition. Example: In version 6.7 the /card-table/ class features a flag /call-handlers-after-snap-back/ but version 6.5 does not have that flag. When the flag and its corresponding accessors are available it should use them, i.e. branch into parts of the code that can use them. If not they're not available it should ignore some parts / branches of the code. I can of course use /version/ to check for Racket's version but this doesn't take patches or third party libraries/modules into account. -- 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.