Re: [racket] Macro + function automation

2013-07-10 Thread Carl Eastlund
On Thu, Jul 11, 2013 at 1:49 AM, Roman Klochkov wrote: > Thank you. You answer is very useful. > > > > You have to be careful about duplicating inputs in expanded code. > > I thought, that hygiene implies not only cl:gensym, but also once-only. Is > there something like > http://common-lisp.net/p

Re: [racket] Macro + function automation

2013-07-10 Thread Roman Klochkov
Thank you. You answer is very useful. > You have to be careful about duplicating inputs in expanded code. I thought, that hygiene implies not only cl:gensym, but also once-only. Is there something like  http://common-lisp.net/project/cl-utilities/doc/once-only.html  in Racket? > A lot of the

Re: [racket] define-generics #:defaults

2013-07-10 Thread Bert De Ketelaere
Vincent, Carl, I stumbled on another workaround, defining the specific methods outside of define-generics, and then rebinding them withing #:defaults. Anyway, it was only for a small exercise. Thanks for the quick reply, Bert From: c...@ccs.neu.edu Date: Wed, 10 Jul 2013 13:32:50 -0400 Subject

Re: [racket] Macro + function automation

2013-07-10 Thread Carl Eastlund
Roman, Bear in mind that by expanding (square x) to (square x x), that means if someone writes (square (perform-expensive-computation)) then you will expand it to: (* (perform-expensive-computation) (perform-expensive-computation)) You have to be careful about duplicating inputs in expande

[racket] Macro + function automation

