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
*Main> concat $ take 10 $ repeat ",.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/" | |
",.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/,.,.,.,.,.,/,.,.,.,.,.,.,.,./.,.,.,.,.,.,.,.,.,.,/" | |
*Main> |
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 CountLines where | |
import System.Environment | |
main = do | |
args <- getArgs | |
file <- readFile $ head args | |
putStrLn $ show $ length $ lines file |
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
splitDigits :: String -> [Int] | |
splitDigits = map digitToInt | |
addNum :: String -> Int | |
addNum = foldl' (+) 0 . splitDigits |
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
splitDigits :: String -> [Int] | |
splitDigits = map digitToInt | |
addNum :: Int -> Int | |
addNum = foldl' (+) 0 . splitDigits . show |
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
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 |
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 Control.Monad | |
import Data.List | |
import Data.Char | |
import System.IO | |
getSecondWord = head . tail . words | |
getLastWord = last . words |
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
countLetters = length . filter (/= ' ') |
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 Control.Monad | |
import Data.List | |
import Data.Char | |
import System.IO | |
import Text.Regex.Posix | |
import Text.Regex | |
getSecondWord = head . tail . words |
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
countLetters xs = | |
length $ filter (/= ' ') $ subRegex (mkRegex "[^aA-zZ]") 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 Control.Monad | |
import Data.List | |
import Data.Char | |
import System.IO | |
import Text.Regex.Posix | |
import Text.Regex | |
getSecondWord :: String -> String |