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

World: r3wp

[Core] Discuss core issues

Henrik
16-Oct-2005
[2344]
basically yes
Louis
16-Oct-2005
[2345]
Sounds like what I am looking for.  Could you share the code?
Henrik
16-Oct-2005
[2346x2]
I could... but I'm going out the door in a few minutes so it's going 
to have to be later this evening.
advice: Learn Rugby :-)
Louis
16-Oct-2005
[2348x3]
Yes, I did play around with Rugby a while back, but could think of 
any way to use it at the time. Now I have a use.
cound not
could not
Geomol
16-Oct-2005
[2351]
Louis, I'm doing something similar as Henrik with a DB, I made in 
REBOL a couple of years ago. A REBOL task is listening on a TCP port 
and is handling the multiuser functionality. The clients could update 
the data in the DB themselves, or a task could do that too. My DB 
(NicomDB) isn't a product yet, but I could make it a product, if 
you're ready to pay for it?
Pekr
16-Oct-2005
[2352]
isn't it a bug that start: now wait 5 print (now - start) returns 
zero?
Henrik
16-Oct-2005
[2353x3]
pekr, it calculates date, not time difference that way. you need 
to:

start: now/time/precise wait 5 print (now/time/precise - start)
there is an interesting "bug" that way: you'll be shifted back 24 
hours if the difference is calculated across midnight.
it would be nice if it calculated the complete time and date difference
Graham
16-Oct-2005
[2356]
Use 'difference
Henrik
16-Oct-2005
[2357x2]
ah... thanks
(but IMHO not particularly obvious)
Graham
16-Oct-2005
[2359]
You pick up these things by talking to people ... not reading obscure 
manuals :)
Henrik
16-Oct-2005
[2360]
and then you write them down in wikibooks :-)
Louis
16-Oct-2005
[2361]
Geomol, let me see what I can do myself first. I like to know what 
is happening in my scripts.
Geomol
17-Oct-2005
[2362]
Isn't this a bit strange?
>> 3 // 3
== 0
>> 3 // 2
== 1
>> 3 // 2.6
== 0.4
>> 3 // 3.4
== 3.0
Sunanda
17-Oct-2005
[2363]
Very!
Ladislav
17-Oct-2005
[2364]
yes, it is, try MOD and MODULO functions, if you need a different 
behaviour
Geomol
17-Oct-2005
[2365]
Same behaviour:

>> mod 3 3
== 0
>> mod 3 2
== 1
>> mod 3 2.6
== 0.4
>> mod 3 3.4
== 3.0
Ladislav
17-Oct-2005
[2366x2]
right, in these specific cases, otherwise the behaviour may differ.
what would did you expect to get?
Geomol
17-Oct-2005
[2368x2]
I guess, I was just surprised, that it worked with decimals. Then 
it can maybe be argues, if 3 // 3.4 should return an integer or a 
decimal.
argues = argued
Ladislav
17-Oct-2005
[2370]
the definition is as follows: if r = a // b, then a - r // b should 
be zero
Sunanda
17-Oct-2005
[2371]
Been thinking about it too....It is surprsing, but does make sense.
It's returning the remainder:
3 // 2.6 --> remainder is 0.4
3 // 3.4 --> remainder is 3
Ladislav
17-Oct-2005
[2372]
other formulation: if r = a // b, then a = some-integer * b + r
Geomol
17-Oct-2005
[2373x2]
In rebcode, I guess the upcode rem is remainder. It works a little 
different there:
set a 3
rem a 3

now a is 0. If doing this:
set a 3.0
rem a 3

then a is 3.0.
I guess, it has to do with the internal floating-point representation 
of numbers.
Gabriele
17-Oct-2005
[2375]
rebcode's rem does *not* support decimals.
Pekr
21-Oct-2005
[2376x2]
will it be possible to do easy types conversion with rebcode? regard 
me being stupid, but I regard following being  bug or at least inconsistence:

type? #{77}
== binary!    ; so no excuse it is a string later!

to-integer #{77}
== 119

to-binary to-integer #{77}
== #{313139}
If pure functions which serve datatype conversion work one way, it 
is imo inconsistent that it does not work the same way in the reverse 
mode ....a
Rebolek
21-Oct-2005
[2378x3]
If you want to convert a number to binary, number must be enclosed 
in brackets, to binary! [119] , not to binary! 119
so your example should look like:
to binary! reduce [to integer! #{77}]
== #{77}
Pekr
21-Oct-2005
[2381x2]
we are not converting here string of "119" values, but integer!
why?
Rebolek
21-Oct-2005
[2383x3]
that's what's written in documentation
I don't know the reason
And you cannot convert numbers bigger than 255
Pekr
21-Oct-2005
[2386]
I said no excuses or silly walkarounds. We are converting integer. 
Take your calculator and look how it converts it ;-)
Rebolek
21-Oct-2005
[2387x2]
to binary! [256]
== #{00}
This is not a workaround, that's in the documentation :)
Pekr
21-Oct-2005
[2389]
Kru - interesting example with integer in the block, but even more 
twisted imo :-)
Rebolek
21-Oct-2005
[2390x2]
http://rebol.com/docs/core23/rebolcore-16.html#section-2.1
To convert an integer into its binary value, pass it in a block
Pekr
21-Oct-2005
[2392x2]
so we take binary as an argument, convert it to integer. Then we 
take exactly the same integer, and convert it back to binary and 
we get different result? :-))
It is like doing 3 * 7 = 21 on calculator, then pressing /, 7, enter, 
and not getting back to 3!