On Mon, Oct 1, 2012 at 4:45 PM, Timothy Baldridge <tbaldri...@gmail.com>wrote:

> I've thought about this as well. Coming from the .NET world I'm quite
> familiar with the Linq.Expression namespace. I too have wondered about
> this. For those who are not familiar with how IQueryable<T> works in Linq,
> it's something like the following (in clojure):
>
>
> (def query (q (db :people)
>                     (where #(> (:age %) 21))
>                     :last-name
>                     distinct))
>
> The (db :people) call will return a IQueryable object. The q macro will
> then take all the clauses in the query, wrap them up into an AST, and then
> create a lazy seq. At this point in the code, nothing has been executed.
> Upon calling (first query), the q macro hands the AST to the IQueryable
> object, and then calls Execute on the object. Execute does whatever it
> pleases with the AST, and then returns a lazy seq of the results.
>
> A C# tutorial on this, is available here (
> http://wekeroad.com/2007/07/02/linq-how-to-use-linq-to-query-just-about-anything/
> )
>
> I see this fitting into the Clojure ecosystem in a very interesting way:
>
> Seq abstraction -
> Lazy evaluation
> Must run on the local CPU (for map, reduce, etc.)
> Must run in order
> Data provider can't influence execution
>
> Reducers -
> Data provider can influence execution
> Must run on the local CPU
> Can run in any order
>
> IQueryable abstraction -
> Data provider has full control over execution
> Code can be run anywhere
> Provider must compile code.
>
>
> Example providers of IQueryable:
>
> Entity Framework (Linq over SQL)
> Linq to XML (Linq over XML)
> Linq to GPU (run queries on a graphics processor)
> http://brahma.ananthonline.net/
> I've also seen index providers for in-memory data structures
>
>
Not to nitpick, but Linq to XML is based on Linq to objects entirely (no
IQueryable, juste vanilla IEnumerables). There also used to be a "Linq to
Map reduce" (called DryadLINQ, then Linq to HPC, then "let's forget about
this and hop on the hadoop bandwagon") which looked a lot like Scalding
(Scala over Cascading), only with IQueryable goodies.

To my - naive - knowledge of clojure macros, writing an provider in clojure
would be a lot easier than it is in C# (or even with F# quotations).

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