Changeset 13763 for src/Pugs/Prim/List.hs
- Timestamp:
- 10/01/06 04:46:04 (2 years ago)
- Files:
-
- 1 modified
-
src/Pugs/Prim/List.hs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim/List.hs
r13728 r13763 64 64 65 65 op1Min :: Val -> Eval Val 66 op1Min v = op1MinMax (== False)v66 op1Min v = op1MinMax not v 67 67 68 68 op1Max :: Val -> Eval Val 69 op1Max v = op1MinMax (== True)v69 op1Max v = op1MinMax id v 70 70 71 71 -- min_or_max is a function which negates truth/falsehood. … … 91 91 op1MinMax' _ _ [] = return undef 92 92 -- We have to supply our own comparator... 93 op1MinMax' _ Nothing valList = foldM default_compare (head valList) valList93 op1MinMax' _ Nothing valList = foldM default_compare (head valList) (tail valList) 94 94 -- or use the one of the user 95 95 op1MinMax' min_or_max (Just subVal) valList = do … … 106 106 -- +1 ==> a > b 107 107 -- We call min_or_max so we can work for both min() and max(). 108 return $ if min_or_max (int > (0::VInt)) then a else b) (head valList) valList108 return $ if min_or_max (int > (0::VInt)) then a else b) (head valList) (tail valList) 109 109 -- This is the default comparision function, which will be used if the user 110 110 -- hasn't specified a own comparision function.
