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 expressio
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 writes:
> For that kind of situation, you should consider writing your test
> submodule like this:
>
> #lang racket
>
> (define (add1 x y)
> (inte
legant, and leave all the dirty things to scribble.
This is a really nice idea. Thanks for sharing.
WarGrey Gyoudmon Ju writes:
> On Fri, May 22, 2015 at 5:41 PM, Atticus wrote:
>
>>
>> Imho it would be nice if there was a small hint in the documentation
>> about that cas
> ;
> #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
> 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 debuggi
Great advice, thank you very much.
Neil Van Dyke 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 (without fancy IDE
>
older.
>
> (Otherwise the .rkt file must be parsed and expanded each/every time
> you run. This includes test submodules, even though they won't be run.
> In addition, expansion time can be significant with non-trivial
> macros, including but not limited to Typed Racket.)
>
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 pollen
> efficiently than eqv?, for example, as a simple pointer comparison instead
>>>> of as some more complicated operation. One reason is that it may not be
>>>> possible to compute eqv? of two numbers in constant time, whereas eq?
>>>> implemented as po
George Neuner 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
>> >
>>
>
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
compari
11 matches
Mail list logo