Sha256: 1c99751ae99f26388f0f3e2f537aad6c7be18a695154b3c1d69e206c0b0c56be

Contents?: true

Size: 392 Bytes

Versions: 177

Compression:

Stored size: 392 Bytes

Contents

open Core.Std

let to_sorted_list s = String.to_list s |> List.sort ~cmp:Char.compare

let anagrams target candidates =
  let target_lc = String.lowercase target in
  let target_sorted = to_sorted_list target_lc in
  List.map ~f:(fun c -> (c, String.lowercase c)) candidates
  |> List.filter ~f:(fun (_, lc) ->
      to_sorted_list lc = target_sorted && lc <> target_lc)
  |> List.map ~f:fst

Version data entries

177 entries across 177 versions & 1 rubygems

Version Path
trackler-2.1.0.21 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.20 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.19 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.18 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.17 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.16 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.15 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.14 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.13 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.12 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.11 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.10 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.9 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.8 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.7 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.6 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.5 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.4 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.3 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.2 tracks/ocaml/exercises/anagram/example.ml