Skip to content

Instantly share code, notes, and snippets.

@Jannis
Created June 24, 2016 15:30
Show Gist options
  • Select an option

  • Save Jannis/0e6d68d192898c176223d0cc726a3af7 to your computer and use it in GitHub Desktop.

Select an option

Save Jannis/0e6d68d192898c176223d0cc726a3af7 to your computer and use it in GitHub Desktop.
(ns workflo.macros.command
(:require [clojure.spec :as s]
[clojure.spec.gen :as gen]))
(s/def ::command-name
symbol?)
(s/def ::command-description
string?)
(s/def ::command-query
::s/any)
(s/def ::command-data-spec
(s/with-gen
s/spec?
#(s/gen #{(s/spec symbol?)
(s/spec map?)})))
(s/def ::command-inputs
(s/tuple (s/? ::command-query) ::command-data-spec))
(s/def ::command-form
seq?)
(s/def ::command-implementation
seq?)
(s/fdef defcommand
:args (s/cat :name ::command-name
;; :description (s/? ::command-description)
;; :inputs ::command-inputs
;; :forms (s/* ::command-form)
;; :implementation ::command-implementation
)
:ret ::s/any)
(defmacro defcommand
[name & forms]
(println "NAME" name)
(println "FORMS" forms))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment