Skip to content

Instantly share code, notes, and snippets.

@agentultra
Created May 6, 2015 16:30
Show Gist options
  • Save agentultra/c516ba0ef739236f986e to your computer and use it in GitHub Desktop.
Save agentultra/c516ba0ef739236f986e to your computer and use it in GitHub Desktop.
borked up calling conventions
<{'color': 'red'}
/body><True
/body>⏎
(import sys)
(defn princ [the-string &optional [stream sys.stdout]]
(apply print [the-string] {"file" stream "end" ""}))
(defn print-tag [name &optional [closingp False] [stream sys.stdout] &kwargs attrs]
(princ "<" stream)
(if closingp (do (print closingp) (princ "/" stream)))
(princ (.lower name) stream)
(if (and attrs (not closingp))
(do (princ " " stream)
(princ (.join " "
(list-comp
(.format "{0}='{1}'" k v)
[[k v] (.items attrs)]))
stream)))
(princ ">" stream))
(defmain [&rest args]
(print-tag "body" {"color" "red"})
(apply print-tag ["body"] {"closingp" True}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment