From: ramza2
Subject: Lisp style question, hashtable? to a function
Date: 
Message-ID: <1105230544.312645.278250@c13g2000cwb.googlegroups.com>
What is a lispier way of handling those 'messages', ideally, I think I
would like to create add more messages, that would be handled by a
function.

My question, from a library perspective, would it be easier to put them
the messages in a hash table where the values are functions?

And then the only argument to that function would be the hash table.

Table:

WM_CREATE - some_function

http://www.retroevolution.com/beta/widget_toolkit/orkit06.htm


Or maybe a list of lists, where the first element is a int and the next
is a function.
From: Jeff
Subject: Re: Lisp style question, hashtable? to a function
Date: 
Message-ID: <033Ed.80960$k25.13277@attbi_s53>
ramza2 wrote:

> What is a lispier way of handling those 'messages', ideally, I think I
> would like to create add more messages, that would be handled by a
> function.
> 
> WM_CREATE - some_function
> 
> http://www.retroevolution.com/beta/widget_toolkit/orkit06.htm

Check out Corman Common Lisp (www.cormanlisp.com). It comes complete
with source code and has a very nice method of doing this. I don't
exactly remember what the method is, just that I thought it was quite
elegant the last time I used CCL.

Barring that, since there aren't very many messages that you'll be
looking at, I'd just use a CASE statement:

(case message
  (#.WM_CREATE (...))
  (#.WM_PAINT  (...))
  (otherwise   (DefWindowProc ...)))

Jeff M.

-- 
http://www.retrobyte.org
··············@gmail.com