Hi all,

I trying to match a dictionary of terms against free form input.  Many
of the dictionary entries have aliases, so I'm using a custom hash
table that matcheskeys by list membership.

My (maybe wrong) reading of the docs suggests that to match a hash
table, the table must be defined inline in the match clause.  This is
not really feasible because of the dictionary's size, so I am doing a
generic expression match instead: e.g., 

   ([list (? (lambda(e) (dict-ref mydict e #f)) pat)  _ ___]
      (let [(val (dict-ref mydict pat))]
         blah blah ))

This works ... but I have to do the lookup twice because match returns
the input pattern - i.e. the lookup key instead of the the resulting
value.

Is there a way to avoid double lookup?  If necessary I can switch to a
normal (equal?) hash table by constructing the dictionary differently,
but I don't see that I will gain anything by doing so.

Thanks,
George

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to