Top "Closures" questions

A closure is a first-class function that refers to (closes over) variables from the scope in which it was defined.

How to use $this in closure in php

I have function like this: class Service { function delete_user($username) { ... $sessions = $this->config->sessions; $this->config-&…

php closures this anonymous-function
python: how binding works

I am trying to understand, how exactly variable binding in python works. Let's look at this: def foo(x): def …

python closures nested-function
How do I write a generic memoize function?

I'm writing a function to find triangle numbers and the natural way to write it is recursively: function triangle (x) …

optimization recursion lua closures memoization
addEventListener, for(), index. how to use closure?

I have this code: var items = this.llistat.getElementsByTagName('a'); for( var i = 0; i < items.length; i++ ){ items[i].…

javascript for-loop closures addeventlistener
Passing parameters into a closure for setTimeout

I've run into an issue where my app lives in an iframe and it's being called from an external domain. …

javascript jquery internet-explorer-9 closures document-ready
What are good JavaScript OOP resources?

JavaScript is a lightweight and powerful language, but it's often misunderstood and hard to learn (especially about its object oriented …

javascript oop closures
Checking Objective-C block type?

This is primarily a curiosity, I'm not really sure what's the practical use of this but here goes. Since blocks …

objective-c oop closures objective-c-blocks introspection
Can someone explain Anonymous methods to me?

Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen the examples, and the blog posts regarding …

delphi closures anonymous-methods
What limitations have closures in Python compared to language X closures?

Where X is any programming language (C#, Javascript, Lisp, Perl, Ruby, Scheme, etc) which supports some flavour of closures. Some …

python closures
dispatch_group_leave crash in swift

This happens very rarely. Here is the last line of the stack trace: 0 libdispatch.dylib 0x0000000197a85a9c dispatch_…

ios swift closures healthkit