- How did it go?
- Head/Tail/Init/Last: https://gist.github.com/gabebw/a6284db3d96612aae5a5
- Pattern Matching: https://gist.github.com/gabebw/a837caca1869ab4daafa
- Bonus: Fill in the Types: https://gist.github.com/gabebw/039ca8c2199372b811ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /dev/fd/13 2019-06-26 17:28:12.960405019 -0700 | |
+++ /dev/fd/14 2019-06-26 17:28:12.960830329 -0700 | |
@@ -70,7 +70,7 @@ | |
json.AAK.longitude = "173.63699340820312"; | |
json.AAK.name = "Buariki Airport"; | |
json.AAK.timezone = "10"; | |
-json.AAK.tz_name = "\\N"; | |
+json.AAK.tz_name = null; | |
json.AAL = {}; | |
json.AAL.altitude = "10"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raw_panda = "🐼" | |
# panda is U+1F43C according to wikipedia | |
puts raw_panda | |
puts "\uf09f\u90bc" | |
# puts "\u2728" | |
# puts "\ud83d\udc3c".force_encoding("UTF-8") | |
# puts raw_panda.each_codepoint { |x| p x } | |
# puts raw_panda.each_byte { |x| p x } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This goes in bin/setup | |
npm install --save \ | |
gulp \ | |
browserify \ | |
react \ | |
react-dom \ | |
babelify \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hey there | |
line two | |
whoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
The expression problem: Adding new data types and new functionality to | |
existing data types is at odds. | |
OOP: | |
* adding new data types is easy | |
- just write new code, and adhere to the API | |
* But adding new functionality to existing data types is hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Added type signatures | |
module PatternMatching where | |
import Data.Char (isUpper) | |
-- `:t even` shows that `even` needs `Integral`, but nothing more precise | |
-- than that | |
anyEven :: (Integral a) => [a] -> Bool | |
anyEven list = not $ null $ filter even list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PatternMatching where | |
-- Return the first character of a String, or the question mark character for an | |
-- empty string. | |
-- > firstCharacter "hello" | |
-- 'h' | |
-- > firstCharacter "" | |
-- '?' | |
-- Hint: String is the same as [Char]. | |
firstCharacter :: String -> Char | |
firstCharacter (c:_) = c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HeadTailInitLast where | |
-- middle [1] == [] | |
-- middle [1..6] == [2, 3, 4, 5] | |
middle :: [a] -> [a] | |
middle s@(_:_:_:_) = tail $ init s | |
middle _ = [] | |
-- Maybe more Rubyish: | |
middle' :: [a] -> [a] | |
middle' s |
NewerOlder