Skip to content

Instantly share code, notes, and snippets.

@bhyde
Last active August 29, 2015 13:56
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 bhyde/9234205 to your computer and use it in GitHub Desktop.
Save bhyde/9234205 to your computer and use it in GitHub Desktop.
(defvar *variable-memory* (make-hash-table :test #'equal))
(fare-memoization:define-memo-function (intern-variable :table *variable-memory*) (name variable-specs)
(flet ((field? (n)
(cdr (assoc n variable-specs))))
(make-instance 'variable
:name (json:lisp-to-camel-case (symbol-name name))
:concept? (field? :concept)
:label (field? :label))))
(defun make-variable (dataset name variable-specs)
(let ((v (intern-variable name variable-specs)))
(pushnew dataset (appears-in v))
v))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment