My own $0.02: I prefer to take the high road, assume the best, and
ROFL (literally).
On Sun, Apr 29, 2012 at 5:35 PM, Neil Van Dyke wrote:
> Matthias Felleisen wrote at 04/29/2012 05:50 PM:
>
>> Are you saying that this was NOT an April fool's joke? Argh.
>>
>
>
> With Microsoft, I can't always t
Matthias Felleisen wrote at 04/29/2012 05:50 PM:
Are you saying that this was NOT an April fool's joke? Argh.
With Microsoft, I can't always tell. With this MS thing recognizing
dubious achievements, and posting those honors on one's Facebook and
such, it could be some fun/lame thing, or
Are you saying that this was NOT an April fool's joke? Argh.
On Apr 29, 2012, at 4:13 PM, Neil Van Dyke wrote:
> Matthias Felleisen wrote at 04/29/2012 12:43 PM:
>> Gamifying a PL for real -- as opposed to the April fool's joke about VS that
>> wear going around -- would indeed be a fun and in
Matthias Felleisen wrote at 04/29/2012 12:43 PM:
Gamifying a PL for real -- as opposed to the April fool's joke about VS that
wear going around -- would indeed be a fun and interesting project -- Matthias
Google found this:
http://www.gamasutra.com/view/news/39717/Microsoft_gamifies_Visua
On Apr 28, 2012, at 5:11 PM, Neil Van Dyke wrote:
> Some student should try making a video-game-like leveling and unlocking
> system for DrRacket. This would be for people who are learning Racket
> without working through HtDP: they have a big language and don't know which
> features are best
Wow, thanks for all the creative solutions! After many years of
programming, I'm still so floored by what a creative and artistic endeavor
it is... and like all artistic endeavors, over time one develops a certain
taste and style. Certain solutions really appeal over others.
Thanks again, learni
;and without having to discard first two elements->
(build-list 21 (compose (λ (x) (/ (* x
(+ x 1))
2))
add1))
Racket Users list:
http://lists.racket-lang.org/users
(build-list 22 (λ (x) (/ (* x
(- x 1))
2)))
Discard the first two values from the list.
R./
Zack
Racket Users list:
http://lists.racket-lang.org/users
> From: Joe Gilray
> To: Racket mailing list
> Subject: [racket] idiomatic and fast
>
> I'm trying to come up with the most idiomatic way to generate triangle
> numbers that is also fast:
>
> (for/list ([i (in-range 2 22)]) (for/sum ([j (in-range i)]) j))
>
Here's a solution based on for/fold that hasn't been suggested
yet. Runs in O(n) time.
(let-values ([(results last-sum)
(for/fold ([sofar '()]
[value 1])
([i (in-range 2 22)])
(values (cons value sofar)
On 28/04/12 22:54, Joe Gilray wrote:
>
> (for/list ([i (in-range 2 22)]) (for/sum ([j (in-range i)]) j))
>
> works but is slow because it regenerates the sums each time
>
> (define s 0) (for/list ([i (in-range 1 21)]) (set! s (+ s i)) s)
>
> is fast, but ugly.
>
> How do I keep the sum in an idioma
I don't know if I could ever be a resource on "most idiomatic",
especially since I basically never use any of the for/et ceteras but
this feels reminiscent of "The Little Schemer" to me (except for the
internal define instead of letrec):
(define (make-triangles to-n)
(define (next-triangle last-
My opinion is to start by *not* using "for"-something forms. I'd
suggest starting with named-"let" or recursive named procedures, and
going from there. I think you'll find yourself wanting "set!" less once
you kick "for"-something to the curb.
I think that "for"-something forms are for peopl
cket mailing list"
Sent: Saturday, April 28, 2012 3:54:31 PM GMT -05:00 US/Canada Eastern
Subject: [racket] idiomatic and fast
Hi,
I'm trying to come up with the most idiomatic way to generate triangle numbers
that is also fast:
(for/list ([i (in-range 2 22)]) (for/sum ([j (in-ra
Hi,
I'm trying to come up with the most idiomatic way to generate triangle
numbers that is also fast:
(for/list ([i (in-range 2 22)]) (for/sum ([j (in-range i)]) j))
works but is slow because it regenerates the sums each time
(define s 0) (for/list ([i (in-range 1 21)]) (set! s (+ s i)) s)
is
15 matches
Mail list logo