Хламидомонада / Говнокод #11478 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
fibs = 0:1:zipWith (+) fibs (tail fibs)
fib = (fibs !!)
 
main =  let 
                a = [fib 250000..] 
                b = a!!0
                c = 1
        in b `seq` print c

Haskell не может в not used expression elimination. Не используемые константы a и b не убрал из вычисления.
В результате видим пустую трату времени time: 13.15s :
http://ideone.com/41Q8D
И это то ленивом языке, не смотря на то, что эти вычисления не нужны. Можно писать в багтреккер.

P.S.: Когда уже хаскель в подсветку говнокода добавят?

HaskellGovno HaskellGovno, (Updated )

Комментарии (58, +58)

Хламидомонада / Говнокод #10205 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
data (,) a b = (,) a b
    deriving Generic
data (,,) a b c = (,,) a b c
    deriving Generic
data (,,,) a b c d = (,,,) a b c d
    deriving Generic
.......
data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
 = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
    -- deriving Generic
{- Manuel says: Including one more declaration gives a segmentation fault.

Вот такая вот реализация туплов:
http://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/src/GHC-Tuple.html

bormand bormand, (Updated )

Комментарии (22, +22)

Хламидомонада / Говнокод #9598 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
-- | The unit datatype @()@ has one non-undefined member, the nullary
-- constructor @()@.
data () = () deriving Generic

data (,) a b = (,) a b
. . .
data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
 = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
    -- deriving Generic
{- Manuel says: Including one more declaration gives a segmentation fault.
. . .

*тяжелый вздох*

http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/src/GHC-Tuple.html#%28%29

wvxvw wvxvw, (Updated )

Комментарии (65, +65)

Хламидомонада / Говнокод #6765 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
chislo :: String -> Bool
chislo []=True
chislo (x:xs) =if (x=='1') then chislo xs
               else if (x=='2') then chislo xs
                 else if (x=='3') then chislo xs
                   else if (x=='4') then chislo xs
                     else if (x=='5') then chislo xs
                       else if (x=='6') then chislo xs
                         else if (x=='7') then chislo xs
                           else if (x=='8') then chislo xs
                             else if (x=='9') then chislo xs
                               else if (x=='0') then chislo xs
                                 else if (x=='.') then chislo xs
							 else False

haskell

resettik resettik, (Updated )

Комментарии (49, +49)