[erlang-questions] Pattern-matching function?
Thu Oct 30 17:27:30 CET 2008
On Thu, Oct 30, 2008 at 8:17 AM, Robert Virding <rvirding@REDACTED> wrote:
> Well of course I would use LFE, but otherwise I agree. :-) And define a
> macro defining macro.
> Seriously though, using macros or parse_transforms is the only way to get
> around the problem of not having patterns or variables as real "things".
To illuminate a bit, I'm writing a mochiweb app and hating life
because I haven't found a good way to reduce the amount of noise
created by the gargantuan case statement created by splitting up the
url. When writing web applications like this in python, there are
often some nice tools provided to at least make the matching list of
routes more readable (see, routes, django urls, werkzeug etc.). Many
of these actually use regexes or a matching techniques that I could
also use in erlang, it just feels like a shame that matches aren't
more readily available as first class citizens. That being said,
parse_transforms are what I've been looking at, but finding very
little in the way of helpful examples :(
> 2008/10/30 mats cronqvist <masse@REDACTED>
>> "Robert Virding" <rvirding@REDACTED> writes:
>> > One solution is to use macros as a wrapper around a fun.
>> Some people, when confronted with a problem, think
>> "I know, I'll use a macro."
>> Now they have two problems.
>> with apologies to jwz.
>> p.s. unless you're coding in lisp, of course.
More information about the erlang-questions