News for hackers. Stuff that matters.
Re:Longest and Shortest Type Name in .NET 4.0 using LINQ by MichaelGG on Saturday August 14, 2010 @01:09PM (#1603612)
The only thing I'm not overly fond of is the repeated "fun x -> x". It'd be nice if there was a way to refer to members without an instance reference. So you could write:

  Seq.map ($GetExportedTypes()) |> Seq.sortBy $x.Name.Length
Where $ is some special syntax to indicate "generate a function that uses its parameter as the this parameter for the instance call". I think this has been brought up but perhaps a nice syntax hasn't been found?
Re:Longest and Shortest Type Name in .NET 4.0 using LINQ by daeken on Saturday August 14, 2010 @02:21PM (#1603753)
In Nemerle (another ML dialect for .NET), you can use _ to that end. Syntax for local functions/lambdas, all equivalent (but suited for different situations, syntactically speaking):

  def foo(x) { x + 5 }
  fun(x) { x + 5}
  (x) => x + 5
  lambda x -> x + 5
  _ + 5
I find I miss the _ syntax more than most syntactical sugar. I don't know how often I have to write things like lambda x: x.foo in Python, where _.foo would serve the same purpose.