{"action":"created","issue":{"url":"https://api.github.com/repos/miner/herbert/issues/11","labels_url":"https://api.github.com/repos/miner/herbert/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/miner/herbert/issues/11/comments","events_url":"https://api.github.com/repos/miner/herbert/issues/11/events","html_url":"https://github.com/miner/herbert/issues/11","id":68939490,"number":11,"title":"NPE with nested sequences","user":{"login":"jcf","id":18374,"avatar_url":"https://avatars.githubusercontent.com/u/18374?v=3","gravatar_id":"","url":"https://api.github.com/users/jcf","html_url":"https://github.com/jcf","followers_url":"https://api.github.com/users/jcf/followers","following_url":"https://api.github.com/users/jcf/following{/other_user}","gists_url":"https://api.github.com/users/jcf/gists{/gist_id}","starred_url":"https://api.github.com/users/jcf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcf/subscriptions","organizations_url":"https://api.github.com/users/jcf/orgs","repos_url":"https://api.github.com/users/jcf/repos","events_url":"https://api.github.com/users/jcf/events{/privacy}","received_events_url":"https://api.github.com/users/jcf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-16T14:43:58Z","updated_at":"2015-04-16T15:20:42Z","closed_at":"2015-04-16T15:16:35Z","body":"Hi Steve,\r\n\r\nI think Herbert could come in really handy for validating some big Datomic transaction maps in a couple of my tests, and have setup a test namespace that uses schemas to make it easy to test types rather than values where I don't have deterministic output.\r\n\r\nI have encountered an NPE from [`miner.herbert.private/mkprb`](https://github.com/miner/herbert/blob/a5da8247501a419ddf95443634c60c5f250f435b/src/miner/herbert/private.clj#L79-L95) where `pred`, which is nil, is called.\r\n\r\nI can reproduce the NPE with the following schema and data. I have noticed the data doesn't match (order's wrong) but don't imaging that's the issue. Perhaps I'm using `pred` incorrectly?\r\n\r\n``` clj\r\n(def uuid? (partial instance? java.util.UUID))\r\n\r\n(def schema\r\n  [[:create-resource\r\n    [:resource/id '(pred uuid?)]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.001-00:00\"}]\r\n   [:create-resource\r\n    [:resource/id '(pred uuid?)]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.002-00:00\"}]\r\n   [:create-resource\r\n    [:resource/id '(pred uuid?)]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.003-00:00\"}]])\r\n```\r\n\r\n``` clj\r\n(def data\r\n  [[:create-resource\r\n    [:resource/id #uuid \"552fc7b3-8905-46fd-b50b-dd613c940504\"]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.003-00:00\"}]\r\n   [:create-resource\r\n    [:resource/id #uuid \"552fc7b3-5ffa-4eb8-b3ac-8e3b15bcead0\"]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.002-00:00\"}]\r\n   [:create-resource\r\n    [:resource/id #uuid \"552fc7b3-af79-489c-8eaf-09e3845106d0\"]\r\n    {:occurrence/place 281474976711832,\r\n     :occurrence/start-time #inst \"1970-01-01T00:00:00.001-00:00\"}]])\r\n```\r\n\r\n``` clj\r\n(miner.herbert/conforms? schema data)\r\n;; => NPE\r\n```\r\n\r\n```\r\n(pst)\r\nNullPointerException \r\n\tclojure.core/apply (core.clj:626)\r\n\tclojure.core/partial/fn--4228 (core.clj:2468)\r\n\tminer.herbert.private/mkprb/fn--70585 (private.clj:93)\r\n\tminer.herbert.private/mk-key/fn--70664 (private.clj:357)\r\n\tminer.herbert.private/mkmap/fn--70659/fn--70660 (private.clj:333)\r\n\tclojure.core.protocols/fn--6086 (protocols.clj:143)\r\n\tclojure.core.protocols/fn--6057/G--6052--6066 (protocols.clj:19)\r\n\tclojure.core.protocols/seq-reduce (protocols.clj:31)\r\n\tclojure.core.protocols/fn--6078 (protocols.clj:54)\r\n\tclojure.core.protocols/fn--6031/G--6026--6044 (protocols.clj:13)\r\n\tclojure.core/reduce (core.clj:6289)\r\n\tminer.herbert.private/mkmap/fn--70659 (private.clj:330)\r\n```\r\n\r\nFull trace here: https://gist.github.com/jcf/2c4daefc55b45418b915\r\n\r\nAny help would be much appreciated. I'll keep digging into the problem in case [PEBCAK](http://en.wiktionary.org/wiki/PEBCAK).\r\n\r\nKind regards,\r\n\r\nJames"},"comment":{"url":"https://api.github.com/repos/miner/herbert/issues/comments/93761722","html_url":"https://github.com/miner/herbert/issues/11#issuecomment-93761722","issue_url":"https://api.github.com/repos/miner/herbert/issues/11","id":93761722,"user":{"login":"jcf","id":18374,"avatar_url":"https://avatars.githubusercontent.com/u/18374?v=3","gravatar_id":"","url":"https://api.github.com/users/jcf","html_url":"https://github.com/jcf","followers_url":"https://api.github.com/users/jcf/followers","following_url":"https://api.github.com/users/jcf/following{/other_user}","gists_url":"https://api.github.com/users/jcf/gists{/gist_id}","starred_url":"https://api.github.com/users/jcf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcf/subscriptions","organizations_url":"https://api.github.com/users/jcf/orgs","repos_url":"https://api.github.com/users/jcf/repos","events_url":"https://api.github.com/users/jcf/events{/privacy}","received_events_url":"https://api.github.com/users/jcf/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T15:20:42Z","updated_at":"2015-04-16T15:20:42Z","body":"Hi Steve,\r\n\r\nThanks for getting back to me. Unfortunately, my workaround doesn't work now that I've restarted my REPL and pasted the above snippet.\r\n\r\nDo you have any suggestions on how I might be able to pass a constant into a schema and get the desired behaviour or testing for equality?"}}