Closed
Description
The following code has to name two functions.
pure fn hash(x: @str) -> uint { str::hash(*x) }
pure fn eq(x: @str, y: @str) -> uint { str::eq(*x,*y) }
ret hashmap(hash, eq);
It'd be nice if we could write:
ret hashmap(pure {|x: @str|str::hash(*x)}, pure {|x,y|str::eq(*x,*y)});
...or even (with type inference, if possible):
ret hashmap({|x: @str|str::hash(*x)}, {|x,y|str::eq(*x,*y)});