Skip to content

Instantly share code, notes, and snippets.

View Raynes's full-sized avatar

Anthony Grimes Raynes

View GitHub Profile
*Main> concat $ take 10 $ repeat ",.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/"
",.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/"
*Main>
module CountLines where
import System.Environment
main = do
args <- getArgs
file <- readFile $ head args
putStrLn $ show $ length $ lines file
splitDigits :: String -> [Int]
splitDigits = map digitToInt
addNum :: String -> Int
addNum = foldl' (+) 0 . splitDigits
splitDigits :: String -> [Int]
splitDigits = map digitToInt
addNum :: Int -> Int
addNum = foldl' (+) 0 . splitDigits . show
Sub TakeVacation()
Dim Vacation As String
Dim Approved As String
If Approved = "Yes" Then
Vacation = "Is Approved"
Else : If Approved = "No" Then
Vacation = "Denied"
End If
End If
module Main where
import Control.Monad
import Data.List
import Data.Char
import System.IO
getSecondWord = head . tail . words
getLastWord = last . words
countLetters = length . filter (/= ' ')
module Main where
import Control.Monad
import Data.List
import Data.Char
import System.IO
import Text.Regex.Posix
import Text.Regex
getSecondWord = head . tail . words
countLetters xs =
length $ filter (/= ' ') $ subRegex (mkRegex "[^aA-zZ]") xs ""
module Main where
import Control.Monad
import Data.List
import Data.Char
import System.IO
import Text.Regex.Posix
import Text.Regex
getSecondWord :: String -> String