It's fine as long as the case listing has few elements (<30-50 somewhere). Your else clause probably wants an error call in it btw.<br><br><div class="gmail_quote">2011/11/2 Vok Vojwo <span dir="ltr"><<a href="mailto:ceving@gmail.com">ceving@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2011/11/2 Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>>:<br>
<div class="im">><br>
> Alternatively, use this macro to import C enums and constants:<br>
><br>
<br>
</div>I am experimenting with a symbol version:<br>
<br>
(define gtk-window-new<br>
  (let ((toplevel ((c-lambda () int "___result = GTK_WINDOW_TOPLEVEL;")))<br>
        (popup ((c-lambda () int "___result = GTK_WINDOW_POPUP;")))<br>
        (new (c-lambda (int) GtkWidget* "gtk_window_new")))<br>
    (lambda (type)<br>
      (new (case type<br>
             ((toplevel) toplevel)<br>
             ((popup) popup)<br>
             (else "gtk-window-new: invalid type: " type))))))<br>
<br>
This seems to be more natural in Scheme and the top level environment<br>
would be smaller. But the code would be slower because of the case<br>
dispatching. And every mapped C function accepting enumerations would<br>
have three closures: the let, the lambda and the c-lambda.<br>
<br>
Is this inappropriate expensive?<br>
<div><div></div><div class="h5">_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
</div></div></blockquote></div><br>