Sha256: 77425ee0d2573dd189e967620b9b24c039b0473e32c1d4a3ff3511a66fc8b8e3

Contents?: true

Size: 520 Bytes

Versions: 396

Compression:

Stored size: 520 Bytes

Contents

(define-module (anagram)
  #:export (anagrams-for))

;; Credit where credit is due: example borrows heavily
;; from xlisp/anagram

(define anagram-equal
  (lambda (a b)
    (let ((sorted-string
           (lambda (s)
             (apply string (sort (string->list s) char-ci<?)))))
      (and
       (string-ci=? (sorted-string a)
                 (sorted-string b))
       (not (string-ci=? a b))))))

(define anagrams-for
  (lambda (subject candidates)
    (filter (lambda (w) (anagram-equal w subject)) candidates)))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.179 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.178 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.177 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.176 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.175 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.174 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.173 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.172 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.171 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.170 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.169 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.167 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.166 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.165 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.164 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.163 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.162 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.161 tracks/scheme/exercises/anagram/example.scm
trackler-2.2.1.160 tracks/scheme/exercises/anagram/example.scm