2013-07-10 Thread Roman Klochkov
I like to make syntax-optimized functions. (define-syntax (square stx)   (syntax-case stx (square expt)     [(square (square expr)) #'(expt expr 4)]     [(square (expt expr n)) (if (number? (syntax-e #'n))                                                  #`(expt expr #,(* (syntax-e #'n) 2))    

Re: [racket] Aging code

2013-07-10 Thread Hendrik Boom
On Wed, Jul 10, 2013 at 10:14:31PM -0400, Sean McBeth wrote: > Hey! Thanks for the story! Yeah, here I'm complaining about unstylish code > over 15 years, you've got a completely different problem! Very interesting. > > In a way, it fits one of my categories. I'm sure there was a motivation for >

Re: [racket] Aging code

2013-07-10 Thread Asumu Takikawa
On 2013-07-10 18:03:07 -0400, Sean McBeth wrote: > -- Embrace more of the Unix philosophy of small programs doing one thing > well. You cannot deny that programs like ls, cd, mkdir, grep, etc. have > lasted a very, very long time and have no need for being changed (beyond > the occasional disc

Re: [racket] Wasting Time?

2013-07-10 Thread Sean McBeth
make time for her. On Wed, Jul 10, 2013 at 10:32 PM, Steve Lett wrote: > How do I convince my computer-illiterate wife that I'm not wasting time on > learning to program? > > Also: Just started HtDP today and came up with this thought. "Except ye > become as a little child ye shall not enter the

[racket] Wasting Time?

2013-07-10 Thread Steve Lett
How do I convince my computer-illiterate wife that I'm not wasting time on learning to program? Also: Just started HtDP today and came up with this thought. "Except ye become as a little child ye shall not enter the kingdom of programming." Steve Racket Users list: http:/

Re: [racket] Aging code -- Algol 68

2013-07-10 Thread Sean McBeth
Hey! Thanks for the story! Yeah, here I'm complaining about unstylish code over 15 years, you've got a completely different problem! Very interesting. In a way, it fits one of my categories. I'm sure there was a motivation for writing an Algol 68 compiler, a motivation that just did not stand up t

Re: [racket] Aging code -- Algol 68

2013-07-10 Thread Hendrik Boom
How can I resist this request to talk about ancient code? Even if it seems off-topic? My own long-lived examples are a type-theoretical program verifier, and an Algol 68 compiler. In 1972 I started an Algol 68 conpiler, worked on it for a few years at the University of Alberta, decided to aba

Re: [racket] Aging code

2013-07-10 Thread Hendrik Boom
On Wed, Jul 10, 2013 at 06:03:07PM -0400, Sean McBeth wrote: > particularly suited for TDD? Let me guess -- Test-Directed Development? Test-Directed Design? -- hendrik Racket Users list: http://lists.racket-lang.org/users

[racket] Preventing get-impure-port from url-encoding the query

2013-07-10 Thread Evan Donahue
Hello, I am trying to use the racket networking libraries for a basic set of get and post requests. I need to send a url of the form: http://foo.com/?url=http://bar.com?baz=1000 (NOT form encoded) however, the standard get-impure-port procedure seems to enforce url-encoding, which ends up submitt

[racket] Aging code

2013-07-10 Thread Sean McBeth
I just spent the last several hours sifting through the folders and folders of code that have accumulated on my hard drive over the last 15 years. I do this about once a year or so, so there actually wasn't anything from as far back as 15 years because somewhere in the middle I was ashamed of how m

Re: [racket] Tests before of to define the function

2013-07-10 Thread Juan Francisco Cantero Hurtado
On 07/10/13 23:00, Matthias Felleisen wrote: #lang racket (module+ test ;; I like to specify dependencies for test submodules in a test submodule: (require rackunit)) ;; N -> N ;; double the given number (module+ test (check-equal? (double 2) 4) (check-equal? (double 2) 3)) (define (do

Re: [racket] Tests before of to define the function

2013-07-10 Thread Matthias Felleisen
On Jul 10, 2013, at 4:55 PM, Juan Francisco Cantero Hurtado wrote: > In Beginning Student mode I can to define a test before of the function: > > (check-expect (double 2) 4) > (define (double n) >(* n 2)) > > In #lang racket, the next code fails: > > (require rackunit) > (check-equal? (d

[racket] Tests before of to define the function

2013-07-10 Thread Juan Francisco Cantero Hurtado
In Beginning Student mode I can to define a test before of the function: (check-expect (double 2) 4) (define (double n) (* n 2)) In #lang racket, the next code fails: (require rackunit) (check-equal? (double 2) 4) (define (double n) (* n 2)) Is it possible to write the tests before of

Re: [racket] define-generics #:defaults

2013-07-10 Thread Carl Eastlund
Bert, I've just pushed a fix to this bug, which I had written previously as part of some other work I'm doing with generics. As Vincent already pointed out, if you're using a released version of Racket and updating to the new code is problematic, you can always work around the bug with your own w

Re: [racket] define-generics #:defaults

2013-07-10 Thread Vincent St-Amour
That's a bug. I'll push a fix shortly. In the meantime, here's a workaround: instead of using #:defaults, you can define for each method `m' (and for the predicate of the generic interface), a function `m/defaults' that explicitly dispatches to the default cases, then falls back to `m'. Then, expo

Re: [racket] Why experienced programmers don’t use comments?

2013-07-10 Thread Hugh S. Myers
Might want to Google "Knuth +Literate Programming" or just "Literate Programming" His book (collection of articles as I remember) discusses the aforementioned problems and his solution... On Wed, Jul 10, 2013 at 8:04 AM, Hendrik Boom wrote: > On Wed, Jul 10, 2013 at 02:34:16PM +0800, Ben Duan wr

Re: [racket] Why experienced programmers don’t use comments?

2013-07-10 Thread Hendrik Boom
On Wed, Jul 10, 2013 at 02:34:16PM +0800, Ben Duan wrote: > Thank you all for your great insights. I've learned a lot through your > books, your documents and your discussions here. You have saved me a large > amount of time figuring out the better way for programming. That's what we're here for!

Re: [racket] Topic number 6, Newbie's Dilemma

2013-07-10 Thread Matthias Felleisen
--- > > Message: 3 > Date: Wed, 10 Jul 2013 14:34:16 +0800 > From: Ben Duan > To: users@racket-lang.org > Subject: Re: [racket] Why experienced programmers don?t use comments? > Message-ID: > > Content-Type: text/plain; charset="windows-1252" > > Th

Re: [racket] Topic number 6, Newbie's Dilemma

2013-07-10 Thread Steve Lett
ang.org > Subject: Re: [racket] Why experienced programmers don?t use comments? > Message-ID: > < > canww-jkh61e-fjpmcwvq-qhpajcgbdtxirbqfnpvm6jhkpq...@mail.gmail.com> > Content-Type: text/plain; charset="windows-1252" > > Thank you all for your great

Re: [racket] Newbie's Dilemma

2013-07-10 Thread Matthias Felleisen
What is your (level of) programming experience? On Jul 10, 2013, at 8:42 AM, Steve Lett wrote: > I recently downloaded four things. Picturing Programs, How to Design > Programs, Realm of Racket, and Intro to Systematic Program Design, from > Coursera. > > My question is, in which order sho

[racket] Newbie's Dilemma

2013-07-10 Thread Steve Lett
I recently downloaded four things. Picturing Programs, How to Design Programs, Realm of Racket, and Intro to Systematic Program Design, from Coursera. My question is, in which order should I complete these? And why? Thanks, Steve Racket Users list: http://lists.racket-lan

[racket] define-generics #:defaults

2013-07-10 Thread Bert De Ketelaere
Helo, in the documentation it is mentioned that the syntax for define-generics #:defaults is the same as for struct #:methods: http://docs.racket-lang.org/reference/struct-generics.html#%28form._%28%28lib._racket%2Fgeneric..rkt%29._define-generics%29%29 and #:methods specifies that define/generic