Snippets created by Joel Huang

  • A Simple Implementation of Lazy Type

    A Simple Implementation of Lazy Type.

    3 people like this

    Posted: 8 years ago by Joel Huang

  • Insertion Sort on List

    A continuation function takes the result when it is computed. Here is an implementation of sorting on List via insertion.

    4 people like this

    Posted: 8 years ago by Joel Huang

  • Sum of Squares Monoid

    This snippet defines a computation builder that sums the squares of float values. It includes Combine, Zero, Yield, Delay, and For operations.

    2 people like this

    Posted: 8 years ago by Joel Huang

  • Formal Concept Analysis

    Formal Concept Analysis (FCA) is a method to determine cohesive groupings of functions and data structures, especially in program comprehension research. For example, consider an object set, O = {1,2,3,4,5,6,7,8,9,10}, and an attribute set, A = {composite,even,odd,prime,square}, we can build a lattice table that holds the relations between O and A.

    2 people like this

    Posted: 8 years ago by Joel Huang

  • An equilibrium list

    An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices. The following is an implementation of such equilibrium list (given the input is a list).

    1 people like this

    Posted: 8 years ago by Joel Huang

  • The Dominator of Array

    The dominator of array A is the value that occurs in more than half of the elements of A. It is a zero-indexed based array consisting of N integers (A [] with N length). To find the index array of the dominator from a A [], we can use a helpful function from Seq module call 'Seq.groupBy' to mitigate the implementation of a solution.

    4 people like this

    Posted: 8 years ago by Joel Huang