Re: [racket-users] Polymorphic functions on Typed Racket classes

2017-07-18 Thread Sourav Datta
On Tuesday, July 18, 2017 at 7:41:05 PM UTC+5:30, Matthias Felleisen wrote: > In essence, TR’s local inference algorithm cannot determine the type of the > sequence you created. It is one of those cases where you need to help along > the type checker with the equivalent of an explicit type

Re: [racket-users] Unable to create account on pkgd.racket-lang.org

2017-07-18 Thread Danny Yoo
Ah, I forgot to mention that I'm trying to add an account as "d...@hashcollision.org", just to clarify. -- 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] Unable to create account on pkgd.racket-lang.org

2017-07-18 Thread Danny Yoo
Hi everyone, I'm trying to get an account on pkgd.racket-lang.org so I can send a few updates, but I'm not getting email confirmations from the server. I've checked my spam folder, and I don't think I'm filtering them out there. The URL I'm seeing is:

Re: [racket-users] Getting the phases right on recursive macros/using ... at runtime in syntax-case

2017-07-18 Thread Ben Greenman
3 hints: - `type-check` can call any helper functions defined with `define-for-syntax` - Turnstile uses `local-expand` to expand any macros in subterms (in your case, any macros in `x` and `y`) - start using `syntax-parse` :) On Tue, Jul 18, 2017 at 6:11 PM, Matthias Felleisen

Re: [racket-users] Getting the phases right on recursive macros/using ... at runtime in syntax-case

2017-07-18 Thread Matthias Felleisen
Take a look at the Turnstile package, its documentation, and the paper that comes with it (http://www.ccs.neu.edu/racket/pubs/#popl17-ckg). > On Jul 18, 2017, at 5:37 PM, Sam Waxman wrote: > > Hello, > > Suppose I'd like a type-checking macro that looks something like

Re: [racket-users] Catching duplicate identifiers.

2017-07-18 Thread Matthias Felleisen
Why don’t you intercept the exception in the error handler and rewrite the error message? Racket already disallows duplicate names in the same scope, which seems to be what you want, except that you don’t like the way the errors are reported. > On Jul 18, 2017, at 5:47 PM, Sam Waxman

Re: [racket-users] Catching duplicate identifiers.

2017-07-18 Thread Sam Waxman
Thanks both for your replies, but it doesn't look like either of these will do exactly what I want. While the code keeping track of id's that you wrote comes close, it doesn't allow for shadowing. I still want racket to do everything that it used to do, so the program (define a 3) (let ()

[racket-users] Getting the phases right on recursive macros/using ... at runtime in syntax-case

2017-07-18 Thread Sam Waxman
Hello, Suppose I'd like a type-checking macro that looks something like this: (define-syntax (type-check stx) (syntax-case stx () [(_ (+ x y)) (if (and (number? (type-check #'x)) (number? (type-check #'y))) #'Number #'(error "bad

[racket-users] Call for Participation: ICFP 2017

2017-07-18 Thread 'Lindsey Kuper' via users-redirect
[ Early registration ends 4 August. ] = Call for Participation ICFP 2017 22nd ACM SIGPLAN International Conference on Functional Programming and affiliated events September 3 - September 9, 2017 Oxford, UK

Re: [racket-users] Catching duplicate identifiers.

2017-07-18 Thread Jens Axel Søgaard
#lang racket (require (for-syntax syntax/parse syntax/id-set)) (begin-for-syntax (define defined-ids (mutable-free-id-set)) (define (already-defined? x) (free-id-set-member? defined-ids x)) (define (define-it! x) (free-id-set-add!defined-ids x))) (define-syntax (def

Re: [racket-users] Catching duplicate identifiers.

2017-07-18 Thread Matthias Felleisen
#lang racket (define my-favorite-numbers '(1 2 3)) (define (duplicate-exists? n) (member n my-favorite-numbers)) (duplicate-exists? 3) (duplicate-exists? 4) > On Jul 17, 2017, at 3:43 AM, Sam Waxman wrote: > > Hello, > > In the regular #racket, the following

Re: [racket-users] Example of file i/o?

2017-07-18 Thread Leith
Very good, thank you! On Tuesday, July 18, 2017 at 11:54:14 AM UTC-5, Ben Greenman wrote: > (with-input-from-file "file.txt" >   (lambda () >     (for ((line (in-lines))) >       ))) > > > On Tue, Jul 18, 2017 at 12:46 PM, Leith wrote: > Basic question, but I can't seem

Re: [racket-users] Example of file i/o?

2017-07-18 Thread Ben Greenman
(with-input-from-file "file.txt" (lambda () (for ((line (in-lines))) ))) On Tue, Jul 18, 2017 at 12:46 PM, Leith wrote: > Basic question, but I can't seem to find a good answer. What is an > example of "idiomatic" file I/O using racket? Like, for example,

[racket-users] Example of file i/o?

2017-07-18 Thread Leith
Basic question, but I can't seem to find a good answer. What is an example of "idiomatic" file I/O using racket? Like, for example, open a file for reading and do something with every line in the file? The example here: https://docs.racket-lang.org/guide/io-patterns.html says "If you want

[racket-users] Racket v6.9.0.900 is available for testing

2017-07-18 Thread Vincent St-Amour
Version 6.9.0.900 is now available for testing from http://pre-release.racket-lang.org/ (Note that this is not available from the usual download site.) If all goes well, we will turn this version into a v6.10 release within a couple of weeks. This release includes a overhaul of Racket's IO

Re: [racket-users] Polymorphic functions on Typed Racket classes

2017-07-18 Thread Matthias Felleisen
In essence, TR’s local inference algorithm cannot determine the type of the sequence you created. It is one of those cases where you need to help along the type checker with the equivalent of an explicit type application: ((inst seq-first Integer) s1) ((inst seq-rest Integer) s1) I have

[racket-users] Polymorphic functions on Typed Racket classes

2017-07-18 Thread Sourav Datta
Hi! I am encountering a type checker error for the following program but not sure exactly what is wrong with it. The program is as follows: #lang typed/racket (define-type (Seq a) (Object [first (-> a)] [rest (-> (Seq a))])) (: seq-first (All