• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Oldes
15-Nov-2012
[3649]
hm.. now I see, that even select and path notation is not returning 
error.. so I don't know where I came to this.
Ladislav
15-Nov-2012
[3650]
Yes, I just explained what should be used instead of PICK FOO -1
Andreas
15-Nov-2012
[3651]
I'd rather add an offset-based PICKZ than a PICK-BACK :)
Ladislav
15-Nov-2012
[3652x2]
(when being consistent, that is)
Andreas, I understand, I was just showing the consistent usage of 
1-based indexing without zero
Andreas
15-Nov-2012
[3654]
Could also be `pick skip foo -1 1`, but that is not less awful.
Ladislav
15-Nov-2012
[3655]
Could also be `pick skip foo -1 1`

 - yes, but that is not the direct equivalent of (inconsistent) PICK 
 FOO -1
Andreas
15-Nov-2012
[3656x3]
Yes.
Of PICK-FORWARD 1 returns the current value, PICK-BACKWARD 1 should 
of course also return the current value.
If*
Ladislav
15-Nov-2012
[3659]
Exactly what I was trying to emphasize
Oldes
15-Nov-2012
[3660]
From R3-alpha world:

Carl:	It is zero based for math computation reasons. If you think 
that is wrong, we should discuss it and correct it soon.	11-Oct-2007 
6:03:15 PM

Carl:	Rest of REBOL is one based for this reason: first = pick series 
1	11-Oct-2007 6:03:33 PM

Carl:	The solution we discussed, but have not yet implemented (but 
it is easy to do) is to add a PICKZ (or PICK0) function.	11-Oct-2007 
6:05:41 PM

BrianH	: Those math computation reasons are why I prefer zero based. 
I tend to use SKIP instead of AT for the same reason.	11-Oct-2007 
6:06:09 PM

BrianH	: Please add PICKZ and POKEZ - I liked them in rebcode.	11-Oct-2007 
6:06:46 PM
Ladislav
15-Nov-2012
[3661]
If PICK-FORWARD 1 returns the current value, PICK-BACKWARD 1 should 
of course also return the current value.
 - which, actually, leads to "overlaying", not to "gap-making".
Oldes
15-Nov-2012
[3662]
(Carl in the post above was answering why vector in the initial R3 
version was 0-based. He changed it afterwords to 1-based but never 
created promised *z functions.)
Ladislav
15-Nov-2012
[3663x2]
Frankly, I am not overly enthusiastic about the PICKZ name, any other 
reasonable idea?
(I mean of the name for such function)
Oldes
15-Nov-2012
[3665]
I don't think there will be better. And it was used in rebcode.
Ladislav
15-Nov-2012
[3666]
In the synonyms for PICK I found ELECT, what about that?
Arnold
15-Nov-2012
[3667]
REPICK REVPICK PREVGET NEGINDX PREPICK PICK-PREV NINDEX 
ELECT? -> NEGLECT ;)
Ladislav
15-Nov-2012
[3668x3]
My idea:

One-based        Zero-based
AT                        SKIP
PICK                    ELECT
INDEX?               BASIS?
FIRST                  ELECT0
SECOND            ELECT1
THIRD                 ELECT2
FOURTH             ELECT3
FIFTH                   ELECT4
SIXTH                   ELECT5
SEVENTH            ELECT6
EIGHTH                ELECT7
NINTH                   ELECT8
TENTH                  ELECT9
LAST                      LAST
HEAD?                  HEAD?
TAIL?                     TAIL?
LAST?                    LAST?
Having that, I would just be able to foget about one-based indexing 
happily ever after...
maybe adding ELECT-1 that may be needed often as well.
Oldes
15-Nov-2012
[3671]
I would hardly ever use elect* actions as I almost never use first, 
second... actions. Actually my english is so bad that I see elect 
for the fist time:)
Ladislav
15-Nov-2012
[3672x3]
I am in favour of ELECT also because it looks "higher level" than 
PICK. PICK seems to look quite "Low level", while in REBOL it isn't 
as "Low level" as it may suggest at the first sight.
(I mean to the users coming from other languages)
as far as I am concerned I would not need ELECT3 and above, but up 
to ELECT2 they look nice to have.
Oldes
15-Nov-2012
[3675]
Ah.. elect like election... that makes sense to have it zero based 
as usually it's hard to elect someone from possible given choices... 
sorry off topic.
Ladislav
15-Nov-2012
[3676x2]
LOL
aha, still not done, I would need to find a name for the zero-based 
counterpart of POKE...
Arnold
15-Nov-2012
[3678x3]
elect is very like select
I had this idea when under the shower, so it is still a bit wet: 
DOWNPICK
Counter part DOWNPOKE and you only need to steggle (twist) idf it 
should be downpick 1 or downpick -1 ;)
Ladislav
15-Nov-2012
[3681x3]
the problem with DOWNPICK, REPICK, and some others is that they aren't 
related to the purpose of the function in any explainable way
PICKZ's problem (in my eyes) is only that it actually violates REBOL 
naming conventions.
POKE counterpart names: seems that some of PUT, DEPOSIT, INJECT may 
be chosen
DocKimbel
15-Nov-2012
[3684x2]
Ladislav: are you advocating for having two conventions, both 1-based 
and 0-based?
Negative indexes applied from tail of series could be a good option, 
that would help replace the `back tail series` idiom.
BrianH
15-Nov-2012
[3686x7]
Doc, ticket #613 is for the introduction of separate functions that 
do 0-based indexing. It's not related to 0-based indexing anywhere 
else.
Ladislav, REBOL doesn't have a naming convention that handles 0-based 
addressing. If you can come up with better names, hopefully just 
as short, go right ahead.
Negative indices being back from the tail of the series: please, 
no, never.
Aside from that, my opinions are documented.
Make sure that the names of PICKZ and POKEZ are immediately relatable 
to PICK and POKE, the way that FUNCTION, FUNC and FUNCT are related.
PICK0 or PICK-0 might do. Definitely not ELECT, since the kind of 
selection that is done in elections is not related to the type done 
when you "pick" something. In US English there is a colloquial term 
"pick out of a lineup", which relates to series in a way that noone 
would think of the term "elect" (unless they are convinced that all 
politicians are crooks). PICK and POKE are from Basic, old-school 
tech terms that are more closely related to assembly instructions 
than they are to any high-level operation.
You wouldn't need to implement PICKZ and POKEZ as actions. Just implement 
them as regular functions that call PICK and POKE, like the ordinal 
functions are in R3.
Andreas
15-Nov-2012
[3693]
Not sure what you mean by "regular functions", but FIRST, SECOND, 
etc are native! in R3.
BrianH
15-Nov-2012
[3694x3]
In Red, there isn't that much difference. But in R3, natives are 
more like regular functions than they are like actions or ops. The 
implementation language is different, but the dispatch model is very 
similar. On the other hand, the dispatch models for actions and ops 
are very different from regular natives.
A native is pretty much called directly, maybe a little argument 
marshalling but that's it. An action dispatches to a handler associated 
with the type of the first argument, one of a table of such handlers. 
The action itself doesn't do much - everything is done by the handler.
Adding more actions makes it more difficult to implement datatypes. 
That is why R3 has fewer actions than R2, why some former actions 
are now natives.
btiffin
15-Nov-2012
[3697]
Ladislav, what about ADDRESS in place of ELECT?  Fan of DEPOSIT. 
 Umm, adding I actually prefer one based indexing and lean toward 
it.
Pekr
15-Nov-2012
[3698]
BrianH: just curious - why don't you like negative indices starting 
from the tail of the series? Some ppl expressed here, that it is 
nice feature in Python. Do you see any negative consequences with 
such a design?