[racket] Racket style question

From: Joe Gilray (jgilray at gmail.com)
Date: Wed Mar 21 17:37:44 EDT 2012

Hi Rodolfo,

In this case though, printf will never return #f so "and" is equivalent to
"begin", right?

-Joe



On Wed, Mar 21, 2012 at 2:30 PM, Rodolfo Carvalho <rhcarvalho at gmail.com>wrote:

> 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/b5afcb21/attachment-0001.html>

Posted on the users mailing list.