Yes, except that the contracts are checked at each call of the procedure. So if (define (foo x) (values x x))
is contracted with (-> any/c any/c)
an exception will be raised on the first call to foo
, but not during compilation.
but in that case, foo
must be supplied a single value argument, right ?
If you try to call foo
with more than one argument, a contract exception will be raise.
(when test body ...)
is equivalent to (if test
(begin body ...)
(void))
So you should use when
when you want to write an if
like the above.
i don’t get it
It’s mostly useful when you want to conditionally execute some imperative code.
(when test (set! x something))
if understand, when
is an if
devoid of failure case?
yes
thanks,
thanks
I just installed a package from the main catalog. If I now want to work with the latest source from github instead, what is required? After making a change to the source, do I just raco pkg update
and pass a flag to use my directory vs. the main catalog?
Hmm… simpler than I thought: raco pkg remove frog
git clone <my fork>
raco pkg install ~/my-dir
Should’ve just read the https://github.com/greghendershott/frog/blob/master/CONTRIBUTING.md\|CONTRIBUTING.md file :)
raco pkg update —clone frog, and then go to frog and do the appropriate git commands
That’s what I’d do