orc-lang / orc

Orc programming language implementation
https://orc.csres.utexas.edu/
BSD 3-Clause "New" or "Revised" License
41 stars 3 forks source link

Change prelude ...Map def names #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Description of Change:

Request from Jay:
1.  Change altMap def name to otherwiseMap.

Request from Arthur:
2.  Change ...Map def names when they don't return a list.

Benefit of/Reason for Change Request:
Naming improvements.

Issues/Concerns with Change Request:
- altMap's name corresponds to the alt prelude def's name.
- Breaking existing code.

Original issue reported on code.google.com by jthywissen on 30 Oct 2012 at 6:02

GoogleCodeExporter commented 9 years ago

Original comment by arthur.peters on 29 Nov 2012 at 9:13

GoogleCodeExporter commented 9 years ago
So after some thought I'm not sure if changing these is a good idea. Here are 
possible choices and my thoughts on them:

* Despite what I said map is a reasonable suffix for a different reason. The 
*Map functions could be written as:
    def forkMap(f, xs) = fork(map(curry(defer)(f), xs))
So we can think of this as fork "composed" with map. So the name forkMap is 
reasonable when thought of as apply fork to the map of f over xs.

* We could change them to *Iterate (or *Iter) but for things like fork and join 
it's not really iteration (since it's parallel). "seqMap" could in a sense be 
called just iterate because it is in fact the closest to the ML iterate 
function (or haskell mapM_), but that makes it inconsistent with the others and 
hides the fact that it is >>.

Jay's request to change altMap to otherwiseMap is also question able because 
alternatives if more descriptive of the use than "otherwise". Otherwise is the 
operator used, but it's not the meaning of the function that takes a list and 
tries them one at a time. However I could go either way on this one.

I think the most basic question here is: Should we name the function based on 
what they do conceptually or what operators they use under the hood?

If we should name it based on the operator, then we should change: fork -> par, 
alt -> otherwise. If we should name based on conceptual usage, I think we 
should leave them all the same including alt and altMap, or possibly use 
something in place of Map though I cannot think of what.

I would love to hear peoples thoughts if I hear nothing I will make a choice on 
my own around the end of the week and we can roll it back later if needed.

Original comment by arthur.peters on 4 Dec 2012 at 9:09

GoogleCodeExporter commented 9 years ago
Add documentation explaining names of "*Map" functions in idioms.inc.

Original comment by arthur.peters on 10 Dec 2012 at 10:37