[racket] Racket style question
On Wed, Mar 21, 2012 at 17:21, Joe Gilray <jgilray at gmail.com> wrote:
> Hi Tim,
>
> Thanks for sharing your code.
>
> Quick, newby question: why do you use "and" instead of "begin" in your
> progress function?
>
If you are used to run commands from bash you may do things like
command1 && command2 && command3
e.g.: mkdir somedir && cd somedir && git clone ...
Why people do that? Simply put, all of the commands after a `&&' are only
run if the commands before executes fine (return code 0).
So "git clone" will be executed only if I could create a dir and cd to it.
It will not be executed if I don't have permissions to create a dir.
Using "and" is like using "&&" in bash, while "begin" is equivalent of
separating the commands with ";".
More on short-circuit evaluation:
http://en.wikipedia.org/wiki/Short-circuit_evaluation
HTH,
Rodolfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120321/06ba1c2e/attachment.html>