I can't tell if I'm being silly, but I'm having issues figuring out how to 
record the results of my computation in Core.Logic.

The basic idea is that I'm trying to determine if a schedule a user has 
requested is solvable or not. I'm trying to find out how to assign to each 
hash-map what resource I determined can be used for it. The following case 
is simplistic, but I need to get this code working before attempting to 
generalize what the user has requested.

(defn solve [types reservations]
  (let [reservations (map #(assoc % :assigned-resource (l/lvar)) 
reservations)
        resources (flatten (map :resources types))
        vars (repeatedly (count reservations) l/lvar)
        resource-vars (take (count by-resource) vars)

        ]
    (l/run 1 [q]
           (l/== q vars)
           ;; 
           (l/everyg #(l/membero % reservations) resource-vars)
           (l/everyg #(l/fresh [resource]
                               (l/membero resource resources)
                               (l/== % (l/partial-map {:resource resource}))
                               ;; Somehow assign resource to 
:assigned-resource here.
                               )
                     resource-vars)


           (l/distincto resource-vars)
           )))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to