# Questions tagged [Lambda expressions] (23)

0

## How do you implement such a feature?

intersectionInvoke<Position, Velocity>(positions, velocities, [] (EntityID id, Position& pos, const Velocity& vel) { pos.x += vel.x; pos.y += vel.y; } ); The Position and Velocity of the struct and just positions, velocities is STD:: unordered_map<id, Positions/Velocity>
electa85 asked March 31st 20 at 14:00
3

## Why list lambda expressions returns the same number?

Good afternoon. In the interview for the post of Python IPA faced with this challenge: There is code:l1 = [lambda: x for x in range(3)] l2 = [f() for f in l1] l2 >>> [2, 2, 2] Actually the question why? There is no suggestion that this 3 links to the same object. But:>>> l1[0] is l1[1] False >>> l...
millie.Heidenrei asked March 29th 20 at 19:37
1

## Python how to implement nested functions in module tkinter?

There is a start window where you select log in or register. If you click to register - there is a login window, then the entered data is saved in a text document intro() -> registration() -> save(). The problem is that the function save() does not see the variables login and password and gives the error: Traceback (...
Chase.Bins asked March 25th 20 at 11:47
0

## Python 3 Ttinker Label Button Lambda — how to change the text using one function and three of the same item?

There's a test code. By using the lambda function to change the text of the button 3 and 4 with one universal function, but do not understand why clicking on the text changes 3 to 4. It is clear that the function takes the last button and change it, but I that is not good at lambda.from tkinter import * from tkinter import ...
aniya asked March 21st 20 at 12:12
1

## In Haskell you can specify a system of equations that he solved it? Instead of writing functions for your own decisions?

For example, there is a system of equations In a functional language you need to write the decision himself? Functional style is declarative, like Prolog? And then just in the definition of a declarative said write what you need to and get the decision. The system will find it. But it seems like functional languages(compile...
Buddy.Hin asked March 19th 20 at 20:08
3

## Makes the specified line of code?

Hi all. There is a line of code:print(*map(lambda x: ".join(x), m), sep='\n') I don't understand what makes the multiplication sign in front of the map and I can not understand what does the lambda function. Where does she get x?
Karelle_Gutmann asked March 17th 20 at 09:18
2

## Does the standard package in Java 8* the ternary operator (condition? результат_true: результат_false) with lambdas?

Hello. It would be convenient if Java (primarily interested in the 8th version) would be a functional replacement for the ternary operator "condition ? результат_true : результат_false". I can write it yourself, but why do that if it may already have. Maybe someone was in the standard delivery methods such. PS something li...
Tobin.OReil asked March 15th 20 at 23:33
1

## How to replace a bulky code with lambdas or make it more beautiful?

I have a mapper that converts actual entity from the database to DTO. The problem is that tables are nested. To be precise, I have 5 tables that are linked like this: And that's where I ultimately need prometi entity to A DTO. For this I wrote a rather bulky mapper:public AssuranceAccessLineDto mapperToAssuranceAccessLineDt...
abe43 asked March 15th 20 at 23:04
1