03: Lists

Handling Lists

  • Before we get started a couple tips for shorthand in Prelude * > GHCi is an interactive Haskell REPL (Read-Eval-Print-Loop) that comes with GHC. At the GHCi prompt, you can evaluate expressions, load Haskell files with :load (:l) (and reload them with :reload (:r)), ask for the type of an expression with :type (:t), and many other things (try :? for a list of commands). * using let in the GHCI
    • Words are are a list of chars

    • In Haskell, lists are a homogenous data structure. It stores several elements of the same type.

    • One of the most basic data types in Haskell

    • List comprehensions?
      • Like set comprehensions, normally used for building more specific sets from a larger general set *
    • List Constructing

      • we should mention type signatures too
      • NOT AN ARRAY
      • ugh, what’s this mean
      • intListLength (x:xs) = 1 + intListLength xs

Resources

Follow