-
Notifications
You must be signed in to change notification settings - Fork 0
Jpere838 hw1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: EdwardBranch
Are you sure you want to change the base?
Jpere838 hw1 #1
Conversation
jalvarado91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Small additions
| /// 2. Powerset set returns the set of all subsets of set | ||
| let rec powerset = function | ||
| | [] -> [[]] | ||
| | x::xs -> List.collect (fun subset -> [subset; x::subset]) (powerset xs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill the indents
let rec powerset = function
| [] -> [[]]
| x::xs -> List.collect (fun subset -> [subset; x::subset]) (powerset xs)| /// 3. Transpose an m-by-n matrix | ||
| let rec transpose = function | ||
| | (_::_)::_ as M -> List.map List.head M :: transpose (List.map List.tail M) | ||
| | _ -> [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
let rec transpose = function
| (_::_)::_ as M -> List.map List.head M :: transpose (List.map List.tail M)
| _ -> []| Step Three: Each recursive call gets an input that is smaller than the original input | ||
|
|
||
| Clue something is wrong: The mergesort function is missing a case, which causes mergesort to be seen by | ||
| the compiler as 'a list -> 'b list instead of 'a list -> 'a list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... list instead of 'a list -> 'a list which tells us our merge sort is returning a list of items of a different type than given, which shouldn't be the case as we're simply sorting the elements.
No description provided.