Re: [racket-users] opinion needed on best fix for handin-server problem

2016-04-27 Thread 'John Clements' via Racket Users
> On Apr 27, 2016, at 3:01 PM, Sam Tobin-Hochstadt wrote: > > The exceptions raised by `match` are indeed not transparent. But I > don't understand why they need to be in order for the handin server to > handle them properly. (caveat: this is my reading of the code below)

Re: [racket-users] opinion needed on best fix for handin-server problem

2016-04-27 Thread Sam Tobin-Hochstadt
The exceptions raised by `match` are indeed not transparent. But I don't understand why they need to be in order for the handin server to handle them properly. Sam On Wed, Apr 27, 2016 at 5:58 PM, 'John Clements' via Racket Users wrote: > >> On Apr 22, 2016, at

Re: [racket-users] opinion needed on best fix for handin-server problem

2016-04-27 Thread 'John Clements' via Racket Users
> On Apr 22, 2016, at 1:47 PM, 'John Clements' via Racket Users > wrote: > > Currently, the handin-server runs student expressions in an ‘eval’ which > intercepts errors and re-raises them with a message that includes the failing > expression. All good. > >

Re: [racket-users] Compiler question

2016-04-27 Thread 'William J. Bowman' via Racket Users
On Wed, Apr 27, 2016 at 01:52:24PM -0600, Jerry Jackson wrote: > I'd really be interested in how the two forms look when they've both been > reduced to some canonical internal format. You can use `raco expand` the result after macro expansion, and `raco decompile` to look at the result of

Re: [racket-users] Compiler question

2016-04-27 Thread Jerry Jackson
I appreciate the responses; at this point, however, I'm trying to figure out what to do with my intuition. If those two pieces of code don't compile to the same thing, I'm not sure how I should approach code style. I tend to favor ((if x y z) foo) over (if x (y foo) (z foo)) because it avoids

Re: [racket-users] the right way to use `syntax-local-introduce`?

2016-04-27 Thread Alex Knauth
> On Apr 27, 2016, at 2:38 PM, Matthew Butterick wrote: > > For the first time, I used `syntax-local-introduce` to solve a problem. But I > don't understand whether I'm using it correctly or just relying on a spooky > side effect. (I did the read the docs, but I'm looking for

[racket-users] the right way to use `syntax-local-introduce`?

2016-04-27 Thread Matthew Butterick
For the first time, I used `syntax-local-introduce` to solve a problem. But I don't understand whether I'm using it correctly or just relying on a spooky side effect. (I did the read the docs, but I'm looking for a higher-level "why this exists and what its idiomatic use is") The problem I had

RE: [racket-users] why this error?

2016-04-27 Thread Jos Koot
In addition to my previous mail: Did you notice that allDiff? is, or at least must be, symmetrical in its two arguments? That is (allDiff? list1 list2) always must return the same answer as (allDiff? list2 list1) Jos -Original Message- From: Jos Koot [mailto:jos.k...@gmail.com] Sent:

RE: [racket-users] why this error?

2016-04-27 Thread Jos Koot
I dont get the error when running your example. Notice that your function (allDiff? '() '(1 2 3)) returns '() I suppose you want #t in this case. Why the line( if (null? (cdr list1)) ? Simpler is: (define (allDiff? list1 list2) (if (null? list1) #t (if (memq (car list1) list2) #f

Re: [racket-users] Compiler question

2016-04-27 Thread Vincent St-Amour
When you have a program that's surprisingly fast (or slow), you can use the optimization coach in DrRacket (in the "view" menu) to see what optimizations Racket applies to your code. For your program, the coach confirms Matthew's diagnosis that inlining is what makes `fib2` faster. Vincent On

Re: [racket-users] Compiler question

2016-04-27 Thread Matthew Flatt
The compiler inlines the call to `aux` in `fib2` because that call is readily apparent. It's not so apparent in the other cases that the function `aux` is always called. At Wed, 27 Apr 2016 06:42:03 -0700 (PDT), Jerry Jackson wrote: > Hello all, > > I was experimenting a bit yesterday and

[racket-users] Compiler question

2016-04-27 Thread Jerry Jackson
Hello all, I was experimenting a bit yesterday and discovered something that surprised me. Here are two fibonacci functions: (define fib1 (letrec ([aux (lambda (i n) (if (< n 2) 1 (+ (fib1 i (- n 2)) (fib1 i (- n 1)]) (let

Re: [racket-users] As clean as possible in a dirty macro

2016-04-27 Thread Alex Knauth
> On Apr 27, 2016, at 2:55 AM, Nicholas Labich wrote: > > Thanks for the feedback. Attached is the solution applied to my original > implementation (only 65loc, documented). A couple of interesting points: > > - My simplified example didn't show this, but I have to >

[racket-users] Re: As clean as possible in a dirty macro

2016-04-27 Thread Nicholas Labich
Thanks for the feedback. Attached is the solution applied to my original implementation (only 65loc, documented). A couple of interesting points: - My simplified example didn't show this, but I have to `syntax-local-introduce' the identifiers recursively, else references to symbol=?