For lightspeed I wrote an internal dsl that allows you to query similarly to the regular api but no special module for linq stuff. I skipped linq altogether didn&#39;t need it there.<div><br></div><div>so what I created there is (It&#39;s in the <a href="http://asp.net">asp.net</a> mvc chapter btw)</div>

<div><br></div><div>find_all User do</div><div>   where a(:name).like(&quot;ivan%&quot;) &amp; a(:age) &gt; 23</div><div>   order_by :name.desc</div><div>end</div><div><br></div><div>that may be wrong but it&#39;s close to something like that.. </div>

<div>---<br>Met vriendelijke groeten - Best regards - Salutations<br>Ivan Porto Carrero<br>Blog: <a href="http://flanders.co.nz">http://flanders.co.nz</a><br>Twitter: <a href="http://twitter.com/casualjim">http://twitter.com/casualjim</a><br>

Author of IronRuby in Action (<a href="http://manning.com/carrero">http://manning.com/carrero</a>)<br><br>
<br><br><div class="gmail_quote">On Wed, Feb 3, 2010 at 4:01 PM, Ryan Riley <span dir="ltr">&lt;<a href="mailto:ryan.riley@panesofglass.org">ryan.riley@panesofglass.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Thanks, Ivan. That&#39;s awesome ... that&#39;s just like F#. I should have realized it would be that simple. I&#39;ll post this to the Delegates section of the .NET interop page on the wiki, since it currently doesn&#39;t exist.<div>



<br></div><div>Also, I noticed you alluded to something similar in IronRuby in Action where you talk about LightSpeed, but I couldn&#39;t find anything in the MEAP copy I have. If I am able to spin up a few LINQ samples (probably Rx, Pfx, and/or XLinq), I&#39;ll shoot them your way, if you are interested.<div>



<br></div><div>Cheers!</div><div><div class="im"><br clear="all">Ryan Riley<br><br>Email: <a href="mailto:ryan.riley@panesofglass.org" target="_blank">ryan.riley@panesofglass.org</a><br>LinkedIn: <a href="http://www.linkedin.com/in/ryanriley" target="_blank">http://www.linkedin.com/in/ryanriley</a><br>



Blog: <a href="http://wizardsofsmart.net/" target="_blank">http://wizardsofsmart.net/</a><br>Twitter: @panesofglass<br>Website: <a href="http://panesofglass.org/" target="_blank">http://panesofglass.org/</a><br>
<br><br></div><div><div></div><div class="h5"><div class="gmail_quote">On Tue, Feb 2, 2010 at 11:40 PM, Ivan Porto Carrero <span dir="ltr">&lt;<a href="mailto:ivan@whiterabbitconsulting.eu" target="_blank">ivan@whiterabbitconsulting.eu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

just pass your block to the constructor of a delegate and you should be good to go<div><br></div><div>Action.new { more_work_here }<br clear="all">---<br>Met vriendelijke groeten - Best regards - Salutations<br><font color="#888888">Ivan Porto Carrero<br>





Blog: <a href="http://flanders.co.nz" target="_blank">http://flanders.co.nz</a><br>Twitter: <a href="http://twitter.com/casualjim" target="_blank">http://twitter.com/casualjim</a><br>Author of IronRuby in Action (<a href="http://manning.com/carrero" target="_blank">http://manning.com/carrero</a>)</font><div>



<div></div><div><br>

<br>
<br><br><div class="gmail_quote">On Tue, Feb 2, 2010 at 11:38 PM, Ryan Riley <span dir="ltr">&lt;<a href="mailto:ryan.riley@panesofglass.org" target="_blank">ryan.riley@panesofglass.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





That&#39;s fantastic, Tomas, thanks! Is there any way to pass a block, lambda, or Proc into the slot for the delegate, or perhaps a way to create a .NET delegate (or Expression) from a block, lambda, or Proc?<div><br></div>







<div>Thanks,</div><div><div><br clear="all">Ryan Riley<br><br>Email: <a href="mailto:ryan.riley@panesofglass.org" target="_blank">ryan.riley@panesofglass.org</a><br>LinkedIn: <a href="http://www.linkedin.com/in/ryanriley" target="_blank">http://www.linkedin.com/in/ryanriley</a><br>







Blog: <a href="http://wizardsofsmart.net/" target="_blank">http://wizardsofsmart.net/</a><br>Twitter: @panesofglass<br>Website: <a href="http://panesofglass.org/" target="_blank">http://panesofglass.org/</a><br>
<br><br></div><div><div></div><div><div class="gmail_quote">On Tue, Feb 2, 2010 at 1:36 AM, Tomas Matousek <span dir="ltr">&lt;<a href="mailto:Tomas.Matousek@microsoft.com" target="_blank">Tomas.Matousek@microsoft.com</a>&gt;</span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Actually, you can add Ruby methods to List&lt;T&gt; … IronRuby type system does some magic for you </span><span style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">J</span><span style="font-size:11.0pt;color:#1F497D">:</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; include System::Collections::Generic</span></p><p class="MsoNormal">







<span style="font-size:11.0pt;color:#1F497D">=&gt; Object</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; List[Fixnum].included_modules</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; [<span style="background:yellow">System::Collections::Generic::List[T]</span>, System::Collections::Generic::IList[Fixnum], System::Collections::Generic::IList[T], System::Collections::Generic::ICollection[Fixnum], System::Collections::Generic::ICollection[T], System::Collections::Generic::IEnumerable[Fixnum], System::Collections::Generic::IEnumerable[T], System::Collections::IEnumerable, Enumerable, System::Collections::IList, System::Collections::ICollection, System::Collections::Generic, Kernel]</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">As you can see the List&lt;&gt; generic type definition is treated as a module that is mixed in each of its instantiations. Although there are no predefined methods on it you can open it and add some. First we need to get Ruby class for List&lt;T&gt;. If you index System.Collections.Generic.List by a fixnum instead of a class/module you’ll get the generic definition of arity 1. Let’s name it ListOfT:</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; ListOfT = List[1]</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">And then we can open it up:</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; module ListOfT</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">...   def size</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">...     count</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">...   end</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">... end</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; nil</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; l = List[Fixnum].new</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; []</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; l.add(1)</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; nil</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; l.add(2)</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; nil</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">&gt;&gt;&gt; l.size</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">=&gt; 2</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p>







<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a> [mailto:<a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a>] <b>On Behalf Of </b>Orion Edwards<br>







<b>Sent:</b> Monday, February 01, 2010 6:31 PM<br><b>To:</b> <a href="mailto:ironruby-core@rubyforge.org" target="_blank">ironruby-core@rubyforge.org</a><br><b>Subject:</b> Re: [Ironruby-core] A nicer syntax for generic extension methods</span></p>







<div><div></div><div><p class="MsoNormal"> </p><p class="MsoNormal">IIRC you can open &quot;concrete&quot; generics, but not &quot;open&quot; ones: In plain english this means you can add methods to List&lt;string&gt; but not List&lt;T&gt;. </p>







<div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">This is essentially because List&lt;T&gt; isn&#39;t a real type in the CLR, it&#39;s basically some metadata that can be used to build a real type when the T is supplied.</p>







</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">You could as an alternative add methods to the underlying non-generic IEnumerable interface, but then you&#39;d have to do some run-time reflection to figure out that your List is actually a List&lt;string&gt;... This is probably not nice.</p>







</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">In theory when CLR4 lands and has support for co/contra variant generics, List&lt;object&gt; should match List&lt;string&gt; and everything else, but I don&#39;t know if IronRuby would also work for this?</p>







</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Good luck</p><div><p class="MsoNormal">On Tue, Feb 2, 2010 at 7:52 AM, Ryan Riley &lt;<a href="mailto:ryan.riley@panesofglass.org" target="_blank">ryan.riley@panesofglass.org</a>&gt; wrote:</p>







<div><p class="MsoNormal">I have been trying to figure out how to Rubify generic extension methods for use with the likes of Rx, Open XML SDK, etc. Ivan went over it a bit with me this weekend, but I&#39;m still having difficulty including a module within a .NET type. Is that even possible?</p>







</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">...</p></div><div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">The questions I&#39;m not able to answer are:</p></div><div><ol start="1" type="1">







<li class="MsoNormal">Can I somehow open up a .NET class, say System::Collections::Generic::List[T] and include the EnumerableExtensions? So far, I&#39;m finding that&#39;s a no.</li><li class="MsoNormal">How do I hook in the included(base) method above? I&#39;m assuming that&#39;s a one-time call, but I don&#39;t see anywhere that it&#39;s called when a module is included. Do I need to use a before_filter or perform that action at the beginning of the linq_select method?</li>







</ol><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Thanks!</p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br clear="all">Ryan Riley<br><br>Email: <a href="mailto:ryan.riley@panesofglass.org" target="_blank">ryan.riley@panesofglass.org</a><br>







LinkedIn: <a href="http://www.linkedin.com/in/ryanriley" target="_blank">http://www.linkedin.com/in/ryanriley</a><br>Blog: <a href="http://wizardsofsmart.net/" target="_blank">http://wizardsofsmart.net/</a><br>Twitter: @panesofglass<br>







Website: <a href="http://panesofglass.org/" target="_blank">http://panesofglass.org/</a><br><br>_______________________________________________<br>Ironruby-core mailing list<br><a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>







<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a></p></div><p class="MsoNormal"> </p></div></div></div></div></div><br>_______________________________________________<br>








Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
<br></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
<br></blockquote></div><br></div>