Re: [racket] static variables question

2012-02-19 Thread Joe Gilray
Hi Rodolfo, Thanks for the suggestion. I ended up reading quite a bit about generators and found this very appropriate and interesting page: http://matthias.benkard.de/journal/116. -Joe On Sun, Feb 19, 2012 at 7:05 PM, Rodolfo Carvalho wrote: > On Mon, Feb 20, 2012 at 00:55, Joe Gilray wrote:

Re: [racket] Challenge: Game of life in 140 chars

2012-02-19 Thread SF
> Here's a 136-character version (after unnecessary spaces are removed): > > (define (life s) >  (let* ((a bitwise-and) >         (s (bitwise-ior (* s #x111000101000111/1000) s))) >    (a (* (a (- -1 s) (* s 4)) 3/32) >       (/ (- (expt 8 48) 1) 15 > > -- Jeremiah Willcock That doesn't wo

Re: [racket] can't run drracket in xubuntu 12.04

2012-02-19 Thread rrandom
? 2012?02?20? 00:25, Bill Markmann ??: I haven't run into that with DrRacket under xubuntu, but two things to check: - if you do a 'sudo apt-get install -s libjpeg'... what is the response? - cd into /usr/lib and do 'ls -l *.jpeg*' and see what you get; mine (under xubuntu) looks like: bill@

Re: [racket] Challenge: Game of life in 140 chars

2012-02-19 Thread David Van Horn
On 2/19/12 10:52 PM, Jeremiah Willcock wrote: Here's a 136-character version (after unnecessary spaces are removed): (define (life s) (let* ((a bitwise-and) (s (bitwise-ior (* s #x111000101000111/1000) s))) (a (* (a (- -1 s) (* s 4)) 3/32) (/ (- (expt 8 48) 1) 15

Re: [racket] Challenge: Game of life in 140 chars

2012-02-19 Thread Jeremiah Willcock
On Sun, 19 Feb 2012, Jeremiah Willcock wrote: On Sun, 19 Feb 2012, SF wrote: Here's a rough draft that has tons of room for improvement: #lang racket (define glider (string->number "#x\ 01\ 001000\ 111000\ 00\ 00\ 00\ ")) (define (life s) (define (c s n) (if (= -1 n)

Re: [racket] (Maybe) misleading error message

