GithubHelp home page GithubHelp logo

do-not's People

Contributors

internetimagery avatar kiwislob avatar

Stargazers

 avatar  avatar

Watchers

 avatar

do-not's Issues

Support the walrus!

do(
    v1 + v2
    for v1 in Just(10)
    if (v2 := v1 + 10) # This assignment works in regular list expressions but if it resides within the "guard" function, which only returns a boolean. How shold this value be propagated?
)

Currently this will not work as the variable is created within the scope of the filter function. Which itself only returns a boolean.

Certainly it could be rearranged.

do(
    v1 + v2
    for v1 in Just(10)
    for v2 in Just(v1 + 10)
    if v2
)

But I"m sure there are some more useful examples than this toy one, that are only expressible in this form.

Unable to use shadowed closure variables

One small edge case remains unsolved.

v2 = 123
do(
    v1+v2
    for v1 in Just(123)
    for v2 in Just(v2)
)

When an outside variable is shadowed, treated as a nonlocal. It is not included in the closure as is standard. So when this is converted into a function, this variable is long out of scope. Thankfully the error message is helpful so it's not the end of the world (and this is poor coding design). But it would be good to have this fixed if a way can be found.

One inconsistency is that the first expression will always be fine, since it's evaluated before any adjustments are made.

v1 = 123
do(
    v1
    for v1 in Just(v1) # Fine, as it's in the first expression...
)

Note that this also works as the variable is non-shadowed:

v3 = 123
do(
    v1+v2
    for v1 in Just(123)
    for v2 in Just(v3)
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.