Skip to content

Commit d925d78

Browse files
committed
Consertos finais e makefile
Geração do compilado, conserto de problemas nos indices aleatórios e de buffering output.
1 parent 09b4ce3 commit d925d78

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ cabal.project.local~
2222
.HTF/
2323
.ghc.environment.*
2424

25-
testes
25+
testes
26+
main

DataHandler.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ base_treino_teste regs percent seed = (base_treino, base_teste)
2424
where
2525
base_treino = [ regs!!x | x <- drop n aleatorios]
2626
base_teste = [ regs!!x | x <- take n aleatorios]
27-
aleatorios = randomList tamanho seed (tamanho)
27+
aleatorios = randomList tamanho seed (tamanho - 1)
2828
n = truncate $ fromIntegral(tamanho*percent)/100.0
2929
tamanho = length regs
3030

main.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import CentroidClassifier
44
import NearestNeighbor
55
import ClassifierAnalysis
66
import Text.Printf
7+
import System.IO
8+
79

810
{-
911
Primeiro trabalho computacional de Programação Funcional em Haskell. Realiza o treinamento de dois classificadores
@@ -12,7 +14,9 @@ import Text.Printf
1214
-}
1315

1416
main :: IO ()
15-
main = do --leitura dos parametros de entrada
17+
main = do -- Impedir buffering para escrever todas as mensagens na tela
18+
hSetBuffering stdout NoBuffering
19+
--leitura dos parametros de entrada
1620
putStr("Forneca o nome do arquivo de entrada: ")
1721
entrada <- getLine
1822
putStr("Forneca o nome do arquivo de saida: ")

makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all: main.hs
2+
ghc -no-keep-hi-files -no-keep-o-files main.hs

0 commit comments

Comments
 (0)