Skip to content

Instantly share code, notes, and snippets.

@rothfield
Forked from anonymous/core.clj
Created November 26, 2013 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rothfield/7667730 to your computer and use it in GitHub Desktop.
Save rothfield/7667730 to your computer and use it in GitHub Desktop.
(ns doremi_script_clojure.core
[doremi_script_clojure.to_lilypond :refer [to-lilypond]]
[clojure.java.io :refer [input-stream resource]]
[clojure.data.json :as json]
[clojure.pprint :refer [pprint]]
))
(defn -json_text_to_lilypond[txt]
"Takes parsed doremi-script json data as text"
"Returns lilypond text"
(to-lilypond (json/read-str txt)))
;;
(ns doremi_script_clojure.to_lilypond
(:require
[clojure.pprint :refer [pprint]]
[clabango.parser :refer [render]]
[clojure.java.io :refer [resource]]
[clojure.string :refer [split lower-case]]
))
(defn to-lilypond[x]
"Takes parsed doremi-script and returns lilypond text"
(render (-> "lilypond_templates/lilypond.txt" resource slurp) x))
@rothfield
Copy link
Author

In Haskell I would change the signature of to-lilypond to take the template as an argument. Does the same apply to Clojure?

@bitemyapp
Copy link

I do Haskell and Clojure, mostly Clojure atm. I would agree, it should be taking the template as an argument. Use more descriptive arguments too.

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