
I just mean syntax. For example. the following code snippet is C-style. In vim, i can use `shift+%` to jump between `{' and `}', and so on. hitSSQ hitNum = do { nums <- fmap str_ints_pick $ readFile "ssqNum.txt"; forM_ nums (\n -> do { let { hitB = if (n!!6 == hitNum!!6) then 1 else 0 ; hitR = foldl (\acc x -> if(elem x (init hitNum)) then acc+1 else acc) 0 (init n);}; printf "%s\t%d:%d\t%s\n" (show n) (hitR::Int) (hitB::Int) (hit_desc hitR hitB); }); } Dietrich Epp-2 wrote:
I think Miljenovic was asking about this (I removed explicit braces):
fac n = let f = foldr (*) 1 [1..n] in f
Which is strictly equivalent to:
fac n = foldr (*) 1 [1..n]
Translated into C, this is kind of like doing this:
int add(int x, int y) { int sum = x + y; return sum; }
instead of this:
int add(int x, int y) { return x + y; }
I find it very cumbersome (though not *difficult*) and painful to use a C style of programming with Haskell, so I am not sure what you mean when you ask why Haskell supports C style. Are you talking about mutable state, syntax, or something else?
--Dietrich
On 2010 March 27, at 4:28, zaxis wrote:
Of course, you are wrong ! C is VERY important for almost every programmer in the world! Why cannot C programmer use haskell ? And Why does haskell support C code style ?
Ivan Miljenovic wrote:
zaxis
writes: Why do you bother with the interior definition of f in there? Because i want to try a C code style not layout style without `do` syntax sugar .
Haskell /= C, so stop trying to code as if it is. If you like C so much, then use C.
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- fac n = let { f = foldr (*) 1 [1..n] } in f -- View this message in context: http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---t... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- fac n = let { f = foldr (*) 1 [1..n] } in f -- View this message in context: http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---t... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.