Hi Daniel,<br><br>A more functional approach might be:<br><br> type Substitution = String -> Maybe Value<br> single :: String -> Value -> Substitution<br> table :: Table -> Substitution<br><br> substitute :: Substitution -> Tree -> Tree<br>
<br>For better performance and a lot more features, you could switch to<br><br> type Substitution = Data.Map String Value<br><br>- Conal<br><br><div class="gmail_quote">On Fri, Feb 13, 2009 at 2:40 AM, Daniel Kraft <span dir="ltr"><d@domob.eu></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Colin Adams wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If you have two functions that do two different things, then they<br>
certainly OUGHT to have different names.<br>
</blockquote>
<br></div>
Well, they do "the same thing" but for different arguments; it's like this:<br>
<br>
Table is a table of name-value pairs I want to substitute in a tree-like structure using:<br>
<br>
substitute :: Table -> Tree -> Tree<br>
<br>
For substituting a single name-value pair I want to define this utitlity routine so I don't have to construct a Table all the time in the user code:<br>
<br>
substitute :: String -> Value -> Tree -> Tree<br>
<br>
In the case I believe it would certainly be good to be able to name both functions the same, but I fear I can not do so? There are languages where this is explicitelly allowed (e.g. C++ or Java), so I don't think it is such an unuseful or evil thing.<div>
<div></div><div class="Wj3C7c"><br>
<br>
Daniel<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>