The Little Schemer is an excellent choice to learn recursion :)
'or' evaluates the expressions from left to right. It returns #f, if
none of its expressions returns #t. If one of its expressions returns
#t, 'or' returns the result of this expression without evaluating the
rest of the
;
#lang racket
(define/contract (add1 x y)
(integer? integer? . - . integer?)
(+ x y))
(provide (contract-out [add2 (integer? integer? . - . integer?)]))
(define (add2 x y)
(+ x y))
(module+ test
(require rackunit)
(check-exn exn:fail? (λ _ (add1 20.5 21.5)))
for sharing.
WarGrey Gyoudmon Ju juzhenli...@gmail.com writes:
On Fri, May 22, 2015 at 5:41 PM, Atticus attic...@posteo.org wrote:
Imho it would be nice if there was a small hint in the documentation
about that case, perhaps there is and I didn't see it?
Yes, there is :
http://docs.racket-lang.org
That's good to know. That means my previous conclusion is wrong
and I'm not forced to use define/contract when using test submodules.
Robby Findler ro...@eecs.northwestern.edu writes:
For that kind of situation, you should consider writing your test
submodule like this:
#lang racket
Great advice, thank you very much.
Neil Van Dyke n...@neilvandyke.org writes:
Three advantages of `test` submodules interspersed with the
implementation code:
* You're usually working on implementation and tests at the same time,
and putting them adjacent in the same file is helpful
with non-trivial
macros, including but not limited to Typed Racket.)
On Thu, May 21, 2015 at 6:25 AM, Atticus attic...@posteo.org wrote:
Hello,
What is the recommended way to add tests in racket? I was looking
through the racket documentation and there are two options for adding
tests, using
Hello,
What is the recommended way to add tests in racket? I was looking
through the racket documentation and there are two options for adding
tests, using test submodules or using a separate file for tests
(rackunit documentation). Some authors seem to prefer one over the other
for example
Do you mean the case where you update your .rkt but don't re-make, so
that the .zo is older? Racket will ignore the zo. As a result,
although you lose the startup speed-up, you don't get any confusion
from it running outdated code.
I thought that the compilded code would have fewer debugging
George Neuner gneun...@comcast.net writes:
Hi,
On 5/17/2015 5:32 PM, Atticus wrote:
---
$ racket
Welcome to Racket v6.1.1.
(eq? 'l 'l)
#f
(eq? 'l 'l)
#t
$ racket --no-jit
Welcome to Racket v6.1.1.
(eq? 'l 'l)
#f
(eq? 'l 'l)
#t
(eq? 'l 'l)
#f
(eq
as eqv?.
You should use = with numbers as far as I remember.
Il giorno 18/mag/2015, alle ore 02.41, George Neuner ha scritto:
Hi,
On 5/17/2015 5:32 PM, Atticus wrote:
---
$ racket
Welcome to Racket v6.1.1.
(eq? 'l 'l)
#f
(eq? 'l 'l)
#t
$ racket
Hello everyone,
So i am trying to learn scheme in my free time (unfortunately my
university doesn't use scheme in their undergraduate courses) and i was
comparing the equality operators in gambit and racket and encountered a
strange behaviour with the eq? operator in racket. To my surprise
11 matches
Mail list logo