[erlang-questions] very large key lookup

Ulf Wiger <>
Mon Sep 25 22:53:30 CEST 2006

Den 2006-09-25 22:16:20 skrev Scott Lystig Fritchie  

> however, other options within the confines of the match spec language
> are hard/impossible? to find.
> I briefly contemplated a chain of boolean or clauses testing hd('$1'),
> hd(tl('$1')), hd(tl(tl('$1'))), ... etc.  I confess that I didn't
> actually test doing that, but the mere thought of doing it 30 or 40
> times seemed quite repulsive.  (And my app doesn't always guarantee a
> max list length of 30 or 40, so I'd be vulnerable to a miss anyway.)

Oh, a fellow pervert. (:

I had a brief outburst of madness with match specs a while ago:

I agree - the end result was quite repulsive, until I had a chat
with John Hughes and added a form of controlled recursion to my
own erlang-based match_spec evaluator.

The suggestion:

   {'let', NewVar, Expr, In}


   {subterm, StartingExpr, RecursiveOp, While, Until}

(described in more detail in the above link)

I stared at the match spec compiler inside the emulator
until I got dizzy. I decided not to try to extend it with
my new constructs, but I remain unconvinced that it wouldn't
be possible. It surely was easy enough in Erlang. (:

Ulf W
Ulf Wiger

More information about the erlang-questions mailing list