ghostwheel 2019-11-08

@saikyun has joined the channel

hey, I've been enjoying ghostwheel lately, but have run into some issues

I'm trying to define a function like this:

(>defn zone-of-card
  [db card-id]
  [::db ::card-id | #((into #{} (keys (:cards db))) card-id)
   => ::zone]
  ...)

but it often fails generating correct card-ids

I was wondering if there was a way to solve this? I've managed to write custom generators like so: (defn card-in-db-gen [] (s/gen (into #{} (keys (:cards db))))) but I don't understand how to fit that with the >defn macro. is it possible? is it feasible?

is there another way one might spec a "database" and its relations?

thankful for any input

I guess what I'm asking for is to be able to add a custom generator that generates all the arguments 🙂

have you looked at <-? I think that is what you want

or do you mean on the args themselves? In that case you just need to use with-gen on things like ::card-id I think

(s/def ::card-ids (s/with-gen .....))