Using Linq in Boo

View: New views
5 Messages — Rating Filter:   Alert me  

Using Linq in Boo

by Byron-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


var list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
var seq = list.Where(i => i > 2);

Is there any equivalence in Boo? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Using Linq in Boo

by Jeffery Olson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


this is discussed in the release notes for 0.9 ... boo supports c#
extension methods (which is how linq is implemented at the framework
level.. the linq "special syntax" is c# compiler syntactic sugar)

you have to do a special import syntax: the FullName (namespace +
className) of the class with the extension methods (for Linq it's
System.Linq.Enumerable) is imported from the *assembly* name minus the
dll extension (System.Core)

import System.Linq.Enumerable from System.Core

bar = List of string()
bar.Add("foo")
bar.Add("baz")

baz = bar.Where({x as string | x == "baz"}).Single()

does that make sense? the release notes for 0.9 are at:
http://blogs.codehaus.org/people/bamboo/archives/001749_boo_09_is_here.html

cheers



On Sat, Sep 19, 2009 at 7:31 PM, Byron <byron321@...> wrote:

>
> var list = new List<int>();
> list.Add(1);
> list.Add(2);
> list.Add(3);
> var seq = list.Where(i => i > 2);
>
> Is there any equivalence in Boo? Thanks
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Using Linq in Boo

by Byron-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thank you Jeffery!
But I would like to know why I can't write bar.Where({x | x == "baz"})
instead of bar.Where({x as string | x == "baz"}).
Wouldn't it be nice if type inference can determine the type of x?

On 9月20日, 上午11時32分, Jeffery Olson <olson.jeff...@...> wrote:

> this is discussed in the release notes for 0.9 ... boo supports c#
> extension methods (which is how linq is implemented at the framework
> level.. the linq "special syntax" is c# compiler syntactic sugar)
>
> you have to do a special import syntax: the FullName (namespace +
> className) of the class with the extension methods (for Linq it's
> System.Linq.Enumerable) is imported from the *assembly* name minus the
> dll extension (System.Core)
>
> import System.Linq.Enumerable from System.Core
>
> bar = List of string()
> bar.Add("foo")
> bar.Add("baz")
>
> baz = bar.Where({x as string | x == "baz"}).Single()
>
> does that make sense? the release notes for 0.9 are at:http://blogs.codehaus.org/people/bamboo/archives/001749_boo_09_is_her...
>
> cheers
>
>
>
> On Sat, Sep 19, 2009 at 7:31 PM, Byron <byron...@...> wrote:
>
> > var list = new List<int>();
> > list.Add(1);
> > list.Add(2);
> > list.Add(3);
> > var seq = list.Where(i => i > 2);
>
> > Is there any equivalence in Boo? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Using Linq in Boo

by Avishay Lavie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Yes, it would be really nice, but unfortunately this feature isn't
completely done yet. If it's any comfort, I can tell you that it's a
lot harder than it seems :)

On Sep 20, 5:57 pm, Byron <byron...@...> wrote:

> Thank you Jeffery!
> But I would like to know why I can't write bar.Where({x | x == "baz"})
> instead of bar.Where({x as string | x == "baz"}).
> Wouldn't it be nice if type inference can determine the type of x?
>
> On 9月20日, 上午11時32分, Jeffery Olson <olson.jeff...@...> wrote:
>
> > this is discussed in the release notes for 0.9 ... boo supports c#
> > extension methods (which is how linq is implemented at the framework
> > level.. the linq "special syntax" is c# compiler syntactic sugar)
>
> > you have to do a special import syntax: the FullName (namespace +
> > className) of the class with the extension methods (for Linq it's
> > System.Linq.Enumerable) is imported from the *assembly* name minus the
> > dll extension (System.Core)
>
> > import System.Linq.Enumerable from System.Core
>
> > bar = List of string()
> > bar.Add("foo")
> > bar.Add("baz")
>
> > baz = bar.Where({x as string | x == "baz"}).Single()
>
> > does that make sense? the release notes for 0.9 are at:http://blogs.codehaus.org/people/bamboo/archives/001749_boo_09_is_her...
>
> > cheers
>
> > On Sat, Sep 19, 2009 at 7:31 PM, Byron <byron...@...> wrote:
>
> > > var list = new List<int>();
> > > list.Add(1);
> > > list.Add(2);
> > > list.Add(3);
> > > var seq = list.Where(i => i > 2);
>
> > > Is there any equivalence in Boo? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Using Linq in Boo

by Philosophil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ah... but nothing is hard for the person who doesn't have to do it :)

Phil

On Sun, Sep 20, 2009 at 11:14 AM, Avish <some.avish@...> wrote:

>
> Yes, it would be really nice, but unfortunately this feature isn't
> completely done yet. If it's any comfort, I can tell you that it's a
> lot harder than it seems :)
>
> On Sep 20, 5:57 pm, Byron <byron...@...> wrote:
>> Thank you Jeffery!
>> But I would like to know why I can't write bar.Where({x | x == "baz"})
>> instead of bar.Where({x as string | x == "baz"}).
>> Wouldn't it be nice if type inference can determine the type of x?
>>
>> On 9月20日, 上午11時32分, Jeffery Olson <olson.jeff...@...> wrote:
>>
>> > this is discussed in the release notes for 0.9 ... boo supports c#
>> > extension methods (which is how linq is implemented at the framework
>> > level.. the linq "special syntax" is c# compiler syntactic sugar)
>>
>> > you have to do a special import syntax: the FullName (namespace +
>> > className) of the class with the extension methods (for Linq it's
>> > System.Linq.Enumerable) is imported from the *assembly* name minus the
>> > dll extension (System.Core)
>>
>> > import System.Linq.Enumerable from System.Core
>>
>> > bar = List of string()
>> > bar.Add("foo")
>> > bar.Add("baz")
>>
>> > baz = bar.Where({x as string | x == "baz"}).Single()
>>
>> > does that make sense? the release notes for 0.9 are at:http://blogs.codehaus.org/people/bamboo/archives/001749_boo_09_is_her...
>>
>> > cheers
>>
>> > On Sat, Sep 19, 2009 at 7:31 PM, Byron <byron...@...> wrote:
>>
>> > > var list = new List<int>();
>> > > list.Add(1);
>> > > list.Add(2);
>> > > list.Add(3);
>> > > var seq = list.Where(i => i > 2);
>>
>> > > Is there any equivalence in Boo? Thanks
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---