Dear All , Hope everyone is fine. I have little question. We use this query normally in MSSQL select * from emp where empid in (1,2,3,4) How to write this query in lambda expression. Is there any way to perfrom above mentioned operation ? Best Regards

Member Avatar
Member Avatar
+0 forum 1

Here lambda is used to create a one-line function for factorials.

Member Avatar
Member Avatar
+0 forum 6

The idea for this snippet came from vegaseat, who wrote a very nifty RPN calculator in Python, simulating a switch/case statement, something that Python is missing. See this code on page 19 in the projects for beginners thread on the Python software development forum. In my opinion, he did a very good job. So I posed myself a goal: write something equal in C# and, although it was tempting to use: don’t use a case statement. Here is the result. The only thing that C# seems to lack here is the use of variable parameters. One could play with different …

Member Avatar
Member Avatar
+1 forum 4

I'm trying to design a lambda function that returns any line in a file that begins with any digit [0-9]. The point would be to return the whole line if it does, and skip any line if it doesn't. This is for log analysis where I want all the lines that begin with an IP address. I'm beginning to think this is too complex for a lambda expression. Any suggestions?

Member Avatar
Member Avatar
+0 forum 8

a method on how to return a boolean using lambda and its conditioned by two parameters

Member Avatar
Member Avatar
+0 forum 1

[code] from Tkinter import * fields = 'Name', 'Job', 'Pay' def fetch(event,entries): for entry in entries: print 'Input => "%s"' % entry.get() # get text print event.widget def makeform(root, fields): entries = [] for field in fields: row = Frame(root) # make a new row lab = Label(row, width=5, text=field) # add label, entry ent = Entry(row) row.pack(side=TOP, fill=X) # pack row on top lab.pack(side=LEFT) ent.pack(side=RIGHT, expand=YES, fill=X) # grow horizontal entries.append(ent) return entries if __name__ == '__main__': root = Tk() ents = makeform(root, fields) root.bind('<Return>', lambda event,entries=ents: fetch(event,entries)) Button(root, text='Fetch', command= lambda event:fetch(event,entries)).pack(side=LEFT) # #how to revise it? root.mainloop() …

Member Avatar
Member Avatar
+0 forum 2

so I recently wrote a function that sorted using the last value in a tuple. Obviously this couldn't be done simply say sorted(tuples, key=tuples[-1]) because that is not a "legal" call. However I did run across, while trying to figure out how to make things like this work, the utilization of lambda so the code became. [CODE]def sort_last(tuples): x=sorted(tuples, key=lambda tuples: tuples[-1]) return(x)[/CODE] The code runs correctly and, that's all well and good, but I don't understand why lambda tuples"or any given var for that matter":. makes this possible. Can someone explain this to me in a way I'll understand …

Member Avatar
Member Avatar
+0 forum 6

[CODE] int[][] jaggedArray = (from line in File.ReadAllLines(fileName).Skip(1) select (from item in line.Split('\t').Skip(1) select int.Parse(item)).ToArray()).ToArray(); [/CODE] This is a crazy example. It was sparked by what is probably a homework thread on another forum here, but it is basically reading in a tab-delimitted text file, stripping out the first row and column (as they contain header information), and spitting out a jagged array of integers as the final product. The crazy part? It's a single statement! All that functionality, 1 semi-colon. The crazier fact is that the above is just syntactic sugar for what the compiler will first translate the …

Member Avatar
Member Avatar
+3 forum 1

The End.