• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp5907
r3wp58701
total:64608

results window for this page: [start: 27601 end: 27700]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Volker:
1-Mar-2006
do bind [a + b + c] 'kontext
In which context is 'kcontext bound? ;)
Pekr:
1-Mar-2006
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
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
Oops forgot  a bit :
>> to decimal! mod now/time 0:01
== 32.0
PeterWood:
2-Mar-2006
I guessed that yeksoon wanted a one-line solution
Ashley:
5-Mar-2006
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.
Ammon:
6-Mar-2006
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
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
is this a bug?

==
>> now/zone
== 8:00
>> now/zone + 60
== 8:01
PeterWood:
7-Mar-2006
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
I see.


More like a fundamental flaw in my own assumptions that timezone 
are separated in hours
PeterWood:
7-Mar-2006
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
it become 'confusing' in a way when you are dealing with 'time components
PeterWood:
7-Mar-2006
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.
Graham:
7-Mar-2006
a political decision should not force RT to change a datatype.
PeterWood:
7-Mar-2006
By the way, one of the two places with a 15 minute offset is part 
of NZ.
Louis:
7-Mar-2006
I have a file containing data in the following format:

acmacks
 "Arkansas City Missionary Baptist Church, Arkansas City, KS"
aslcut
 "Anchor Baptist Church, Salt Lake City, UT"
awmi
 "Antioch Baptist Church, Warren, MI"
bamo
 "Bethany Baptist Church, Ava, MO"
bbin
 "Berean Baptist Church, Batesville, IN"
bbmcanada
 "Bible Baptist Church, Brandon, Manitoba"
bcbctx
 "Bay City Baptist Church, Bay City, TX"
bdtx
 "Bible Baptist Church, Dumas, TX"
beok
 "Bible Baptist Church, Enid, OK"

How can I sort this data on the second string?
Claude:
7-Mar-2006
and this function   [    sort-db: func [db field [word!] /local result 
offset] [
        offset: find fields field
        either offset [offset: index? offset][
            print ["ERROR:" field "does not exist"]
            halt
        ]
        db: copy db
        sort/compare db func [a b] [
            if a/:offset = b/:offset [return 0]
            either a/:offset > b/:offset [1][-1]
        ]
        db
    ]
Louis:
7-Mar-2006
Thanks Claude! I just found some old code. This also works:


sort/skip/compare/all codes-block 2 func [a b] [return either a/2 
< b/2 [-1][either a/2 = b/2 [0][
+1]]]
Ladislav:
8-Mar-2006
Should now be immutable?

 - this is quite unfortunate question - Now is a function returning 
 a time! value in this special case (now/zone). Moreover, the returned 
 value *is* immutable :-P. What are you questioning is not mutability, 
 but the possibility to use this special time! value as an argument 
 for the Add function.

Can a timeone take the value 8:01

 - again, an unfortunate question. Now/zone did return a specific 
 time! value. If you add 60 seconds to such a value you obtain yet 
 another time! value, but nobody is trying to convince you it is a 
 timezone.
Ingo:
8-Mar-2006
Hi Graham, yes that's it ...

I actuallly add some things to the protocol, like mailbox handling, 
the ability to fetch only specific headers, etc. so I would like 
to be able to use a unified interface. 

Additionally I'd like to fetch by uid,  and it would be nice if I 
were able to position to the read mail.
PeterWood:
9-Mar-2006
Ladislav: I see your point about immutability.


I guess that point about zone boils down to one of  datatype. I had 
been thinking along the lines that zone was a special datatype but, 
after checking, I see if it is of type time!.


What has confused me is the additional validation on time/zone in 
to-date:

>> to-date 9-mar-2006/14:17:38+8:01
** Syntax Error: Invalid date -- 9-mar-2006/14:17:38+8:01
** Near: (line 1) to-date 9-mar-2006/14:17:38+8:01
PeterWood:
9-Mar-2006
and the rounding:
>> a: 9-mar-2006 15:23
== 15:23
>> a/zone: +8:15
== 8:15
>> print a/zone
8:00
>> a/zone: +8:31
== 8:31
>> print a/zone
8:30
PeterWood:
9-Mar-2006
which indicates that zone is a special case of time!
Ladislav:
9-Mar-2006
I had been thinking along the lines that zone was a special datatype

 - there is a possibility to propose such a datatype, but I am OK 
 with time! in this case, because the new datatype wouldn't (just 
 IMO) bring substantial benefits. So, we have to be careful when "composing" 
 a new date! value.
