473,806 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems compiling a lambda expression

I've got a hint from a gentleman here to use the
following syntax.

public static FileInfo[]
GetFilesRegExp( this DirectoryInfo di, string pat)
{
Regex re = new Regex(pat);
return Array.FindAll(
di.GetFiles(),
(f) =re.IsMatch(f.N ame));
}

The problem is that the compiler seems to dislike
"this" in the argument list as well as "goes to"
in the lambda expression.

What's up with that and how do i kill it?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Jul 26 '08
15 4498
Another reason not to stick to fancy syntactic
sugar stuff like "lambda expressions" and to do
things the old fashioned (C#2.0) way.
I just reviewed lambda expressions this morning,
as well as Action and Func, and it seems an
enormous waste of time, designed to impress
fellow programmers, like the ternary conditional
operator ?:, rather than to get the job done.
Oh, c'mon a bit. Sometimes it's nice to play with
your coworkers and typing some really complicated
code they haven't seen before, nodding the head
and asking, "what do you think, guys?". It's a
great way to learn who's got the cojones to admit
they don't know what's going on. :)

I warmly recommend the language of APL , if one
wishes to impress/scare/astonish colleagues...

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Jul 27 '08 #11
On Sun, 27 Jul 2008 08:39:36 -0700, K Viltersten <tm**@vilterste n.com>
wrote:
[...]
>I just reviewed lambda expressions this morning,
as well as Action and Func, and it seems an
enormous waste of time, [...]

Oh, c'mon a bit.
Don't worry about Ray. He dismisses as useless pretty much everything in
C# that he doesn't fully understand. I don't think that will ever change.

Pete
Jul 27 '08 #12
raylopez99 <ra********@yah oo.comwrote:
Another reason not to stick to fancy syntactic sugar stuff like
"lambda expressions" and to do things the old fashioned (C#2.0) way.
I just reviewed lambda expressions this morning, as well as Action and
Func, and it seems an enormous waste of time, designed to impress
fellow programmers, like the ternary conditional operator ?:, rather
than to get the job done.
That suggests you haven't really understood how useful they can be - in
particular, LINQ relies on them.

Lambda expressions are very, very powerful. I just wish Java had them
:(

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jul 27 '08 #13
On Jul 27, 12:37*pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
>
Don't worry about Ray. *He dismisses as useless pretty much everything in *
C# that he doesn't fully understand. *I don't think that will ever change.

That's not true. I dismissed as useless delegates until such time
that I started using them.

RL
Jul 28 '08 #14
On Jul 27, 1:31*pm, Jon Skeet [C# MVP] <sk...@pobox.co mwrote:
raylopez99 <raylope...@yah oo.comwrote:
Another reason not to stick to fancy syntactic sugar stuff like
"lambda expressions" and to do things the old fashioned (C#2.0) way.
I just reviewed lambda expressions this morning, as well as Action and
Func, and it seems an enormous waste of time, designed to impress
fellow programmers, like the ternary conditional operator ?:, rather
than to get the job done.

That suggests you haven't really understood how useful they can be - in
particular, LINQ relies on them.

Lambda expressions are very, very powerful. I just wish Java had them
:(
LINQ is just a poor man's SQL. Be a man and learn the real thing.
That said, when I start learning LINQ I might change my mind...

RL
Jul 28 '08 #15
"raylopez99 " <ra********@yah oo.comwrote in message
news:43******** *************** ***********@d45 g2000hsc.google groups.com...
LINQ is just a poor man's SQL. Be a man and learn the real thing.
That said, when I start learning LINQ I might change my mind...
How about learning it *before* dismissing it as being poor man's SQL? LINQ
is by far the best approach I've seen to integrate relational query syntax
into a "normal" language. Integration has many advantages that are otherwise
very hard to realize, e.g. compile-time type-safety.

Regards,

--
Andreas Huber

When replying by private email, please remove the words spam and trap
from the address shown in the header.

Jul 29 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
3708
by: Oliver Fromme | last post by:
Hi, I'm trying to write a Python function that parses an expression and builds a function tree from it (recursively). During parsing, lambda functions for the the terms and sub-expressions are constructed on the fly. Now my problem is lazy evaluation. Or at least I think it is. :-)
63
3429
by: Stephen Thorne | last post by:
Hi guys, I'm a little worried about the expected disappearance of lambda in python3000. I've had my brain badly broken by functional programming in the past, and I would hate to see things suddenly become harder than they need to be. An example of what I mean is a quick script I wrote for doing certain actions based on a regexp, which I will simlify in this instance to make the pertanant points more relevent.
6
1618
by: Xavier Décoret | last post by:
Hi, I cannot find the way to do generic lambda functions using the lambda syntax in python. I am probably missing a point. For example, the code # f = lambda : print "hello" # f()
181
8936
by: Tom Anderson | last post by:
Comrades, During our current discussion of the fate of functional constructs in python, someone brought up Guido's bull on the matter: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 He says he's going to dispose of map, filter, reduce and lambda. He's going to give us product, any and all, though, which is nice of him.
5
2165
by: Octal | last post by:
How does the lambda library actually works. How does it know how to evaluate _1, how does it recognize _1 as a placeholder, how does it then calculate _1+_2, or _1+2 etc. The source files seem a bit complicated so any explanation would be appreciated. Thanks
15
4855
by: Matt | last post by:
Hi There, Can anyone explain me the real advantages of (other than syntax) lambda expressions over anonymous delegates? advantage for one over the other. delegate int F(int a); F fLambda = a =a++; F fAnonymous = delegate(int a) { return a++; }; fLambda(1);
2
2202
by: =?Utf-8?B?UnV0aCBNYXJr?= | last post by:
Hey, Am trying to write a lambda expression for a delegate, am getting an error as ------------------------------ only assignment, call, increment, decrement, and new expression can be used as a statement ----------------------------- For the following code.
21
1860
by: globalrev | last post by:
i have a rough understanding of lambda but so far only have found use for it once(in tkinter when passing lambda as an argument i could circumvent some tricky stuff). what is the point of the following function? def addn(n): return lambda x,inc=n: x+inc if i do addn(5) it returns
11
1691
by: puzzlecracker | last post by:
I am not understanding what's happening in the code below (from accelerated c#) -- I know what the outcome but not how .net does it: using System; using System.Linq; public class LambdaTest { static void Main()
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.