LamdaCalculusV2

This commit is contained in:
Johannes Merl
2024-05-07 14:58:00 +02:00
parent d5fe65ab8c
commit 17b64f263b
10 changed files with 676 additions and 13189 deletions

View File

@@ -4,7 +4,6 @@
import Options.Applicative
import Pipes
import Pretty
import Protolude hiding (for)
import System.IO
import Seminar
@@ -65,6 +64,6 @@ main =
where
format seminarL s = do
let f = fitness' seminarL s
putErrText $ show f <> "\n" <> pretty s
putErrText $ show f <> "\n" <> output (AssignmentEnviroment (students prios, topics prios)) s
logCsv = putText . csv
csv (t, f) = show t <> " " <> show f

View File

@@ -107,6 +107,14 @@ instance Pretty AssignmentEnviroment where
pretty (AssignmentEnviroment (persons,assignables)) = "Persons: " <> show persons <> " Assignables: " <> show assignables
instance Environment Assignment AssignmentEnviroment where
output _ a =
T.unlines (gene <$> a)
where
gene :: (Maybe Student, Maybe Topic) -> Text
gene (s, t) =
pretty s <> ": " <> pretty t
new (AssignmentEnviroment (persons,assignables)) = do
let aPadding = replicate (length persons - length assignables) Nothing
let paddedAssignables = (Just <$> assignables) ++ aPadding
@@ -139,14 +147,6 @@ instance Environment Assignment AssignmentEnviroment where
f x v1 v2 i = if i <= x then v1 else v2
instance Pretty Assignment where
pretty (a) =
T.unlines (gene <$> a)
where
gene :: (Maybe Student, Maybe Topic) -> Text
gene (s, t) =
pretty s <> ": " <> pretty t
-- |
-- The priority value given by a student to a topic including the case of her not
-- receiving a topic.