-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subsection on let blocks #188
Comments
The difference is that other scope blocks just control visibility, but let allocates new bindings (where a binding is defined as the location where a variable is stored). This difference is only visible when you have closures, which allow variables to live longer than the blocks that introduced them:
|
Awesome, I can include this example in the docs. I wonder if this shouldn't be the behavior of |
It's also the case that
is equivalent to In the case of for loops, the former behavior doesn't seem too useful, but it's much more efficient for common uses, even when closures are involved:
Here the closure is only used in the loop, so not only is a new binding not needed, but allocating the closure itself can be lifted out of the loop because you can keep reusing it and just update the binding inside. |
What section of the docs is this going in? |
Variables and Scoping seems like the only reasonable place, right? On Aug 31, 2011, at 12:21 PM, [email protected] wrote:
|
Done! |
Support kw argument in call overload.
Stdlib: Statistics URL: https://github.com/JuliaStats/Statistics.jl.git Stdlib branch: master Julia branch: master Old commit: d49c2bf New commit: 77bd570 Julia version: 1.13.0-DEV Statistics version: 1.11.2(Does not match) Bump invoked by: @nalimilan Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaStats/Statistics.jl@d49c2bf...77bd570 ``` $ git log --oneline d49c2bf..77bd570 77bd570 Fix `quantile` doctest (#188) bfa5c6b Merge pull request #184 from JuliaStats/an/quantilemuladd 6bd1531 Update src/Statistics.jl 44d51c7 Use muladd in aleph calculation in _quantile to avoid some rounding errors. 793733e Bump codecov/codecov-action from 4 to 5 (#181) ``` Co-authored-by: nalimilan <[email protected]>
Stdlib: Statistics URL: https://github.com/JuliaStats/Statistics.jl.git Stdlib branch: master Julia branch: master Old commit: d49c2bf New commit: 77bd570 Julia version: 1.13.0-DEV Statistics version: 1.11.2(Does not match) Bump invoked by: @nalimilan Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaStats/Statistics.jl@d49c2bf...77bd570 ``` $ git log --oneline d49c2bf..77bd570 77bd570 Fix `quantile` doctest (#188) bfa5c6b Merge pull request #184 from JuliaStats/an/quantilemuladd 6bd1531 Update src/Statistics.jl 44d51c7 Use muladd in aleph calculation in _quantile to avoid some rounding errors. 793733e Bump codecov/codecov-action from 4 to 5 (#181) ``` Co-authored-by: nalimilan <[email protected]> (cherry picked from commit 504cbc3)
We don't explain
let
blocks since they're not control structures, per se. However, they're mentioned as introducing new variable scope blocks in [[Variables and Scoping]]. We need to explain them somewhere. @JeffBezanson, can you explain this, optimally with a few example to distinguish from other variables binding constructs — such as plain old assignment? I.e. what's the difference between these three blocks:The text was updated successfully, but these errors were encountered: