[racket] Printing multiple stmts in cond

From: nikhil (nik.mis at gmail.com)
Date: Sat Apr 30 03:16:27 EDT 2011

Ok. Here's what I am trying to do.

I am parsing incoming racket code and generating back racket code.

In my case, I have an incoming function which takes 4 arguments and I need
to generate a function which takes in 5 args when a condition satisfies, if
not then the original 4 args .

Something like,

(f x1 x2 x3 x4)

(FF x1 x2 xNEW x3 x4)


(define (parse-func exp)

   [(f? exp)
         ,(if (condition?)


(The above is just pseudo-code) As shown above, when the if condition fails
I just want 4 args. But a default #<void> is passed instead when used with

I am new to racket and functional programing in general, so I am not able to
express my problem very accurately :(
Hope the above example is clear enough to explain what I am doing.

On Sat, Apr 30, 2011 at 7:00 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:

> nikhil wrote at 04/30/2011 02:52 AM:
>  Basically, I dont want to execute an else stmt or return multiple values.
>> I just want to return "stmt1" if condition satisfies and dont do anything if
>> false. No returning #<void> or anything.
> An expression always produces at least one value, even if the value is the
> void value.  (Usually, a REPL will hide a returned void value from you, but
> a void value is still being returned, which can be confusing.)
> If you can show *why* you don't want to produce *any* value, then people
> can show you different ways to write that code.
> --
> http://www.neilvandyke.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110430/243a8c70/attachment.html>

Posted on the users mailing list.