[racket] Racket style question

From: Richard Cleis (rcleis at me.com)
Date: Wed Mar 21 18:01:07 EDT 2012

FWIW:

I believe the style guide suggests that 'cond' should be used instead of 'if' when a clause requires more than one expression. The newer Racket versions of 'cond' also permit internal defines. 'Begin' is unnecessary.

rac



On Mar 21, 2012, at 3:37 PM, Joe Gilray wrote:

> 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
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120321/626967e0/attachment.html>

Posted on the users mailing list.