Re: [racket-users] format-id question

2016-05-09 Thread Benjamin Greenman
On Mon, May 9, 2016 at 1:41 PM, Kevin Forchione wrote: > (with-syntax ([name (format-id stx "~a-~a" #'a #'b)]) Change this line to: (with-syntax ([name (format-id stx "~a-~a" (syntax-e #'a) (syntax-e #'b))]) Using syntax-e explicitly gets the value out of the syntax

Re: [racket-users] Alternative to interfaces/type classes in Typed Racket

2016-04-24 Thread Benjamin Greenman
On Sun, Apr 24, 2016 at 1:47 PM, Daniel Karch wrote: > how this could be done with structures One way is to consider the struct definition as an interface. Then different values can implements the same interface & be used in a uniform way. Here's a struct that I used as

Re: [racket-users] hash-clear*

2016-04-24 Thread Benjamin Greenman
I think you want hash-clear! because I think you're using a mutable hashtable. hash-clear! is for mutable hashtables (built with make-hash, added to with hash-add!) and returns void after it updates its argument hash-clear is for immutable hashes (build with hash or for/hash, added to with

Re: [racket-users] Re: What do you use macros for?

2016-04-11 Thread Benjamin Greenman
Today I decided to convert all structure definitions in a Typed Racket file to lists. For instance, (struct foo ([x : Integer])) would become a tagged list: (define-type foo (Pairof 'foo (List Integer))) along with a constructor, predicate, and accessors. Using a macro, I was able to write

Re: [racket-users] Re: Problem with # and mutable lists

2016-04-11 Thread Benjamin Greenman
> > but although I changed else expresion, Racket sometimes returns same > warning(but now with #f instead of #). After you call `select-room`, you'll want to check that the result is an mlist (instead of #f or #) before calling mcdr. -- You received this message because you are subscribed to

Re: [racket-users] Problem with # and mutable lists

2016-04-10 Thread Benjamin Greenman
On Sun, Apr 10, 2016 at 7:29 AM, Joan Martin wrote: > I use it without problems : (select-room 2 environment) in this case. > But when I use it in another procedure (for example: set-symbol), > sometimes Racket returns this: > > mcdr: contract violation;;(mcdr in let

Re: FW: [racket-users] macros within expressions.

2016-04-06 Thread Benjamin Greenman
This is "bad syntax" for the same reason that `(map or '())` is "bad syntax". When the macro expander sees `(map y-coord points)`, it recognizes `map` as a variable binding and then tries expanding each argument to `map`. Expanding `y-coord` by itself leads to the error. You could instead define

Re: [racket-users] racket not W^X?

2016-04-05 Thread Benjamin Greenman
> > [Still waiting for the verified compiler guys to look at reflective > methods. > http://www.mpi-sws.org/~marcopat/marcopat/Publications_files/paper_4%20%283%29.pdf (They give the attacker an alpha-equivalence predicate. It's a start.) -- You received this message because you are subscribed

[racket-users] ANN #lang agile

2016-03-31 Thread Benjamin Greenman
Finally, the language for agile software development. https://github.com/bennn/agile (raco pkg install agile) Featuring: - Concise, unambiguous syntax - Time-tested suite of primitive datatypes

Re: [racket-users] serialization of math/array

2016-03-30 Thread Benjamin Greenman
Here's one hack. #lang racket/base (require math/array (prefix-in rkt: racket/serialize)) (define secret-key 'array) (define (serialize val) (if (array? val) (rkt:serialize (cons secret-key (array->list val))) (rkt:serialize val))) (define (deserialize val) (define d

Re: [racket-users] How to manage a Racket package within a Git repo?

2016-03-23 Thread Benjamin Greenman
Ok, that would help On Wed, Mar 23, 2016 at 2:21 PM, Matthew Flatt wrote: > Are there other places where you looked that could also use a note? > Only pkgs.racket-lang.org, but I think the note in "getting started" should be enough. -- You received this message because

Re: [racket-users] How to manage a Racket package within a Git repo?

2016-03-23 Thread Benjamin Greenman
Great, thank you -- 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

Re: [racket-users] How to manage a Racket package within a Git repo?

2016-03-23 Thread Benjamin Greenman
Thank you! Is this documented / is there a good place to add a note in the docs? (Maybe the package server should have an FAQ link, besides just linking to docs.racket-lang.org ?) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe

[racket-users] How to manage a Racket package within a Git repo?

2016-03-23 Thread Benjamin Greenman
I have a git repo that contains a Racket package. The repo also contains other folders related to the package. How do I share the package on pkgs.racket-lang.org without sharing (or just compiling/installing) the other folders? Say I ("bennn") own a repo "foo" with 2 folders, "pkg" and "other".

Re: [racket-users] regexp-match? problem

2016-03-11 Thread Benjamin Greenman
I'm glad you found #px. The issue here is that bounded repetitions like {1,2} are not part of the #rx grammar. But #px supports them just fine. http://docs.racket-lang.org/reference/regexp.html On Fri, Mar 11, 2016 at 5:38 PM, Héctor Mc wrote: > > Hey, I have this

Re: [racket-users] [ANN] trivial 0.1

2016-03-02 Thread Benjamin Greenman
found, I'd love to hear them! In exchange I promise a beer or other legal refreshment at the next Racket-Con :) Ben On Tue, Dec 15, 2015 at 10:33 AM, Benjamin Greenman < benjaminlgreen...@gmail.com> wrote: > Short answer: I made a package because I wanted to release as soon as > possible

Re: [racket-users] "Contracts can have significant overhead" but Typed Racket cannot?

2016-02-29 Thread Benjamin Greenman
One more clarification :p Contracts are always checked at run-time. Each time you call a function with a contract on it, you need to check the contract. Typed functions called from typed code are checked at compile-time. They're both safe and fast at run-time. The tricky part is when typed and

Re: [racket-users] Nesting structs – I'm confused!

2016-02-23 Thread Benjamin Greenman
Very puzzling! I think you're doing the update correctly: > (hash-ref (hashtainer-contents (hash-ref (hashtainer-contents the-hashtainer) 'layer-1)) 'layer-2) "hello from layer 2" But here's the trouble: > (eq? (hashtainer-contents the-hashtainer) (hashtainer-contents (hash-ref

Re: [racket-users] Typed Racket

2016-02-20 Thread Benjamin Greenman
Hi Piyush, Is it viable to use typed racket for production use ? > At least 3 people are using Typed Racket in production: - https://groups.google.com/forum/#!searchin/racket-users/typed$20racket|sort:date/racket-users/rfM6koVbOS8/JHaHG03cCQAJ - https://www.youtube.com/watch?v=QoYJfA7cq2I -

Re: [racket-users] raco pkg install -> connection refused

2016-02-17 Thread Benjamin Greenman
You should be able to install html-parsing now. On Wed, Feb 17, 2016 at 9:32 AM, Matthew Flatt wrote: > A second problem is is that the package catalog is not supposed to > depend on that machine's uptime. That's a configuration mistake that we > will fix, too.

Re: [racket-users] rebinding a macro-introduced identifier from afar?

2016-02-11 Thread Benjamin Greenman
Could you put the dialect values in separate modules and have the #%module-begin conditionally pick which dialect modules to require? On Thu, Feb 11, 2016 at 11:18 AM, Matthew Butterick wrote: > > Why don't you put the val-id into the module via foo? Why is bar > supposed to do

Re: [racket-users] rebinding a macro-introduced identifier from afar?

2016-02-11 Thread Benjamin Greenman
gt; different filesystem context, and thereby coerced into loading the right > "dialect-settings.rkt". > > OTOH the dissertation committee won't be impressed. > > > On Feb 11, 2016, at 9:47 AM, Benjamin Greenman < > benjaminlgreen...@gmail.com> wrote: > > Could

Re: [racket-users] Package documentation category with info.rkt

2016-02-09 Thread Benjamin Greenman
Yep, use a string instead of a symbol: (define scribblings '(("yaml/yaml.scrbl" () ("Parsing Libraries" The only valid symbols are the category names listed here [1]. [1] http://docs.racket-lang.org/raco/setup-info.html?q=info On Tue, Feb 9, 2016 at 2:39 AM, Erik Silkensen

Re: [racket-users] Package documentation category with info.rkt

2016-02-09 Thread Benjamin Greenman
uot;srfi-lite-lib" "typed-racket-lib")) > (define build-deps '("rackunit-lib" "scribble-lib" "racket-doc" > "sandbox-lib")) > (define scribblings '(("yaml/yaml.scrbl" () ("Parsing Libraries" > > On Feb 9,

Re: [racket-users] Help trying to create a script to launch a program from command line.

2016-02-05 Thread Benjamin Greenman
I think you want: (system "~users/myuser/minecraft/start.sh") -- 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

[racket-users] scribble: module->typed-exports ?

2016-02-01 Thread Benjamin Greenman
Is there a way to get a list of identifiers exported by a typed module, along with their type signatures? This is just for scribble, in case that makes it easier. The story: I have an untyped library with a typed compatibility interface, so you can either (require my-lib) or (require

Re: [racket-users] Re: appending files

2016-01-30 Thread Benjamin Greenman
Fixed, thanks for the report! On Sat, Jan 30, 2016 at 8:31 PM, Scotty C wrote: > just found a small mistake in the documentation: can you find it? > > (numerator q) → integer? > > q : rational? > > Coerces q to an exact number, finds the numerator of the

Re: [racket-users] Re: LaTeX inspired key bindings

2016-01-28 Thread Benjamin Greenman
On Thu, Jan 28, 2016 at 5:33 PM, Brian Adkins wrote: > configure Emacs (like I already have) to display λ instead of lambda I really like using the agda input mode in Emacs. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.UnicodeInput -- You received this message

Re: [racket-users] list of macro & #lang resources

2016-01-27 Thread Benjamin Greenman
The Racket Manifesto http://www.ccs.neu.edu/home/matthias/manifesto/ On Wed, Jan 27, 2016 at 11:31 AM, Matthew Butterick wrote: > For an upcoming project I'm assembling a list of articles & videos about > making macros and #langs in Racket. These are the ones I've come across,

Re: [racket-users] appending files

2016-01-26 Thread Benjamin Greenman
On Tue, Jan 26, 2016 at 1:32 AM, Neil Van Dyke wrote: > you want to do "filename globbing" There's also the glob package [1], which should give the exact same API as the shell. No need to remember the trailing "$" or specifically exclude dotfiles. (require glob) (glob

Re: [racket-users] appending files

2016-01-25 Thread Benjamin Greenman
If you don't mind all the indentation, this one is streaming. (define (concat file* destination) (with-output-to-file destination #:exists 'append (lambda () ;; 'cat' each file (for ([f (in-list file*)]) (with-input-from-file f (lambda () (for ([ln

Re: [racket-users] warning on use trie functions in #lang racket?

2016-01-05 Thread Benjamin Greenman
I'm afraid it's just O(n) contracts. For example: #lang racket/base (module stack typed/racket/base (define-type Stack (Listof Integer)) (provide: [create (-> Stack)] [push (-> Integer Stack Stack)] [pop (-> Stack Stack)]) (define (create) '()) (define push cons) (define

Re: [racket-users] warning on use trie functions in #lang racket?

2016-01-05 Thread Benjamin Greenman
programmers, but in fact the opposite. > > Jay > > On Tue, Jan 5, 2016 at 3:28 PM, Benjamin Greenman > <benjaminlgreen...@gmail.com> wrote: > > I'm afraid it's just O(n) contracts. For example: > > > > #lang racket/base > > > > (module stack typed/racket

Re: [racket-users] Potential Contract Profiler UI Change

2016-01-05 Thread Benjamin Greenman
Sounds great! Two suggestions: 1. A `raco contract-profile` command to run the main submodule in a file. 2. Make even less output by default -- just the overall runtime & by-callee contracts. But this is just my opinion :) On Tue, Jan 5, 2016 at 6:06 PM, Vincent St-Amour <

Re: [racket-users] Typed/Untyped cost reduction and experience

2015-12-29 Thread Benjamin Greenman
Is the server code online anywhere? I'd like to see what the boundary contracts are. Let me know if starting typed works for a future project. So far, I've had the best experience starting untyped but keeping type annotations in comments -- basically like no-check, but without annotations on

Re: [racket-users] Typed/Untyped cost reduction and experience

2015-12-29 Thread Benjamin Greenman
On Tue, Dec 29, 2015 at 7:05 PM, JCG wrote: > If I understand this correctly, the unsafe version will perform the same > static checks on callers of the functions published by (provide) but not > incur contract cost. Yep, that's right. #lang typed/racket/base (require

Re: [racket-users] Time Series in Racket

2015-12-28 Thread Benjamin Greenman
On Mon, Dec 28, 2015 at 5:29 AM, Greg Trzeciak wrote: > Re: 3 Is there any example of plotting with x axis being the time+date > available? There's a small example in the docs for the 'plot' package:

Re: [racket-users] listing the identifiers from "all-defined-out" and "all-from-out"

2015-12-22 Thread Benjamin Greenman
You might also like `filtered-out` from `racket/provide` [1]. The code sample below prints two identifiers (at compile-time): a:x y [1] http://docs.racket-lang.org/reference/require.html#%28mod-path._racket%2Fprovide%29 #lang racket/base (module a racket/base (provide x) (define x 1))

Re: [racket-users] [newbie] Help with streams

2015-12-20 Thread Benjamin Greenman
I've been struggling with streams recently too. in-producer solved my problems. (define name-gen (in-producer (lambda () (new-name ethnicity sex (define some-names

Re: [racket-users] Advent of Code

2015-12-19 Thread Benjamin Greenman
Here's how I'd outline lang/reader.rkt, assuming the API from advent7/main.rkt in comments below. (If I write a full solution, I'll come back & post that) #lang racket/base (provide (rename-out [advent7-read read] [advent7-read-syntax read-syntax])) (require racket/port

Re: [racket-users] [ANN] trivial 0.1

2015-12-15 Thread Benjamin Greenman
, my curiosity aside, this is a cool idea. I’ll definitely > consider playing with this a bit if I can get some free time. > > > > Alexis > > > >> On Dec 14, 2015, at 21:40, Benjamin Greenman < > benjaminlgreen...@gmail.com> wrote: > >> > >> Have you

[racket-users] [ANN] trivial 0.1

2015-12-14 Thread Benjamin Greenman
Have you or someone you know [1] ever thought: "Gee, I wish Typed Racket could figure out that ___ has type ___. It's pretty obvious to me." Then the new "trivial" [2] library is here to help. If you're using basic arithmetic (+, -, *, /), format strings, or regexp-match, just add a colon to

Re: [racket-users] Re: Happy Module Day!

2015-12-11 Thread Benjamin Greenman
> > FWIW, http://www.dwheeler.com/sloccount/ might be a better way to > accomplish this once it supports Racket detection. I just opened a feature > request for that at > https://sourceforge.net/p/sloccount/feature-requests/20/ and am hoping > there is interest. > You could also use sloc [1],

Re: [racket-users] pasteboard% applications

2015-12-01 Thread Benjamin Greenman
I know of two (but I don't know them well) The PLT card games library: https://github.com/racket/games/blob/master/cards/classes.rkt Matthias's Acquire game: https://github.com/mfelleisen/Acquire/blob/master/tree-game.rkt On Tue, Dec 1, 2015 at 10:39 PM, Byron Davies

Re: [racket-users] Value printing in REPL and for students

2015-11-26 Thread Benjamin Greenman
I think you'll want to override the current-print parameter. On Thu, Nov 26, 2015 at 7:16 PM, Paolo Giarrusso wrote: > Hi all! > > How does the

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Benjamin Greenman
On Wed, Oct 14, 2015 at 11:01 PM, Alexis King wrote: > I can’t wait until all of my programs look like this at the top: Haskellers are living the dream. For example: https://github.com/ekmett/lens/blob/master/src/Control/Lens/Tuple.hs -- You received this message

Re: [racket-users] help on coding finite state automata

2015-10-13 Thread Benjamin Greenman
> > - why you use [i (in-range 10)] in all for loop? what's the difference > with [i 10]. they both produce stream, right? Yes, but `in-range` runs faster because of "types". Here's a little example: #lang racket/base (define N (expt 10 7)) (time (for ([n (in-range N)]) (void))) ;; cpu time:

Re: [racket-users] module providing both safe and unsafe procedures

2015-09-29 Thread Benjamin Greenman
How about making an unsafe submodule? #lang racket/base (provide vplus) (module+ unsafe (provide vplus) (require racket/unsafe/ops)) (define (vplus v1 v2) (build-vector (vector-length v1) (lambda (i) (+ (vector-ref v1 i) (vector-ref v2 i) (module+ unsafe

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Benjamin Greenman
Could you post the "ugly" code? I'm curious because things like this compile fine: (define (f-recur x y) (cond ((< x 1) 10) (else (define z 3) (f-recur x y On Wed, Sep 23, 2015 at 7:25 PM, Kaushik Ghose wrote: > > On Wed, Sep 23, 2015 at 12:26 PM,

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Benjamin Greenman
On Wed, Sep 23, 2015 at 7:38 PM, Kaushik Ghose wrote: > I haven't gotten to cond yet. Ok. Yeah, if- branches aren't allowed to have definitions, or even sequences of operations. You can get around this with begin: (define (f x) (if (even? x) (/ x 2)

Re: [racket-users] Re: typed/racket + rackunit = trouble

2015-09-17 Thread Benjamin Greenman
On Thu, Sep 17, 2015 at 4:38 PM, Raoul Duke wrote: > wait, who needs tests when you have static typing?! sheesh Really though, Typed Racket might benefit from a non-rackunit library that encourages a different style of testing. (Instead of duplicating all the rackunit

[racket-users] Scribble: line comment swallows paragraph break

2015-09-16 Thread Benjamin Greenman
Scribble and LaTeX disagree on these documents. Should Scribble be changed to match LaTeX? Scribble: #lang scribble/manual Hello @; John World Output is: "Hello World" ;; --- LaTeX \documentclass{article} \begin{document} Hello % John World \end{document} Output is: "Hello World" -- You

[racket-users] values considered harmful

2015-09-12 Thread Benjamin Greenman
Something bad happened. I was using values and pairs, made a small mistake, and wound up with a segfault (on v6.2 and v6.2.900.16). Here's a minimal example: #lang racket/base (define (split xy) (define-values (x y) (values (car xy) (cdr xy))) (values y x)) ;; My mistake: x should be a pair

Re: [racket-users] Question about log-ticks

2015-08-28 Thread Benjamin Greenman
I'm not sure if this is intended, but I do have a hack to add them in manually: (parameterize ([plot-y-transform log-transform] [plot-y-ticks (log-ticks #:number 6)]) (define xs (range 1 11)) (define ys (map (lambda (x) (exp x)) xs)) (define extra-ticks (for/list ([n (in-range 2

Re: [racket-users] Re: Continued Fraction Arithmetic Package

2015-08-26 Thread Benjamin Greenman
Package installed. Thanks! On Wed, Aug 26, 2015 at 12:58 PM, Deren Dohoda deren.doh...@gmail.com wrote: Thanks Vincent, I have done so. On Wed, Aug 26, 2015 at 12:41 PM, Vincent St-Amour stamo...@eecs.northwestern.edu wrote: It's easy. Just click the login link on the top-right, and

[racket-users] Impersonating a 0-arity function

2015-08-22 Thread Benjamin Greenman
I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt. #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda () ;;(values ;; -- this

[racket-users] Impersonating a 0-arity function

2015-08-21 Thread Benjamin Greenman
I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt -- this even possible? #lang racket/base (struct wrap (vals)) ;; Wrap a list (define (create) '()) (define create-wrap (impersonate-procedure create (lambda ()

Re: [racket-users] Impersonating a 0-arity function

2015-08-21 Thread Benjamin Greenman
Thank you! On Fri, Aug 21, 2015 at 2:38 PM, Matthew Flatt mfl...@cs.utah.edu wrote: At Fri, 21 Aug 2015 12:44:08 -0400, Benjamin Greenman wrote: I'd like to change the result of a 0-arity function, but I need help crafting the right magic spell. Here's my attempt -- this even possible

Re: [racket-users] Typesetting Racket code

2015-08-12 Thread Benjamin Greenman
I'm not sure about squarer, but using `\boldsymbol` will get you bolder. \usepackage{amsmath} \RktSym{$\boldsymbol\lambda$} (But I think the right answer is to use a font family with a lambda symbol. I bet that's what Scribble does.) On Wed, Aug 12, 2015 at 2:38 PM, Paul van der Walt

Re: [racket-users] Wanted: Crazy nested lambda test cases

2015-07-23 Thread Benjamin Greenman
Worked fine on two of my favorite examples. Example 1, grows exponentially under call-by-name reduction H = (\ (f x) (f f (x x)) W = (\ (x) (x x)) (H H (W W)) Example 2, variable-arity map adapted from http://www.brics.dk/RS/01/10/BRICS-RS-01-10.pdf On Thu, Jul 23, 2015 at 2:09 PM,

Re: [racket-users] plot: change pen cap?

2015-07-08 Thread Benjamin Greenman
for these? I'd be happy to label myself as responsible. On Fri, Jul 3, 2015 at 12:50 PM, Neil Toronto neil.toro...@gmail.com wrote: On 07/02/2015 08:37 PM, Benjamin Greenman wrote: On Thu, Jul 2, 2015 at 11:23 AM, Neil Toronto neil.toro...@gmail.com mailto:neil.toro...@gmail.com wrote

Re: [racket-users] plot: change pen cap?

2015-07-02 Thread Benjamin Greenman
On Thu, Jul 2, 2015 at 11:23 AM, Neil Toronto neil.toro...@gmail.com wrote: rounded ends are the only kind that compose nicely when drawn that way Oooh, that's interesting. After sending the first email I'd actually gone ahead and hacked make-pen% to always use the square cap -- which looked

Re: [racket-users] Using ‘except-in’ to exclude identifiers for a single phase level

2015-06-28 Thread Benjamin Greenman
Sure, you just need to require and provide b at your favorite phase level in c. Replacing module c with the following makes the rest compile for me: (module c racket/base ;; Require provide everything except `some-fun` at phase 0 (require (except-in (submod .. b) some-fn)) (provide

Re: [racket-users] Using ‘except-in’ to exclude identifiers for a single phase level

2015-06-28 Thread Benjamin Greenman
:21, Benjamin Greenman bl...@cornell.edu wrote: Sure, you just need to require and provide b at your favorite phase level in c. Replacing module c with the following makes the rest compile for me: (module c racket/base ;; Require provide everything except `some-fun` at phase 0

Re: [racket-users] Using ‘except-in’ to exclude identifiers for a single phase level

2015-06-28 Thread Benjamin Greenman
it, you’ll see that some-fn is still available in phase 1. That’s because the (provide (all-from-out (submod .. b))) provides it as well, which is why I’ve been struggling. On Jun 28, 2015, at 13:09, Benjamin Greenman bl...@cornell.edu wrote: No problem, just change the provides around

[racket-users] plot: change pen cap?

2015-06-24 Thread Benjamin Greenman
I'd like to change the pen cap on my racket/plot images from the default 'round to 'butt. What's the easiest way to do this? -- 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

[racket-users] Re: [racket] updated trycode.io

2015-05-31 Thread Benjamin Greenman
Just tried teaching a friend Racket with this and noticed that typing an extra right paren causes the interpreter to hang. We had to refresh the page. On Tue, Mar 3, 2015 at 2:48 PM, Floyd Arguello floyd.argue...@gmail.com wrote: Its fixed - nginx cached the racket web server response :P

Re: [racket-users] racket-explorer now deals with cyclic/mutable data

2015-05-22 Thread Benjamin Greenman
Awesome! -- 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 submodules vs tests in separate file

2015-05-21 Thread Benjamin Greenman
Three advantages of `test` submodules interspersed with the implementation code: Here's a fourth: no need for tricks like require/expose to sneak around interfaces. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this

[racket-users] Type error using in-list on empty list

2015-05-19 Thread Benjamin Greenman
This program raises a type error about unsafe-car (for ([x : Void (in-list '())]) x) So far, I've found ways to remove the error 1. Remove the annotation on x 2. Remove the in-list hint 3. Use a non-empty list Is this a bug? -- You received this message because you are subscribed to the

[racket-users] type mismatch: given (Listof Error)

2015-05-11 Thread Benjamin Greenman
This program gives a confusing error message. Does anyone know why the xs in the body doesn't have type (List Foo)? The error message is much better if the return type is (Listof Integer). It only complains about Foo being unbound instead of Foo unbound and got a listof error. ;; --- #lang

[racket-users] Typed analog of integer-in contract

2015-04-20 Thread Benjamin Greenman
The contract integer-in lets me guarantee an integer is within a certain range. (define/contract (mod3 n) (- integer? (integer-in 0 2)) (modulo n 3)) Is there a similar way to specify a type for an integer range? Or do I need to use a union type? (I'd really like to specify a range

Re: [racket-users] DrRacket plugin to remove trailing whitespace on save?

2015-04-13 Thread Benjamin Greenman
On Mon, Apr 13, 2015 at 1:51 PM, 'John Clements' via users-redirect us...@plt-scheme.org wrote: On Apr 13, 2015, at 10:26 AM, Robby Findler ro...@eecs.northwestern.edu wrote: You could just make delete-trailing-whitespace a keyboard shortcut instead. Another approach would be to add a

[racket-users] ANN: glob, for Unix-style globbing

2015-03-31 Thread Benjamin Greenman
I've pushed a script for globbing to the package server. It exports two functions, `glob` and `in-glob`. I hope that some day functions like these can be in racket/file, but until then, enjoy. (glob ./files/*.rkt) Returns a list of all files ending with the .rkt extension in the directory files