[racket] how must I interpreted this exercise

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Sat Jun 23 16:56:47 EDT 2012

On Sat, Jun 23, 2012 at 12:45 PM, Roelof Wobben <r.wobben at home.nl> wrote:

>  I have another "problem" I try to solve in my head.
> Suppose I want to change one word in a sentence depening if a comparision
> is true or false.
> I could do this in pseudo code.
> if comparision is true then print "it's true" else  print "it's not true"
> It works but I type two time's "it's true".
> Can this be done so I have to type only one time the sentence and depeding
> on true or false the word not is used.
> Roelof
I'm sure those with a deeper understanding of Racket than I could suggest
something a little more elegant, but here's what I immediately came up with:

#lang racket

(define (print-statement some-cond)
  (printf "~a~a~a~n"
          (if some-cond
              " "
              " not ")

(print-statement #f)
(print-statement #t)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120623/134f1e2d/attachment.html>

Posted on the users mailing list.