Re: [racket] Cube two numbers

2012-09-14 Thread Matthias Felleisen
Indiana still does. They use it in a second-order fashion to get students going and latter they tell them that lambda is really a stand-alone value. The belief is that this helps the transition. Shriram convinced me that it was silly and he needed several years. I switched and was so happy, I

Re: [racket] structural program comparison tool in Racket

2012-09-14 Thread Neil Van Dyke
Yin Wang wrote at 09/14/2012 10:48 PM: "We are not afraid that students would try to tune their work to the similarity tester. We reckon if they can do that they can also do the exercise." Threat: industrious student makes program that accepts input of one correct program and yields N equi

Re: [racket] structural program comparison tool in Racket

2012-09-14 Thread Yin Wang
It looks fun. "We are not afraid that students would try to tune their work to the similarity tester. We reckon if they can do that they can also do the exercise." I used a tool called MOSS from Alex Aiken for detecting plagiarism in programming class, but it was not open source. I guess I need

Re: [racket] structural program comparison tool in Racket

2012-09-14 Thread Hendrik Boom
On Fri, Sep 14, 2012 at 04:34:21AM +0800, Yin Wang wrote: > Hello, > > I'm developing a tool for "diffing" program by parse trees and not > text. It is written in Racket and can process Lisp family languages, > C++, JavaScript and Python. It has a JavaScript based interactive UI > for browsing the

Re: [racket] Cube two numbers

2012-09-14 Thread Grant Rettke
On Fri, Sep 14, 2012 at 6:26 PM, Ashley Fowler wrote: > How would I make it so it will execute both numbers? >>(cube-two 3 4) Ashley play around with it in the REPL first just to see how it works eg: > (* 3 3 3) 27 > ((λ (x) (* x x x)) 3) 27 > (list 27) '(27) > (list 27 59) '(27 59) Then write

Re: [racket] Cube two numbers

2012-09-14 Thread Danny Yoo
Slight tangent: Can you please point out which curriculum you are using to learn from, as it seems weird. It's almost as if you're making things hard for yourself. Could it be that the curriculum's to blame? I've never seen an intro programming class start off with using lambda when one hasn't

Re: [racket] TR req: could 'modulo' be more optimized or specialized?

