unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* expression
@ 2010-06-23 21:09 Michael Lucy
  2010-06-23 23:14 ` expression No Itisnt
  2010-06-24  6:55 ` expression Ken Raeburn
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Lucy @ 2010-06-23 21:09 UTC (permalink / raw)
  To: guile-devel

Hey,

Is there any scheme expression that will just get ignored when the
scheme code is compiled?

I'm generating some code with a function like:

(define (gen-update-ab updatea updateb)
  `(begin
     ,(if updatea `(set! a (+ a 1)) `(donothing))
     ,(if updateb `(set! b (+ b 1)) `(donothing))))

And ideally I could replace the donothing function with something that
will get discarded during compilation.

There are alternatives, but they're pretty ugly (significantly moreso
in my actual code than they look below):

(define (gen-update-ab-2 updatea updateb)
  `(begin
     ,@(if updatea `((set! a (+ a 1))) `())
     ,@(if updateb `((set! b (+ b 1))) `())))

(define (gen-update-ab-3 updatea updateb)
  (filter (lambda (x) (not (null? x)))
          `(begin
             ,(if updatea `(set! a (+ a 1)) `())
             ,(if updateb `(set! b (+ b 1)) `()))))



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-06-24 14:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 21:09 expression Michael Lucy
2010-06-23 23:14 ` expression No Itisnt
2010-06-23 23:23   ` expression Michael Lucy
2010-06-24 13:01     ` expression Andy Wingo
2010-06-24  6:55 ` expression Ken Raeburn
2010-06-24  7:27   ` expression Thien-Thi Nguyen
2010-06-24  7:52   ` expression Michael Lucy
2010-06-24 13:05     ` expression Andy Wingo
2010-06-24 13:03   ` expression Andy Wingo
2010-06-24 14:40     ` expression Ken Raeburn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).