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

World: r3wp

[Core] Discuss core issues

Pekr
1-Mar-2006
[3615x2]
ok, before I read your replies I found it out too :-) can we somehow 
influence how 'do or 'load behave in that regard?
simply to bind 'do to the context of the function?
Volker
1-Mar-2006
[3617x2]
ff: func [a] [str: "a + 1" blk: bind load str 'a do blk]
bind the argument, not the 'do
Anton
1-Mar-2006
[3619]
just   do bind load str 'a
Pekr
1-Mar-2006
[3620x4]
I thought bind is involved somehow :-)
I have one other question to bindology :-)
following works:

 >> kontext: context [a: 1 b: 2 c: 3]
 >> do bind [a + b + c] in kontext 'a
== 6
but I first tried:

do bind [a + b + c] 'kontext 


and it did not work. So is 'kontext itself a different context than 
in kontext 'a? :-)
JaimeVargas
1-Mar-2006
[3624x4]
do bind [a + b + c] kontext ;; works.
Or you can use this mezz.
with: func [object [object!] block [block!]] [
    do bind/copy block object
]


>> kontext: context [a: 1 b: 2 c: 3]
>> with kontext [a + b + c]
== 6
The WITH mezz was proposed by greg his implementation is backward 
compatilble, while the above is for 2.6 core. For completeness here 
is his implementation:

with: func [object block] [
    if object [do bind/copy block in object 'self]
]
Pekr
1-Mar-2006
[3628x2]
uh, that is cute ....
will it be accepted to Core?
JaimeVargas
1-Mar-2006
[3630]
It is being considered.
Volker
1-Mar-2006
[3631x2]
do bind [a + b + c] 'kontext
In which context is 'kcontext bound? ;)
(the word. Not the content of the word! its quoted! ;)
Pekr
1-Mar-2006
[3633]
well, the quote char was there simply by mistake and because I rewrote 
example according to initial syntax of do bind load str 'a, where 
'a is quoted too ;-)
yeksoon
1-Mar-2006
[3634]
is there a reason why 'NOW' does not have refinements for hour, minutes 
and seconds.?


I would have thought that it make sense to provide those refinements 
as well..since NOW will return a value that comprise date, time and 
GMT offset
PeterWood
1-Mar-2006
[3635x2]
Yes it is odd :
 now/time/second
** Script Error: now has no refinement called second
** Near: now/time/second
>> my-time: now/time
== 11:04:35
>> my-time/second
== 35.0
One for RAMBO?
yeksoon
1-Mar-2006
[3637]
submitted to RAMBO
PeterWood
1-Mar-2006
[3638x2]
An inefficient workaround :
>> mod now/time 0:01
== 0:00:21
Oops forgot  a bit :
>> to decimal! mod now/time 0:01
== 32.0
Ashley
2-Mar-2006
[3640]
How about:

	t: now/time
	first t
	second t
	third t
PeterWood
2-Mar-2006
[3641x2]
I guessed that yeksoon wanted a one-line solution
So he could use:
>> third t: now/time
== 56.0
yeksoon
2-Mar-2006
[3643]
thanks for the one-liner solution.. 


but I would also like to request for additional refinements to be 
added to 'NOW'...


it just seems more natural to me if we can use refinements for the 
time as well
Ingo
5-Mar-2006
[3644x2]
How can I position the internal (imap) scheme position? I'm trying 
to do sth. along the lines of: 

i: open imap://....
insert i [get mail 7]

and want to get the 7th mail ...
and then 

insert i [get mail next]
Graham
5-Mar-2006
[3646x2]
pick i 7 ?
oh, you want to set i to the 7th mail and then read consecutively 
with 'next ?
Ashley
5-Mar-2006
[3648]
Ever have a script that is used by other scripts but occassionaly 
needs to be run standalone and accessed from the console? Well I 
have, and my usual solution was to comment/uncomment a 'halt as the 
last line; but this got a bit tiresome so I came up with the following 
little trick:

	any [system/script/parent/header halt]


  just add it as the last line of your script and you can now run the 
  script directly as a console script or have others scripts use it 
  without being dropped to the console.
Anton
6-Mar-2006
[3649]
Sounds good! What's the theory behind it ?
Ammon
6-Mar-2006
[3650]
system/script/parent/header contains the header for a script that 
has DOne another script so if the parent header exists then ANY will 
be satisfied and the script won't halt allowing other scripts to 
load it but if the parent header doesn't exist ANY isn't satisfied 
and the script halts.  This is a rather useful concept for a library 
where you would like to be able to test new changes at the console 
and run it from another script without having to modify the script 
depending on how you want to execute it.
Allen
6-Mar-2006
[3651]
perhaps it could be added as a refinement to halt ?  such as halt/ 
only or halt/console or something like that.
yeksoon
7-Mar-2006
[3652]
is this a bug?

==
>> now/zone
== 8:00
>> now/zone + 60
== 8:01
Rebolek
7-Mar-2006
[3653]
No it is not. Integer! in this case is considered as seconds.
PeterWood
7-Mar-2006
[3654]
Purely a matter of opinion.... or raather a couple of opinions...


Should now be immutable?  Of course not unless you want to reset 
the time on the machine for testing.


Can a timeone take the value 8:01 - not in real life at the moment 
- I  came across this odd behaviour when investigating the difference 
between mydate/zone: and to-date. I found out that there are a few 
:30 minute timezones and a couple of 0:15 (or 0:45) time zones, the 
rest were all hours.
yeksoon
7-Mar-2006
[3655]
I see.


More like a fundamental flaw in my own assumptions that timezone 
are separated in hours
PeterWood
7-Mar-2006
[3656]
but you still have a point - today the only four valid values for 
minutes are 00, 15, 30 and 60 - and I don't think they are that likely 
to change.
yeksoon
7-Mar-2006
[3657]
it become 'confusing' in a way when you are dealing with 'time components
PeterWood
7-Mar-2006
[3658x2]
I feel that it would be a worthwhile improvement to restrict time 
zones to 15 minute intervals but the powers that Rambo didn't agree 
when I last auggested it.
auggested -> suggested
Graham
7-Mar-2006
[3660x2]
since timezones are arbitrarily divided this way, I would suggest 
leaving it alone.
a political decision should not force RT to change a datatype.
PeterWood
7-Mar-2006
[3662x2]
That counts out Unicode then ;-)))
By the way, one of the two places with a 15 minute offset is part 
of NZ.
Sunanda
7-Mar-2006
[3664]
There have been timezones in living history with an offset of 20min 
(I forget where), so it is possible that it could happen again/