From 8208f03f822f5ef6ae71a35b0b0fb4e8b05d17f7 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Fri, 3 Apr 2015 23:12:35 +0200 Subject: [PATCH] added arguments --- Main.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Main.hs b/Main.hs index 5de1d1a..578094f 100644 --- a/Main.hs +++ b/Main.hs @@ -3,11 +3,15 @@ module Main where import CSVParser import Apriori import qualified Data.Set as Set +import System.Environment (getArgs) main :: IO() main = do - file <- readFile "out.csv" + args <- getArgs + let filename = head args + let threshold = read $ last args + file <- readFile filename case parseCSV file of Left _ -> putStrLn "Could not parse out.csv" - Right val -> mapM_ (\x -> putStrLn (show x ++ "(" ++ show (count table x) ++ ")")) (concat (frequentPatterns 0.6 table)) where + Right val -> mapM_ (\x -> putStrLn (show x ++ "(" ++ show (count table x) ++ ")")) (concat (frequentPatterns threshold table)) where table = map (ItemSet. Set.fromList .map Item) val