Clojure already has something like this, it's called datalog. Datomic has 
an implementation that can be used to query it's database as well as most 
collections. There's also another datalog implementation which has it's own 
persistent database. An opportunity that's still open would be a datalog to 
SQL compiler, which might be feasible. Logic programming SQL has already 
been done in Prolog. I don't know if it's possible, but it would be nice if 
there was an extendable datalog 'middleware', where collection, Datomic, 
SQL, Mongo etc. implementations could be built on.

On Friday, September 28, 2012 11:57:23 PM UTC+2, Manuel Paccagnella wrote:
>
> Hi!
>
> I'm participating in a discussion in the progfun course on Coursera (Scala 
> based). Interesting discussions are going on there, especially when Clojure 
> is involved. I was wondering if something like 
> Slick<http://slick.typesafe.com/>would be doable in Clojure. I've no 
> experience with Slick (and very little 
> with Scala), but from a learning perspective I was wondering if I could 
> write something like it in Clojure (another good, probably advanced, 
> exercise that maybe I could do in the future to improve my Clojure-fu).
>
> Here the relevant portion of the comment that made me think:
>
> [...] if at runtime you can get the metadata inferred by the compiler and 
>> the syntax tree used, then this allows for libraries like LINQ in .NET ... 
>> i.e. reuse of existing syntax to issue queries to a DB or to offload 
>> processing to a GPU, all while keeping type-safety. The point being that 
>> you do not care about how those queries are going to get processed, you 
>> just issue queries using standard syntax and let the provider compile and 
>> execute those queries. You can also change the implementation on the fly, 
>> as easily as you can change between a LinkedList and an ArrayList in Java. 
>> The macros support and the compiler refactoring happening in Scala 2.10 is 
>> awesome and you should checkout Slick, which is the LINQ alternative for 
>> Scala: slick.typesafe.com.
>>
>> Here's a sample:
>>
>>  val l = for {
>>      c <- coffees if c.supID == 101
>>  } yield (c.name, c.price)
>>
>> Where "coffees" can represent anything, from a collection of in-memory 
>> objects, like a linked list, to a database table or a MongoDB collection. 
>> And the filtering could be implemented in whatever is best for the 
>> collection type, from parallel filtering by multiple threads to issuing the 
>> right SELECT to a MySQL, or the right API call to MongoDB. Same syntax, 
>> same type-safety, polymorphism at its best.
>>
>> I've never seen such a library for LISP, with all their support for 
>> multimethods, homoiconicity and macros.
>>
>
> Sounds quite complex, but I'm thinking mainly about the syntax part: same 
> syntax different implementations in the background. From an intuitive point 
> of view, it should be possible I think but I'm wondering what would be the 
> best approach to do this. 
>
> (M)
>

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

Reply via email to