Tagged articles
anonymous function
16 articles · Page 1 of 1
This article explains PHP closures, showing their basic syntax, how to use them as function arguments, and how to generate dynamic functions at runtime with clear code examples that illustrate creating reusable and adaptable anonymous functions.
Callbackanonymous functionclosure
0 likes · 5 min read

This guide explains what PHP callbacks are, shows how to define them using anonymous functions or function name strings, demonstrates their implementation as function parameters and class methods, and outlines common scenarios such as event handling, asynchronous processing, and array sorting or filtering.
CallbackClass MethodPHP
0 likes · 4 min read

This article explains Python's anonymous (lambda) functions, covering their syntax, characteristics, basic usage examples, common application scenarios such as map, filter, reduce, sorting, GUI event handling, advantages and disadvantages, best practices, and comparisons with regular def functions.
Code ExamplesPythonanonymous function
0 likes · 8 min read

This article introduces Python's anonymous (lambda) functions, explains their syntax and typical use cases, and provides a series of clear code examples—including calculations, map/filter/sorted operations, reduce, callbacks, and string formatting—while highlighting important considerations for readability and limitations.
Code ExamplesPythonanonymous function
0 likes · 11 min read

This guide explains why anonymous functions in Go can be made recursive by assigning them to a variable, shows a complete factorial example with code, and clarifies the underlying type‑declaration trick needed for self‑reference.
Goanonymous functionfactorial
0 likes · 3 min read

This article explains the concepts of callbacks, anonymous functions, and closures in PHP, providing definitions, practical examples, and demonstrating how to implement sorting with callback functions, create inline anonymous functions, and use closures to capture external variables, highlighting their benefits for code reuse and readability.
CallbackPHPanonymous function
0 likes · 7 min read

This article explores how to replicate Python's context manager behavior in Go by examining defer's delayed execution, demonstrating its limitations in loops, and presenting three solutions—anonymous functions, a WithClose helper, and a withLock-inspired pattern—to ensure timely resource release.
GoWithCloseanonymous function
0 likes · 10 min read

This article explains what Python lambda (anonymous) functions are, shows their syntax, highlights four typical pitfalls—returning values, choosing alternatives, assigning to variables, and overusing them with higher‑order functions—and provides clear guidelines and code examples to use lambdas correctly.
Best Practicesanonymous functionlambda
0 likes · 7 min read

This article explains PHP callback functions, covering their definition through anonymous functions and function name strings, demonstrates implementation as function parameters and class methods with code examples, and discusses common use cases such as event handling, asynchronous operations, and array sorting or filtering.
CallbackClass MethodPHP
0 likes · 5 min read

The article explains Go closures, shows how capturing loop variables by reference can cause bugs like repeated values, demonstrates correct patterns such as copying variables inside loops or passing them as parameters, and offers guidelines to avoid common pitfalls with defer and concurrency.
GoPitfallanonymous function
0 likes · 11 min read

This article explains what Python lambda (anonymous) functions are, shows their syntax, demonstrates typical use cases with built‑in functions and pandas, and outlines four common pitfalls—returning values, assigning to variables, ignoring better alternatives, and overusing them—while providing code examples and best‑practice recommendations.
Best PracticesPythonanonymous function
0 likes · 7 min read

This article explains what Python lambda (anonymous) functions are, shows their syntax, demonstrates common mistakes such as using return statements, assigning them to variables, and preferring list comprehensions, and provides correct usage examples with built‑in functions like sorted, map, and pandas.
Best PracticesPythonanonymous function
0 likes · 7 min read

Python's lambda expressions provide a concise way to create anonymous functions, and this guide explains their syntax, demonstrates simple to complex examples—including arithmetic, conditional logic, and sorting—and compares them with traditional functions and built‑in utilities like filter and list comprehensions.
Code ExamplePythonanonymous function
0 likes · 5 min read

This article explains the PHP preg_replace_callback function, its parameters, how to use anonymous functions as callbacks, and demonstrates passing extra arguments via globals or class properties with clear code examples.
Callbackanonymous functionpreg_replace_callback
0 likes · 4 min read

This article explains PHP's preg_replace_callback function, details its parameters, demonstrates using anonymous functions for callbacks, and shows how to pass additional arguments via globals or class properties with clear code examples.
Callbackanonymous functionpreg_replace_callback
0 likes · 4 min read

This article introduces Python’s lambda anonymous functions, explains their syntax and differences from regular functions, showcases practical one‑line examples, explores functional programming tools like map, filter, and reduce, and highlights how lambdas can reduce code size while enhancing readability.
Code ExamplesPythonanonymous function
0 likes · 9 min read
