
Hi
I'm working on a project for my university. But I do not understand the assignment.
If you don't understand a university assignment the best place to ask is the person who set the assignment. If you don't understand what is being asked, most lecturers will provide clarification.
It asks me to write a function that does the following:
grayCode :: Int -> ([Char] -> Int, Int -> [Char])
well in my opinion this assignment tells me to write some function that gets one input (an integer) and result two functions in one tuple. One function goes from [Char] to Int and the other one goes from Int to [Char].
But in my opinion this function will stay the same forever... am I mistaken?
What do you mean by stay the same forever? Haskell is referentially transparent and pure so all functions always return the same results for the same input.
Write an efficient code
grayCode :: Int -> ([Char] -> Int, Int -> [Char])
that, for values between 2 and 36 (included), creates a Gray Code. That is, a tuple of two functions.
That seems a reasonable description, but without checking with the person who set the test, you may never know for sure. I personally can't see any difference between your second version and the original question... Thanks Neil