2012-02-19 Thread Robby Findler
On Sun, Feb 19, 2012 at 9:14 PM, Rodolfo Carvalho wrote: > On Mon, Feb 20, 2012 at 01:07, Robby Findler > wrote: >> >> In the interactions window, free variables are runtime errors not >> compile time errors (unlike empty applications). If that had been in a >> module (or in the definitions windo

Re: [racket] (Maybe) misleading error message

2012-02-19 Thread Rodolfo Carvalho
On Mon, Feb 20, 2012 at 01:07, Robby Findler wrote: > In the interactions window, free variables are runtime errors not > compile time errors (unlike empty applications). If that had been in a > module (or in the definitions window), then you would have gotten > that, I believe. > That's right.

Re: [racket] (Maybe) misleading error message

2012-02-19 Thread Robby Findler
In the interactions window, free variables are runtime errors not compile time errors (unlike empty applications). If that had been in a module (or in the definitions window), then you would have gotten that, I believe. Robby On Sun, Feb 19, 2012 at 8:52 PM, Rodolfo Carvalho wrote: > Hello, > >

Re: [racket] static variables question

2012-02-19 Thread Rodolfo Carvalho
On Mon, Feb 20, 2012 at 00:55, Joe Gilray wrote: > Hi Rodolfo, > > Thanks for the suggestions. Your re-factoring (no pun intended) of the > conds really cleaned things up. Much appreciated. > > About the unnecessary loops, good point, I simply changed to starting with > end set to 10 instead of

Re: [racket] static variables question

2012-02-19 Thread Joe Gilray
Hi Rodolfo, Thanks for the suggestions. Your re-factoring (no pun intended) of the conds really cleaned things up. Much appreciated. About the unnecessary loops, good point, I simply changed to starting with end set to 10 instead of 1000 and I think that helps a lot. I know that there are othe

[racket] (Maybe) misleading error message

2012-02-19 Thread Rodolfo Carvalho
Hello, I ran "(define my-generator (generator () (yield 1) (yield 2 3 4)))" on DrRacket's Interactions Window, but forgot to require racket/generator first. The error message was: #%app: missing procedure expression; probably originally (), which is an illegal empty application in: (#%app) Whic

Re: [racket] Style mistakes (was: static variables question)

2012-02-19 Thread Gary Baumgartner
On Sun, Feb 19, 2012 at 09:10:57PM -0500, Eli Barzilay wrote: [...] > Speaking about such transformations and about things like (if E #t #f), > I have some code which I run against student submissions to find style > problems like these, and using syntax transformations means that it's > easy to ma

Re: [racket] Style mistakes (was: static variables question)

2012-02-19 Thread Joe Gilray
I love it! Ron Paul Middle school, 2024, Ms. Anderson's 5th grade: "But Teacher, when I ran 'StyleNazi' like you told us to, it just came back with: 'here's a phone card, call your mother...' " -Joe On Sun, Feb 19, 2012 at 6:10 PM, Eli Barzilay wrote: > 20 minutes ago, Rodolfo Carvalho wro

[racket] Style mistakes (was: static variables question)

2012-02-19 Thread Eli Barzilay
20 minutes ago, Rodolfo Carvalho wrote: > It is possible to replace a pattern like this: > > (cond >    [..a..] >    [else (cond >    [..b..] >    ...)]) > > With this simpler: > > (cond >    [..a..] >    [..b..] >     ...) Speaking about such transformations and about t

Re: [racket] static variables question

2012-02-19 Thread Rodolfo Carvalho
Hello Joe, I'd like to make a few suggestions also. ~ 1 I repeat what Neil V. said: Formatting-wise, you might consider generally putting newlines between each > of the three parts of an "if" form. It's easier to distinguish the parts > at a

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Robby Findler
On Sun, Feb 19, 2012 at 7:10 PM, Neil Toronto wrote: > On 02/19/2012 06:05 AM, Robby Findler wrote: >> >> On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner >>  wrote: >>> >>> On a more productive note: in Racket code I define and use 'implies' a >>> lot, >>>  often conjoined, for predicates. It's

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Neil Toronto
On 02/19/2012 06:05 AM, Robby Findler wrote: On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner wrote: On a more productive note: in Racket code I define and use 'implies' a lot, often conjoined, for predicates. It's mainly of declarative value, which is perhaps why it's uncommon in impleme

Re: [racket] Boolean expressions

2012-02-19 Thread Hendrik Boom
On Sun, Feb 19, 2012 at 03:17:49PM -0600, Robby Findler wrote: > > If it helps, the usual English construction is "neither A nor B", so > maybe that's a good memory clue. That's what I needed! I don't think I'll ever forget now. -- hendrik Racket Users list: http://list

Re: [racket] static variables question

2012-02-19 Thread Joe Gilray
Thanks Gary (and Neil and Robby) Very enlightening. I didn't know about "when". Of course what you said about "set!" and "cond" makes perfect sense. Minor mods to your code (using your set! elimination idea twice and caching (integer-sqrt x)) gives the code below. I noticed that I can also rem

Re: [racket] Computer Language Benchmark Game

2012-02-19 Thread Isaac Gouy
> From: Robby Findler > Sent: Sunday, February 19, 2012 1:32 PM > Subject: Re: [racket] Computer Language Benchmark Game > > Hi guys: this doesn't seem to be a very Racket-specific discussion. Do > you mind taking it elsewhere? (Feel free to point us to where you go > if you'd like, just in case

Re: [racket] Computer Language Benchmark Game

2012-02-19 Thread Robby Findler
Hi guys: this doesn't seem to be a very Racket-specific discussion. Do you mind taking it elsewhere? (Feel free to point us to where you go if you'd like, just in case others want to join in there.) Thanks, Robby On Sun, Feb 19, 2012 at 1:35 PM, Isaac Gouy wrote: >> From: Eli Barzilay > >> Sen

Re: [racket] static variables question

2012-02-19 Thread Robby Findler
The compiler does not track if a function always returns the same results to the same inputs, and even if it did, it would have to figure out where to save the results to reuse them the next time, something that is tricky to do in the general case. Anyways, doing this kind of optimization is not so

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Robby Findler
On Sun, Feb 19, 2012 at 1:03 PM, Hendrik Boom wrote: > On Sun, Feb 19, 2012 at 07:05:37AM -0600, Robby Findler wrote: >> On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner >> wrote: >> > On a more productive note: in Racket code I define and use 'implies' a lot, >> >  often conjoined, for predic

Re: [racket] static variables question

2012-02-19 Thread Gary Baumgartner
Applying a lot of what Neil said: ; function to create a list of prime factors of a number ; invoke as (factor n) (define (factor n) (let loop-factors ([facts '()] [x n] [start 2] [end 1000] [candidate-primes (primes-from-to 2 1000)]) (cond [(and (empty? cand

Re: [racket] Boolean expressions

2012-02-19 Thread Gary Baumgartner
On Sun, Feb 19, 2012 at 02:03:51PM -0500, Hendrik Boom wrote: > On Sun, Feb 19, 2012 at 07:05:37AM -0600, Robby Findler wrote: > > On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner > > wrote: > > > On a more productive note: in Racket code I define and use 'implies' a > > > lot, > > >  often co

Re: [racket] Challenge: Game of life in 140 chars

2012-02-19 Thread Jeremiah Willcock
On Sun, 19 Feb 2012, SF wrote: Here's a rough draft that has tons of room for improvement: #lang racket (define glider (string->number "#x\ 01\ 001000\ 111000\ 00\ 00\ 00\ ")) (define (life s) (define (c s n) (if (= -1 n) 0 (+ (if (bitwise-bit-set? 3080 (ari

Re: [racket] sad user face?

2012-02-19 Thread J. Ian Johnson
Sure it's not the whole reason, but it's one more message that says, "your kind does not belong." Cookbooks don't really fit, since there are so many written by both men and women, whereas more technical fields have a hard time getting female representation. -Ian - Original Message - F

Re: [racket] Computer Language Benchmark Game

2012-02-19 Thread Isaac Gouy
> From: Eli Barzilay > Sent: Sat, 18 Feb 2012 19:30:58 -0800 -snip- > To explain some of the background, Issac is the person who is running > the shootout at the moment. We have had private email conversations > on this topics before, and I let my frustration from that context show > through in a

Re: [racket] Computer Language Benchmark Game

2012-02-19 Thread Isaac Gouy
> From: Eli Barzilay > Sent: Friday, February 17, 2012 8:11 PM > Subject: Re: [racket] Computer Language Benchmark Game -snip- > When submissions are dropped because of a vague "it's too fast", > that's a bias.  For sake of argument, I'll not even bother asking you to show where anyone wrote

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Rodolfo Carvalho
On Sun, Feb 19, 2012 at 17:03, Hendrik Boom wrote: > > The trouble is, I can never remember which of 'nand' and 'nor' is > which. Either of them could mean 'neither'. But I do know what > 'neither' means. > > Think of them as composed boolean functions: - nand is "not and" - nor is "not or" `a

Re: [racket] sad user face?

2012-02-19 Thread Grant Rettke
On Sun, Feb 19, 2012 at 9:29 AM, J. Ian Johnson wrote: > Er you may think that's funny, but that kind of gender insentivity is > what this thread is trying to avoid. The implied > amount of work to introduce a new character so that the book is gender > neutral makes (non-half-assed/unintenti

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Hendrik Boom
On Sun, Feb 19, 2012 at 07:05:37AM -0600, Robby Findler wrote: > On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner > wrote: > > On a more productive note: in Racket code I define and use 'implies' a lot, > >  often conjoined, for predicates. It's mainly of declarative value, which is > >  perhap

Re: [racket] for/vector bug in typed racket

2012-02-19 Thread Sam Tobin-Hochstadt
On Sun, Feb 19, 2012 at 1:13 PM, SF wrote: > > ; this doesn't > (for/vector: : (Vectorof Integer) >  ([i 5]) >  i) Unfortunately, Typed Racket does not yet do enough inference to figure out uses of `for/vector' in all cases, so you will probably need to write the loop explicitly here. -- sam th

Re: [racket] static variables question

2012-02-19 Thread Neil Van Dyke
Joe Gilray wrote at 02/19/2012 12:52 PM: You are doing "(integer-sqrt x)" a few times, when "x" can't change in between. You might want to have the code look like "(integer-sqrt x)" is computed only once in the block of code in which "x" can't change. Just good practice, IMHO;

[racket] for/vector bug in typed racket

2012-02-19 Thread SF
#lang typed/racket ; this works (for/list: : (Listof Integer) ([i 5]) i) ; this doesn't (for/vector: : (Vectorof Integer) ([i 5]) i) error: Type Checker: Error in macro expansion -- insufficient type information to typecheck. please add more type annotations in: (for/vector: : (Vectorof

Re: [racket] static variables question

2012-02-19 Thread Joe Gilray
Hi Neil, thanks for the input. My responses inline below: On Sun, Feb 19, 2012 at 2:02 AM, Neil Van Dyke wrote: > Some random feedback, from a quick glance at the code (I didn't work > through the algorithm)... > > Do you mean to do "[candidate-primes (primes-from-to 2 1000)]" each time > that

Re: [racket] Space safety in lazy

2012-02-19 Thread Rodolfo Carvalho
Thanks, Matthew. On Sun, Feb 19, 2012 at 11:50, Matthew Flatt wrote: > Oops --- I should have tried that program more carefully. > > The problem seems to be with `or'. If I change to `if', then the > example runs as intended: > > (define (has-negative? l) > (if (negative? (car l)) > #t

Re: [racket] can't run drracket in xubuntu 12.04

2012-02-19 Thread Bill Markmann
I haven't run into that with DrRacket under xubuntu, but two things to check: - if you do a 'sudo apt-get install -s libjpeg'... what is the response? - cd into /usr/lib and do 'ls -l *.jpeg*' and see what you get; mine (under xubuntu) looks like: bill@cheese:/usr/lib$ ls -l *jpeg* -rw-r--r-- 1 r

[racket] can't run drracket in xubuntu 12.04

2012-02-19 Thread rrandom
i can't run drracket in xubuntu 12.04. when i typed drracket in terminal,this message showed: rrandom@rrandom-ThinkPad-Edge:~$ drracket ffi-lib: couldn't open "libjpeg.so.62" (libjpeg.so.62: cannot open shared object file: No such file or directory) === context === /usr/share/racket/collects/rack

[racket] POPL'13: Call for proposals for co-located events

2012-02-19 Thread David Van Horn
*** POPL'13: Call for proposals for co-located events *** Event dates: 20 -- 22, 26 January 2013 Location: Rome, Italy Deadline: 22 April 2012 Notification: 30 May 2012 Proposals are invited for workshops and other events to be co-located with POPL2013. Events can either be sponsore

Re: [racket] sad user face?

2012-02-19 Thread J. Ian Johnson
- Original Message - From: Neil Van Dyke To: Racket mailing list Sent: Sun, 19 Feb 2012 05:40:56 -0500 (EST) Subject: Re: [racket] sad user face? John Clements wrote at 02/18/2012 08:48 PM: > On Feb 18, 2012, at 5:43 PM, Luke Vilnis wrote: > >> To weigh in on this - when I was an un

Re: [racket] Space safety in lazy

2012-02-19 Thread Matthew Flatt
Oops --- I should have tried that program more carefully. The problem seems to be with `or'. If I change to `if', then the example runs as intended: (define (has-negative? l) (if (negative? (car l)) #t (has-negative? (rest l The `or' from `lazy' effectively adds a `!' aroun

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Robby Findler
On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner wrote: > On a more productive note: in Racket code I define and use 'implies' a lot, >  often conjoined, for predicates. It's mainly of declarative value, which is >  perhaps why it's uncommon in implementation despite how common it is in >  speci

Re: [racket] Racket consultants

2012-02-19 Thread Neil Van Dyke
I've heard privately from several people, and will be getting back to each of them individually. It seems there's a good amount of interest in Racket consulting. I'll see what information I can distill for this email list without spilling anyone's beans. -- http://www.neilvandyke.org/ __

Re: [racket] sad user face?

2012-02-19 Thread Neil Van Dyke
John Clements wrote at 02/18/2012 08:48 PM: On Feb 18, 2012, at 5:43 PM, Luke Vilnis wrote: To weigh in on this - when I was an undergrad, women routinely called themselves "freshmen." I think this is becoming less common. Even Brown U. and the few Seven Sisters that I checked

Re: [racket] static variables question

2012-02-19 Thread Neil Van Dyke
Some random feedback, from a quick glance at the code (I didn't work through the algorithm)... Do you mean to do "[candidate-primes (primes-from-to 2 1000)]" each time that "factor" is called? 2 and 1000 are magic numbers, and should at least be given names, for documentation purposes and so

Re: [racket] Boolean expressions [Was: static variables question]

2012-02-19 Thread Laurent
On Sun, Feb 19, 2012 at 07:30, Gary Baumgartner wrote: > On Sat, Feb 18, 2012 at 09:02:41PM -0500, Stephen Bloch wrote: > [...] > > I see a lot of my students doing this -- in whatever language -- because > they think of Booleans as a way to decide which of two things to DO, rather > than as legi

Re: [racket] static variables question

2012-02-19 Thread Joe Gilray
Here's a slight reworking of the factor function. I think it is prettier and my in the spirit of Racket/Scheme. ; function to create a list of prime factors of a number ; invoke as (factor n) (define (factor n) (let loop-factors ([facts '()] [x n] [start 2] [end 1000] [candidate-primes (primes-

Re: [racket] sad user face?

2012-02-19 Thread Stefan Schmiedl
On Sat, 18 Feb 2012 23:31:03 -0500 David Van Horn wrote: > On 2/18/12 9:23 PM, J. Ian Johnson wrote: > > More important than the word choice, the representative character of the > > book is male. Potential female readers will not see this book as for them > > because they don't identify with th

Re: [racket] Neils

2012-02-19 Thread Neil Caldwell
Oh dear... Neil Matthew Caldwell On 13 February 2012 07:47, Todd O'Bryan wrote: > Before this goes too far, I just want to let everyone know that I will > never kneel to the Neils, nor go to the mat for the Matthews. Now if > Shriram announced his candidacy for supreme dictator in the > post-apo