Nodejs re-sparked interest in FP Course by RxJs author Still not fluent, looking for chances to try things out HackerRank, noughts and crosses Computer game puzzle first real-world solution using Haskell
Also - it's important to hear what everybody thinks about all this and learn from that Still, is a lot to get through, so instead of one2one chats, there's the pub, email or coffee sometime Really – my contact details are at the end, do get in touch
don't . (not kidding here !) There isn't a test at the end (I hope not,anyway) Although all the topics are related, you don't need to grasp all of them to learn the next one. This is really so, it's ok to let stuff go by So whether you ask questions now, later or never, that's fine
Elm front-end Go over Haskell code, then talk about solutions Elm - uni-directional design and code review DEMO! Time travel debugging Bonus - solutions in Js/RxJs app & C# Linq (if we get the time)
I just write Haskell programs What follows is how I see/understand things It may or may not exactly match the books, wikis, academic papers, mathematical proofs etc.
casts or ignore flags … Can decide not to specify type – Haskell complains if this does not hold up It does have the notion of type groups – num, equality … (C# generic constraints)
are like arrays Any length – can only hold a single type Tuples are like, er, multiples ? Fixed length – may store multiple types Algebraic create our own from the above (diy) Records object-like syntactic sugar in Elm, a bit duck type-y
2: 3: [] Pass as params like this xs entire list x:xs x is “head”, xs is “tail” (destructuring) NOTE - access anything past the head – may take a (lot) longer TL;DR – Haskell functions are designed to work with head of list as much as possible
to go through secLoop and attach to copy of first item This creates a LoopsPermutation - two loops mixed, perhaps In effect, basis for solution/algorithm – see in app Here, Haskell code is little different from any modern language (that uses an anonymous function)
perms items So keep memory use limited to a small amount Since then, have heard about “constant space” Created a revised version of this, which filters the items before processing
13,881,442,884 bytes copied during GC 1,488,404 bytes maximum residency (9495 sample(s)) 56,556 bytes maximum slop 4 MB total memory in use (0 MB lost due to fragmentation) 25 million items, approx 20 mins
14,737,731,940 bytes copied during GC 1,460,032 bytes maximum residency (10954 sample(s)) 57,016 bytes maximum slop 4 MB total memory in use (0 MB lost due to fragmentation)
19,752,688,420 bytes copied during GC 1,460,060 bytes maximum residency (14680 sample(s)) 54,804 bytes maximum slop 4 MB total memory in use (0 MB lost due to fragmentation) 25 million items, approx 10 mins
9,224,696,568 bytes copied during GC 2,454,488 bytes maximum residency (4059 sample(s)) 71,972 bytes maximum slop 6 MB total memory in use (0 MB lost due to fragmentation)
usage – however Haskell may treats dropWhile as tail recursion, so may be tight loop 2nd – definitely works in constant space, should be treated as tail recursion 3rd – creates differences between perms – a middle ground in use of memory
be used where lazy eval is, or is not, appropriate Very flexible and powerful Used for main familiar functions, map, filter … And which takes us to Elm
here) View – takes model, creates Html Html events lead to Signal changes (like Redux Actions) Update – takes Signal(s), updates model New model sent to view Considering code as pseudo-code works well
infinite streams we can choose to get first item only Typescript – preserves Haskell types Do they stand out so clearly Are they useful? What have we gained or lost by this functional programming style ?
but get a flavour Like that the Haskell types transfer well We have lazy eval – we declare operations But nothing happens until x amount of data requested What have we gained or lost by this functional programming style ?