module Main (main) where import TestUtils import EvalIntExpr (testEvalIntExpr) import…
- User
module Main (main) where
import TestUtils import EvalIntExpr (testEvalIntExpr) import EvalIdExpr (testEvalIdExpr) import EvalMaybeExpr (testEvalMaybeExpr) import PostfixExpr (testPostfixExpr)
-- Implement toSingletonLists using map toSingletonLists :: [e] -> [[e]] toSingletonLists xs = map (:[]) xs
-- Implement listMap using list comprehension listMap :: (a -> b -> c) -> a -> [b] -> [c] listMap f a xs = [f a x | x <- xs]
-- Implement member using foldl member :: Eq e => e -> [e] -> Bool member e xs = goFalse xs where goFalse ys = foldl (\acc y -> acc || (y == e)) False ys
-- Implement selectNApart using drop selectNApart :: Int -> [e] -> [e] selectNApart n [] = [] selectNApart n xs = head part ++ selectNApart n rest where (part, rest) = splitAt (min n (length xs)) xs
-- Rewritten tests after implementing functions tests = [ ("Test toSingletonLists", testToSingletonLists), ("Test listMap", testListMap), ("Test member", testMember), ("Test selectNApart", testSelectNApart), ("Test EvalIntExpr", testEvalIntExpr), ("Test EvalIdExpr", testEvalIdExpr), ("Test EvalMaybeExpr", testEvalMaybeExpr), ("Test PostfixExpr", testPostfixExpr) ]
-- Set all tests to Run allTests = [ (Run testToSingletonLists), (Run testListMap), (Run testMember), (Run testSelectNApart), (Run testEvalIntExpr), (Run testEvalIdExpr), (Run testEvalMaybeExpr), (Run testPostfixExpr) ]
main = do mapM_ id tests where only = onlyTests allTests tests = if (length only > 0) then only else runTests allTests I will provide you with some functions and you need to implement them in this program
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.