Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.32 KB

README.md

File metadata and controls

41 lines (29 loc) · 1.32 KB

str-named

str-named is a Clojure function used to stringify values, some of which may implement clojure.lang.Named, such as keywords. I found the need to constantly rewrite this function, or a variant of this function, with every new Clojure project. I finally decided to move str-named into a library instead. It seems that some other Clojure projects similarly define such a function.

Installation

Add the following dependency to your project.clj file:

[str-named "1.0.0"]

Usage

str-named can be used as you would clojure.core/str:

(ns project.core
  (:require
    [str-named.core :refer [str-named]]))
    
(str-named 10 \- :keyword)
;=> "10-keyword"

Any arguments to str-named which implement clojure.lang.Named, such as keywords, will have (name value) used to produce the string representation of the value instead of (str value). All other values will have their string representation produced by calling (str value) as with clojure.core/str.

License

Copyright © 2013 Chris LaVoie

Distributed under the Eclipse Public License, the same as Clojure.