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.1 tracks/ocaml/exercises/anagram/example.ml
trackler-2.1.0.0 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.55 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.54 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.53 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.52 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.51 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.50 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.49 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.48 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.47 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.46 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.45 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.44 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.43 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.42 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.41 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.40 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.39 tracks/ocaml/exercises/anagram/example.ml
trackler-2.0.8.38 tracks/ocaml/exercises/anagram/example.ml