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

World: r3wp

[!REBOL3-OLD1]

BrianH
29-May-2009
[14634]
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
Maxim
29-May-2009
[14640x2]
I know  ;-)
why is why reference, in REBOL, has a different meaning to me.  if 
all words are references in C terms, then that concept has its own 
meaning in REBOL terms... IMHO.
Steeve
29-May-2009
[14642]
Brian, don't lecture me, I know those obvious things too (Bad habit)
I just think '* is as good as -EACH and shorter.
So '* is the winner.
Maxim
29-May-2009
[14643x2]
'* doesn't mean anything.  so its pointles... 


so you'd rather have acronyms for cunction names... just make  it 
totally cryptic?  ' * '  isn't english for any thing.  rebol doesn't 
name things in CS terms, it uses readable english.
cunction = function
Steeve
29-May-2009
[14645]
English doesn't mean anything to me :)
Pekr
29-May-2009
[14646x2]
guys, chill out :-) How often will you use map-each so that it will 
irritate you? Well, I do care for naming conventions too, but I have 
my reservations for where imo architecture goes wrong, like using 
read-text, load-plugin and similar stuff ....
Steeve :-)
Maxim
29-May-2009
[14648]
quoi?   ;-)
Janko
29-May-2009
[14649]
speak for yourself ...  I will use it many times :)
Izkata
29-May-2009
[14650x2]
I prefer just "map", but if there's going to be a name change, I 
think "map-each" is best - not only is it consistent with foreach, 
remove-each, etc, it's shorter than "map-every" or other alternatives, 
and feels like more natural English to me.

And I use my map all over the place
if nothing else, at least keep "map" in the name.  Part of the reason 
I dislike "accumulate" for fold - it's harder to find, coming from 
another language
Steeve
29-May-2009
[14652]
Yes, map is useful.
Maxim, map this "baillon" on your mouth :-)
Pekr
29-May-2009
[14653]
Izkata: it is not consistent with foreach, it would have to be for-each 
then :-)
Janko
29-May-2009
[14654]
my vote now: map-each , filter-each (isn't remove-each reverse in 
meaning) , fold-each (accumulate - I never know how to type this 
word) ... and something like find-each would also be very nice to 
have
Steeve
29-May-2009
[14655]
Wow, what hemorrhage...
Why don't you add -EACH everywhere we deal with series then ?
Janko
29-May-2009
[14656]
Steeve .. do you say this to me because of find-each :) .. I mean 
a fing that uses block of code to determine what to find .. like: 
find-each x numbers [ x > 3 ]    ... in same manner as map/fold/filter 
work
Pekr
29-May-2009
[14657]
I also wanted change-each :-)
Steeve
29-May-2009
[14658]
i propose a new fork for rebol.
REBOL-EACH
Janko
29-May-2009
[14659x2]
hehe :)
fact is that find with a codeblock as criterium would be very usefull 
.. maybe it already exists under some other name? I remember someone 
proposing it not a long ago too
BrianH
29-May-2009
[14661]
Pekr, the FOR* functions have their own naming convention, and for 
historical reasons "-" isn't included.
Janko
29-May-2009
[14662x2]
I use map reduce and seek  at jsgoo and I can do a lot of stuff with 
those (an appy inject for dictionaries) .. let's say you want to 
check if users with username and password exists in a block of users:

find-each U users [ all [ equal? U/user user equal? U/pwd pwd ] ] 
... much cleaner and more error prone than with foreach IMHO ( and 
these functions show intent of why you are looping through block 
of users )
(seek is similar to  what here would  be find-each for example)
BrianH
29-May-2009
[14664]
Steeve, the *EACH functions have a really specific calling convention 
and all have the same bind/copy overhead for the code block. The 
other series functions have neither of thoise characteristics.
Steeve
29-May-2009
[14665]
Janko, I agree on one point, i dislike the name remove-each (too 
long).

Why don't we use the short name "filter" which is not used anywhere 
else (so we don't need -each prefix to decipher it from other uses).
Janko
29-May-2009
[14666]
(error proff  not error prone ) :))
BrianH
29-May-2009
[14667x2]
Janko, REMOVE-EACH is not reverse in meaning - elements are removed 
if they meet a particular criteria. The REBOL version is modifying, 
though.
Steeve, is the filter function modifying or does it return a new 
series?
Janko
29-May-2009
[14669]
Brian: but don't you usually want to whitelist not blacklist stuff, 
(what should stay not what should be lost) ? I don't use something 
like filter much so I don't know what is more used
BrianH
29-May-2009
[14670]
I use REMOVE-EACH a lot in R2, but mostly because of how fast it 
is. It is easy to make your condition return false or none.
Janko
29-May-2009
[14671]
ok
BrianH
29-May-2009
[14672]
Pekr, MAP-EACH (using the new name) is used in LOAD to implement 
LOAD [%s1.r %s2.r ...]. I don't know how it is used in the rest of 
the mezzanines. I mostly use it in my own code, but the version I 
backported to R2 as a mezzanine.
Janko
29-May-2009
[14673]
can I just express humble request that if you will have something 
like map in "core" please also have accumulate .. they are cousins 
if you use one you will also the other .. (like map-reduce) :)
BrianH
29-May-2009
[14674]
I tried, but it won't go in the core - it has been moved to R3/Plus.
Janko
29-May-2009
[14675]
to bad... I gues some people won't use neither map-each or accumulate 
, but those that will use map-each will also use accumulate, as they 
together give you the most usages of foreach and other primitive 
loops
BrianH
29-May-2009
[14676]
Other functions that are in the core now will also be moved to R3/Plus. 
We don't know which will make the cut, just that the cuts are coming. 
The core will be tight, bt the functions will still be available 
if you need them.
Janko
29-May-2009
[14677]
ok.. no problem I will survive .. I am happy that they will be there 
core or plus
BrianH
29-May-2009
[14678x3]
Janko, map and fold are only efficient in functional languages that 
are compiled and optimized. In hand-optimized, interpreted languages 
iteration is *much* more efficient.
You could use map and fold to implement foreach, but FOREACH is much 
faster that that implementation.
that that -> than that
Janko
29-May-2009
[14681x2]
if I would care only for efficient I wouldn't be using compiled languages 
anyway .. sometimes it doesn't matter that much .. I like map/fold 
because they cleanly express what you want to do , you don't have 
to setup and update temp variables and they are expressions ( they 
return result)
wouldnt = would
BrianH
29-May-2009
[14683]
Pekr, LOAD-PLUGIN is an internal function. We reserve the most awkward 
names for the internal functions :)

And READ-TEXT doesn't exist and won't - it will probably be READ/text 
instead.