Comments (1)
Closures are now implemented natively.
For example:
func accumulator(sum){
func (n) { # returns a closure
sum += n;
}
}
var acc = accumulator(1);
acc(2);
accumulator(0); # does not affect "acc"
say acc(3); # will print 6 (the result of: 1+2+3)
from sidef.
Related Issues (20)
- Struct definitions require commas HOT 1
- `nested_evals` test fails with -W (constant subroutine redefined)
- -> declarations cannot immediately follow an `import`
- right shift with signed input doesn't match documentation HOT 1
- Optimization: Potential speedup for nth_powerfree
- Const variable sub names in modules sometimes aren't invoked HOT 2
- Optimization level 2 breaks / disables inheritance across modules HOT 4
- Inherited arrays of callables are buggy HOT 4
- Method optional arguments aren't optional with slurpy arguments HOT 2
- some const values are eagerly optimised away or not reinitialised on scope entry HOT 1
- __CLASS__ in child classes
- Cross-module imports of sub-modules are not possible HOT 10
- -O2 causes colon Hash syntax to become a Pair(Hash, key) inside classes
- Missing package name when interactively declaring a variable with an immediate reference HOT 2
- Explicit topic variable _ disappears in a module's outermost scope HOT 5
- Try/Catch don't treat returned lists / multiple values properly HOT 1
- Static variables in methods are static to all class instances? HOT 1
- Test whether an object is a typename or constructed HOT 3
- ConstInit is not within the optimising deparser's scope HOT 2
- Const variables cause "Code point is not Unicode, and not portable in say"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sidef.