Skip to content

Conversation

@R4il
Copy link
Collaborator

@R4il R4il commented Oct 11, 2017

No description provided.

Copy link
Collaborator

@jalvarado91 jalvarado91 left a 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)
Copy link
Collaborator

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)
| _ -> []
Copy link
Collaborator

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants