World: r3wp
[!REBOL3-OLD1]
older newer | first last |
BrianH 29-Apr-2009 [13835x2] | Not the same thing. If you have skip > length of the series, it will only do one iteration and your access to the results off the end will usally be none, unless you constrain it yourself. The question is whether negative skip should be silently constrained or generate an error, as a general rule. |
By the way, when you have 1-based indexing, 0 is a negative index :) | |
Maxim 29-Apr-2009 [13837x6] | yep... not the best for the math in index calculations.... hehehe but much more human readable for code and human interaction, so I still prefer one indexing after 9 years... even if the techy in me sometimes lets out a little <sigh> in trying to get to the proper start/end of complex series extractions hehehe |
well, I just realised that it should do the exact same as for the end... if you are not currently record aligned and are doing reverse operations, its possible you'll encounter incomplete records at the start.f | |
having an error in this case would make it toocomplicated to code around the error, methinks | |
so fill with nones. to prevent the start of the records to shift and corrupt the first record. | |
the algorythm using the /skip is responsible for ensuring that it treats the unaligned first value in any case... but the algorythm will much simple to write if the offset which is returned by the use of /skip doesn't change. | |
if we align to first item of the block, then what would be the third, will become something else, when you hit the head of the series.... this adds a lot of complexity to the loop for nothing I think. | |
BrianH 29-Apr-2009 [13843] | Maxim, once you have 1-based indexing (which we are stuck with for historical reasons), then having 0 be negative *is* the best for math calculations. That way you can count on offset = index - base. |
Maxim 29-Apr-2009 [13844x2] | but functions like insert are a bit simpler to use with 0 based, since a length is used as the value past an item in a series not the last character in it. they both have advantages. but trying to explain to someone that an index of 0 moves backwards isn't very obvious to promote as a feature ;-) I'd have trouble justifying this to my kid which is learning to do math :-D |
brian: any reflections on my post regarding the /skip past start? | |
BrianH 29-Apr-2009 [13846] | /skip is a length, not a index or an offset. I'm not sure what effect /skip past start should have. |
Maxim 29-Apr-2009 [13847x2] | an example? |
gimme me a minute will try to build a little example. | |
BrianH 29-Apr-2009 [13849] | No, I just don't know which post you are talking about so I don't get what you are saying. |
Maxim 29-Apr-2009 [13850x9] | hum... implementing an example to show, I realise that using skip should return an error in the case of series, cause alignment is broken, just like sort. |
ex: a: next "1234567890" probe head move/skip a 4 2 == "1456789023" | |
in reality there should be something between 0 and 2 if "23" was to keep its alignment with its original position within the series. | |
this sort of stumps me philosophically on how to manage the /skip in either direction when you go past bounds. | |
with blocks we could decide to add nones, but would it be any usefull? | |
same for going beyond head. | |
I guess the best action to take is to specify explicitely that /skip is meant to handle records when they are aligned. results of un-aligned /skip operations are un-defined at best. | |
(they are aligned === when the series is aligned with the records) | |
with this detail in place, and with blocks, I'd say it would be usefull to pad with nones. | |
BrianH 29-Apr-2009 [13859] | Give me a moment and I can answer your concerns. |
Maxim 29-Apr-2009 [13860x2] | with strings... I guess you stick to head. |
to create an empty record set of 30 records would be as easy as: rs: move/skip [] 30 3 | |
Pekr 29-Apr-2009 [13862] | I have difficulcy to get Chat files. I do nf, to list new files, then I submit get * but nothing is synced. I try other aproach, going to e.g. R3 mezzanines section, and doing get * does either report, that there was no change to files, or that my local copy is changed, and hence it can't be synced. I am sure I did not do any local changes here ... So - how do you usually work with Chat file facility? |
BrianH 29-Apr-2009 [13863x4] | I usually purge the directory when I'm not working on the files. Then when I want to work with them I get the specific files I want to edit, edit them, test them locally, submit the changes, then empty my work directory. If my submission sucks I deny it, if it is good I accept it. |
If I want to keep local versions to compare to I keep them in another directory, then compare to the changes made by others. I only need to do this when I am working on the same file that others are working on, usually a sign that there is too much in the file (it needs to be broken up), or that I need to do a better job of talking to the other person. | |
Situations like that are why DevBase and chat are integrated now. | |
OK, Maxim, the MOVE/skip example you specify is not an error in MOVE, it is an error in the code calling MOVE in that example. MOVE was specifically designed to do something useful in that case, rather than generate an error. The whole reason that MOVE takes one position and one offset is because that limit gets rid of a host of potential aliasing errors. MOVE is designed to be the most efficient and safe solution to the problem of moving stuff, and it should *never fail* unless the series is protected from changes. MOVE is a DWIM function: Do What I Mean. This goes for treating negative /skip lengths as an error too - having it magically constrain the /skip length to 1 or greater was a deliberate design choice, the result of a lot of discussion. So the question is whether the error of having /skip lengths being less than 1 is worth worrying about, worth the overhead of generating an error and checking for that error every time you use the function. Don't be fooled, that overhead is really significant. We've already changed other functions so they don't generate errors anymore, and just DWIM, like FIRST not complaining about bounds and acting like PICK 1 now. These changes have made these functions faster, and better to use. Generating an error is considered something to do when it is really important, as it sometimes is. How important is the /skip < 1 error? | |
Maxim 29-Apr-2009 [13867x2] | you have been talking about the actual /skip parameter value, and all along I was talking about the effect of using /skip which causes the function to go outside of bounds of the series based on the skip size... doh! hahahaha |
I was so off, I could have landed in ireland, while trying to go to the corner store! ;-) | |
BrianH 29-Apr-2009 [13869x2] | No, I got that about your example. The behavior you describe was deliberately chosen. |
The behavior that Henrik is concerned with is /skip lengths < 1. MOVE was designed to just up that to one, DWIM. | |
Maxim 29-Apr-2009 [13871x4] | but *I* didn't get your point ;-) /skip size < 1 should effectively just be bound to 1 as long as its explicitely documented. there is no real use in /skip < 1 |
and I understand that adding too much verification to series handling code really slows the whole a lot. | |
cause its exponential in the long run. 1 % becomes 1.5 then 2. the slowdown rate accelerates as mezz code uses other mezz code. | |
its like when I discovered that using 'RETURN was slowing down some code I had by more than 20%! is 'RETURN any faster in R3, btw? | |
BrianH 29-Apr-2009 [13875] | The problem is that DIFFERENCE/skip < 1 generates an error, and every other function /skip < 1 hangs. So the question is whether they should *all* be changed to act like MOVE (silently DWIM), or all be changed to act like DIFFERENCE (generate an error). |
Maxim 29-Apr-2009 [13876] | tough call, but if it can't lead to data corruption, I'd say the later. |
BrianH 29-Apr-2009 [13877] | No, RETURN, EXIT, BREAK, CONTINUE and error throws are just as slow in R3. It's the setjmp/longjmp exception frame overhead. |
Henrik 30-Apr-2009 [13878x2] | Finally some simple thread reading ability in Chat: 3928 lr will display all messages related to that thread. j will jump to the previous message in the thread. |
Correction. lr lists all messages previous to the current one, not all messages. | |
Sunanda 1-May-2009 [13880] | It's10 years (to the month) from this slashdotting: http://slashdot.org/article.pl?sid=99/05/14/1921231 If REBOL3 got slashdotted, what are the huge milestones that should show up as progress? |
Pekr 1-May-2009 [13881] | There's no R3 yet. In few months, maybe. There is many usefull changes in it compared to R2, R3 fixes everything we wished for for so long. I don't understand what you mean by "milestone" here ... |
Mchean 1-May-2009 [13882] | wow 10 years |
Henrik 2-May-2009 [13883] | Progress milestones: Single graphics engine VID3.4 Unicode Tasks Modules Built-in chat system Built-in open source management Completely redesigned ports (fully documented and ready to use, you protocol writers) When finished: Fixing almost every deficiency that R2 has through 10 years of use by expert developers. |
Gabriele 2-May-2009 [13884] | I hope you never put "built-in chat system" as a milestone on Slashdot... |
older newer | first last |