Name: Anonymous 2007-07-14 8:37 ID:DWRQwZU8
discuss
(<=>) :: (Ord a) => a -> a -> Bool
x <=> y | x > y = True
| x == y = True
| x < y = True(<=>) :: (Ord a) => a -> a -> Bool
x <=> y | x > y = True
| x == y = True
| x < y = True
| otherwise = False
Prelude> 42 <=> (0/0)
False
(0/0) <=> (0/0)
[spoiler]False[/spoiler]
a <=> b = flip any [(<), (==), (>)] (\ f -> f a b)Maybe or Either functors for proper error propagation. Haskell has an expressive type system, USE IT!
while(<>) will not read until EOF, get your faqts str8.
foreach $file (@ARGV) {
open(VAGINA, $file) || die("$file: $!\n");
while (!eof(VAGINA)) {
$_ = readline(VAGINA);
# manipulate $_
}
close(VAGINA);
}
foreach $file (@ARGV) {
die $! unless open(VAGINA, $file);
print readline(VAGINA) until eof(VAGINA);
close(VAGINA);
}
foreach $file (@ARGV) {
die $! unless open(VAGINA, $file);
print readline(VAGINA) until eof(VAGINA) and close(VAGINA);
}