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

2012-02-23 Thread Gustavo Massaccesi
Thanks for the answer. I prefer to use the standard plt-web-server executable, because I'm working in a small internal project for a few hundreds users. I solved my problem using a refresh in the index.html file to redirect the users to the real page. It isn't very elegant, but it works. This mess

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

2012-02-23 Thread Sam Tobin-Hochstadt
On Thu, Feb 23, 2012 at 1:30 PM, Neil Toronto wrote: > 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) >>   ((in

Re: [racket] Simplified scut-like macro

2012-02-23 Thread Paul Pereira
Thanks Jay and Gary, I remember seeing something like this in an APL variant and it was one of the few features I didn't know how to translate into scheme. Cheers, Paul Pereira On 23 February 2012 14:36, Jay McCarthy wrote: > I think you should look at the Macro Stepper output for your failing

Re: [racket] Antw:Re: Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread Stephen Bloch
> I found out that I must load the teachpack from the collects directory, > I now have a clue how to do this. Yes, technically, but you don't need to think about that. Just use the "require" line Matthias gave you, and don't worry about "load teachpack" at all. Alternatively, you can use (requi

[racket] Antw:Re: Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
Thanks, I found out that I must load the teachpack from the collects directory,I now have a clue how to do this.Thanks for the insight.RoelofOp 23/02/12, Robby Findler schreef: Remove the teachpacks (via the menu). Then use Matthias's code (all ofit, including the first line).RobbyOn Thu, Feb 23,

Re: [racket] Simplified scut-like macro

2012-02-23 Thread Jay McCarthy
I think you should look at the Macro Stepper output for your failing example, because you'll see that the code that references y appears in the branch that doesn't have access to a y. You'd want to do something in the macro to determine which function to compile to. Jay p.s. I'm glad you like sup

Re: [racket] Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread Robby Findler
Remove the teachpacks (via the menu). Then use Matthias's code (all of it, including the first line). Robby On Thu, Feb 23, 2012 at 1:18 PM, ROELOF WOBBEN wrote: > I have added the image.ss teachpack. > I have no clue how the 2e image teachpack is named in Dr Racket 2.5.1. > > Roelof > > > Op 23

[racket] Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
I have added the image.ss teachpack. I have no clue how the 2e image teachpack is named in Dr Racket 2.5.1.RoelofOp 23/02/12, Robby Findler schreef: I think possibly Roelof has added the HtDP image teachpack, not theHtDP/2e image teachpack. :(RobbyOn Thu, Feb 23, 2012 at 12:58 PM, Matthias Fellei

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Matthias Felleisen
On Feb 23, 2012, at 2:01 PM, Kieron Hardy wrote: > Look like this will work very nicely indeed ... Thanks. > > Am I correct in thinking that 'button-colors' models a 3-element ring buffer > where 'cdr' advances the access window one element? yes. > > On Thu, Feb 23, 2012 at 10:59 AM, Matth

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Danny Yoo
The following code is bigger than the limit, but I've always thought it was cute: #lang racket ;; see: http://mail.python.org/pipermail/tutor/2001-April/004888.html (define (a n) (* 2 n (add1 (* 2 n (define (b x y) (if (<= (abs x) (abs y)) (+ (a (- y)) (abs (- y x)))

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Kieron Hardy
Look like this will work very nicely indeed ... Thanks. Am I correct in thinking that 'button-colors' models a 3-element ring buffer where 'cdr' advances the access window one element? On Thu, Feb 23, 2012 at 10:59 AM, Matthias Felleisen wrote: > > Would this work for you: > > #lang racket/gui >

Re: [racket] Antw:Re: multiple images problem

2012-02-23 Thread Robby Findler
I think possibly Roelof has added the HtDP image teachpack, not the HtDP/2e image teachpack. :( Robby On Thu, Feb 23, 2012 at 12:58 PM, Matthias Felleisen wrote: > > The code was developed in BSL. You must have forgotten to copy and paste the > require line. > > > On Feb 23, 2012, at 1:52 PM, R

Re: [racket] Antw:Re: multiple images problem

2012-02-23 Thread Matthias Felleisen
The code was developed in BSL. You must have forgotten to copy and paste the require line. On Feb 23, 2012, at 1:52 PM, ROELOF WOBBEN wrote: > > > Op 23/02/12, Matthias Felleisen schreef: >> >> Here is a high-riding American SUV, does this help? >> >> >> (require 2htdp/image) >> >> (d

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Gary Baumgartner
On Thu, Feb 23, 2012 at 12:04:50PM -0600, Robby Findler wrote: [...] > What is this thing? It seems coolly symmetric in this view: [...] http://en.wikipedia.org/wiki/Thomae%27s_function Racket Users list: http://lists.racket-lang.org/users

[racket] Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
Op 23/02/12, Matthias Felleisen schreef: Here is a high-riding American SUV, does this help? (require 2htdp/image)(define cab  (beside (rectangle 33 18 'solid 'red) (right-triangle 10 18 'solid 'red)))(define body (rectangle 100 30 'solid 'red))(define top  (above/align 'right cab body))(define

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Neil Toronto
On 02/23/2012 11:04 AM, Robby Findler wrote: > > (define (r n) >(for/fold ([s 1] [l '()]) ([i n]) > (values (/ 1 (- (* 2 (floor s)) s -1)) (cons s l > > I tweeted this to make sure it fit. I had 23 characters to spare, could > squeeze a bit of whitespace out, then use the rest to

Re: [racket] multiple images problem

2012-02-23 Thread Matthias Felleisen
Here is a high-riding American SUV, does this help? (require 2htdp/image) (define cab (beside (rectangle 33 18 'solid 'red) (right-triangle 10 18 'solid 'red))) (define body (rectangle 100 30 'solid 'red)) (define top (above/align 'right cab body)) (define tire (circle 15 'solid 'bl

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

2012-02-23 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)) Turns out this wasn't enough to solve my pr

[racket] multiple images problem

2012-02-23 Thread ROELOF WOBBEN
Hello, I try to make a car with Racket.So far I have got this : (define (rechthoek a)  (rectangle 200 50 "solid" "black"))(define (cirkel a)  (circle 20 "solid" "red"))(define (auto a) (overlay/xy (rechthoek a) -50 30 (cirkel a)))(auto 1)As far as I can see I cannot use overlay/xy to make the secon

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Robby Findler
On Thu, Feb 23, 2012 at 11:47 AM, Prabhakar Ragde wrote: > Neil Toronto wrote: > >> What's your favorite not just computable, but tweetable function? > > > (define (r n) >  (for/fold ([s 1] [l '()]) ([i n]) >    (values (/ 1 (- (* 2 (floor s)) s -1)) (cons s l > > I tweeted this to make sure i

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Matthias Felleisen
Would this work for you: #lang racket/gui (define (make-colored-bm color:str) [define bm (make-object bitmap% 200 200)] [define dc (make-object bitmap-dc% bm)] (send dc set-brush (make-object brush% color:str 'solid)) (send dc draw-rectangle 0 0 200 200) (send dc set-bitmap #f) bm)

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Prabhakar Ragde
Neil Toronto wrote: What's your favorite not just computable, but tweetable function? (define (r n) (for/fold ([s 1] [l '()]) ([i n]) (values (/ 1 (- (* 2 (floor s)) s -1)) (cons s l I tweeted this to make sure it fit. I had 23 characters to spare, could squeeze a bit of whitespace

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Matthias Felleisen
I don't think there should be a need to look at the library. You should be able to implement the idea on top of the existing library. On Feb 23, 2012, at 12:37 PM, Kieron Hardy wrote: > So take a copy of the source for a standard button% from the Racket code > itself and than hack on it to c

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Kieron Hardy
So take a copy of the source for a standard button% from the Racket code itself and than hack on it to create a class for a new type of widgit? On Tue, Feb 21, 2012 at 10:56 AM, Matthias Felleisen wrote: > > You could change the button child of the GUI and bring in a completely new > button with

Re: [racket] Changing the background color of a GUI button.

2012-02-23 Thread Kieron Hardy
I was thinking I'd eventually need more than two states, and so hadn't considered a checkbox. Happily, today's problem only requires the two states, and so a little rework has yielded what looks to be a better solution. Thanks for the suggestion. On Tue, Feb 21, 2012 at 10:53 AM, Matthew Flatt w

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

2012-02-23 Thread Matthias Felleisen
On Feb 22, 2012, at 11:12 PM, Neil Toronto wrote: > It would be fun to try to port Coq's constructive ordinals to phantom types > in TR, though, to see how far I could get with occurrence typing instead of > dependent typing. If you got far, it would validate our gut-level conjecture of 'prac

Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Matthias Felleisen
ackermann should fit, no? On Feb 23, 2012, at 12:09 AM, Neil Toronto wrote: > 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, a