[erlang-questions] Core erlang wildcards and sequences
Wed Jul 31 21:02:13 CEST 2013
I'm building a small DSL which compiles to Erlang VM. I have two
questions about how to achieve this.
First, if i want compile this pseudo code
a = something
b = do_something_with(a) %% involves a
... rest of code ...
I end to build the following (pseudo) core erlang code:
let A = something
in let B = apply do_something_with(A)
in ... rest of code
I printed dummy erlang code to core erlang representation and it
resulted in the same forms, namely a stack of 'let expressions'.
Is that ok ? Are there better ways to achieve this in certain situations ?
Then, i want to implement wildcards ( _ ), so in core erlang i create
a regular variable (which is never used) to match any value. Again, is
there a better way to do this, does one more variable involves more
overhead (i assume the compiler will optimize it anyway) ?
One more question !! I figured out that operators like + are calls to
erlang:'+'. I would like to play with the cons opearator but neither
erlang:'|' nor erlang:'cons' seems to exist. Is there another name ?
This is not important, just for fun.
More information about the erlang-questions