Nemerle.Linq
От: _nn_ www.nemerleweb.com
Дата: 17.10.09 13:46
Оценка:
Код на C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    static class Program
    {
        static void Main(string[] args)
        {
            var a = new List<int> { 10,2,33,4,5,40 };
            var b = F(a);
            foreach(var x in b)
                Console.WriteLine(x);
        }

        static IEnumerable<int> F(IEnumerable<int> e)
        {
            return from x in e where x > 10 orderby x descending select x;
        }
    }
}


Аналогичный(?) код на Nemerle:
using System;
using System.Collections.Generic;
using System.Console;
using Nemerle.Utility;
using Nemerle.Data.Linq;

module Program
{
  Main() : void
  {
    def a : List[int] = List([10,2,33,4,5,40]);
    def b = F(a);
    foreach(x in b)
      Console.WriteLine(x);
  }
  
  F(e : IEnumerable[int]) : IEnumerable[int]
  {
    <#linq from x in e where x > 10 orderby x descending select x #>
  }
}


Получаю ошибку:

C:\Users\K\Documents\Nemerle Studio\ConsoleApplication1\Main.n(17,29):Error: expected System.Collections.Generic.IEnumerable[int], got string in function return value: the types char and int are not compatible [simple unify]


С чем это связанно и как правильно применять Nemerle.Data.Linq ?
http://rsdn.nemerleweb.com
http://nemerleweb.com
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.