Re: [racket] Racket style question

2012-03-18 Thread Eli Barzilay
20 minutes ago, Rodolfo Carvalho wrote: > > (define (pythagorean-triple/alt n) >   (for*/first ([a (in-range 1 n)] >                [b (in-range a n)] >                [c (in-value (- n a b))] >                #:when (right-triangle? a b c)) >     (list a b c)))  You can also use `for*/or': (d

Re: [racket] Racket style question

2012-03-18 Thread Rodolfo Carvalho
Hi Joe, On Mon, Mar 19, 2012 at 01:44, Joe Gilray wrote: > Hi, I created the following code from some scheme I found on > ProjectEuler.net (problem #9): > > (define (right-triangle? a b c) > (= (+ (* a a) (* b b)) (* c c))) > > -snip- > Thoughts? > > When I saw your code it made me think of

[racket] Racket style question

2012-03-18 Thread Joe Gilray
Hi, I created the following code from some scheme I found on ProjectEuler.net (problem #9): (define (right-triangle? a b c) (= (+ (* a a) (* b b)) (* c c))) (define (pythagorean-triple n) (let loop-a ([a 1]) (let loop-b ([b (add1 a)]) (let ([c (- n a b)]) (if (<= c b)

Re: [racket] do I understand the concept World ?

2012-03-18 Thread Matthias Felleisen
This is all wrong even though 'it works' :-) [[see my homepage]] 1. You need to agree on one set of possible worlds? What states can the world be in? What kind of data describes these states? Call this set of data WORLD. 2. Then you need to design three functions with the following signatur

Re: [racket] Partion

2012-03-18 Thread Danny Yoo
> Followup: "quickselect" is the name of this: > > http://en.wikipedia.org/wiki/Selection_algorithm#Partition-based_general_selection_algorithm Hi Jens, I've coded this algorithm up with a few minimal test cases: https://github.com/dyoo/quick-select It should do the trick, though you'll need

Re: [racket] spirit of Racket?

2012-03-18 Thread Matthias Felleisen
The improvement is not due to the nested result but the string-based palindromic? function. For the advantages of nested defines, see the draft of the Style Guide: http://www.ccs.neu.edu/home/matthias/Style/style/index.html -- Matthias On Mar 18, 2012, at 2:57 AM, Racket Noob wrote: > Wh

Re: [racket] spirit of Racket?

2012-03-18 Thread Danny Yoo
On Sunday, March 18, 2012, Racket Noob wrote: > Which leads to question: when to use nested define and when to use let? Contemporary Racket coding style prefers nested defines. See Section 4.2 of: http://www.ccs.neu.edu/home/matthias/Style/style/ Racket Users list: h

[racket] do I understand the concept World ?

2012-03-18 Thread ROELOF WOBBEN
Hello, I have this programm : ; WorldState -> WorldState; the clock ticked; decrease the gauge with 0.1; example:; given: 20, expected 19.9; given: 78, expected 77.9(define (tock ws)   (if (> ws 0) (- ws 0.1)0 )); GaugeState -> Gaugestate. ; display the gauge.(define (gauge ws)  (overlay/xy (rectan

Re: [racket] classes and objects

2012-03-18 Thread jkaczorek
On Sun, 2012-03-18 at 14:38 -0400, jkaczo...@aol.pl wrote: > Could anyone explain me how to create objects and their instances? > [...] Hello, first you have to create a class. An empty class definition might look like this: (define foo% (class object% (super-new))) Note that a

Re: [racket] classes and objects

2012-03-18 Thread Thomas Chust
On Sun, 2012-03-18 at 14:38 -0400, jkaczo...@aol.pl wrote: > Could anyone explain me how to create objects and their instances? > [...] Hello, first you have to create a class. An empty class definition might look like this: (define foo% (class object% (super-new))) Note that a clas

[racket] classes and objects

2012-03-18 Thread jkaczorek
Could anyone explain me how to create objectsand their instances? I've read of course the racket guide and reference but the examples I foundthere are (for me) completely useless: I'm not interested in how to create class hierarchies. The only thing I want toknow is how to create a class and how

Re: [racket] Getting started with Scribble

2012-03-18 Thread Hendrik Boom
On Sat, Mar 17, 2012 at 02:02:22PM -0700, Mark Engelberg wrote: > > semi-literate-programming seems an apt name. > > I don't think Javadoc would even qualify for that label though. In my > mind, "semi-literate" at least implies a focus on building a narrative > exposition of why the functions wo

Re: [racket] spirit of Racket?

2012-03-18 Thread Racket Noob
Which leads to question: when to use nested define and when to use let? > From: matth...@ccs.neu.edu > Date: Sun, 11 Mar 2012 19:14:38 -0400 > To: jgil...@gmail.com > CC: users@racket-lang.org; jus...@zamora.com > Subject: Re: [racket] spirit of Racket? > > > I believe the code below cuts your

[racket] comments on html-template changes? (and preview of web-server integration)

2012-03-18 Thread Neil Van Dyke
Please let me know if you have any comments on the non-backward-compatible changes I'm about to make to "html-template" ("http://www.neilvandyke.org/racket-html-template/";)." Most of the visible changes to the "html-template" syntax is completely changing all the "%"-something parts of the te

Re: [racket] Snips displaying pdfs

2012-03-18 Thread Jens Axel Søgaard
2012/3/17 Neil Van Dyke : > Jens Axel Søgaard wrote at 03/17/2012 09:17 AM: > >> Is it possible to display pdfs in snips without converting them to >> bitmaps? > You might be able to implement this using Poppler. >  http://en.wikipedia.org/wiki/Poppler_%28software%29 Looks like Poppler is the way

[racket] Fannkuch-redux benchmark

2012-03-18 Thread Chris
Hi all, I've implemented the 'pfannkuchen' algorithm for the fannkuch-redux benchmark on shootout.alioth.debian.org, since this is the only remaining benchmark without a Racket attempt. It seemed like a fun newbie project. I'd appreciate any optimization hints or general comments and criticism