Sha256: 5f786763069fdeb77c8116f15b52a9fd65d3e94558db68366b80edfd067f6b6d

Contents?: true

Size: 388 Bytes

Versions: 151

Compression:

Stored size: 388 Bytes

Contents

open Core

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

151 entries across 151 versions & 1 rubygems

Version Path
trackler-2.2.1.110 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.109 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.108 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.107 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.106 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.105 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.104 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.103 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.102 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.101 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.100 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.99 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.98 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.97 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.96 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.95 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.94 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.93 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.92 tracks/ocaml/exercises/anagram/example.ml
trackler-2.2.1.91 tracks/ocaml/exercises/anagram/example.ml