[erlang-in-lisp-devel] fare-match question

Robert Virding rvirding at gmail.com
Sun Jun 1 15:36:21 UTC 2008


2008/6/1 Dan Bensen <dsb at prairienet.org>:

> Matt Bone wrote:
>
>> are our pattern matching requirements so minimal that a) it does not
>> matter and b) we could even roll our own
>> ala some of the Norvig examples?
>>
>
> According to one of the tutorials[*], Erlang patterns support variable
> repetition.  I think Fare mentioned using existing Erlang test code,
> so that might be an issue.
>

Excuse my ignorance here but what exactly are you planning to use the
pattern matching for? If it is for use in the code to which you compile
Erlang then I would seriously think through how you are compiling Erlang.

Yes, Erlang supports variable repetition (with implicit checking of values)
and also non-lexical scoping so using and already bound variable in a
pattern also means an implicit comparison of values.

I would not directly compile the Erlang code to lisp but would use the first
few passes of the Erlang compiler. This would ensure compatibility with
existing Erlang for many features (records, list/binary comprehensions) and
be much easier as the internal languages are much simpler.

I would suggest using Core Erlang or even kernel Erlang. Core is a very
simple functional language which has lexical scoping and simplified pattern
matching. Kernel erlang has been fully lambda lifted and is completely
"flat" and pattern matching has been compiled and optimised to basic tests.

In a follow up to this mail I will send a copy of a presentation of LFE
(Lisp Flavoured Erlang) I gave which I think would be interesting in 2
respects:

- the LFE core forms are *very* close to Core Erlang (almost 1-to-1)
- there is a *short* description of the compiler at the end, only 3 slides
but it at least presents the passes and some of the internal languages.

It's 87 kB Powerpoint document so I apologise for sending big message.
Unfortunately I can't convert it to PDF, if anyone can help with this I
would appreciate it.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/erlang-in-lisp-devel/attachments/20080601/089ed77d/attachment.html>


More information about the Erlang-in-lisp-devel mailing list