Giter Club home page Giter Club logo

Comments (13)

matthewhammer avatar matthewhammer commented on May 21, 2024 1

Working on this today. I'll try to tackle it all, unless I hear otherwise.

from motoko-base.

rossberg avatar rossberg commented on May 21, 2024 1

@matthewhammer:

  • In TrieMap renaming fromIter -> fromEntries for consistency with iter -> entries

Ah, this actually was on purpose. I thought that for uniformity, toX/fromX should always denote type conversions, where X names the resp type (I suppose that could go into the design guide as well). So either fromIter, or perhaps better in this case, some other name not using from (not sure which one, though).

from motoko-base.

rossberg avatar rossberg commented on May 21, 2024 1

Let's go with foreach then.

from motoko-base.

rossberg avatar rossberg commented on May 21, 2024 1

I think we can close this now.

from motoko-base.

matthewhammer avatar matthewhammer commented on May 21, 2024

Notes:

  • Skipping the compiler primitives in the current draft PR (#44 ); anyone want to help there?
  • In TrieMap renaming fromIter -> fromEntries for consistency with iter -> entries

from motoko-base.

matthewhammer avatar matthewhammer commented on May 21, 2024

Update #44 now addresses nearly all of the items above (not compiler prims).

from motoko-base.

rossberg avatar rossberg commented on May 21, 2024

Some folks expressed their dislike of changing map to transform, which is understandable. My main motivation was to avoid confusion and domain conflicts like with a map function on maps. But if you all think this is preferable, I'm happy to switch back.

The other naming that may be overly obscure is apply. In most cases, iter would be the more obvious and recognisable name, except that (1) it is unrelated to the type Iter, and (2) it is an odd name in the case of singleton containers like options (even though OCaml happily provides Option.iter).

Thoughts?

from motoko-base.

nomeata avatar nomeata commented on May 21, 2024

I find apply not great; it sounds as if I am applying the container to a value. forEach might be a more proletarian alternative. But I would be happy with iter or iterate.

Also in favor of reinstanting map, but of course I am heavily primed to understand map. transform sounds too generic – anything could be a transformation.

Maybe pick someone in the org who is close to our target audience and ask them? Andew maybe, being a front-end developer?

from motoko-base.

rossberg avatar rossberg commented on May 21, 2024

@nomeata, agreed. Anybody else has thoughts? Is there enough appetite for another (smaller) name change like this?

from motoko-base.

crusso avatar crusso commented on May 21, 2024

Alternatives for apply might be do or act or every, though I'm not sure we want to burn do as a keyword. Scala uses foreach, FWIW.

from motoko-base.

crusso avatar crusso commented on May 21, 2024

Or just each.

from motoko-base.

crusso avatar crusso commented on May 21, 2024

@nomeata. @rossberg, @kritzcreek wants to know what to use for apply

from motoko-base.

matthewhammer avatar matthewhammer commented on May 21, 2024

FWIW, I also prefer foreach to replace apply, to name side-effect-based iteration that accepts each item with the function arg.

@rossberg -- In fact, I do think it's directly related to the type Iter (foreach is the "computation form" of imperative iteration for a structure, rather than the "object/value form" for that given structure), but I do not see any benefit from reusing the name "iter" for this operation, since it may just be too confusing, given that we also want an operation that produces iterators, and we want to call that operation iter. Given this situation, it doesn't make sense to call them the same thing.

I'm happy with transform. I'm also happy with map, since I think people are used to concepts being manifested separately as both nouns (values) and verbs (computations) without those concepts being either identical nor confused. map is a good example of this.

from motoko-base.

Related Issues (20)

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.