你应该试着找到一个简单的解决方案。你不必找到最简单的解决方案就能获得满分,但你不应该有一个过于复杂的解决方案。如果您的解决方案过于复杂,则可能会扣除分数。如果您担心您的解决方案是否过于复杂,请联系指导老师。小心使用库函数Haskell有一个相当大的内置库。这项任务不是关于如何找到库函数,而是关于如何使用Haskell的一些核心功能。如果你只调用一个解决整个问题的库函数,你不会得到很多分数。重点是自己解决问题。如果您不确定是否调用了解决整个问题的库函数,请联系讲师。请注意,如果我们建议使用库函数,您当然可以使用它。(我知道避免这个问题的唯一方法是处理复杂和任意的问题,这样就没有库函数可以解决它们。我不喜欢解决复杂和任意问题,你可能也不喜欢。)重要事项:您的文件必须编译您的文件必须成功加载(:在GHCi中加载),否则我们将从您的分数中减去30%。如果你已经解决了一半的问题,时间不够了,请注释掉导致加载失败的代码:用{–…–}包围它,并写一条注释来描述你试图做的事情。我们通常可以给出(部分)标记来证明解决方案的进展
CISC 360 Assignment 2
1.Strive for simplicity
You should try to find a simple solution. You do not have to find the simplest solution to get full marks, but you should not have an excessively complicated solution. Marks may be deducted if your solution is too complicated. If you are worried about whether your solution is too complicated,contact the instructor.
Be careful with library functionsHaskell has a rather large built-in library. This assignment is not about how to find library functions,but about how to use some of the core features of Haskell. You will not receive many marks if you just call a library function that solves the whole problem. The point is to solve the problem yourself.If you are not sure whether you are calling a library function that solves the whole problem,contact the instructor. Note that if we suggest a library function, you may certainly use it.
(The only way I know to avoid this issue is to craft problems that are complicated and arbitrary,such that no library function can possibly solve them. I don’t like solving complicated and arbitrary problems, and you probably don’t either.)IMPORTANT: Your file must compileYour file must load (:load in GHCi) successfully, or we will subtract 30% from your mark.If you are halfway through a problem and run out of time, comment out the code that is causing :load to fail by surrounding it with {– . . . –}, and write a comment describing what you were trying to do. We can often give (partial) marks for evidence of progress towards a solution,but we need the file to load and compile.If you choose to work in a group of 2You must use version control (such as GitHub, GitLab, Bitbucket, etc.). This is primarily to help you maintain an equitable distribution of work, because commit logs provide information about the members’ level of contribution.Your repository must be private—otherwise, anyone who has your GitHub (etc.) username can copy your code, which would violate academic integrity. However, upon request from the course staff, you must give us access to your repository. (You do not need to give us access unless we ask.)We only need one submission of the assignment. However, each of you must submit a brief statement.
Give your names and student ID numbers.Estimate the number of hours you spent on the assignment.Briefly describe your contribution, and your teammate’s contribution. (Coding, trying to understand the assignment, testing, etc.)This is meant to ensure that both group members reflect on their relative contributions.If you do not submit a statement, you will not receive an assignment mark. This is meant to ensure that each group member is at least involved enough to submit a statement. Each member must submit a statement.Add your student IDThe file a2.hs will not compile until you add your student You do not need to write your name. When we download your submission, onQ includes your name in the filename.If you are working in a group of 2, put the second student ID in a comment, like this:
student_id = 11112222 — 33334444
1 ‘rewrite’
Haskell has a built-in function ord, with the type
ord :: Char -> Int
When applied to a Char, the ord function returns the ASCII code corresponding to that Char.For example, ord ’A’ returns 65.Your task is to implement a function named rewrite. Given a String, rewrite returns a copy of that String with all “important” Chars duplicated.However, your employer keeps changing their mind about what is important, so the first argument to the function rewrite is a function that tells you whether a given character is important.For example, if the first argument passed to rewrite is divisible_by 5then every character whose ASCII code is evenly divisible by 5 is “important” and should be duplicated. (The function divisible_by isalready defined in a2.hs.)If the first argument passed to rewrite is
(\x -> (x == ’ ’))
then every space character (and only space characters) will be considered important.Some examples:
rewrite (divisible_by 5) “” should evaluate to “”
rewrite (\x -> x == ’ ’) “it’s a deed” should evaluate to “it’s a deed”
rewrite (divisible_by 5) “CombinatorFest” should evaluate to “CombiinnatorFFesst”
WX:codehelp
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。