It was! Thank you very much.

Phil


Jean Niklas L'orange <jeann...@hypirion.com> writes:
> If you want to say "the goal g(x) shall succeed, for all x in this list", 
> then use `everyg` from clojure.core.logic instead of map. I think it is 
> exactly what you're looking for.
>
> On Monday, April 28, 2014 3:36:10 PM UTC+2, Phillip Lord wrote:
>>
>>
>>
>> I can do this with core.logic (yes, I know that match-list isn't doing 
>> anything much here) 
>>
>> (defn match-list [member list] 
>>   (membero member list)) 
>>
>>
>> (run* [q] 
>>       (match-list 10 [1 10 100]) 
>>       (== q "worked")) 
>>
>> For q to come back with any values then 10 has to be part of the list [1 
>> 10 100]. 
>>
>> I want to do the same thing where the second argument is a list of 
>> lists. So something like: 
>>
>> (defn match-lists [member lists] 
>>   (map 
>>    (fn [l] (membero member l)) 
>>    lists)) 
>>
>> (run* [q] 
>>       (match-lists 10 
>>                    [[1 10 100] 
>>                     [1 10 100]]) 
>>       (== q "worked")) 
>>
>> which should also return "worked". The point is that I don't know how 
>> many "membero" forms I need at compile time, only at runtime. My initial 
>> attempt above fails. 
>>
>> java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to 
>> clojure.lang.IFn 
>>  at clojure.core.logic.Substitutions.bind (logic.clj:410) 
>>     logic_expts.what_i_want$eval7021$fn__7022$fn__7023$_inc__7024.invoke 
>> (form-init238773086654203315.clj:2) 
>>     clojure.core.logic$eval5780$fn__5781$fn__5782.invoke 
>>     (logic.clj:1109) 
>>
>>
>> Is there a way to do this with functions -- or do I need to macro it? 
>>
>> Phil 

-- 
Phillip Lord,                           Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics,             Email: phillip.l...@newcastle.ac.uk
School of Computing Science,            
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,               skype: russet_apples
Newcastle University,                   twitter: phillord
NE1 7RU                                 

-- 
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