GoConqr has a new look! Let us know what you think.

Mind map

Cap 2 : Starting Out

MENESES CHAVARRIA XUASY SANTIAGO Spanish

Cap 2 : Starting Out

Map content

Cap 2 : Starting Out

  1. Basic things

    • operators
      • ( +) ( - ) ( *) ( /)
      • True && False False , True && True True, False || True True,not False
    • functions
      • The succ function takes anything that has a defined successor and returns that successor
        • max returns the one that's greater
        • min returns the one that's lesser
  2. first functions

    • functions are defined in a similar way that they are called.
      • The function name is followed by parameters seperated by spaces.
        • We can call your own functions from other functions that you made
        • Functions in Haskell don't have to be in any particular order when you create
          • IF statement
            • in imperative languages is that the else part is mandatory in Haskell
            • n Haskell every expression and function must return something
            • Example to add one to every number that's produced in a function
        • to append a function to the file, you should save it whit the .hs on the final (name.hs) and load de module (: l) in GHCI
  3. intro to lists

    • It's the most used data structure and it can be used in a multitude of different ways to model and solve a whole bunch of problems
      • A common task is putting two lists together. This is done by using the ++ operator.
        • Haskell has to walk through the whole list on the left side of ++
      • also we can use"hello" ++ " " ++ "world" = "hello world"
      • putting something at the beginning of a list using the : operator
        • to get an element out of a list by index, use !!. The indices start at 0.
      • [], [[]] and[[],[],[]] are all different things
        • The first one is an empty list, the seconds one is a list that contains one empty list, the third one is a list that contains three empty lists
      • can be use. <, <=, > and >= to compare list
      • basic functions that operate on lists.
        • head takes a list and returns its head
        • tail takes a list and returns its tail
        • last takes a list and returns its last element.
        • init takes a list and returns everything except its last element
        • length takes a list and returns its length
        • null checks if a list is empty.
        • reverse reverses a list.
        • take takes number and a list
        • drop works in a similar way,
        • maximum and minimum
        • um takes a list of numbers and returns their sum.
        • elem takes a thing and a list of things and tells us if that thing is an element of the list
  4. Texas ranges

    • Ranges are a way of making lists that are arithmetic sequences of elements that can be enumerated
      • from 1 to 20, you just write [1..20] and the alphabet ['a'..'z']
      • A handful of functions that produce infinite lists:
        • cycle takes a list and cycles it into an infinite list.
        • repeat takes an element and produces an infinite list of just that element.
        • replicate function if you want some number of the same element in a list.
  5. a list comprehension

    • A basic comprehension for a set that contains the first ten even natural numbers is set notation.
      • The part before the pipe is called the output function, x is the variable, N is the input set and x <= 10 is the predicate
      • Add a condition (or a predicate) to that comprehension. Predicates go after the binding parts and are separated from them by a comma. we only get the elements which, doubled, are greater than or equal to 12.
      • if we wanted all possible products that are more than 50
  6. Tuples

    • they are a way to store several values into a single value.
      • are used when you know exactly how many values you want to combine and its type depends on how many components it has and the types of the components.
        • They are denoted with parentheses and their components are separated by commas.
          • they don't have to be homogenous. Unlike a list, a tuple can contain a combination of several types.
            • so let's use that instead. Instead of surrounding the vectors with square brackets, we use parentheses:
              • Like lists, tuples can be compared with each other if their components can be compared.
                • fst takes a pair and returns its first component.
                • snd toma un par y devuelve su segundo componente
                • zip :It takes two lists and then zips them together into one list by joining the matching elements into pairs
                  • zip [1,2,3,4,5] [5,5,5,5,5] [(1,5), (2,5), (3,5), (4,5), (5,5)]

Images and files in the map

  • Cap 2 : Starting Out
  • Cap 2 : Starting Out
  • Cap 2 : Starting Out

Information

Description
Mind Map on Cap 2 : Starting Out, created by MENESES CHAVARRIA XUASY SANTIAGO on 01/03/2018.
Views
2
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?