Snippets created by Hugh Gleaves

  • Lippert's Comma Challenge Revisited

    Stumbled upon this challenge and tried my hand: The original challenge calls for a string result, so there's no issue with converting the sequence to a list from the outset since we need to enumerate it completely anyway; had it insisted on returning a sequence my answer would be different. > commaize ["ABC"; "DEF"; "G"; "H"];; val it : string = "ABC, DEF, G and H"

    1 people like this

    Posted: 1 years ago by Hugh Gleaves

  • Strip HTML tags from a string

    Shows a recursive means of filtering out simple HTML tags from a string. This is ultimately a simple FSM with state transitions implemented by recursive invocations and a bool flag (in this simple case).

    0 people like this

    Posted: 11 months ago by Hugh Gleaves

  • Elegant Sum of digits

    Sums a sequence of decimal digits by repeatedly adding pairs of digits resulting in a single digit result.

    2 people like this

    Posted: 7 months ago by Hugh Gleaves