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
test :: [Int] -> [Int] | |
test [] = [] | |
test (x:xs) | |
| even x = x : test xs | |
| otherwise = test xs |
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
even :: Int -> Bool | |
even x = x `mod` 2 == 0 | |
test :: [Int] -> [Int] | |
test xs = filter even xs |
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
{-# INLINE filter #-} |
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
test :: [Int] -> [Int] | |
test [] = [] | |
test (x:xs) | |
| x `mod` 2 == 0 = x : test xs | |
| otherwise = test xs |
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
test :: [Int] -> [Int] | |
test xs = filter (\x -> x `mod` 2 == 0) xs |
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
filter :: (a -> Bool) -> [a] -> [a] | |
filter p = go | |
where | |
go [] = [] | |
go (x:xs) | |
| p x = x : go xs | |
| otherwise = go xs |
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
filter :: (a -> Bool) -> [a] -> [a] | |
filter _ [] = [] | |
filter p (x:xs) | |
| p x = x : filter p xs | |
| otherwise = filter p xs |
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
member :: Int -> [Int] -> Bool | |
member n = go | |
where | |
go [] = False | |
go (x:xs) | |
| x == n = True | |
| otherwise = go xs |
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
member :: Int -> [Int] -> Bool | |
member _ [] = False | |
member n (x:xs) | |
| x == n = True | |
| otherwise = member n xs |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import qualified Data.ByteString.Lazy as S | |
import qualified Data.Text as T | |
import qualified Data.Text.Lazy.Encoding as E | |
import Data.Text.Template |