n number of elements in array / size along each dimension
1; 1-- (1 / number of dimensions of first input)
numel. For several outputs, or a single output other than the first, gives size along those dimensions
In programming languages, closures (also lexical closures or function closures) are techniques for implementing lexically scoped name binding in languages with first-class functions. Operationally, a closure is a record storing a function together with an environment: a mapping associating each free variable of the function (variables that are used locally, but defined in an enclosing scope) with the value or reference to which the name was bound when the closure was created. A closure—unlike a plain function—allows the function to access those captured variables through the closure's copies of...
98. Befunge-98 (PyFunge), 153 bytes, A001772
&v >1 >1+:00g\%kvv>1\>1-\2*\:kvv
# vw\-1g00: < >$v ^ < $
>0p^ >$01g1-:01v> #> > 1+vv-1*b<
^>1+01p ^ ^: <>0
>p k^.@zz
Try it online!
The two zs after the @ are nop's that never get executed but I added in the make...
The main idea to closures is that the function constructed inside is always in the scope of its parent function, even after that function is gone from the stack
@HyperNeutrino enumerations? (Let me give you an example again)
class Person{
init(name:String,personType:PersonType)
}
enumeration PersonType{
case Worker
case Teacher
case Driver
case Programmer
}
let Alexander = Person(name: "Alex", personType: Person.Programmer)