Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active August 29, 2017 07:06
Show Gist options
  • Save trikitrok/a97d330bacb1f56fe5ee027c12ff273a to your computer and use it in GitHub Desktop.
Save trikitrok/a97d330bacb1f56fe5ee027c12ff273a to your computer and use it in GitHub Desktop.
Camels, snakes, pascals and kebabs kata

Write a code that change keywords between different naming conventions.

Examples:

(format :hello-koko :using :camel-case) -> :helloKoko

(format :hello-koko :using :snake-case) -> :hello_koko

(format :hello-koko :using :pascal-case) -> :HelloKoko

(format :hello-koko :using :kebab-case) -> :hello-koko

(format :helloKoko :using :kebab-case) -> :hello-koko

...

The same for keywords in any data structure:

(format [:hello-koko :hello_koko] :using :camel-case) -> [:helloKoko :helloKoko]

(format #{:hello-koko :hello_koko} :using :camel-case) -> #{:helloKoko}

(format {:hello-koko 1 :HelloLolo :hello_koko} :using :camel-case) -> {:helloKoko 1 :helloLolo :helloKoko}

...

It must also work for nested data structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment