-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
This library was exactly what I needed. I am having trouble with the defphrase for the following predicate however.
(defn contains-only?
[m ks]
(-> m keys set (set/difference ks) empty?))
Put together the following code to show the problem.
(ns phraser-test
(:require [phrase.alpha :refer [defphraser] :as phraser]
[clojure.set :as set]
[clojure.spec.alpha :as s]))
(defn contains-only?
[m ks]
(-> m keys set (set/difference ks) empty?))
(defphraser #(contains-only? % ks)
[_ _ ks]
(str ks " are the only allowed keys."))
(s/def ::person #(contains-only? % #{:name :age :gender}))
(defn test []
(phraser/phrase-first {} ::person {:name "dave" :age 42 :gender :male :hair :brown}))
Despite several attempts I cannot get the phraser dispatching to match. Any help would be appreciated.
blue0513
Metadata
Metadata
Assignees
Labels
No labels