logo       

extension methods for local function.: msg#00001

lang.nemerle.devel

Subject: extension methods for local function.

Hi,

I tryed to use extension methods for local function. but compile error
occurred.

Is this by design?

-- sample.n
using System;
using Nemerle.Collections;

def foldl (this ls, acc, fn) {
match (ls) {
| x::xs => foldl (xs, fn (acc, x), fn);
| _ => acc;
}
}

def foldr (this ls, acc, fn) {
match (ls) {
| x::xs => fn (x, foldr(xs, acc, fn));
| _ => acc;
}
}

def ls = [1, 2, 3];

// compile error !
// there is no member named `foldr' in list.Cons[int-] with type ?
Console.WriteLine (ls.foldl (0, _ - _));
Console.WriteLine (ls.foldr (0, _ - _));

--
akiramei <mei@xxxxxxxxxxxxxxxx>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise