[racket] Please help with syntax

2014-06-27 Thread Roman Klochkov
I need to define syntax set!-values*, that will ignore _ in value place. Such as (define a #f) (set!-values* (_ _ a) (values 1 2 3)) ; should set a to 3. But I have two problems: 1. _ don't want to pattern match in syntax case. If I make it literal, I can't match "anything else". 2. How to omit

[racket] Functional Art, Music, Modelling and Design (FARM 2014): Call for Participation

2014-06-27 Thread Michael Sperber
FARM 2014 2nd ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design Gothenburg, Sweden; 6 September, 2014 http://functional-art.org/2014/ The ACM SIGPLAN International Workshop on Functional Art, M

Re: [racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
On Fri, 27 Jun 2014 16:17:01 -0400 Sam Tobin-Hochstadt wrote: > On Fri, Jun 27, 2014 at 4:08 PM, Manfred Lotz > wrote: > > On Fri, 27 Jun 2014 15:59:47 -0400 > > "Alexander D. Knauth" > > wrote: > > > >> Are you sure you meant "hash-ref!" and not just "hash-ref”? > >> > > > > Well I thought has

Re: [racket] Splicing nested syntax clauses

2014-06-27 Thread Alexander D. Knauth
Is this anything like what you wanted? (require web-server/dispatch (for-syntax syntax/parse racket/list)) (begin-for-syntax ;; mdr-clause->dr-clauses : Syntax -> (Listof Syntax) (define (mdr-clause->dr-clauses mdr-clause) (syntax-parse mdr-clause [[(th

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
On Fri, Jun 27, 2014 at 4:08 PM, Manfred Lotz wrote: > On Fri, 27 Jun 2014 15:59:47 -0400 > "Alexander D. Knauth" > wrote: > >> Are you sure you meant "hash-ref!" and not just "hash-ref”? >> > > Well I thought hash-ref! is the way to go because I just wanted #f in > case of not found. > >> Becaus

Re: [racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
On Fri, 27 Jun 2014 15:59:47 -0400 "Alexander D. Knauth" wrote: > Are you sure you meant "hash-ref!" and not just "hash-ref”? > Well I thought hash-ref! is the way to go because I just wanted #f in case of not found. > Because even with (hash-ref! my-hash size (lambda () #f)), it would > expec

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
I think you should follow Alexander's advice here about using `hash-ref` and not `hash-ref!`. Also, your whole function can also be written as: (hash-update! my-hash size (λ ([v : (Listof String)]) (cons s v)) (λ () null)) Sam On Fri, Jun 27, 2014 at 3:55 PM, Manfred Lotz wrote: > On Fri,

Re: [racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
On Fri, 27 Jun 2014 15:49:14 -0400 Sam Tobin-Hochstadt wrote: > On Fri, Jun 27, 2014 at 3:32 PM, Manfred Lotz > wrote: > > > > Argument 3: > > Expected: (-> b) > > Given:False > > > This is the key part of the error message: you have to provide a > function as the third argument, and y

Re: [racket] Typed racket and hash table

2014-06-27 Thread Alexander D. Knauth
Are you sure you meant "hash-ref!" and not just "hash-ref”? Because even with (hash-ref! my-hash size (lambda () #f)), it would expect the #f to be of type (Listof String), which it isn’t. On Jun 27, 2014, at 3:32 PM, Manfred Lotz wrote: > I tried this: > > #lang typed/racket/base > > (: m

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
On Fri, Jun 27, 2014 at 3:32 PM, Manfred Lotz wrote: > > Argument 3: > Expected: (-> b) > Given:False This is the key part of the error message: you have to provide a function as the third argument, and you provided `#f`. I'd just change that to (lambda () #f). Sam

[racket] Splicing nested syntax clauses

2014-06-27 Thread Jack Firth
I'm working with some servlet dispatching code and I want to be able to use dispatch-rules to generate the url to response mappings, but I want to be able to group related handlers to subpages. Under dispatch-rules, that looks something like this: (dispatch-rules [("page-a" "handler-a" (intege

[racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
I tried this: #lang typed/racket/base (: my-hash (HashTable Nonnegative-Integer (Listof String))) (define my-hash (make-hash)) (: my-hash-add (-> Nonnegative-Integer String Void)) (define (my-hash-add size s) (let* ([val (hash-ref! my-hash size #f)]) (if val (hash-set! my-hash si

[racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
I tried this: #lang typed/racket/base (: my-hash (HashTable Nonnegative-Integer (Listof String))) (define my-hash (make-hash)) (: my-hash-add (-> Nonnegative-Integer String Void)) (define (my-hash-add size s) (let* ([val (hash-ref! my-hash size #f)]) (if val (hash-set! my-hash si

[racket] Typed racket and hash table

2014-06-27 Thread Manfred Lotz
I tried this: #lang typed/racket/base (: my-hash (HashTable Nonnegative-Integer (Listof String))) (define my-hash (make-hash)) (: my-hash-add (-> Nonnegative-Integer String Void)) (define (my-hash-add size s) (let* ([val (hash-ref! my-hash size #f)]) (if val (hash-set! my-hash si

Re: [racket] Python creep

2014-06-27 Thread Todd O'Bryan
I used Scala for our intro course last year, mostly because I wanted types. I know Matthias thinks types are a horrible thing to make students deal with first semester, but I found that students made different kinds of mistakes than they did in Racket. When you're writing containsDoll and the syste

Re: [racket] typed and racket/date

2014-06-27 Thread Manfred Lotz
On Fri, 27 Jun 2014 14:04:46 -0400 Sam Tobin-Hochstadt wrote: > You should use `(require typed/racket/date)` instead. > Great. > There's a list of already-typed libraries in the documentation here: > http://docs.racket-lang.org/ts-reference/Libraries_Provided_With_Typed_Racket.html > but I see

Re: [racket] typed and racket/date

2014-06-27 Thread Sam Tobin-Hochstadt
You should use `(require typed/racket/date)` instead. There's a list of already-typed libraries in the documentation here: http://docs.racket-lang.org/ts-reference/Libraries_Provided_With_Typed_Racket.html but I see that it doesn't mention `racket/date`. Sam On Fri, Jun 27, 2014 at 1:49 PM, Manf

Re: [racket] Typed racket and apply

2014-06-27 Thread Sam Tobin-Hochstadt
I would write the program this way: #lang typed/racket (: exit-with-error-msg : String Any * -> Any) (define (exit-with-error-msg m . e) (apply eprintf m e) (exit 1)) Note that we explicitly require at least one argument, the format string. In your program, Typed Racket can't tell that

Re: [racket] Typed racket and apply

2014-06-27 Thread Manfred Lotz
On Fri, 27 Jun 2014 13:55:52 -0400 Sam Tobin-Hochstadt wrote: > I would write the program this way: > > #lang typed/racket > > (: exit-with-error-msg : String Any * -> Any) > (define (exit-with-error-msg m . e) > (apply eprintf m e) > (exit 1)) > > Note that we explicitly require at le

[racket] typed and racket/date

2014-06-27 Thread Manfred Lotz
Hi there, In order to use racket/date in a typed racket program do I need to use (require/typed ...)? If understand it right I have to define types for the stuff I use from racket/date. Is this true? -- Manfred Racket Users list: http://lists.racket-lang.org/users

[racket] Typed racket and apply

2014-06-27 Thread Manfred Lotz
I have this: (define (exit-with-error-msg . e) (apply eprintf e) (exit 1)) When using it with typed racket I get: test.rkt:127:4: Type Checker: Bad arguments to function in apply: Domain: String Any * Arguments: (Listof Any) * in: (apply eprintf e) context...: /home/manfred/rac

[racket] Python creep

2014-06-27 Thread Prabhakar Ragde
On 2014-06-26, 1:29 AM, users-requ...@racket-lang.org wrote: I heard Cornell and Harvard use OCaml, of all things. . . . Cornell appears to use Python and MATLAB in their first courses; I don't see OCaml until third year. Harvard uses OCaml in a second course; C, PHP, Javascript in a first.

Re: [racket] Python creep

2014-06-27 Thread Hendrik Boom
On Wed, Jun 25, 2014 at 08:49:32PM -0500, Lawrence Bottorff wrote: > I see a huge differential between the high quality of Racket and the fact > that its popularity is low. Then again, perhaps Racket is where Python was > ten years ago, i.e., more than ready for prime-time, "batteries included," >

[racket] [CfPart] International Lisp Conference 2014, August 15-17, Montreal

2014-06-27 Thread Didier Verna
ILC 2014 - International Lisp Conference "Lisp on the Move" August 15-17 2014, Université de Montréal, Montréal, Canada Sponsored by the Association of Lisp Users In cooperation with: ACM SIGPLAN h