Informatiker Board (http://www.informatikerboard.de/board/index.php)
- Themengebiete (http://www.informatikerboard.de/board/board.php?boardid=1)
--- Theoretische Informatik (http://www.informatikerboard.de/board/board.php?boardid=5)
---- formale Sprachen (http://www.informatikerboard.de/board/board.php?boardid=12)
----- Haskell Funktion (http://www.informatikerboard.de/board/thread.php?threadid=4341)


Geschrieben von Neuling1 am 26.11.2020 um 20:46:

  Haskell Funktion

Meine Frage:
Ich bin neu bei Haskell. Kann mir jemand die Haskell Funktion erlkären?

bin2dec :: [Int] -> Int
bin2dec bits = bin2dec' 0 bits
where
bin2dec' ac = 2*ac + b
bin2dec' ac (b:bs) = bin2dec' (2*ac + b) bs

Wie reduziert man den Ausdruck?

bin2dec [0,1,0,1,1,0] => ?

[b]Meine Ideen:

Ich verstehe die erste Zeile (eingabe, Ausgabe Datentyp) aber dannach verstehe ich nichts.


Forensoftware: Burning Board, entwickelt von WoltLab GmbH