commit f4fa590833f3b5fccef401d9970e45014cbe53b8 Author: Felix Van der Jeugt Date: Mon Nov 29 11:34:50 2021 +0100 initial commit diff --git a/Day00/Part1.hs b/Day00/Part1.hs new file mode 100644 index 0000000..d3a5b90 --- /dev/null +++ b/Day00/Part1.hs @@ -0,0 +1,7 @@ +import System.IO (readFile) +import System.Environment (getArgs) + +main :: IO () +main = do [_, _, file] <- getArgs + (_:numbers) <- map (read :: String -> Int) . lines <$> readFile file + putStrLn $ show (minimum numbers) ++ " " ++ show (maximum numbers) diff --git a/clean b/clean new file mode 100755 index 0000000..e077475 --- /dev/null +++ b/clean @@ -0,0 +1,8 @@ +#!/bin/sh +day="$1" +part="$2" + +day="$(printf '%02d' "$day")" + +rm -f ./run +rm -f "Day${1}/Part${2}.hi" "Day${1}/Part${2}.o" diff --git a/inputs/00-1.txt b/inputs/00-1.txt new file mode 100644 index 0000000..a1e3fbb --- /dev/null +++ b/inputs/00-1.txt @@ -0,0 +1,6 @@ +5 +10 +20 +5 +123 +0 diff --git a/prepare b/prepare new file mode 100755 index 0000000..6f493f9 --- /dev/null +++ b/prepare @@ -0,0 +1,10 @@ +#!/bin/sh +day="$1" +part="$2" + +day="$(printf '%02d' "$day")" + +if test -f "Day${day}/Part${part}.hs"; then + #stack build + stack ghc -- -O3 "Day${day}/Part${part}.hs" -o run +fi