{"id":17446171,"url":"https://github.com/markus1189/anagramskata","last_synced_at":"2025-03-28T03:28:52.357Z","repository":{"id":4986631,"uuid":"6144658","full_name":"markus1189/AnagramsKata","owner":"markus1189","description":"The Anagrams Kata from Dave Thomas","archived":false,"fork":false,"pushed_at":"2012-10-09T17:26:27.000Z","size":484,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T04:44:02.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"quidmonkey/Canvas-Native-Fonts-Plugin","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markus1189.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-09T17:25:00.000Z","updated_at":"2019-12-05T06:32:32.000Z","dependencies_parsed_at":"2022-08-30T04:53:14.892Z","dependency_job_id":null,"html_url":"https://github.com/markus1189/AnagramsKata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markus1189%2FAnagramsKata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markus1189%2FAnagramsKata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markus1189%2FAnagramsKata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markus1189%2FAnagramsKata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markus1189","download_url":"https://codeload.github.com/markus1189/AnagramsKata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245965910,"owners_count":20701739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T18:22:47.236Z","updated_at":"2025-03-28T03:28:52.327Z","avatar_url":"https://github.com/markus1189.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Kata Six: Anagrams\n\nBack to non-realistic coding this week (sorry, Martin). Let's solve some\ncrossword puzzle clues.\n\nIn England, I used to waste hour upon hour doing newspaper crosswords.\nAs crossword fans will know, English cryptic crosswords have a totally\ndifferent feel to their American counterparts: most clues involve\npunning or word play, and there are lots of anagrams to work through.\nFor example, a recent Guardian\n[crossword](http://www.guardian.co.uk/crossword/java/blank/0,7082,-5903,00.html)\nhad:\n\n      Down:\n        ..\n        21. Most unusual form of arrest (6)\n\nThe hint is the phrase ‘form of,’ indicating that we’re looking for an\nanagram. Sure enough ‘arrest’ has six letters, and can be arranged\nnicely into ‘rarest,’ meaning ‘most unusual.’ (Other anagrams include\nraster, raters, Sartre, and starer)\n\nA while back we had a thread on the Ruby mailing list about finding\nanagrams, and I’d like to resurrect it here. The challenge is fairly\nsimple: given a file containing one word per line, print out all the\ncombinations of words that are anagrams; each line in the output\ncontains all the words from the input that are anagrams of each other.\nFor example, your program might include in its output:\n\n      kinship pinkish\n      enlist inlets listen silent\n      boaster boaters borates\n      fresher refresh\n      sinks skins\n      knits stink\n      rots sort\n\nIf you run this on the word list\n[here](http://pragdave.pragprog.com/data/wordlist.txt) you should find\n2,530 sets of anagrams (a total of 5,680 words). Running on a larger\ndictionary (about 234k words) on my OSX box produces 15,048 sets of\nanagrams (including all-time favorites such as actaeonidae/donatiaceae,\ncrepitant/pittancer, and (for those readers in Florida)\nelectoral/recollate).\n\nFor added programming pleasure, find the longest words that are\nanagrams, and find the set of anagrams containing the most words (so\n\"parsley players replays sparely\" would not win, having only four words\nin the set).\n\nKata Objectives\n---------------\n\nApart from having some fun with words, this kata should make you think\nsomewhat about algorithms. The simplest algorithms to find all the\nanagram combinations may take inordinate amounts of time to do the job.\nWorking though alternatives should help bring the time down by orders of\nmagnitude. To give you a possible point of comparison, I hacked a\nsolution together in 25 lines of Ruby. It runs on the word list from my\nweb site in 1.5s on a 1GHz PPC. It’s also an interesting exercise in\ntesting: can you write unit tests to verify that your code is working\ncorrectly before setting it to work on the full dictionary.\n\nPosted at 05:56 PM |\n[Permalink](http://codekata.pragprog.com/2007/01/kata_six_anagra.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkus1189%2Fanagramskata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkus1189%2Fanagramskata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkus1189%2Fanagramskata/lists"}