I was reading about metaprgramming in elixir where Chris explains how 
easily elixir provides unicode support in a few lines of code through 
pattern matching. I thought it would be a cool idea to cache functions by 
generating code which defines the function with the previously passed 
parameters as input and the computed value as the body of the function. 
Next time, instead of evaluating the function, you just have to pattern 
match !!!

Lets assume a function:

def add(a,b) do: a+b

add(1,2)  -> evaluates 1+2 = 3 -> spawn a function that creates a function 
: def add(1,2) do: 3 
add(1,2) -> pattern matches with  add(1,2) -> returns 3

thoughts?



-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/eb276b92-cfd5-4263-b2d1-13ebc271bdef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to