This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns cljcks.hiccup | |
| (:require [clojure.string :as s])) | |
| (defn render-attr [[key value]] (str (name key) "=\"" value "\"")) | |
| (defn render-attrs [attrs] | |
| (s/join " " (map render-attr (seq attrs)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class StringMeta(type): | |
| def __getattr__(cls, name): | |
| return name | |
| class e(metaclass=StringMeta): | |
| pass | |
| def render_attrs(attrs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import reduce, partial | |
| def comp(func1, *others): | |
| """ | |
| Inspired by Clojure function (comp) | |
| Accepts positional arguments - functions | |
| Creates functional composition of functions. Allows to pack nested functions call to single function: | |
| result = f1(f2(f3(f4(args, kwargs)))) |