Re: [racket] Simplified scut-like macro

2012-02-22 Thread Gary Baumgartner
#lang racket (define-syntax (fun stx) (syntax-case stx () ((fun body rest ...) (with-syntax ((x (datum->syntax #'body 'x)) (y (datum->syntax #'body 'y)) (z (datum->syntax #'body 'z))) (let ([y? (identifier-binding #'y)] [z? (iden

[racket] Challenge: in 140 chars or less

2012-02-22 Thread Neil Toronto
Inspired by the Game of Life tweet challenge (that was seriously cool, for a geeky definition of "cool"), I compressed a program that calculates pi to arbitrary precision. By my count, this is 132 characters, after removing comments and extra whitespace: ;; Computes a converging approximation

Re: [racket] TR: Making recursive types as subtypes of non-recursive types

2012-02-22 Thread Neil Toronto
On 02/22/2012 05:35 PM, Sam Tobin-Hochstadt wrote: You're very close -- you just need to give inference a little more help. This definition works: (: card* (All (a) ((Set* a) -> Hereditary-Set))) (define (card* A) ((inst card (U a (Set* a))) A)) Ah, excellent. Thanks! My brain was injur

Re: [racket] TR: Making recursive types as subtypes of non-recursive types

2012-02-22 Thread Neil Toronto
It's probably not what you think. :) Jay and I just submitted a paper to FLOPS (conditionally accepted) that defines an untyped lambda calculus, lambda-ZFC, that contains a model of set theory and primitive set operations. The basic idea is to "port" constructions from contemporary math into l

[racket] Simplified scut-like macro

2012-02-22 Thread Paul Pereira
I am new to macro writing and am trying to do the following: (fun body ...) => (lambda (x) body ...) or (lambda (x y) body ...) or (lambda (x y z) body ...) where x, y, z are taken from the scope of body. Right now, I am just trying to use case-lambda to switch between these. I guess I am tryin

Re: [racket] TR: Making recursive types as subtypes of non-recursive types

2012-02-22 Thread Matthias Felleisen
So are you going to reconstruct all of set theory in TR, including ordinals up to epsilon0 and cardinals below aleph-something? On Feb 22, 2012, at 7:35 PM, Sam Tobin-Hochstadt wrote: > You're very close -- you just need to give inference a little more > help. This definition works: > > (:

Re: [racket] TR: Making recursive types as subtypes of non-recursive types

2012-02-22 Thread Sam Tobin-Hochstadt
You're very close -- you just need to give inference a little more help. This definition works: (: card* (All (a) ((Set* a) -> Hereditary-Set))) (define (card* A) ((inst card (U a (Set* a))) A)) My brain was injured thinking about those types, though. :) On Wed, Feb 22, 2012 at 7:11 PM, Neil

[racket] TR: Making recursive types as subtypes of non-recursive types

2012-02-22 Thread Neil Toronto
I'd like to use the same functions to operate on both "flat" container types and arbitrarily nested container types. More precisely, I want a type for `Set*' that allows this program otherwise unchanged: #lang typed/racket (struct: Empty-Set ()) (struct: (a) Opaque-Set ([error-thunk : (-> a)]

Re: [racket] TR disappearing types?

2012-02-22 Thread Neil Toronto
On 02/22/2012 03:34 PM, Sam Tobin-Hochstadt wrote: On Wed, Feb 22, 2012 at 3:51 PM, Neil Toronto wrote: The following program types without trouble: #lang typed/racket (struct: (a) Foo ()) (: make-foo (All (a) (a -> (Foo a (define (make-foo x) (Foo)) (ann (make-foo 1) : (Foo String)

Re: [racket] TR disappearing types?

2012-02-22 Thread Sam Tobin-Hochstadt
On Wed, Feb 22, 2012 at 3:51 PM, Neil Toronto wrote: > The following program types without trouble: > > > #lang typed/racket > > (struct: (a) Foo ()) > > (: make-foo (All (a) (a -> (Foo a > (define (make-foo x) >  (Foo)) > > (ann (make-foo 1) : (Foo String)) > > It doesn't seem like it should,

[racket] TR disappearing types?

2012-02-22 Thread Neil Toronto
The following program types without trouble: #lang typed/racket (struct: (a) Foo ()) (: make-foo (All (a) (a -> (Foo a (define (make-foo x) (Foo)) (ann (make-foo 1) : (Foo String)) It doesn't seem like it should, though. If this is the right behavior, is there a way to get a `Foo' pa

Re: [racket] Problem with default-indices files in Web-Server

2012-02-22 Thread Jay McCarthy
Indexes are used by the file server to turn a directory request into a file request if the file exists. What you want is some default behavior if there is no other handler for a request, you could do that with a lift [1] dispatcher where the procedure was just (lambda (req) (redirect-to "/index.rk

Re: [racket] streams, recursion and running out of memory

2012-02-22 Thread Joe Gilray
Thanks Rodolfo, I did some further experiments which confirm your results. I noticed that results vary quite a bit run to run so I ran several times from clean and took the median: prime-pi/acc 400 with original make-coroutine: cpu time: 2808 real time: 2879 gc time: 1000 prime-pi/acc 40

[racket] How do I make TR refinements work?

2012-02-22 Thread Neil Toronto
When I run this code: #lang typed/racket (: ten? (Integer -> Boolean)) (define (ten? x) (= x 10)) (declare-refinement ten?) (define-type Ten (Refinement ten?)) I get this error: Type Checker: cannot declare refinement for non-predicate Nothing in: (Refinement ten?) But the test in "ref

Re: [racket] exercise problem

2012-02-22 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Roelof, On 22-02-12 12:49, Roelof Wobben wrote: > I found a working solution but I wonder if there is a better way > to achieve the answer in the Beginning Student modus. Allow me to propose an alternative solution and perform some constructive cr

Re: [racket] streams, recursion and running out of memory

2012-02-22 Thread Rodolfo Carvalho
Hello Joe, 2012/2/22 Joe Gilray > Hi Matthew, > > Thanks for your help. I really can't even pretend to understand the > make-coroutine code but this is what I'm seeing: > > Original make-coroutine, without stream-ref pre-call => out of memory > (1GB) when running (prime-pi 50) > I tried

Re: [racket] exercise problem

2012-02-22 Thread Roelof Wobben
Op 22-2-2012 9:58, Roelof Wobben schreef: Thanks, I have now a answer to my question. I will debug my programm with check-expect and wil take a look at the second edition. Roelof Op 21-2-2012 22:40, Stephen Bloch schreef: On Feb 21, 2012, at 3:18 PM, Roelof Wobben wrote: Op 21-2-2012 2

Re: [racket] sad user face?

2012-02-22 Thread Norman Gray
Neil and all, hello. On 2012 Feb 21, at 21:59, Neil Van Dyke wrote: > Neil Van Dyke wrote at Sun, 19 Feb 2012 05:40:56 -0500 (EST): >> Even Brown U. and the few Seven Sisters that I checked seem to use >> "freshmen" in current official communications. (Not a lot of >> "freshwomyn" in Google.)