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

World: r3wp

[Core] Discuss core issues

sqlab
28-Feb-2006
[3604x3]
or this
call/console/output "tracert 72.14.207.104" f %google.txt
sorry, it's wrong above.
Should be;
call/console/output "tracert 72.14.207.104"  %google.txt
Gabriele
28-Feb-2006
[3607x2]
don't use /console! /console means redirecting i/o to the rebol console, 
which conflicts with the other redirection you are asking for.
just call/output "tracert www.google.ca" out: ""
Brock
28-Feb-2006
[3609]
so close... thanks guys.
Pekr
1-Mar-2006
[3610x2]
why this does not work?

  ff: func [a] [str: "a + 1" do str]
>> ff 2
** Script Error: a has no value
** Where: ff
** Near: a + 1
while following does?

>> ff: func [a] [b: a  str: "b + 1" do str]
>> ff 1
== 2
Volker
1-Mar-2006
[3612]
string is bound global. 'b too.
Anton
1-Mar-2006
[3613x2]
'b is global, as is not.
Yes, Volker is right, (and I made a spelling mistake.)
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.