2012-09-14 Thread Vincent St-Amour
Replacing `modulo' with `fxmodulo' removes the allocation for me. Thankfully, Typed Racket can do it for you, and Optimization Coach can help you get there. OC reports that the upper bound on `i', `(* 10 44100)', can't be proven to be a fixnum. If you add an explicit check (i.e. `(assert (* 10 44

Re: [racket] TR performance bug: removing variable ref slows things down substantially?

2012-09-14 Thread John Clements
On Sep 14, 2012, at 5:04 PM, Vincent St-Amour wrote: > I can't reproduce what you describe. > > With `flvector-set!': > cpu time: 3404 real time: 3405 gc time: 0 > > Without: > cpu time: 548 real time: 546 gc time: 64 > > Are you running the two versions in the same way? I'm running out the d

Re: [racket] TR performance bug: removing variable ref slows things down substantially?

2012-09-14 Thread Vincent St-Amour
I can't reproduce what you describe. With `flvector-set!': cpu time: 3404 real time: 3405 gc time: 0 Without: cpu time: 548 real time: 546 gc time: 64 Are you running the two versions in the same way? Vincent At Fri, 14 Sep 2012 16:19:56 -0700, John Clements wrote: > > [1 ] > [1.1 ] > Okay

[racket] TR req: could 'modulo' be more optimized or specialized?

2012-09-14 Thread John Clements
NB: you may wish to read the last sentences of this e-mail before the rest: Currently, the "modulo" function seems to perform a lot of allocation. Specifically, here's a program that copies one flvector into another one: #lang typed/racket (require racket/flonum) (define f (make-flvector (* 10

Re: [racket] Cube two numbers

2012-09-14 Thread John Clements
On Sep 14, 2012, at 4:26 PM, Ashley Fowler wrote: > I have to make this code called cube-two where it takes two numbers and cubes > the both of them . > > This is what I have so far: > > (define cube-two(lambda(X Y)(list'(* X X X)(* Y Y Y)) > > but the problem is, is that it only executes Y l

[racket] Cube two numbers

2012-09-14 Thread Ashley Fowler
I have to make this code called cube-two where it takes two numbers and cubes the both of them . This is what I have so far: (define cube-two(lambda(X Y)(list'(* X X X)(* Y Y Y)) but the problem is, is that it only executes Y like the example below... > (cube-two 3 4) ((* x x x) 64) How would

[racket] TR performance bug: removing variable ref slows things down substantially?

2012-09-14 Thread John Clements
Okay, I think I have to start this e-mail with a big wow and thanks. This program runs about 4-5x faster in TR: #lang typed/racket (require racket/flonum) (define f (make-flvector (* 10 44100))) (define k (* 440.0 1/44100 2 pi)) (time (for ([j 100]) (for ([i (* 10 44100)]) (define i

Re: [racket] a few questions while reading about racket/draw libray

2012-09-14 Thread Matthew Flatt
At Fri, 14 Sep 2012 13:12:11 -0400, J G Cho wrote: > Q1. Possible syntax error? > > Code that generates Racketeers, ho! (with reflections) near the bottom > of the tutorial, goes like this: > > (define-values (tw th) > (let-values ([(tw th 1 2) > (send dc get-text-extent str the

Re: [racket] immediate problem

2012-09-14 Thread Matthew Flatt
Did you mean to use #lang slideshow without "racket" between "#lang" and "slideshow"? At Fri, 14 Sep 2012 15:27:26 -0400, Richard Fuller wrote: > #lang racket slideshow "run" > > results in > > slideshow: unbound identifier in module in: slideshow > > hence circle: unidentified

Re: [racket] immediate problem

2012-09-14 Thread Danny Yoo
On Fri, Sep 14, 2012 at 1:27 PM, Richard Fuller wrote: > #lang racket slideshow "run" > > results in > > slideshow: unbound identifier in module in: slideshow > > hence circle: unidentified Hi Richard, Oh! Make a small change to the first line. Change: #lang racket slideshow to just:

[racket] immediate problem

2012-09-14 Thread Richard Fuller
#lang racket slideshow "run" results in slideshow: unbound identifier in module in: slideshow hence circle: unidentified Racket Users list: http://lists.racket-lang.org/users

[racket] Offtopic: Clojurist Racketeers

2012-09-14 Thread Grant Rettke
Hi, If any of you are also Clojurists then may I email you off list with some questions? Best wishes, Grant -- http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE Racket Users list: http://lists.racket-lang.org/users

[racket] a few questions while reading about racket/draw libray (http://docs.racket-lang.org/draw/overview.html)

2012-09-14 Thread J G Cho
Q1. Possible syntax error? Code that generates Racketeers, ho! (with reflections) near the bottom of the tutorial, goes like this: (define-values (tw th) (let-values ([(tw th 1 2) (send dc get-text-extent str the-font)]) (values (inexact->exact (ceiling tw)) (ine

Re: [racket] Can't `yield' multiple values when `in-generator' is returned from a function?

2012-09-14 Thread Jon Rafkind
FYI this is PR 11662 On 09/14/2012 06:53 AM, Matthew Flatt wrote: > At Fri, 14 Sep 2012 08:20:22 -0400, Greg Hendershott wrote: >> tl'dr: I can `yield' multiple values when an `in-generator' sequence >> is used directly in a comprehension, but not when it is returned from >> a function. I'm stumpe

Re: [racket] Scribble->HTML: adding to head

2012-09-14 Thread Prabhakar Ragde
On 2012-09-11 8:07 PM, Matthew Flatt wrote: In the latest in the git repo, I've added `js-addition' to `scribble/html-properties'. It's like `css-addition': you can attach it to anything as a style property, and it bubbles up to the enclosing section that corresponds to the HTML page. When a `js

Re: [racket] structural program comparison tool in Racket

2012-09-14 Thread Yin Wang
Hi Eli, Thanks a lot for the thoughts! > IOW, I think that it would be nicer to have a good api for the tool, > something that takes two files (or two pieces of text) and returns the > representation of the additions/deletions and the mapping between > chunks of text that is the same. This way

Re: [racket] Can't `yield' multiple values when `in-generator' is returned from a function?

2012-09-14 Thread Greg Hendershott
> I thought I'd also tried `in-producer' without > success, but I may have made a mistake. I had difficulty with the `stop' arg to `in-producer'. It can't simply be void or void?. I looped back to try this again, and finally figured it out (although maybe the following isn't the most concise way

Re: [racket] Can't `yield' multiple values when `in-generator' is returned from a function?

2012-09-14 Thread Greg Hendershott
Thank you Matthew. I thought I'd also tried `in-producer' without success, but I may have made a mistake. Since I posted, I realized I don't need to use a generator at all, so I'm not road-blocked. Speaking of which, I'm curious what are folks' attitudes toward generators? I ask because I rarely

Re: [racket] Can't `yield' multiple values when `in-generator' is returned from a function?

2012-09-14 Thread Matthew Flatt
At Fri, 14 Sep 2012 08:20:22 -0400, Greg Hendershott wrote: > tl'dr: I can `yield' multiple values when an `in-generator' sequence > is used directly in a comprehension, but not when it is returned from > a function. I'm stumped. > > > Let's try using the `in-generator' sequence directly in a com

[racket] Can't `yield' multiple values when `in-generator' is returned from a function?

2012-09-14 Thread Greg Hendershott
tl'dr: I can `yield' multiple values when an `in-generator' sequence is used directly in a comprehension, but not when it is returned from a function. I'm stumped. Let's try using the `in-generator' sequence directly in a comprehension: ;; Yield 1 value, directly using `in-generator` (for/list (