Comments (13)
Working on this today. I'll try to tackle it all, unless I hear otherwise.
from motoko-base.
- 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.
Let's go with foreach
then.
from motoko-base.
I think we can close this now.
from motoko-base.
Notes:
- Skipping the compiler primitives in the current draft PR (#44 ); anyone want to help there?
- In
TrieMap
renamingfromIter
->fromEntries
for consistency withiter
->entries
from motoko-base.
Update #44 now addresses nearly all of the items above (not compiler prims).
from motoko-base.
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.
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.
@nomeata, agreed. Anybody else has thoughts? Is there enough appetite for another (smaller) name change like this?
from motoko-base.
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.
Or just each
.
from motoko-base.
@nomeata. @rossberg, @kritzcreek wants to know what to use for apply
from motoko-base.
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)
- Chore: rename/factor RBTree unshare tests to avoid confusion.
- chore: delete antora related doc detritus
- Improve RBTree with static leaf HOT 9
- Float.equalWithin tolerance?
- Doc: add link to doc site to readme
- Add messageQueueLeft() method to ExperimentalInternetComputer HOT 2
- The term "bets" is introduced without first explaining what it means HOT 9
- Error propagation in CI is broken HOT 1
- Deque.size() is missing
- Stack overflow for Heap.fromIter
- AssocList is missing keys(), vals()
- bug: undocumented functions
- Class `SHA224` in `Principal.mo` contains dead data HOT 1
- Array.chain(): Error "index out of bounds"
- Principal.mo uses deprecated function HOT 5
- sequence-like collections should have a `group` operation that lumps together equal subsequences
- utilities for tuple comparisons
- FR: consider adding List.contains : (List<A>, A, (A,A) -> Bool) -> Bool (or similar)
- FR: consider adding module `VarArray` with mutable versions of the immutable array functions in `Array`
- chore: test `viper` again
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 motoko-base.