<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
<style>BODY{font:10pt Tahoma, Verdana, sans-serif}</style></head><body>
Hi Kostis,<br><blockquote style="padding-left: 5px; margin-left: 5px; border-left: #0000ff 2px solid; margin-right: 0px"><hr>I see that in your program you have the following:<br>
<br>
-define(VOWELS, [$a, $e, $i, $o, $u, $y]).<br>
<br>
So far so good. Then you define the following:<br>
<br>
-spec consonant() -> proper:test().<br>
consonant() -><br>
?SUCHTHAT(Char, char(), lists:all(fun(C) -> Char /= C end, ?VOWELS)).<br>
<br>
Let mention that the above:<br>
1. does not define a proper test; instead, it defines a generator<span></span></blockquote><div id="kerio-curpos"> Good point, need to change the spec</div><blockquote style="padding-left: 5px; margin-left: 5px; border-left: #0000ff 2px solid; margin-right: 0px">
2. seems a complicated (and a bit weird) way of writing a definition <br>
for consonants...<span></span></blockquote><div id="kerio-curpos"> What i need is a char generator that returns all non-vowel chars. What would be a prettier way? </div><blockquote style="padding-left: 5px; margin-left: 5px; border-left: #0000ff 2px solid; margin-right: 0px"><br>
Anyway, the point is that the consonant() generator may look like an <br>
Erlang function, but it's not evaluated to a value once and for all. <br>
Instead, it's evaluated lazily. You should keep this in mind because <br>
it's a subtle point in an otherwise eager language like Erlang.<span></span></blockquote><div id="kerio-curpos"> Thx for the detailed explanation! </div><blockquote style="padding-left: 5px; margin-left: 5px; border-left: #0000ff 2px solid; margin-right: 0px"><span></span><br>
<br>
Hope this helps,<br>
Kostis<br>
</blockquote><style>
</style>
</body></html>