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 objects #'a & #'b. (I'm n

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 an interface for web sc

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 hash-ad

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 wh

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 t

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 in set-symbol) > expe

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 (rkt:deseri

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 you are subscribed to

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 https://groups.google.com/d/o

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 f

[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". I

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 problem, I want filter values

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

2016-03-02 Thread Benjamin Greenman
C, or bugs 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 a

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 u

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 (hashtainer-

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 - https

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. Unfortunately, I haven't yet found

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

2016-02-11 Thread Benjamin Greenman
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: > >

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 that? > > > This

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

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 wrote: > Hi Rac

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 more

[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 my-lib/type

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 number expressed > in its s

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 because you are subscri

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, > but I welcome su

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 "foo/*/*.rkt") [1] http

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] 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 < stamo...@eecs.northw

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

2016-01-05 Thread Benjamin Greenman
gt; > Jay > > On Tue, Jan 5, 2016 at 3:28 PM, Benjamin Greenman > wrote: > > I'm afraid it's just O(n) contracts. For example: > > > > #lang racket/base > > > > (module stack typed/racket/base > > (define-type Stack (Listof Integer)) &g

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 p

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 typed/racket/unsafe) (uns

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 lambd

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: http://docs.racket-lang.org/plot/ticks_and_transforms.html#%28def._%28%28lib._plot%2Fmain..rkt%

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 syntax/strip-cont

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

2015-12-15 Thread Benjamin Greenman
dea. 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 or someone you know [1] eve

[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 the

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], whic

Re: [racket-users] about REALM OF RACKET

2015-12-11 Thread Benjamin Greenman
A is close, but the problem just wants the number of guesses -- not their values. In your example, the right value to display is 5. On Fri, Dec 11, 2015 at 7:35 AM, Taro Annual wrote: > Everyone, > > Hi, I'm reading "REALM OF RACKET" and can't understand the following > question. > > > [p.89 / C

Re: [racket-users] "Is Sound Gradual Typing Dead?"

2015-12-04 Thread Benjamin Greenman
> > now I feel bad about helping kill TR Far from it! Quad (and the math library, etc) are inspiring the bright future*™* of Typed Racket. The next paper should be titled "No!", based on improvements since today's results. [[ From an academic perspective, this paper is about establishing an eval

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 wrote: > Does anyone have

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 REPL print values? In some

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 because you are subscribed to

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: 3

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 (de

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) (begin (define a (* x

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, Pierpaolo Bernardi >> wro

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 code.) -- You receiv

[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 r

[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&flip xy) (define-values (x y) (values (car xy) (cdr xy))) (values y x)) ;; My mistake: x should be a p

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 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 create an a

[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 w

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 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 po

[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 () ;;(v

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 wrote:

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, Emmanue

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

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

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

2015-07-02 Thread Benjamin Greenman
On Thu, Jul 2, 2015 at 11:23 AM, Neil Toronto 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 "matplotlib good" for m

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

2015-06-28 Thread Benjamin Greenman
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 wrote: > > > > No problem, just change t

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

2015-06-28 Thread Benjamin Greenman
;t figured out exactly how to make that particular configuration > work. > > > On Jun 28, 2015, at 01:21, Benjamin Greenman wrote: > > > > Sure, you just need to require and provide b at your favorite phase > level in c. Replacing module c with the following makes th

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 (all

[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 a

[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 wrote: > > Its fixed - nginx cached the racket web server response :P > > Thanks for pointing tha

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 g

[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 Google

[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". ;; --- #

[racket-users] Call to arms: Typed Racket performance costs

2015-05-04 Thread Benjamin Greenman
Dear Racket Community, For the past few weeks, we've been studying the performance costs of Typed Racket. Our procedure is essentially: 1. Find an interesting Racket project 2. Configure the project to run all combinations of typed and untyped modules 3. Experiment with the results Friday's disc

[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 containin

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 > wrote: > > > You could just make delete-trailing-whitespace a keyboard shortcut > instead. > > > > Another approach would be to add a mode that colo

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

2015-03-30 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

Re: [racket] the typed Values restriction

2015-03-18 Thread Benjamin Greenman
On Wed, Mar 18, 2015 at 5:16 PM, Michael Wilber wrote: > this doesn't work in vanilla Racket > Sure, but it works without the let! For context, I ran into this issue adding types to a function originally written in continuation passing style. Switching to cons was an easy fix. __

[racket] the typed Values restriction

2015-03-18 Thread Benjamin Greenman
Today I got a surprising type error that I think is worth sharing. (: my-force (All (A) (-> (-> A) A)) (define (my-force x) (x)) (my-force (lambda () (values (void) (void))) ;; ERROR! 'my-force' cannot be applied to argument. ;; expected "(-> A)", got "(-> (values Void Void))" ;; result type "A",

Re: [racket] Can I get some feedback / a code review for some simple game code?

2015-03-16 Thread Benjamin Greenman
This was fun, and the code was easy to read. Besides that I don't have much constructive criticism. Figure out why it's lagging and finish the game! On Mon, Mar 16, 2015 at 4:01 AM, Alexis King wrote: > I wrote a “game” (in quotes because it’s a WIP and barely qualifies as a > game in its curre

Re: [racket] Cannot share a require/typed #:struct

2015-02-05 Thread Benjamin Greenman
ta-defn, and use require/typed/provide to import the struct and > provide it. Then just require that module for all other modules that need > to use that struct in a typed context. > > On Feb 5, 2015, at 21:10, Benjamin Greenman wrote: > > I've got three modules: > - One u

[racket] Cannot share a require/typed #:struct

2015-02-05 Thread Benjamin Greenman
I've got three modules: - One untyped module defines some structs - One typed module defines some helper functions - One typed module does some interesting things I've also got a problem: I cannot share imported untyped structs between the typed modules. The problem goes away if I linearize the m

Re: [racket] racket and lisp/scheme

2015-02-03 Thread Benjamin Greenman
Here's a quick overview of the name change (PLT Scheme -> Racket) from the Racket website: http://racket-lang.org/new-name.html On Sun, Feb 1, 2015 at 5:59 AM, Catonano wrote: > In what is racket different from Scheme ? > > I read that the racket language is a "descendent" of Lisp and Scheme > >

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] Void expression found

2015-01-06 Thread Benjamin Greenman
> > From a practical point of view, at the low level the implementation is > heavily optimized for functions that return exactly one value. > Functions that return a different number of values are slower. > Does this mean I'm better off returning (cons a b) than (values a b)?

Re: [racket] comments on format for api documentation embedded in modules

2014-12-18 Thread Benjamin Greenman
> > For the new tool, I'm leaning strongly towards the documentation format > being exactly like in McFly Sounds great; with syntax highlighting, I'd use this tool all the time. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] using scribble/eval in conjunction with scribble/lp

2014-12-14 Thread Benjamin Greenman
self-referential, though. > > > > On Sun, Dec 14, 2014 at 4:46 PM, Benjamin Greenman > wrote: > > I tried and failed to figure this out. In particular, when I create the > > example "lp.rkt" file described at the top of the scribble/lp docs and > > require

Re: [racket] using scribble/eval in conjunction with scribble/lp

2014-12-14 Thread Benjamin Greenman
I tried and failed to figure this out. In particular, when I create the example "lp.rkt" file described at the top of the scribble/lp docs and require it "in the normal manner", the identifier f is unbound for me. The code I'm using is pasted below: ;; lp.rkt #lang scribble/lp Literate programs

Re: [racket] Run-time record access

2014-12-10 Thread Benjamin Greenman
nd > all fields are accessed by position. > > We plan to change the structure-type core to add field names, but it > hasn't happened, yet. > > At Wed, 10 Dec 2014 04:36:50 -0500, Benjamin Greenman wrote: > > I'm hoping to implement the following function to access arbitr

[racket] Run-time record access

2014-12-10 Thread Benjamin Greenman
I'm hoping to implement the following function to access arbitrary struct fields. ;; Compute `[st]-field-name st`, where ;; [st] is the name of the struct type of `st` (define (runtime-get st field-name) (-> struct? string? any/c) (error "not implemented")) Is this possible? I fear I can't us

Re: [racket] `require/typed` with a parameterized struct

2014-12-06 Thread Benjamin Greenman
> > > > > > On Dec 6, 2014, at 5:00 PM, Benjamin Greenman wrote: > > The typed racket reference shows how to require/typed a struct from an > untyped program [1]. I'd like to generalize this example to a struct with a > type parameter. > > Here is the

[racket] `require/typed` with a parameterized struct

2014-12-06 Thread Benjamin Greenman
The typed racket reference shows how to require/typed a struct from an untyped program [1]. I'd like to generalize this example to a struct with a type parameter. Here is the code I would like to write. How can I get this to type check? #lang racket/base (module UNTYPED racket/base (struct Tre

Re: [racket] eval question

2014-11-20 Thread Benjamin Greenman
But why does eval's default namespace include "+" but not "expt"? On Thu, Nov 20, 2014 at 10:39 AM, Éric Tanter wrote: > This is answered in the Racket Guide, see section 15.1. > > The reason is that you need to provide a namespace (which in the > interaction mode is already initialized). > > So

[racket] From types to contracts

2014-11-17 Thread Benjamin Greenman
I'd like to convert the following typed program into an untyped one that uses a contract instead of a type signature to protect the member function. #lang typed/racket (struct: (A) Node ([val : A] [left-tree : (MyTree A)] [right-tree : (MyTree A)])) (define

Re: [racket] Cyclic data structures in Typed Racket

2014-09-29 Thread Benjamin Greenman
Could Andrew Myer's work on masked types (to eliminate nulls for object initialization) be relevant? http://www.cs.cornell.edu/Projects/jmask/ On Mon, Sep 29, 2014 at 3:30 PM, Matthias Felleisen wrote: > > I guess the real problem is to create suitable default values so > that the pass the type

Re: [racket] Cyclic data structures in Typed Racket

2014-09-29 Thread Benjamin Greenman
To be sure: Is there any TR analog to this OCaml code, initializing a cyclic, 3-element list? I've tried using letrec in TR, but the typechecker yells at me even if I annotate the a,b,c,d. # type 'a mylist = Nil | Cons of 'a * 'a mylist;; type 'a mylist = Nil | Cons of 'a * 'a mylist # let mylist