Hi,
To teach myself Racket scheme (which I now Iove), I wrote an adapter to
the mongrel2 webserver. I just open-sourced the code on github. Once I
add unit testing and scribble documentation, I might try have it accepted
into planet racket, if anyone thinks it would be of interest.
http://git
Hi Joe,
Thanks for the tip on on values in for*/fold. That should be added to docs.
I took a stab at converting your example into something more
functional. I'm too new to Racket to claim it's idiomatic. I mostly
went in and tried to remove what I considered iterative idioms; things
like do, let
Oh, right you are. I misunderstood what was going on. Sorry for the noise.
Robby
On Tue, Apr 17, 2012 at 4:27 PM, Deren Dohoda wrote:
> It was convenient to have something that bypassed the whole gui issue. Since
> it really is a gui issue, I am not too offended that my own laziness got in
> my
It was convenient to have something that bypassed the whole gui issue.
Since it really is a gui issue, I am not too offended that my own laziness
got in my way.
That said, it seemed to me that the use of the new window was a convenience
added for just this kind of use, otherwise I would be using a
Cristian,
One more thing, since for*/fold in your code only takes one accumulator,
you don't need "values" at all. Makes the code even shorter!
-Joe
On Tue, Apr 17, 2012 at 12:54 PM, Joe Gilray wrote:
> Hi Guys.
>
> Thanks for the education on for/fold and for*/fold.
>
> Cristian, your soluti
Hi Guys.
Thanks for the education on for/fold and for*/fold.
Cristian, your solution is very elegant, thanks, but unfortunately it does
generate all the numbers so is relatively slow and won't scale too well
with a and b.
-Joe
On Tue, Apr 17, 2012 at 11:01 AM, Cristian Esquivias <
cristian.esqu
FWIW, I think we'd want somehow, in the library, to show plot windows
in a way that doesn't do any special threading/eventspace stuff, or
else the opposite confusion can happen.
How about, for this situation, having a function called 'show-plot!'
that takes a plot and puts it into a window in a se
You could give each frame in its own eventspace.
At Tue, 17 Apr 2012 11:45:20 -0600, Neil Toronto wrote:
> Would it be possible to change plot so that its windows always behave
> like this? Could I make it not require cooperation from the program that
> calls `plot-frame'?
>
> This is going to
I used Project Euler to try out new languages as well. Here was my
attempt at Problem 29 for reference.
(define (prob29 a b)
(set-count
(for*/fold
([nums (set)])
([i (in-range 2 (add1 a))]
[j (in-range 2 (add1 b))])
(values (set-add nums (expt i j))
- Cristian
On
Would it be possible to change plot so that its windows always behave
like this? Could I make it not require cooperation from the program that
calls `plot-frame'?
This is going to come up every time someone wants to pop up plot windows
in a non-GUI, interactive loop.
Neil ⊥
On 04/17/2012 10
That's extremely helpful, thank you.
Deren
On Tue, Apr 17, 2012 at 12:48 PM, Matthew Flatt wrote:
> All GUI activity like window drawing happens only in the main thread of
> an eventspace. Your program also starts out in the main thread. So,
> yes, drawing has to wait until your loop completes.
Blindly refactoring the code, I'd use `for/fold' and add a `lst'
accumulator to `loop':
(define (euler29c)
; calculate 99^2 - duplicates
(- (sqr 99)
(for/sum ([d '(2 3 5 6 7 10)])
(let loop ([lst '()] [exp 1])
(if (> (expt d exp) 100)
(- (length lst) (length
All GUI activity like window drawing happens only in the main thread of
an eventspace. Your program also starts out in the main thread. So,
yes, drawing has to wait until your loop completes.
One solution is to put your loop in a separate thread. The example
below creates a thread and passes it to
Hi,
To continue our conversation about creating idiomatic Racket code, here is
some code I wrote last night to solve projecteuler.net problem #29:
(define (euler29a)
; calculate 99^2 - duplicates
(- (sqr 99)
(for/sum ([d '(2 3 5 6 7 10)])
(let ([lst '()])
(l
I was messing around with a spline utility last night and was using
the plot-new-window? setting to get a plot. The goal was to share an
exe with a coworker who doesn't have Racket. Just a command-line app
but to get the plot to display I needed a window and this seemed
awesome. The problem is I co
Op 17-4-2012 1:31, Stephen Bloch schreef:
On Apr 16, 2012, at 5:18 PM, Neil Van Dyke wrote:
... if one is still looking for additional beginner programming exercises, I
think that one not-totally-bad option is to start picking standard algorithms
and data structures one can learn about by sea
16 matches
Mail list logo