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

World: r3wp

[!REBOL3-OLD1]

Ladislav
9-Nov-2009
[19587]
Reals surely is a much more appropriate name, than decimals
Geomol
9-Nov-2009
[19588]
Thanks! :) I think the same.
Ladislav
9-Nov-2009
[19589]
...but I bet, that I and Geomol would be OK with IEEE-754! or a similarly 
"ugly" name, which may really scare some people
BrianH
9-Nov-2009
[19590]
I still think float! is the most appropriate, due to that significant 
"subset of" thing.
Ladislav
9-Nov-2009
[19591]
but, if you want be that precise, you cannot use the integer! name 
either
Geomol
9-Nov-2009
[19592]
make IEEE-754! exp 1
oh no! :)
Henrik
9-Nov-2009
[19593]
I agree on real!
Geomol
9-Nov-2009
[19594]
A problem with "float" might be, that many will think 32-bit right 
away. And we have 64 bits to play with.
BrianH
9-Nov-2009
[19595]
Geomol, it wouldn't be normal to convert to integers first if you 
are trying to manage rounding and the specific integer values are 
only an end-device approximation of real valued proportions and coordinates. 
In other cases, converting to integers would be appropriate. It varies.
Ladislav
9-Nov-2009
[19596]
nevertheless, I guess, now it is not real to require real! as the 
real name :-D
BrianH
9-Nov-2009
[19597]
A 64bit float is still a float. There are 128bit IEEE754 floats too 
(and perhaps 256bit, I don't know).
Geomol
9-Nov-2009
[19598]
:)
BrianH
9-Nov-2009
[19599]
No 256bit yet - it will come soon, I'm sure :)
Ladislav
9-Nov-2009
[19600]
there is a "slight" difference between "real" and "float" - both 
can be used, but "real" is more understandable for a layman than 
"float" - where does it float?
Geomol
9-Nov-2009
[19601]
Another thing, we have pi:

>> pi
== 3.14159265358979

Would it be an idea to have e equal to:

>> exp 1
== 2.71828182845905

I mean, we can create pi ourselves with

arccosine/radians -1

, so why is pi there? And if it is, why isn't e there?
BrianH
9-Nov-2009
[19602x2]
That is what  I like about the name. A programmer will understand 
the difference. REBOL is made for programmers, not laymen. We finally 
disabused ourselves of that delusion.
When do you use e when not doing exponents? Not familiar with e's 
use - I took calculus in 1987 and haven't used most of it since.
Ladislav
9-Nov-2009
[19604x2]
yes, but in the above case both "real" and "float" are actually of 
the "same information value" for an expert - not knowing from the 
name neither how many bits they use, nor what is the base (2 or 10)
re E: Rebol has LOG-E, so it would be natural to have E defined, 
the problem I see is, that the name is "too short", so Carl wanted 
to leave it for "common use"
BrianH
9-Nov-2009
[19606]
Ah, but "float" is a keyword for programmers that implies binary 
floating-point numbers (usually IEEE754), while "real" is a keyword 
for what floating point numbers (binary or decimal) *appproximate*. 
You know, the real world. The "real" pi doesn't have a finite binary 
representation. That distinction is why I like "float" instead. All 
moot now though - we are stuck with decimal!.
Geomol
9-Nov-2009
[19607x2]
We could call integers for Integral, like Python have numbers.Integral
(just kiddin)
I like integer! and real!
(I may change my mind.)
Should the hyperbolic math functions be part of REBOL? Like the C 
functions cosh, sinh, tanh. Many languages have them (I've checked 
Lua, Python and Ruby).
GiuseppeC
9-Nov-2009
[19609x4]
Pekr as for HTTPS protocol I agree with the other people here. Lets 
some external developer do the work once the basis is complete.
I was very amazed to read that even Gabriele sometime gets no answers 
from Carl. He is one of the closest developers to RT !
However, if we could summarize 2009, it has been a nice year for 
REBOL. Many things have evolved and I have not seen the development 
blocked for more than a week. I don't know how many people are still 
at RT but I suppose the number is quite low and I think we must congrat 
with Carl.
If we think about the needing for money and time a company and a 
family needs (talking about Carl's Family and RT) I am really suprised 
to see how much work has been spent over REBOL. Sometime I even ask 
myself  how it could be possible ? Has Carl some hidden treasure 
? Has he found a way to split himself so we have 2 Carl and not one 
? :-)
Pekr
9-Nov-2009
[19613x3]
I asked Carl to react on reboltutorial article and to add old R3 
architecture doc I remember from the past. It is on R3 rebol.com 
page now ....
ppl were constantly confusing and merging R3 product with R2 marketing, 
although the model was explained many times ....
I am glad the doc is back ...
Pekr
10-Nov-2009
[19616]
Changes to high resolution time in R3 - http://www.rebol.net/r3blogs/0293.html
Jerry
11-Nov-2009
[19617x3]
Is there a way that I can get the number of parameters of a function 
in R3? 
So I can do this:

