Top "Closures" questions

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

'[weak self]' in RXSwift closures

Do i need to use [weak self] within RXSwift subscribeNext closures? I have the code: searchController.searchBar.rx_text.throttle(0.2, …

swift closures rx-swift
How do you test functions and closures for equality?

The book says that "functions and closures are reference types". So, how do you find out if the references are …

closures swift equality
Twitter Bootstrap typeahead: get context / calling element with `this`

I am using the Typeahead component of Twitter Bootstrap 2.1.1, and jQuery 1.8.1 I am trying to access the text box element …

javascript jquery twitter-bootstrap closures typeahead
Is it possible to make a recursive closure in Rust?

This is a very simple example, but how would I do something similar to: let fact = |x: u32| { match x { 0 =&…

recursion closures rust
Groovy Closure with optional arguments

I want to define a closure which takes one argument (which i refer to with it ) sometimes i want to …

groovy parameters arguments closures optional
How to make Groovy / Grails return a List of objects instead of a List of Lists of objects?

I have a class like this: class Foo { static hasMany = [bars: Bar] } When I write: Foo.getAll() I get a …

grails collections groovy closures collect
How to maintain state in Python without classes?

Are there pythonic ways to maintain state (for purposes of optimisation, for example) without going fully object-oriented? To illustrate my …

python closures state
Modify bound variables of a closure in Python

Is there any way to modify the bound value of one of the variables inside a closure? Look at the …

python functional-programming closures
The foreach identifier and closures

In the two following snippets, is the first one safe or must you do the second one? By safe I …

c# enumeration closures
Local variables in nested functions

Okay, bear with me on this, I know it's going to look horribly convoluted, but please help me understand what's …

python scope closures nested-function