Ladislav:
9-Mar-2006
(which may be a good addition to REBOL documentation)
DideC:
9-Mar-2006
Is there a "Rebolish" way to change this string! :
	"A text with%27some%25encoded chars"
to this string! :
	"A text with%some'encoded chars"
Without using replace/all in a loop?
DideC:
9-Mar-2006
In the other way there is 'to-url :
	>> to-url "a b"
	== a b
But is there something simple to do the opposite ?
Terry:
13-Mar-2006
Yeah, I suppose that would work from a cgi environment.
Pekr:
15-Mar-2006
will not I loose data when 'wait is entered for the second time because 
of "if block? event [event: first event]"? Hopefully not ... or maibe 
wait without /all never returns a block, even if there is event on 
more than one port at a time?
Pekr:
15-Mar-2006
ok ... so what happens if there is still data on first port in the 
wait-list? will it always return that one? So it means that other 
ports will simply wait for maintanance, because first port in the 
wait-list is still receiving a data?
sqlab:
15-Mar-2006
I do not know if you will get your first port again as the first, 
if you did for example just copy/part from it.

But imagine, that you do a copy on it, and new data arrives at the 
same time. This will probably raise a new event on it and this port 
will probaby the last in your queue of waiting events.
Pekr:
15-Mar-2006
ah, thanks a lot ... so wait [port1 ... portn] does not anything 
in common with the order how 'wait returns the events? That is good, 
because otherwise I would maintain only first port, till the data 
would not stop appearing ...
sqlab:
15-Mar-2006
Just what I think is a little bit annyoing, that sometimes you do 
not get the proper timeout, if you have a timeout value in your wait 
list  and many events.

Yes, I always thought that I got the ports ordered according their 
event time and not according their position in the event list.
Pekr:
15-Mar-2006
but maybe that is the only corrent aproach - to use wait/all and 
maintain data on all ports in a loop, then go for the next wait ...
Robert:
21-Mar-2006
Thanks a lot. But I really can't believe that this formatting stuff 
isn't supported by default.
Maxim:
22-Mar-2006
thanks !   I feel a little dumb ... hehe
Sunanda:
24-Mar-2006
>> a: now - 125:00:00
== 19-Mar-2006/9:08:07
>> a - now
== -5    ;; five days
>> difference a  now
== -125:00:16    ;;; 125 hours
That's the difference!
>>
Sunanda:
24-Mar-2006
it's a strange hack -- difference was originally for sets. So making 
it work for time is seriously non-orthogonal.
Gregg:
24-Mar-2006
I don't like hacks, but the minus op is a very practical shortcut. 
Should it try to be smart and return days if no time exists for either 
arg; otherwise do the same thing DIFFERENCE does (and what time do 
you assume if only given for one arg; midnight UTC?)?
Jarod:
26-Mar-2006
but let's say I set some words to some blocks, and I put those words 
into another block, do I always have to reduce to actually see the 
stuff pointed to by the words in the blocks, or is there a way to 
actually insert the content of the words themselves into the blocks
Jarod:
26-Mar-2006
let's say a: [value1 value2 value3]
Jarod:
26-Mar-2006
and I want b to have a in it
Jarod:
26-Mar-2006
b: [a] will have the word a, not value1 value2 value3
Jarod:
26-Mar-2006
what I do b: [a] and have it put value1 value2 value3 in b instead 
of a itself
ChristianE:
26-Mar-2006
you can do B: REDUCE[A], but if don't want to reduce you can also 
do sth. like B: [ ] APPEND B A
But I think what your looking for is sth. like
	>> a: [1 2 3] b: [ ]
	>> append/only b a
	>> probe b
	>> [ [ 1 2 3 ] ]
	>> clear a
	== [ ]
	>> probe b
	== [ [ ] ]
	>> append a 4 probe b
	== [ [ 4 ] ]