>> num-of-parameters :print
== 1
>> num-of-parameters :now
== 2
should be: >> num-of-parameters :now
== 0
num-of-parameters: funct [ f [ any-function! ] ] [
    clear find spec: spec-of :f /local

    remove-each element spec [ any [ string? element block? element ] 
    ] 
    length? spec
]
Pekr
11-Nov-2009
[19620]
Important - Finalizing read and write - http://www.rebol.net/r3blogs/0294.html
PeterWood
11-Nov-2009
[19621x3]
Jerry - you can use words-of instead of spec-of. It doesn't return 
the comments.


>> a: func [b "comment" c "comment"  /local d] []                
        
 
>> b: func [c d e f /local z] []

 >> n-o-p: func [f] [length? copy/part spec: words-of :f find spec 
 /local]
 
>> n-o-p :a
 
== 2


>> n-o-p :b
 
== 4


Sory for the cryptic code. I had to keep it to a single line in the 
R3 console.
The code above doesn't handle 0 parameters though :-(
... and more importantly it doesn't handle refinements either.


What would you expect num-of-parameters to return for the following 
function:

a: func [b c /d e /f g /local x y z]
Jerry
12-Nov-2009
[19624]
clear find spec: spec-of :f /local     ... can move the refinements 
part
PeterWood
12-Nov-2009
[19625]
Here is a version using parse:


>> n-o-p: func [f] [ct: 0 parse words-of f [some [word! (++ ct) | 
refinement! thru end]] ct]
 >> n-o-p :now
 == 0


>> a: func [b c /local e] []
>> n-o-p :a
 == 2
>> x: func [b c /d e /f g /local x y z] [
 
>> n-o-p :x                                

== 2
Geomol
12-Nov-2009
[19626x4]
A version without parse:

>> npars: func [f /local w] [
	w: words-of :f
	length? copy/part w any [find w refinement! tail w]
]
>> npars :print
== 1
>> npars :now
== 0
>> npars :insert
== 2
Some thought of naming. How should such a function be named the REBOL 
way?

number-of-parameters seems a bit long. I sometimes write functions, 
that return the number-of something. I come to think of # as being 
number-of, but # in the start mean an issue! datatype. What about 
allowing # in the end of words? Like:

parameters#: func [ ....

Or is that too ugly?
A bit like we have ? in the end of many words: length? tail? none? 
...
Maybe not pluralis, but just
parameter#: func [ ...
Izkata
12-Nov-2009
[19630]
num-args, num-of-args ?
Henrik
12-Nov-2009
[19631]
args-of
BrianH
12-Nov-2009
[19632]
Remember that there is nothing special about the /local refinement 
or the words that follow it. All /local is is an option that you 
aren't using, and in that is no different than any other option you 
aren't using. In order to determine the number of args that a function 
takes, you need to specify which options you will be using in the 
call, perhaps by providing a path! instead of a function reference. 
Otherwise, just use WORDS-OF.
Jerry
12-Nov-2009
[19633]
Thanks you guys, very helpful.
PeterWood
13-Nov-2009
[19634]
John's non-parse version looks to be the fastest on 10,000 iterations 
with :print, :now and :insert :

Jerry's original took 0:00:00.346343

John's version took   0:00:00.06549

Parse version took    0:00:00.129942
BrianH
13-Nov-2009
[19635x2]
Try this one (words-of already copies, no need to again):
npars: func [f [any-function!] /local w] [
	length? also w: words-of :f clear find w refinement!
]
Version without also:
npars: func [f [any-function!] /local w] [
	clear find w: words-of :f refinement!
	length? w
]