Skip to content

Instantly share code, notes, and snippets.

@wfarr
Created March 8, 2009 22:51
Show Gist options
  • Select an option

  • Save wfarr/75994 to your computer and use it in GitHub Desktop.

Select an option

Save wfarr/75994 to your computer and use it in GitHub Desktop.
;; Works for (yql-filter 'sampleQuery (yql desc flickr.places))
(defmacro yql-filter (symbol list)
"Filters any JSON returned from a `yql-send-request' call for the value(s)
associated to `symbol', where the JSON is `list'."
`(let ((result (yql-search-for-symbol ,symbol ,list)))
(if (or (typep result 'list)
(typep result 'string)
(typep result 'number))
result
(coerce result 'list))))
;; Doesn't work at all for (yql-filter sampleQuery (yql desc flickr.places)) OR with 'sampleQuery
(defmacro yql-filter (symbol list)
"Filters any JSON returned from a `yql-send-request' call for the value(s)
associated to `symbol', where the JSON is `list'."
`(let ((result (yql-search-for-symbol (quote ,symbol) ,list)))
(if (or (typep result 'list)
(typep result 'string)
(typep result 'number))
result
(coerce result 'list))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment