World: r3wp
[!REBOL3-OLD1]
older newer | first last |
BrianH 30-Jun-2009 [15808] | No "but there also" related to EQUAL? in your statement, so that was the assumed subject of "The current behaviour in R3". |
Ladislav 30-Jun-2009 [15809] | EQUAL? b b causes an error. The value of such an error is doubtful, taking into account, that e.g. the MOLD function accepts the series happily, in an incompatible manner. So, what is "more useful"? To cause or not to cause? My personal opinion is, that the value of causing the error is totally negligible even for the beginners. (the EQUAL? function is not meant to be used as the function supposed to be used for such checking) |
BrianH 30-Jun-2009 [15810] | I'm not convinced that the lack of an error with the straight b reference is good either. It seems like a good error to throw. |
Ladislav 30-Jun-2009 [15811] | If we examine the "nature" of the implementation of REBOL blocks, then we come to the conclusion (at least I do), that the "abstraction" is as follows: (at least when we examine the PICK function): a block is an "essentially unlimited" series of values, the majority of them are #[none] s, except for a limited "segment", which may "contain" other values as well |
BrianH 30-Jun-2009 [15812x3] | There is a lot of correct code that would assume that >>greater-or-equal? length? head b index? b If this is ever not the case and I try to retrieve a value from that reference before that condition is true again, that is a serious error. If you fill in the missing data before you attempt to retrieve anything, not an error. |
So, either b is an error in R3, or INDEX? is an error (which might be the case). | |
So we could either have INDEX? be an error, or unstable. Which do you prefer? | |
Ladislav 30-Jun-2009 [15815] | PICK happily allows you to examine any position, so a code that works in a manner incompatible with PICK is violating the block design principle IMO |
BrianH 30-Jun-2009 [15816] | I'm OK with declaring that bounds don't matter, and that INDEX? is not an error. The rationale for the new series bounds model was my idea, anyways. And having =, !=, == and !== (and their actions) not generate an error is consistent with that. Just taking the devil's advocate position :) |
Ladislav 30-Jun-2009 [15817] | moreover, the INDEX? function does not show you an error. |
Maxim 30-Jun-2009 [15818] | as long as the index can be used as such. using an object for the index should raise an error. |
Ladislav 30-Jun-2009 [15819x2] | using an object for the index should raise an error - you mean e.g. poke 4 index, when the index is "out"? |
sorry, I mean poke block 4 index | |
BrianH 30-Jun-2009 [15821] | Ladislav, my point was that if bounds matter, INDEX? *not* generating an error (or changing its results) for an out-of-bounds index *is itself an error*. If bounds don't matter (except apparently for POKE), then INDEX? not changing its behavior is fine. |
Ladislav 30-Jun-2009 [15822x2] | aha, so you examined the possibility to change the INDEX? behaviour as well |
my experience tells: it is better to be able to find out what the value of INDEX actually is (even for debugging), than to obtain an error, which does not tell me where I actually am | |
BrianH 30-Jun-2009 [15824x3] | Yeah. However, consistently not caring about out-of-bounds on read seems more useful. We only care on write. |
(that was in answer to your last message) | |
(AltME is slow for me today) | |
Maxim 30-Jun-2009 [15827x3] | henrik: the neutral? is very usefull, python uses that as the false values. when everything is coded using this it simplifies a lot of code, even more than using none. |
I have often wondered what the name for the function would be.... 'NEUTRAL? is not bad! | |
(altme is fast here. (very)) | |
BrianH 30-Jun-2009 [15830] | I prefer REBOL's false/none treatment to Python's, but that NEUTRAL? sounds good, especially if it also checked for unset values, and SERIES? instead of BLOCK?. |
Maxim 30-Jun-2009 [15831x2] | its just different allows different optimisation of conditionals. neutral? can be very usefull, especially for GUI handling code... where you usually don't care for the type, but only if a value is meaningfull. |
my name for the function was: meaningfull? | |
Henrik 30-Jun-2009 [15833x2] | I have not thought it through that much, other than figuring there would have to be a way to shorten that code to one step. I have compiled a list of neutral values for all types, that are capable of producing neutral values. Some can't, and I wonder what the response to NEUTRAL? would be there. |
the lack of datatype screening might be a problem. | |
BrianH 30-Jun-2009 [15835x2] | It could take a datatype/typeset parameter (probably the first parameter of two). |
Internally you could even convert the datatype! to a typeset! and use FIND; since typesets are immediate there would be no overhead. | |
sqlab 1-Jul-2009 [15837] | why should be this >> equal? b [] == true but >> equal? [] b ** Script error: out of range or past end ** Where: equal? ** Near: equal? [] b equal? should just compare the two params, but not test if they are in in their own limits. As I understand this, blocks are containers and empty containers are equal from the outside. Even errors should be equal.) |
Ladislav 1-Jul-2009 [15838] | seems, that Carl agrees with you |
Pekr 1-Jul-2009 [15839] | btw - as for 'arrays - will there be any change in R3? I never use them, as I worry they are slow (mezzanine). Now with vectors, blocks and arrays - do we have fast multidimensional arrays and vectors? |
BrianH 1-Jul-2009 [15840x3] | It is possible that vectors will get multidimensional addressing - it is sort-of planned to do so, but nothing concrete yet. |
I don't understand: "I never use them, as I worry they are slow (mezzanine)." REBOL doesn't really have multidimensional arrays. There is an ARRAY function that creates nested blocks (which is as close as C gets to multidimentional arrays too), but once created they aren't mezzanine, they're a data structure. | |
Once the data structure is in memory, it doesn't matter whether it was created with a mezzanine or a native - all that matters is what kind of data structure it is. The nested block style is better for some things (data structure manipulation, flexibility) but worse at others (vector math). You make your tradeoffs. At least in R3 you have a choice :) | |
Pekr 1-Jul-2009 [15843] | If I understand it correctly, Carl is leaving for vacation in France at the end of the week. So - what last minute fixes do we request, before Carl vanishes for 2 or so weeks? :-) |
Anton 1-Jul-2009 [15844] | Nothing. Better let him finish up what he was doing. |
Pekr 1-Jul-2009 [15845x2] | Do you think fixing another 20 tickets, or releasing plugins finally? :-) |
Well, summer is going to be a slow time anyway, for many of us ... | |
BrianH 1-Jul-2009 [15847] | If necessary, put off releasing the plugins until after the vacation, in case perspective is needed :) |
Ladislav 1-Jul-2009 [15848x3] | Peter once ( Rambo#3518 ) objected against some things being inequal. I could use more opinions on this. |
this is a test that succeeds in R2 as well as in R3; but, is it really supposed to? a-value: first ['a/b] parse :a-value [b-value:] not equal? :a-value :b-value | |
(it is related to the Rambo#3518 ticket) | |
BrianH 1-Jul-2009 [15851] | I like the idea of non-datatype-specific EQUAL? considering datatypes in the any-string! family to be equal to each other, and also the any-block!, any-word! and number! families. I'm a little wary of the potential breakage, though have no idea of the scale of it. Is anyone aware of any code that wouuld be broken if EQUAL?, =, NOT-EQUAL?, <> and != changed in this way? |
Ladislav 1-Jul-2009 [15852x3] | ;This is an example by Geomol: d: to-decimal to-binary 1023 blk: [] insert/dup blk 0 1024 random/seed now loop 1000000 [ i: to-integer to-binary random d blk/(i + 1): blk/(i + 1) + 1 ] print [blk/1 blk/512 blk/1024] |
showing, that my "original" implementation of the uniform deviates actually generated both endpoints of the specified interval: the 0.0 as well as the given value, but both with the frequency equal to the half of the frequency of any interior value | |
it has been corrected (ticket #1027) yesterday, but Geomol seems to dislike the fact, that the correction excluded the given value. Anybody wanting to express their preferences? | |
Geomol 1-Jul-2009 [15855] | I find, the first version, with both endpoints (0.0 and the input value) as possible output with half frequency than other possible values in between, gives most sense. I think of a number line going from 0.0 to the given value, and a random number is picked on the line. |
Ladislav 1-Jul-2009 [15856x2] | well, for some applications (Fourier analysis) it makes the most sense that way |
just for the record: a variant yielding all values in the interval including the endpoints with equal frequency is possible too (just the generating formula is a bit different) | |
older newer | first last |