Edited, memorised or added to reading list

on 04-Jul-2020 (Sat)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Both performance and computational differences exist between foldl and foldr . At this stage in learning, it’s important to know that these functions give different answers if the order of the application matters

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




foldl is the most intuitive behaving of the folds, but it usually has terrible performance and can’t be used on infinite lists.
foldl' is a nonlazy version of foldl that’s often much more efficient.
foldr is often more efficient than foldl and is the only fold that works on infinite lists

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Many recursive problems can be solved with map , filter , and foldl . When encountering a recursive problem, the first question you should ask is whether you can solve it with one of these three functions.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Prototype-based object-oriented languages, such as JavaScript, create instances of objects by modifying a prototypical object, rather than using classes. Prototypes in Java- Script are often a source of much confusion. Here you can see how cloning an object and modifying it to create a new object is a natural result of using functional programming. In Haskell, you can create new objects by modifying copies of old, existing ones

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Used closures to represent objects created with lambda functions

Sent messages to objects by using first-class functions

Managed state in a functional way, allowing you to be more exact in controlling program execution

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Types in Haskell are more abstract. They provide a way of understanding how values behave and how to organize data.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




in Haskell literal numbers are polymorphic: their type is determined from the compiler based on the way they’re used.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




what should Haskell do here?

z = read "6"

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Just as with regular variables, using different names for type variables doesn’t imply that the values represented by the variables must be different, only that they can be.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




When you have two names for the same type, it’s referred to as a type synonym. Type synonyms are extremely useful, because they make reading type signatures much easier.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs