r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

BrianH
28-May-2009
[14590]
(slow altme)
Steeve
28-May-2009
[14591x2]
i vote to discard decimals, if it can be of any help :)
they can use fixed point decimals instead, so users will not complain
BrianH
28-May-2009
[14593]
Ladislav will complain :(
Steeve
28-May-2009
[14594]
who's that ? :-)
BrianH
29-May-2009
[14595]
Quick discussion needed, and here because more people need to chime 
in:


There is a proposal to change the name of the MAP function to MAP-EACH. 
Here's why:

- There's a map! type, and this function is unrelated - except in 
CS theoretical terms, which is why we suggest the name MAP-EACH.

- The other functions that have the name of a type without the ! 
are constructors for that type. The map! type could use one.
- This function is behaviorily one of the *EACH family already.

- This is *not* the functional language map function, and it might 
be good to emphasize that...


In functional languages, functions like map take functions as parameters. 
However, such languages tend to be compiled and the function values 
they take are constructed ahead of time. Since REBOL is interpreted 
and functions are created at runtime, that kind of code pattern tends 
to be inefficient. That is why REBOL control and loop functions tend 
to take blocks instead, and have any argument words to those blocks 
as a separate parameter: It's much more efficient that way.


There is precedent: The REBOL function that corresponds to the functional-langage 
filter function is REMOVE-EACH.


We ask this question now because now is the time to make the change, 
if ever. Not many functions in R3 use MAP yet (the only one I can 
think of off the top of my head is LOAD). This will change when we 
do a hand-optimization pass of the mezzanines, and it will definitely 
be too late once we hit beta.


What do you all think? Please chime in in the next couple days if 
you can (and have an opinion).
Oldes
29-May-2009
[14596]
No problem to rename it now
BrianH
29-May-2009
[14597]
I'm taking votes. If it happens it will likely do so in the next 
release.
Sunanda
29-May-2009
[14598]
Thanks for the opportunity to comment.....
I'll vote yes to renaming it away from 'map.

Not sure 'map-each is an _ideal_ alternative, but it is better than 
'map for the reasons given by BrianH.
Janko
29-May-2009
[14599]
My vote: I don't want it to be called MAP because of reasons you 
named.. anything reasonable else is ok... 


I can't decide if I like map-each remove-each *-each ... naming convention... 
 

just thinking outloud..

1) you named fold/reduce accumulate ... if you name map/filter in 
similar vein they could be something like  map -> transform  translate 
  alter   apply ?     remove-each -> filter  purge ...


2) common to these functions is that they take a block of code (and 
a series) ... each hints about the serries but maybe more specific 
about them is first part - block of code (function in classic functional).... 
one idea for the common word that hints about  do something with 
block of code as a rule IMHO is with


map -> map-with , transform-with , ... ; remove-with  filter-with 
purge-with ;  fold-with ??
Pekr
29-May-2009
[14600]
I am OK with renaming too. OTOH I too dislike map-each, remove-each 
names, but not a big deal here ...
Janko
29-May-2009
[14601]
(agh ... altme ate my post 2 times!!)


I use the similar with naming for other types of combinators ( functions 
taht take blocks of code) for example


with-sqlite %a.db [ SQL "select * from t;" ]   ( opens db ; runs 
block of code (could bind to words but not needed here) ; closes 
db  ; returns result )
Henrik
29-May-2009
[14602]
I'm fine with changing it.
Vladimir
29-May-2009
[14603]
Two questions:
1.  is there a way to load-gui from local file ?
2. How is unicode in rebol3 working ?  (is it working ? ) :)
BrianH
29-May-2009
[14604x2]
Well, one advantage for calling them something other than map and 
filter is that you could put functional map and filter functions 
in a module somewhere and not have naming conflicts. They'll be less 
efficient and less flexible, but at least the functional programming 
fans would be happy :)
The only reason the *EACH makes sense is the word parameter that 
comes first:
    foreach x data [code]  ->  For each x in data do code
    remove-each x data [code]  ->  Remove each x in data if code
    map-each x data [code]  >  Map each x in data to code
Steeve
29-May-2009
[14606]
i don't like verbose naming conventions.
Maxim
29-May-2009
[14607x2]
vote for change.


funny that I sometimes add the 'in word when typing code ... then 
rebol pops an error... ehhehe  that 'in doen't work on blocks.  ;-)
I prefer consistency over anything else.   things that are consistent 
don't have to be remembered.
BrianH
29-May-2009
[14609]
That's a good point Maxim - we better make sure that IN series block 
is never added as a feature :)
Maxim
29-May-2009
[14610]
how many times have I gone to the dictionnary to remember the functions 
names of  the various grouping functs... UNION COMPLEMENT EXCLUDE, 
etc.
Steeve
29-May-2009
[14611]
me never
Maxim
29-May-2009
[14612]
there are just to many functions to remember.  at some point the 
brain has to let go of some stuff, and the things which can't be 
computed, are forgotten first.
Steeve
29-May-2009
[14613]
creating super long names resolve nothing
BrianH
29-May-2009
[14614]
Or in my case archived and taken out of the index, Maxim :(
Steeve
29-May-2009
[14615]
or do you want our programms looks like C or Java ones
Maxim
29-May-2009
[14616x3]
map-each isn't long.  the 'each part is classification, and adds 
intent and meaning to what the function does.
steeve, this isn't a noun prefix.
that is a big difference.
Steeve
29-May-2009
[14619]
they-like-long-names
Maxim
29-May-2009
[14620]
map in this context is a verb.
Steeve
29-May-2009
[14621]
REMOVE*, MAP*
Is that not enough ?
Maxim
29-May-2009
[14622]
personnaly I'd prefer the use of 'EVERY instead of 'EACH
Steeve
29-May-2009
[14623]
i vote for '*
Maxim
29-May-2009
[14624x2]
more explicit that it traverses the WHOLE series to its end.
much better to include a totaly obcure character... sure steeve. 
 assembly style code is much better than C.
BrianH
29-May-2009
[14626]
Steeve, if you want short wording then the question is whether the 
MAP-EACH block builder or the MAP map! constructor would be called 
more often. In mezzanine code creating map! values if more frequent 
than the use of the current MAP function.
Janko
29-May-2009
[14627]
aha, I didn't see the reason for *-EACH ... that makes good sense.. 
I like it!
Steeve
29-May-2009
[14628]
'* is not obscur as convention, it's used by other languages too
Maxim
29-May-2009
[14629x2]
rebol IS NOT another language... that was my point.  thanks for pushing 
it   ;-)
but in any case, REBOL style usually uses the '* as a notation for 
"pointer" or "reference to",
Steeve
29-May-2009
[14631]
uh ? in your dream i guess
BrianH
29-May-2009
[14632x3]
(more lost messages and dropouts)
Steeve, REBOL gets its speed of programming by preferring unshifted 
characters to speed typing of code, and English-like naming to speed 
reading. The syntax and naming conventions of REBOL were carefully 
chosen for good reason.
Steeve, other languages that use the * convention use it differently 
from each other. C-like languages use it for pointers. REBOL uses 
it for keeping the original definition of redefined words, like COPY* 
(not for pointers or references, Maxim, because those are implicit). 
The only language in major use that uses * to mean do-many-or-all 
is Regular Expressions.
Maxim
29-May-2009
[14635x3]
brianH to me, a reference in rebol is not the same as a reference 
in C.  semantically they are equivalent, even if technically they 
are implemented differently.
note the use of equivalent... over... "the same"
meaning, keeping a reference to some data.   which is why we never 
use a-word* to store scalar values for example, but we will sometimes 
use them for copies of series, and words.
BrianH
29-May-2009
[14638x2]
All assigned non-immediate values are references in REBOL, implicitly 
:)
bbl