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

World: r3wp

[!REBOL3-OLD1]

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)
Geomol
1-Jul-2009
[15858]
RANDOM is a distribution. Getting random integers, the mean value 
is well defined as:

(max + 1) / 2

So e.g.

random 10

will give a mean of 5.5. What is the mean of

random 10.0
or
random 100.0
Ladislav
1-Jul-2009
[15859]
5.0 and 50.0 (or, do you mean, it is only "roughly" 5.0 and 10.0?)
PeterWood
1-Jul-2009
[15860]
Ladislav: I reported bug #3518 in Rambo mainly because the behaviour 
of the '= function is not consistent. My thinking was if 1 = 1.0 
why doesn't  #"a" = "a"?


It appears that the '= function acts as the '== function unless the 
types are number!. 


I have come to accept that Rebol has been designed pragmatically 
and, understandably, may be inconsistent at times. I thing this makes 
the need for accurate documentation essential. I would hope that 
the function help for = can be changed to accurately reflect the 
functions behaviour.
Ladislav
1-Jul-2009
[15861]
actually, my task now is to define the desired results of such comparisons 
for R3, (which may serve as documentation too)
PeterWood
1-Jul-2009
[15862x2]
The R2 behaviour has the advantage that it is easy to define and 
understand (especially if the function helpext was improved). If 
other options are to be considered, defining the desired results 
will be more difficult. No wonder  you ar taking this on.
I believe that there needs to be some restriction on the datatypes 
on which the '= function will work. It seems to make no sense to 
comparer a URL! with an email! (Unless you define a URL! to be equla 
to  an email! if they refer to the same ip address or domain name. 
Perhaps that's something for same?).


It's harder to say whether an issue! can be equal to a binary! but 
waht about an integer! with a binary!?
Maxim
1-Jul-2009
[15864x2]
I WANT PLUGINS !!!!!    :-)
wouldn't it be cool to load a rebol instance as a plugin within rebol? 
 :-)

this could be the basis for an orthogonal REBOL kernel  :-)
Anton
1-Jul-2009
[15866]
Peter, are you sure you would never want to compare an email with 
a url?
What about urls like this?
http://some.dom/submit?email=[somebody-:-somewhere-:-net]


I might want to see if a given email can be found in the query string.
Anton
2-Jul-2009
[15867]
Ladislav, your "parsing a lit-path" example above looks ok to me 
for the proposed ALIKE?/SIMILAR? operator, and EQUAL? if it's been 
decided that EQUAL? remains just as ALIKE?/SIMILAR?, but not ok if 
EQUAL? is refitted to name its purpose more accurately (ie. EQUAL? 
becomes more strict).
BrianH
2-Jul-2009
[15868x2]
Peter, in response to the suggestions in your last message:

- issue! = binary! : not good, at least in R3. Perhaps issue! = to-hex 
binary!

- integer! = binary! : not good, at least in R3. Use integer! = to-integer 
binary!


Actually, anything-but-binary! = binary! is a bad idea in R3, since 
encodings aren't assumed. The TO whatever conversion actions are 
good for establishing what you intend the binary! to mean though, 
especially since extra bytes are ignored - this allows binary streams.
Anton, we decided that making EQUAL? more worthy of its name would 
break too much code that depends on it being loose. Oh well :(
PeterWood
2-Jul-2009
[15870]
Brian H: My "suggestions" are not suggestions merely questions.
Anton
2-Jul-2009
[15871]
BrianH, oh well, it's a pity.
Geomol
2-Jul-2009
[15872x2]
Ladislav wrote: "5.0 and 50.0 (or, do you mean, it is only "roughly" 
5.0 and 10.0?)"


Yes, the mean must be slightly below 5.0 and 50.0 with the new random. 
With your first version, it is exactly 5.0 and 50.0.
With the new random, 0.0 will also get a lot more hits than numbers 
close to 0.0. It's because the distance between different decimals 
is small with number close to zero, while the distance gets larger 
and larger with higher and higher numbers. (Because of IEEE 754 implementation.) 
So the max value will get a lot more hits than a small number, and 
all hits on the max value gets converted to 0.0.

I wouldn't use the new random function with decimals.
Ladislav
2-Jul-2009
[15874x2]
slightly below 5.0 and 50.0
 - certainly, but the difference is "undetectable" in these cases
moreover, this version is quite standard - see e.g. Wikipedia, or 
the Dylan programming language, etc.
Geomol
2-Jul-2009
[15876]
If you do a lot of

random 2 ** 300

, the mean will be a lot below 2 ** 300 / 2.
Ladislav
2-Jul-2009
[15877]
yes, in that case, sure
Geomol
2-Jul-2009
[15878]
You're doing a good job, I just don't agree with Carl's view on this.
Ladislav
2-Jul-2009
[15879]
hmm, but I am still not sure, you would have to use a denormalized 
number as an argument to be able to detect the difference