Browse thread
C-like macros in OCaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Raj B <rajb@r...> |
| Subject: | C-like macros in OCaml |
Hi there
Is there any way I can achieve the use of C-like preprocessor macros
in OCaml?
i.e.
#define FOO 1
etc.
I am using an array of bits (a bitset) where each bit represents a
flag, and i would like to
access this set by using names rather than remembering which index in
the array represents which flag.
Similarly, is there any way of getting a C-like enumeration? e.g.
enum days {Mon = 1, Tue, Wed...}
I guess that OCaml does not provide these by default, but I wonder if
someone has done some camlp4 magic
to use these.
Thanks
Raj