This file contains hidden or 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
const format = num => | |
(num / 100).toLocaleString("en-US", { style: "currency", currency: "USD" }) | |
const parse = str => +str.replace(/[^0-9.]/, "") * 100 | |
const rEFormat = num => { | |
const formattedNum = | |
num.toString().length < 3 | |
? `000${num.toString()}`.slice(-3) | |
: num.toString() | |
return `$${formattedNum |
This file contains hidden or 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 PhoneExercise where | |
import Data.Char | |
import Data.List (elemIndex) | |
import Data.Maybe (fromJust) | |
data DaPhone = DaPhone [(Digit, String)] deriving (Eq, Show) | |
type Digit = Char | |
type Presses = Int |
This file contains hidden or 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
{-# LANGUAGE DeriveGeneric #-} | |
module SemigroupExercises where | |
import Data.Semigroup | |
import Test.QuickCheck | |
import GHC.Generics | |
-- ... |
This file contains hidden or 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 Mem where | |
import Data.Monoid hiding ((<>)) | |
import Data.Semigroup | |
newtype Mem s a = | |
Mem { | |
runMem :: s -> (a,s) | |
} |
This file contains hidden or 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 Semigroup where | |
import Prelude | |
import Control.Alt ((<|>)) | |
import Control.Plus (class Plus, class Alt) | |
import Data.Array as Array | |
import Data.Bifunctor as Bifunctor | |
import Data.Either as Either | |
import Data.Foldable as Foldable |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
{"type":"Topology","arcs":[[[2787,3051],[15,-108]],[[2802,2943],[-118,-16],[-27,-20],[-72,1],[-2,22]],[[2583,2930],[2,51],[51,101]],[[2636,3082],[151,-31]],[[1757,3274],[120,-33]],[[1877,3241],[42,-12],[6,-35]],[[1925,3194],[14,-67],[-19,-55],[14,-41],[-3,-78]],[[1931,2953],[-413,4]],[[1518,2957],[25,149],[-33,215]],[[1510,3321],[247,-47]],[[4888,2903],[-228,3]],[[4660,2906],[-16,42],[6,54],[19,4],[-2,90]],[[4667,3096],[147,63]],[[4814,3159],[74,-256]],[[4347,3084],[11,-104],[-11,-65]],[[4347,2915],[-306,7]],[[4041,2922],[72,110],[23,49],[38,40],[32,108]],[[4206,3229],[38,12],[5,-37],[83,-27],[15,-93]],[[7441,6095],[83,-14],[109,-81],[94,42],[1,-133],[13,-59],[-80,8],[-77,-29],[-32,42],[-78,43]],[[7474,5914],[9,36],[-42,145]],[[8965,1854],[60,-9],[193,-8],[24,-29],[-16,-25],[-64,26],[-95,-16],[39,-26],[-20,-34],[39,17],[134,-8],[37,15],[16,-24]],[[9312,1733],[8,-56],[-41,-158]],[[9279,1519],[2,-65],[-50,13],[-76,-38],[-70,41],[-48,-6],[-44,-33],[5,-41],[-83,-30],[20,68],[-33,55],[-14,-35],[-65,-35],[-5,-42],[ |
This file contains hidden or 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 Main where | |
removePlus :: String -> String | |
removePlus = filter (/= '+') | |
toInts :: String -> [Int] | |
toInts = map ((read :: String -> Int) . removePlus) . lines | |
solve :: [Int] -> Int | |
solve xs = go [0] xs |
This file contains hidden or 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 Main where | |
import Data.List | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.Maybe (listToMaybe, maybe) | |
import Data.Ord (comparing) | |
import System.Environment (getArgs) | |
data ReportEntry = ReportEntry |
OlderNewer