[erlang-questions] : abstract patterns vs macros was:( Floating guard sequences)
Fri Feb 20 12:01:02 CET 2009
I like Abstract Patterns, I think they make patterns more like first-class
citizens and make ADTs implementation easier. There several comments, which
I'll write later. For now, I just trying to write simple abstract pattern
for inclusive range of integers:
#range(N,M) when is_integer(X) -> N=<X, X<=M.
I just introduced X. Is this right way?
#range(N,M) -> is_integer(X), N=<X, X<=M.
Do I need to specify is_integer(N), is_integer(M) for abstract pattern
arguments too ?
It's getting too complex...
Raimo Niskanen-2 wrote:
> On Thu, Feb 19, 2009 at 04:44:35PM -0800, Anthony Molinaro wrote:
>> On Fri, Feb 20, 2009 at 12:15:20PM +1300, Richard O'Keefe wrote:
>> > On 20 Feb 2009, at 7:53 am, fess wrote:
>> > > I'm sure I can learn something by asking, why not just do this with
>> > > macros?
>> > Well, you could start by reading the paper.
>> I went looking for said paper and it's extremely hard to find.
>> After hunting on google for 10 minutes with keywords like "abstract
>> "abstract patterns erlang", "abstract patterns o'keefe", I eventually
>> found 2 other papers which reference "Abstract Patterns for Erlang"
>> by Richard O'Keefe, so that must be it, right? Well another google
>> search returns 3 results
>> None of which are the paper. However the 3rd link eventually leads to
>> Which includes a paper with the title "Pattern Abstraction" apparently
>> by Richard O'Keefe.
> That should be it. You can find it from:
> http://www.erlang.org/faq/faq.html section 10.14.
> There you also find a link to Joe Armstrong's struct suggestion.
>> So maybe that's the so called paper, or maybe there is another one out
> I sincerely hope if this paper you found is wrong, someone will yell,
> because I also had a hard time finding it.
>> Anthony Molinaro <nym@REDACTED>
>> erlang-questions mailing list
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> erlang-questions mailing list
View this message in context: http://www.nabble.com/Floating-guard-sequences-tp22067566p22118636.html
Sent from the Erlang Questions mailing list archive at Nabble.com.
More information about the erlang-questions