Sha256: 825fcbd0a1b6547f053c8587ee7c955fab68d0c4ec888094011458741a537d1e

Contents?: true

Size: 621 Bytes

Versions: 262

Compression:

Stored size: 621 Bytes

Contents

module BracketPush

open System

let matched (input: string) =
    let brackets = "[]{}()" |> Set.ofSeq
    let filtered = input.ToCharArray() |> Array.filter brackets.Contains |> String
    let replaceMatchingBrackets (str: string) = str.Replace("[]", "").Replace("{}", "").Replace("()", "")
    
    let rec loop (remaining: string) =
        match remaining.Length with
        | 0 -> true
        | _  -> 
            let updated = replaceMatchingBrackets remaining
            match updated.Length = remaining.Length with
            | true -> false
            | false -> loop updated
        
    loop filtered

Version data entries

262 entries across 262 versions & 1 rubygems

Version Path
trackler-2.2.1.44 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.43 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.42 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.41 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.40 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.39 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.38 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.37 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.36 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.35 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.34 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.33 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.32 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.31 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.30 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.29 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.28 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.27 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.26 tracks/fsharp/exercises/bracket-push/Example.fs
trackler-2.2.1.25 tracks/fsharp/exercises/bracket-push/Example.fs