Anton:
27-Mar-2006
It reduces the expressions found within the block (and it returns 
the results in a new block).
Jarod:
27-Mar-2006
I am also perplexed why rebol doesn't have a substring function, 
sure even if you can create one with a few extra commands, it seems 
to me like most people don't want to have to invent a language, just 
to use the functionality that exists.
Jarod:
27-Mar-2006
I hope rebol 3.0 has a substring function built in
Graham:
27-Mar-2006
A line in the sand has to be drawn somewhere.
Graham:
27-Mar-2006
Gregg has posted a dialected substring function.
Jarod:
27-Mar-2006
rebol's help also should have a see also at the bottom of commands, 
to direct attention to other rebol commands and functions of interest
Jarod:
27-Mar-2006
the language as a whole feels very fragmented, I recognize the power 
of Rebol only because of its lispy nature, but I feel limited compared 
to a language like perl, because examples are far too scattered about, 
and the names for functions are often oddly named or sometimes the 
functionality exists but is so obscured that I never knew it was 
there at all in the first place
Jarod:
27-Mar-2006
for example, how could I take a date, and add 3 months or 3 weeks 
to the date?
yeksoon:
27-Mar-2006
a CPAN for Rebol?
Jarod:
27-Mar-2006
having to re-invent the functionality that other languages just give 
you is a serious pitfall if you ask me
Jarod:
27-Mar-2006
that was one of the things that drove me crazy about lisp, yeah it 
is a powerful language, and yeah it is a programmable language, but 
to some degree the only way to do anything really useful in the langauge 
was to in essence program lisp to function similar to other languages 
you were already familiar with, or to in essence extend lisp with 
functionality it should have already had before you even started 
programming in it it
Graham:
27-Mar-2006
Better to have a way to point to mezzanines that implement the common 
functionality that people want.
Jarod:
27-Mar-2006
I dunno, I think that languages like java or .NET would be far less 
successful if people had to implement a majority of the class library 
by hand, anytime they wanted to take advantage of advanced functionality. 
There is just some functionality that people come to expect regardless 
of what higher level language they are coding in. And for a language 
that supposedly can be used to parse and manipulate text and data, 
not having a built in substring function is pretty crazy
Jarod:
27-Mar-2006
that is my primary need or want to use rebol for, is to manipulate 
text. I like perl, but  love rebol's small footprint, if it can give 
me the same power of perl in a much smaller package, with a gui, 
that is all the better. I could potentially replace access and a 
lot of proprietary tools with a small rebol view application.
Jarod:
27-Mar-2006
I dunno maybe I am being anal, or stupid, or just plain unreasonable. 
But this sort of irked me, when I found people offering a solution, 
and it was so simple as to have just been a part of the darn language 
from the beginning.
Graham:
27-Mar-2006
this was in my response to my suggestion that we adopt a python type 
syntax for parts of series

substring "abcd" [2 .. 3]
Jarod:
27-Mar-2006
I like that function a bit more Graham, I basically think I understand 
what that is doig
Jarod:
27-Mar-2006
having to write a function to do that is a pain, but I can probably 
live with it, knowing exactly what it is doing
Bo:
27-Mar-2006
So why doesn't someone write a .r file you can run that adds common 
functions for other languages (i.e. basic.r would have 'substr,
Bo:
27-Mar-2006
Someone (or a group of someones) should write a .r file for the common 
languages (i.e. basic.r would include 'substr, 'peek, 'poke, etc.; 
rexx.r would include 'mid, etc.).  That way, new users from other 
languages could move into Rebol with the knowledge they already have. 
 Of course, the script flow would be different, but their favorite 
functions would be available, and they could see how to implement 
their favorite functions natively using 'source.  There could also 
be a %c.r for those coming straight from C. :-)
Bo:
27-Mar-2006
Just kidding...I was being mean about how bad DOS really is as a 
scripting language. :-)
Bo:
27-Mar-2006
>> week: 7 ;Defining a "constant" here
== 7
>> b/date: b/date + (6 * week)
== 8-Nov-2006
Bo:
27-Mar-2006
A pretty close estimate is the following: date2 - date1 / 365.25 
* 12
Bo:
27-Mar-2006
Over a period of time, dividing by 365.25 and multiplying by 12 is 
pretty accurate.
Geomol:
28-Mar-2006
The situation with REBOL is, that you can do almost anything with 
it. If someone should document that, she could start now and not 
be finish, before she turned 100 years old. I saw myself as a very 
competent programmer with many years of experience in many different 
languages, before I discovered REBOL. It took me a year or so do 
'get' REBOL, because it's so different. I could very fast write simple 
things, but to get in under the skin of REBOL takes some time. In 
some way REBOL is a bit hard at first, and it takes some time to 
'get' it, then suddently it become very easy.
Geomol:
28-Mar-2006
As a function:

monthdiff: func [d1 d2 /local months days] [
	months: (d2/year * 12 + d2/month) - (d1/year * 12 + d1/month)
	if d1/day > d2/day [months: months - 1]
	d1/month: d1/month + months
	days: d2 - d1
	reduce [months days]
]
Gregg:
28-Mar-2006
As far as what is included, this is tough because everybody coming 
to REBOL will want different things, and including all of it would 
make REBOL a complete mess. Is a substring function a good idea? 
Sure; I've written a lot of them. :-) I'm still working on a whole 
*bunch* of functions that might be useful, but they are hard to design 
well, so they are easy to use, flexible, and intuitive.
Gregg:
28-Mar-2006
Fore example In the case of "substring", that's a bad name IMO, because 
you can use the same concept on any series, not just strings. Is 
"subseries" a good name? Does it read well? Not so much. It could 
mean different things to different people (e.g. are you looking for 
nested series values?). What about "extract", ah, that's used already, 
and what are the implied semantics if we do override it and add behavior? 
I like EXCERPT myself, but it's not a nice short word that's easy 
to guess if you're not sure what it might be called. Whatever the 
name, should there be a /REMOVE refinement, or should there be a 
separate function for that?


OK, so let's assume we have a good name now, how do you define the 
bounds? There is no range! or bounds! type in REBOL. Do you just 
use lower and upper bounds, or should it take an offset and length? 
Should we define a dialect for this? If so, how flexibile should 
it be? Can you get multiple "pieces" all at once? Can you handle 
2D extractions easily and clearly? Should you? Can you specify reverse 
extractions (e.g. from the tail)? Should it return the elements in 
reverse in that case, or should it throw an error if the lower bound 
is higher than the upper bound? etc.
Gregg:
28-Mar-2006
So, you have to do this:
	COPY/PART AT xxx 5 10
instead of
	SUBSTRING xxx 5 14
	(or maybe SUBSTRING 5 10) 


Yeah, it's a few extra characters, but it's actually pretty expressive 
and clear.
Gregg:
28-Mar-2006
Sorry, mine is way more than a one-liner. :-)
Gregg:
28-Mar-2006
I can give you mine, and I do have some one-liner versions around 
I think, but I assume you already have some, and are just talking 
about having a standard one.
Gregg:
28-Mar-2006
I think FORMAT is on many lists. That's a *really* hard one to design 
though. So many ways it could go.
[unknown: 10]:
28-Mar-2006
What is the quickest routine  in rebol to compare 2 series of values 
based on position of the value against data of the value.. i.e. a: 
[ 1 2 3 4 5 ]  b:[ 5 6 7 8 9 ]
[unknown: 10]:
28-Mar-2006
How do i check If a value in serie a does occeur in b on a specific 
position ? Currently im doing that with a foreach including a for 
loop..But somehow rebol should have something buildin i thought? 
or not.. unqiue intersect and difference are not good enough for 
this...and speed is a concern too..
Allen:
28-Mar-2006
Rebolinth: Need you to show an example with the expected results. 
Also are A and B of fixed length or varied?
[unknown: 10]:
29-Mar-2006
yes well find and index where not what i searched for...ill drop 
an example...hold on a few hours ;-) back ltr...
[unknown: 10]:
29-Mar-2006
...an example...


I build in lisp a latin-square example and rebuil it in rebol.. the 
bottle neck is not the random generator

but its for me the function called 'clean? (can this function be 
exchanged with a rebol buildin funtion? or
even be made smaler?)


; a latin square in rebol

random/seed now

clean?: func [ x /local bb i ][ 

 catch [ foreach bb b [for i 1 9 1 [ if = pick bb i pick x i [throw 
 false] true ]]]]

print "---- running ----"

T1: now/time/precise
insert/only b: copy [] random/seed [ 1 2 3 4 5 6 7 8 9 ]
print first b

while [ < length? b 9 ][  

 if clean? set 'x random [ 1 2 3 4 5 6 7 8 9 ] [ print x insert/only 
 b x ]]

print rejoin [ "Timed: " now/time/precise - T1 ]

wait 0:0:5
quit
Allen:
29-Mar-2006
As a general rule, try to use native! looping functions, they are 
faster. In the above the native! "repeat" could replace the use of 
"for"
Oldes:
1-Apr-2006
Is there someone using a Rebol script to send IF_MODIFIED_SINCE in 
HTTP get header?
Anton:
2-Apr-2006
Ok I have a question.


I would like to catch an error inside a function and throw it out 
so the error position is reported "near"

the function itself. As far as I understand we should do that with 
something like this:

check: func [

 [catch]  ; <-- function spec attribute flag which changes the reported 
 position of the error.
][
	load "http://("  ; <-- cause an error on purpose
]

Now I have tried various things:

>> check: func [][load "http://("]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: (line 1) http://(

>> check: func [[catch]][load "http://("]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: (line 1) http://(

>> check: func [[catch]][throw-on-error [load "http://("]]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: 



But none of these seems to be reporting the "Near:" position that 
I'm expecting.

(Indeed, the last one looks kind of buggy reporting to me. Anyone?)
Anton:
2-Apr-2006
So it looks like a bug to you too ? I would like to check with Ladislav, 
Romano or Gabriele.
Jerry:
5-Apr-2006
Outer: context [
	name: "Outer"
	Inner: context [
		name: "Innter"
		get-outer-name: does [
			; I would like to return the outer name.
			; How would I do that? Thank you.
		]
	] 
]

; Making the get-outer-name function return Outer/name is not
; a good idea, since Outer can be cloned and its name can be
; changed, as follows 

Outer2: make Outer [ name: "Outer2"]
Outer2/Inner/get-outer-name

; Any help will be appreciated.
Sunanda:
5-Apr-2006
As you say, the context doesn't have a name.

it could be anonymous, or multiple words could be assigned to it, 
so there is no one "name"
outer2:  :outer
outer3: :outer2
Anton:
5-Apr-2006
You have to maintain a parent attribute.
>> outer: context [inner: context compose [parent: (self)]]
>> probe outer/inner/parent
make object! [
    inner: make object! [
        parent: make object! [...]
    ]
]
JeffM:
8-Apr-2006
Is there any way to get the RGB data from a loaded image?
JeffM:
8-Apr-2006
I assume there is a simple refinement to do so (like /size to get 
the size of the image), but I can't seem to find it.
JeffM:
10-Apr-2006
Can REBOL/SDK define functions that will be called from C and passed 
to a C function? For example:
JeffM:
10-Apr-2006
c-logger: make routine! [ "Define the callback function for error 
tracking."

    logger: [string!] "using string! since a function ptr is just a pointer"
    return: [integer!]
] my-lib "C_Logger"

rebol-logger: func [s] [ print s ]

c-logger :rebol-logger
Pekr:
10-Apr-2006
i know - that method was suggested to me by Oldes IIRC. Because in 
other way, that is one of rebol's aspects I don't like and I regard 
it being inconsitent - to-binary 15 - It is a NUMBER, not two chars 
1 and 5, so I don't understand, why it tranlates each char .... it 
should change for 3.0
Pekr:
10-Apr-2006
so the way to go is to use to-hex, but when you need a binary e.g. 
for struct!, you have to compose it, at least I did it that way in 
the past iirc :-) But maybe I am missing something obvious. But if 
not, those things should be looked into fro 3.0 .... as so far I 
like Carl's aproach = willingness for change, if the change makes 
sense of course and improves consistency ....
Jerry:
10-Apr-2006
I got it. The LOAD function is the magic.
 
>> load rejoin [ "#{" to-string to-hex 15 "}" ]
== #{0000000F}


I start to think that LOAD is not only for loading something, but 
also for converting a string to something.
DideC:
10-Apr-2006
It's what "be a guru" means ;-)
BrianH:
10-Apr-2006
That's easy, you just set a conversion function at the beggining 
of your app, picking a bigendian or littleendian one based on the 
platform, and then just use it like a black box. A bigger problem 
is that struct! is currently only available on /Pro, /View/Pro or 
/Command, which means that you can't run the code on Mac right now 
anyways. Making struct! available in /Core and /Base has been requested 
though.
Vincent:
10-Apr-2006
struct! is not limited to /Pro. It's available on /View since at 
least 1.2.1 (not license needed). Absence in /Core is a problem, 
as there isn't usable alternatives for float conversion.
27601 / 6460812345...275276[277] 278279...643644645646647