diff --git a/Makefile b/Makefile index 9e8e11c..32afd30 100644 --- a/Makefile +++ b/Makefile @@ -172,5 +172,5 @@ $(SHELLCHECK_DIR): $(SHELLCHECK_TAR) tar xf $< $(SHELLCHECK_TAR): - wget --quiet $(SHELLCHECK_RELEASE) + curl -sSOL $(SHELLCHECK_RELEASE) endif diff --git a/config.json b/config.json index b0d1a3d..2b4b28b 100644 --- a/config.json +++ b/config.json @@ -62,6 +62,14 @@ "practices": [], "prerequisites": [], "difficulty": 1 + }, + { + "slug": "isogram", + "name": "Isogram", + "uuid": "4e43c38f-500e-4f56-a502-91cbc1bade5f", + "practices": [], + "prerequisites": [], + "difficulty": 1 } ] }, diff --git a/config.yaml b/config.yaml index be63cf0..c350a12 100644 --- a/config.yaml +++ b/config.yaml @@ -67,6 +67,13 @@ exercises: prerequisites: [] difficulty: 1 + - slug: isogram + name: Isogram + uuid: 4e43c38f-500e-4f56-a502-91cbc1bade5f + practices: [] + prerequisites: [] + difficulty: 1 + tags: - execution_mode/compiled - execution_mode/interpreted diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md new file mode 100644 index 0000000..2e8df85 --- /dev/null +++ b/exercises/practice/isogram/.docs/instructions.md @@ -0,0 +1,14 @@ +# Instructions + +Determine if a word or phrase is an isogram. + +An isogram (also known as a "non-pattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. + +Examples of isograms: + +- lumberjacks +- background +- downstream +- six-year-old + +The word _isograms_, however, is not an isogram, because the s repeats. diff --git a/exercises/practice/isogram/.meta/config.json b/exercises/practice/isogram/.meta/config.json new file mode 100644 index 0000000..e8365d7 --- /dev/null +++ b/exercises/practice/isogram/.meta/config.json @@ -0,0 +1,20 @@ +{ + "authors": [ + "ingydotnet" + ], + "files": { + "solution": [ + "isogram.ys" + ], + "test": [ + "test/test-1.ys", + "Makefile" + ], + "example": [ + ".meta/isogram.ys" + ] + }, + "blurb": "Determine if a word or phrase is an isogram.", + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Isogram" +} diff --git a/exercises/practice/isogram/.meta/isogram.ys b/exercises/practice/isogram/.meta/isogram.ys new file mode 100644 index 0000000..4f4f60e --- /dev/null +++ b/exercises/practice/isogram/.meta/isogram.ys @@ -0,0 +1,10 @@ +!yamlscript/v0 + +# A function to check if a string is composed of all unique letters: +defn isogram?(string): + if empty?(string) true: + string + .lower-case() \#"Want to be case insensitive" + .split('') \#"Split string into chars" + .filter(\(re-matches /\w/ %1)) \#"Keep letters only" + .apply(distinct?) \#"Check if distinct letters" diff --git a/exercises/practice/isogram/.meta/test b/exercises/practice/isogram/.meta/test new file mode 120000 index 0000000..419df4f --- /dev/null +++ b/exercises/practice/isogram/.meta/test @@ -0,0 +1 @@ +../test \ No newline at end of file diff --git a/exercises/practice/isogram/.meta/tests.toml b/exercises/practice/isogram/.meta/tests.toml new file mode 100644 index 0000000..ba04c66 --- /dev/null +++ b/exercises/practice/isogram/.meta/tests.toml @@ -0,0 +1,52 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[a0e97d2d-669e-47c7-8134-518a1e2c4555] +description = "empty string" + +[9a001b50-f194-4143-bc29-2af5ec1ef652] +description = "isogram with only lower case characters" + +[8ddb0ca3-276e-4f8b-89da-d95d5bae78a4] +description = "word with one duplicated character" + +[6450b333-cbc2-4b24-a723-0b459b34fe18] +description = "word with one duplicated character from the end of the alphabet" + +[a15ff557-dd04-4764-99e7-02cc1a385863] +description = "longest reported english isogram" + +[f1a7f6c7-a42f-4915-91d7-35b2ea11c92e] +description = "word with duplicated character in mixed case" + +[14a4f3c1-3b47-4695-b645-53d328298942] +description = "word with duplicated character in mixed case, lowercase first" + +[423b850c-7090-4a8a-b057-97f1cadd7c42] +description = "hypothetical isogrammic word with hyphen" + +[93dbeaa0-3c5a-45c2-8b25-428b8eacd4f2] +description = "hypothetical word with duplicated character following hyphen" + +[36b30e5c-173f-49c6-a515-93a3e825553f] +description = "isogram with duplicated hyphen" + +[cdabafa0-c9f4-4c1f-b142-689c6ee17d93] +description = "made-up name that is an isogram" + +[5fc61048-d74e-48fd-bc34-abfc21552d4d] +description = "duplicated character in the middle" + +[310ac53d-8932-47bc-bbb4-b2b94f25a83e] +description = "same first and last characters" + +[0d0b8644-0a1e-4a31-a432-2b3ee270d847] +description = "word with duplicated character and with two hyphens" diff --git a/exercises/practice/isogram/Makefile b/exercises/practice/isogram/Makefile new file mode 100644 index 0000000..1560b4b --- /dev/null +++ b/exercises/practice/isogram/Makefile @@ -0,0 +1,9 @@ +SHELL := bash + +export YSPATH=$(PWD) + +default: + +.PHONY: test +test: + prove -v test/*.ys diff --git a/exercises/practice/isogram/isogram.ys b/exercises/practice/isogram/isogram.ys new file mode 100644 index 0000000..bbe5a60 --- /dev/null +++ b/exercises/practice/isogram/isogram.ys @@ -0,0 +1,7 @@ +!yamlscript/v0 + +# (ns isogram) + +# (defn isogram? [] ;; <- arglist goes here +# ;; your code goes here +# ) diff --git a/exercises/practice/isogram/test/test-1.ys b/exercises/practice/isogram/test/test-1.ys new file mode 100644 index 0000000..c68836c --- /dev/null +++ b/exercises/practice/isogram/test/test-1.ys @@ -0,0 +1,78 @@ +#!/usr/bin/env ys-0 + +require ys::taptest: :all + +use: isogram + +test:: +- name: Empty string + code: isogram?("") + want: true + uuid: a0e97d2d-669e-47c7-8134-518a1e2c4555 + +- name: Isogram with only lower case characters + code: isogram?('isogram') + want: true + uuid: 9a001b50-f194-4143-bc29-2af5ec1ef652 + +- name: Word with one duplicated character + code: isogram?('eleven') + want: false + uuid: 6450b333-cbc2-4b24-a723-0b459b34fe18 + +- name: Word with one duplicated character from the end of the alphabet + code: isogram?('zzyzx') + want: false + uuid: 6450b333-cbc2-4b24-a723-0b459b34fe18 + +- name: Word with duplicated character in mixed case + code: isogram?('Alphabet') + want: false + uuid: f1a7f6c7-a42f-4915-91d7-35b2ea11c92e + +- name: Word with duplicated character in mixed case, lowercase first + code: isogram?('alphAbet') + want: false + uuid: 14a4f3c1-3b47-4695-b645-53d328298942 + +- name: Hypothetical isogrammic word with hyphen + code: isogram?('thumbscrew-japingly') + want: true + uuid: 423b850c-7090-4a8a-b057-97f1cadd7c42 + +- name: Hypothetical word with duplicated character following hyphen + code: isogram?('thumbscrew-jappingly') + want: false + uuid: 93dbeaa0-3c5a-45c2-8b25-428b8eacd4f2 + +- name: Isogram with duplicated hyphen + code: isogram?('six-year-old') + want: true + uuid: 36b30e5c-173f-49c6-a515-93a3e825553f + +- name: Made-up name that is an isogram + code: isogram?('Emily Jung Schwartzkopf') + want: true + uuid: cdabafa0-c9f4-4c1f-b142-689c6ee17d93 + +- name: Duplicated character in the middle + code: isogram?('accentor') + want: false + uuid: 5fc61048-d74e-48fd-bc34-abfc21552d4d + +- name: Same first and last characters + code: isogram?('angola') + want: false + uuid: 310ac53d-8932-47bc-bbb4-b2b94f25a83e + +- name: Word with duplicated character and with two hyphens + code: isogram?('up-to-date') + want: false + uuid: 0d0b8644-0a1e-4a31-a432-2b3ee270d847 + +- name: Longest reported english isogram + code: isogram?("subdermatoglyphic") + want: true + uuid: a15ff557-dd04-4764-99e7-02cc1a385863 + +done: