[REBOL] text file changes Re:
At 03:59 PM 7/10/00 +1000, you wrote: hi all just need a little help with something.. i am trying to change all returns in a text file to tabs file: read %some-filename.txt replace/all file "^/" "^-" and then change every occurence of ZZZ to a returnis this possible? replace/all file "ZZZ" "^/" i am on windoze 98se.the file is about 12mb with about 500,000 records. i have checked the user guide but couldn't get anything out of it regarding this sort of thing thanks in advance keith ;- Elan [ : - ) ]
[REBOL] to-file none?
Hi, IIRC we had this issue some time ago, however: to-file ["test" none] %test/none ?? I would have expected just %test. I have this problem at a point, where I have an optional function input parameter (which is an extension) and I only want to include it if the parameter was given. How do I do this now? I can't specify "" or something else as alternate parameter because than Rebol make a directory-path (%test/) out of the value, which isn't what I need. Robert M. Muench, Karlsruhe, Germany == ask for PGP public-key == When do you want to reboot today? Use the free portable GUI Library OpenAmulet from http://www.openip.org
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(5)
I never planed on buying it any place else, I had to look there to passifiy my frugal wife. I still keep hear about the $15 I could have saved on "Embedded Systems Building Blocks" if I'd done it her way. I'll be placing my order with RebolPress just as soon as the wife is not looking at the credit card statement... :-) She is sleeping now. I just put in my order but after I clicked the "Record Order" button it popped up and said "Script Error bla bla bla" then switched to the screen that said "Thank you for ordering". I tried to use the back button to see what "bla bla bla" really said but it went back to the "Record Order" button screen. Didn't want to hit the button again. E-Commerce just isn't ready for Prime Time yet... Some one might want to look into that, might be loosing sales, or more importantly I won't get my Rebol book... :-)
[REBOL] Function and variable scope
Hi all, A naïve question : how do you define a local variable in a function and then return it: Instead of this : dirtree: make block! 100 list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" ] [ foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Something like this : list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" ] [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Problem is that " print list-dirs %/root " only works with the first block of code, not the second. What do I get wrong ? -- [EMAIL PROTECTED] http://perso.worldonline.fr/mutant
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(3)
Your absolutely right. You can get it cheaper through amazon or ecampus or whatever. But there is another issue at hand here. When you buy the book through Rebol Press you are directly supporting Rebol. This is a give a little get a lot situation. We've all gotten a lot from Rebol now it's time to give back. Lets face it Rebol has given our little community a wealth of support, to say nothing of Rebol itself. They have never asked for a thing in return. This is a chance for us to give back. Personally I don't think "$13.60" is to much to ask for. Paul From: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [REBOL] REBOL: THE OFFICIAL GUIDE Re:(2) Date: Sun, 9 Jul 2000 12:01:46 -0400 No disrespect intended, but having found the book for $31.89 with no shipping (at ecampus) I don't think the tip sheet is worth the extra $13.60. On a side note, it seems that there are two other Rebol books out there as well. I'm still getting this one, but... REBOL: THE OFFICIAL GUIDE, the first commercial book about the REBOL language, is now at the printers! You can check the contents and read a sample chapter at REBOL Press Online, http://www.REBOLpress.com. I thought it was interesting to note that Barnes And Noble says this book has a "sales rank of 127,053", for the *February Edition*. Does that mean they sold 127k+ copies of a nonexistent book? http://shop.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=661E9NA68H; mscssid=37372K8DA4SR2JTS001PQUW8M69N11F1isbn=007212279X Amazon.com is selling the *July Edition* with a "sales rank of 84,434". Sold? Searched for? Page looked at? What? http://www.amazon.com/exec/obidos/ASIN/007212279X/qid=96301/sr=1-1/103-2 087116-3747003 Their prices are less but you don't get the Special Offer: Special Offer: Order your advance copy of REBOL: THE OFFICIAL GUIDE (with CD) directly from REBOL Press Online and receive an exclusive, limited-edition DESIGNER'S TIP SHEET written and signed by REBOL's Designer, Carl Sassenrath! Not available in bookstores or through any other source. It includes numerous insider tips that make REBOL scripts easier to write and more powerful to use. -- For information on any of the following check out my WEB site at: http://www.csonline.net/bpaddock/ Chemical Free Air Conditioning/No CFC's, Chronic Pain Relief, Echofone, Matric Limited, Neurophone, Oil City PA, Philadelphia Experiment. http://www.uCOS-II.com Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
[REBOL] Re: REBOL: THE OFFICIAL GUIDE Re:(5)
On 10-Jul-00, [EMAIL PROTECTED] wrote: I just put in my order but after I clicked the "Record Order" button it popped up and said "Script Error bla bla bla" then switched to the screen that said "Thank you for ordering". I tried to use the back button to see what "bla bla bla" really said but it went back to the "Record Order" button screen. Didn't want to hit the button again. E-Commerce just isn't ready for Prime Time yet... Some one might want to look into that, might be loosing sales, or more importantly I won't get my Rebol book... :-) My experience with the Amiga browsers at the REBOL shop was thus: IBrowse2.2 wouldn't work... "SSL Connect error. The remote server is using an encryption protocol not supported by IBrowse." AWebII v3.3 would've let me continue if I'd wanted to, but the transaction would not have been secure. Voyager 3 worked fine - ordered the book. (: Odd that IBrowse didn't work, as I thought both it and Voyager use Miami SSL, but there you go.
[REBOL] Function and variable scope Re:
You could use the /local refinement like this: list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" /local dirtree ; A change here ] [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Or you could the other way to define a function like this: list-dirs: function [; A change here "returns dir tree as block" dir [file!] "root dir" ][dirtree] ; A change here - this block specifies the locals [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Brett.
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(6)
Dear Bob: I'm not sure why you got an error message, but your order came through fine and we'll ship your book when they arrive. What kind of browser are you using? --Ralph Roberts ALEXANDER BOOKS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 10, 2000 6:52 AM To: [EMAIL PROTECTED] Subject: [REBOL] REBOL: THE OFFICIAL GUIDE Re:(5) I never planed on buying it any place else, I had to look there to passifiy my frugal wife. I still keep hear about the $15 I could have saved on "Embedded Systems Building Blocks" if I'd done it her way. I'll be placing my order with RebolPress just as soon as the wife is not looking at the credit card statement... :-) She is sleeping now. I just put in my order but after I clicked the "Record Order" button it popped up and said "Script Error bla bla bla" then switched to the screen that said "Thank you for ordering". I tried to use the back button to see what "bla bla bla" really said but it went back to the "Record Order" button screen. Didn't want to hit the button again. E-Commerce just isn't ready for Prime Time yet... Some one might want to look into that, might be loosing sales, or more importantly I won't get my Rebol book... :-)
[REBOL] Function and variable scope Re:
Hi, Hi all, A naïve question : how do you define a local variable in a function and then return it: Instead of this : dirtree: make block! 100 list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" ] [ foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Something like this : list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" ] [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Problem is that " print list-dirs %/root " only works with the first block of code, not the second. What do I get wrong ? -- [EMAIL PROTECTED] http://perso.worldonline.fr/mutant You can do it as follows: list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" /local dirtree rlist-dir ] [ dirtree: make block! 100 rlist-dir: func [ dir ] [ foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name rlist-dir dir/:name ] ] dirtree ] rlist-dir dir ] Regards Ladislav
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(7)
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] My experience with the Amiga browsers at the REBOL shop was thus: IBrowse2.2 wouldn't work... "SSL Connect error. The remote server is using an encryption protocol not supported by IBrowse." AWebII v3.3 would've let me continue if I'd wanted to, but the transaction would not have been secure. Voyager 3 worked fine - ordered the book. (: Odd that IBrowse didn't work, as I thought both it and Voyager use Miami SSL, but there you go. Interesting info, Carl. I wrote the order system, testing it with Internet Explorer. Once I finished, I then checked it on Netscape and Opera. It worked fine on Opera but it took a bunch more hours to get it to take a Netscape orders. The pnice thing about browser standards is: there are so manyg. As to Amiga browsers, I'll take any advice on getting them to work. The "SSL connect error" of course is not REBOL and I'm not sure what we can do about that. I'll have to ask my secure service provider. It's an adventure, but REBOLPress is getting tons of orders and, so far as far as I now know, we have not lost a single order. However, I DO want to hear about any problems anyone has so that I can fix 'em. Thanks, --Ralph Roberts
[REBOL] No Content-Length
Hi, folks: REBOL my browers are having trouble getting a complete web page and one thing which I noticed about it is that it does not specify the Content-Length. Does this decrease reliability? Other common things in the header are missing, too. -- ---===///||| Donald Dalley |||\\\===--- The World of AmiBroker Support http://webhome.idirect.com/~ddalley UIN/ICQ#: 65203020
[REBOL] Function and variable scope Re:(2)
Great. Thanks a lot. You could use the /local refinement like this: list-dirs: func [ "returns dir tree as block" dir [file!] "root dir" /local dirtree ; A change here ] [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Or you could the other way to define a function like this: list-dirs: function [; A change here "returns dir tree as block" dir [file!] "root dir" ][dirtree] ; A change here - this block specifies the locals [ dirtree: make block! 100 foreach name read dir [ if dir? dir/:name [ append dirtree dir/:name list-dirs dir/:name ] ] dirtree ] Brett. -- [EMAIL PROTECTED] http://perso.worldonline.fr/mutant
[REBOL] to-file none? Re:
Hello Robert, on 10-Jul-00 You wrote: How do I do this now? Simply write Your own 'to-file :) Okay, this may look like: my-to-file: func [ "Converts to file value, skipping NONEs." value "Value to convert." /local block val ][ either block? value [ block: copy [] foreach val reduce value [ if not none? val [append block val] ] either equal? 0 length? block [none] [to-file block] ][ either none? value [none] [to-file value] ] ] Behaves like original 'to-file instead of returning none for each 'none "in" value: my-to-file none == none ; instead of %none my-to-file ["test" none] == %test ; instead of %test/none my-to-file ["test" none "file"] == %test/file ; instead of %test/none/file But be aware of file? my-to-file none == false ; instead of true HTH! Regards Christian [EMAIL PROTECTED]
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(6)
By the way, this was a bug in my order system, now squashed. --Ralph -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 10, 2000 6:52 AM To: [EMAIL PROTECTED] Subject: [REBOL] REBOL: THE OFFICIAL GUIDE Re:(5) I never planed on buying it any place else, I had to look there to passifiy my frugal wife. I still keep hear about the $15 I could have saved on "Embedded Systems Building Blocks" if I'd done it her way. I'll be placing my order with RebolPress just as soon as the wife is not looking at the credit card statement... :-) She is sleeping now. I just put in my order but after I clicked the "Record Order" button it popped up and said "Script Error bla bla bla" then switched to the screen that said "Thank you for ordering". I tried to use the back button to see what "bla bla bla" really said but it went back to the "Record Order" button screen. Didn't want to hit the button again. E-Commerce just isn't ready for Prime Time yet... Some one might want to look into that, might be loosing sales, or more importantly I won't get my Rebol book... :-)
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(7)
On Mon, 10 Jul 2000, you wrote: My experience with the Amiga browsers at the REBOL shop was thus: IBrowse2.2 wouldn't work... "SSL Connect error. The remote server is using an encryption protocol not supported by IBrowse." abooks.safeserver.com is one of those servers which do not handle fallback from a TLSv1 connection correctly. There are two possibilities: either use Miami Deluxe (which has its own transparent fallback), or set one of the V2/V3 environment variables to disable TLS. This is explained in more detail in MiamiSSL.guide. -- Holger Kruse [EMAIL PROTECTED]
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(7)
carl (@cybercraft) wrote: My experience with the Amiga browsers at the REBOL shop was thus: IBrowse2.2 wouldn't work... "SSL Connect error. The remote server is using an encryption protocol not supported by IBrowse." Worked fine here... ... Odd that IBrowse didn't work, as I thought both it and Voyager use Miami SSL, but there you go. Older versions of IBrowse had SSL built in, but despite it being more capable, it was scrapped when the developer rewrote everything from scratch, in producing version 2.x. You have to specify, in the IB prefs, that MiamiSSL should be used.
[REBOL] func[func] Re:(4)
Galt wrote: make-adder: func [x] [func [y] [+ x y]] Ladislav pointed out that if you use it more than once, you must do this: make-adder: func [x] [func [y] compose[+ (:x) y]] Galt again: what is the bloody point of having to put in the compose? I thought the whole idea here was that contexts were cool, and you could use them to have a hidden local variable. I got this from a Scheme example and there's no extra compose needed there. I am guessing that the problem is that there is only one copy of the block [+ x y] and that it has a context, whatever that is, and that it can only have one context, and that one gets changed everytime you run make-adder again with a new parameter value for x. So running make-adder a 2nd time messes up the value hidden in the context of the first? with the original simple method, you get this: source add6 add6: func [y][+ x y] with Ladislav's method, you get this: source add6 add6: func [y][+ 6 y] which is a nice demonstration. But it's mechanism doesn't depend on context at all any more. The function is really returning 6 not X with context. 6 is 6 in any context, so big whoop? Did this used to work in an older rebol without compose? I note that this works, too, silly as it is: make-adder: func [x] [func [y] reduce['+ x 'y]] And this failed to work, which surprised me, so I guess I still don't get it yet: z: [+ x y] make-adder: func [x] [func [y] bind copy z 'x] I was hoping that I could make a new copy of the z block each time make-adder was called, and then make x take on a different value in the context of each copy. Maybe somebody could show me how to do it using contexts? -galt
[REBOL] Re: REBOL: THE OFFICIAL GUIDE Re:(5)
c My experience with the Amiga browsers at the REBOL shop was thus: c c AWebII v3.3 would've let me continue if I'd wanted to, but the c transaction would not have been secure. Strange, AWeb worked just fine and in secure mode for me. On the otherhand, I thought I was supposed to receive an email confirmation and I haven't seen that so perhaps it just seemed like it worked! I found the "Thanks from RT" page in my browser cache so something happened :) Regards -- EdV E-Squared Technologies
[REBOL] NETSCAPE vs EXPLORER... CGI problem solved! Re:(3)
Hi, Ralph! You could make better use of lists in Rebol. order: join "https://abooks.safeserver.com/cgi-bin/bookord.r?title=" title order: join order {author=} order: join order trim author order: join order {isbn=} order: join order trim isbn order: join order {pub=} order: join order trim pub order: join order {price=} order: join order trim price This bit about using "order: join" repeatedly is a good clue. That's one of the great things about rebol list syntax. order: join copy "" [ https://abooks.safeserver.com/cgi-bin/bookord.r?title=" title {author=} trim author {isbn=} trim isbn {pub=}trim pub {price=} trim price ] I didn't actually test it, but it should work, or something very similar to this. It's roughly right, for sure, and still easy to read. Cool, huh? -galt
[REBOL] REBOL: THE OFFICIAL GUIDE Re:(7)
c My experience with the Amiga browsers at the REBOL shop was thus: c c AWebII v3.3 would've let me continue if I'd wanted to, but the c transaction would not have been secure. Strange, AWeb worked just fine and in secure mode for me. On the otherhand, I thought I was supposed to receive an email confirmation and I haven't seen that so perhaps it just seemed like it worked! I found the "Thanks from RT" page in my browser cache so something happened :) Regards -- EdV E-Squared Technologies Ed Vishoot?... yep, we got your order... there have only been 3 or 4 people did not get confirming email. Think I've fixed that bug. But our data integrity is good; REBOL gets the orders through. Best, --Ralph
[REBOL] func[func] Re:(5)
Hi Galt, couldn't you ask simpler questions? {8^D Galt wrote: make-adder: func [x] [func [y] [+ x y]] Ladislav pointed out that if you use it more than once, you must do this: make-adder: func [x] [func [y] compose[+ (:x) y]] Galt again: what is the bloody point of having to put in the compose? I thought the whole idea here was that contexts were cool, and you could use them to have a hidden local variable. I got this from a Scheme example and there's no extra compose needed there. I am guessing that the problem is that there is only one copy of the block [+ x y] and that it has a context, whatever that is, and that it can only have one context, and that one gets changed everytime you run make-adder again with a new parameter value for x. So running make-adder a 2nd time messes up the value hidden in the context of the first? Ladislav: No, the problem is, that Make-adder uses just one context with just one 'x during its whole lifetime, that's why you can't rely on X's value, if you use Make-adder again. with the original simple method, you get this: source add6 add6: func [y][+ x y] with Ladislav's method, you get this: source add6 add6: func [y][+ 6 y] which is a nice demonstration. But it's mechanism doesn't depend on context at all any more. The function is really returning 6 not X with context. 6 is 6 in any context, so big whoop? Did this used to work in an older rebol without compose? Here you are: REBOL 1.0.3.3 (Win32 x86) TM Copyright 1998 REBOL Technologies Inc. All rights reserved. Send bugs to [EMAIL PROTECTED] Loading internal rebol.r REBOL top level. make-adder: func [x] [func [y] [x + y]] #[function [x] [func [y] [x + y]]] add5: make-adder 5 #[function [y] [x + y]] add6: make-adder 6 #[function [y] [x + y]] add6 1 7 add5 1 6 I note that this works, too, silly as it is: make-adder: func [x] [func [y] reduce['+ x 'y]] Ladislav: Exactly the same result as with Compose. And this failed to work, which surprised me, so I guess I still don't get it yet: z: [+ x y] make-adder: func [x] [func [y] bind copy z 'x] I was hoping that I could make a new copy of the z block each time make-adder was called, and then make x take on a different value in the context of each copy. Maybe somebody could show me how to do it using contexts? -galt I am curious too... (BTW, if you want to look at some higher order functions, have a look at http://www.rebol.org/advanced/highfun.r ) Regards Ladislav
[REBOL] NETSCAPE vs EXPLORER... CGI problem solved! Re:(4)
That looks useful... I'll try it... Thanks! Indeed cool. --Ralph Hi, Ralph! You could make better use of lists in Rebol. order: join "https://abooks.safeserver.com/cgi-bin/bookord.r?title=" title order: join order {author=} order: join order trim author order: join order {isbn=} order: join order trim isbn order: join order {pub=} order: join order trim pub order: join order {price=} order: join order trim price This bit about using "order: join" repeatedly is a good clue. That's one of the great things about rebol list syntax. order: join copy "" [ https://abooks.safeserver.com/cgi-bin/bookord.r?title=" title {author=} trim author {isbn=} trim isbn {pub=}trim pub {price=} trim price ] I didn't actually test it, but it should work, or something very similar to this. It's roughly right, for sure, and still easy to read. Cool, huh? -galt
[REBOL] text file changes Re:(2)
With 500,000 rows in the file, you may want to just read the rows one at a time. This might take some work. Rebol is good at gulping everything all at once, and computers are pretty fast and have lots of ram, but for really big data that approach chokes like a dog. You should also be careful about writing and testing on toy size data because it might fail to scale. good luck! -galt From: [EMAIL PROTECTED] on 07/09/2000 11:16 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: Galt Barber/LearningTree/US) Subject: [REBOL] text file changes Re: At 03:59 PM 7/10/00 +1000, you wrote: hi all just need a little help with something.. i am trying to change all returns in a text file to tabs file: read %some-filename.txt replace/all file "^/" "^-" and then change every occurence of ZZZ to a returnis this possible? replace/all file "ZZZ" "^/" i am on windoze 98se.the file is about 12mb with about 500,000 records. i have checked the user guide but couldn't get anything out of it regarding this sort of thing thanks in advance keith ;- Elan [ : - ) ]
[REBOL] func[func] Re:(5)
Howdy, Galt: Galt wrote: make-adder: func [x] [func [y] [+ x y]] I am guessing that the problem is that there is only one copy of the block [+ x y] and that it has a context, whatever that is, and that it can only have one context, and that one gets changed everytime you run make-adder again with a new parameter value for x. So running make-adder a 2nd time messes up the value hidden in the context of the first? There's only one context for make-adder where the value for x is looked up in your returned adder function. You'd need to create a new context for each x. You'll also need to keep those contexts around to be GC safe. Here is one possible way of creating these functions based solely on contexts: save-em: copy [] make-adder: func [x][ get in last append save-em make object! [ z: x f: func [y][+ z y] ] 'f ] The above creates new contexts to hold the different values of X in your separate add functions. (It also creates new functions that use those X values). -jeff
[REBOL] New REBOL Manual
Dear REBOLs, I've got a major revision to the REBOL/Core manual that will be nearing completion this week. It's been occupying a huge portion of my time (which is one reason why I've not been active on the lists), but I see it as something that really needs to be done. I suspect you feel the same way. I plan to post a draft of the manual to our web site, and if any of you would be interested in reviewing it, I would appreciate your comments and suggestions. Watch for it near the end of this week. I will provide instructions on the site for how to reply and post comments. Thanks, -Carl
[REBOL] func[func] Re:(6)
Ladislav,thanks for pointing out highfun.r!!! It sure is interesting that make-adder works with the old Rebol 1 but not with the newer ones. What exactly did we lose? What work-arounds are feasible? I assume that the change was some deal with the devil that RT made for more speed. Still, it would be nice to know how the system is doing things internally, descriptively at least. Where is the clear explanation of context and so forth? I remember a while back somebody was asking for a something like a whitepaper on the language and at the time people either denied it's usefulness, or claimed it would take important developer time away from improving rebol so it couldn't be written, or that nobody there seemed to understand the request. Andrew initially defended the lack of such documentation in taking the position that nobody else documents their crap, you just have to fool with it till it works, like every other system we've all had to get working. Except that Lisp and Pascal and many others are in fact very well described. And really we are talking here about the core functionality of the language, not trying to get Rebol to cough up source code nor to dwell on the details of the implementation of web protocols. We just want to know how to think about the process so we can write correct programs based on understanding. I still don't even use parse for any but the simplest things. If I had a burning need that nothing else could satisfy I probably would sit down and grind through the details, but short of that I may never go any deeper. The examples available for parse are certainly better today than they used to be, but they are not that easy. This really means that only expert users with a penchant for playing with parse will get much out of it. Regular users will merely boggle. I suspect however that it is actually possible to document parse better so that more people would be able to make it over the hump. Please chime in, everyone! -galt
[REBOL] func[func] Re:(7)
Galt wrote: Andrew initially defended the lack of such documentation in taking the position that nobody else documents their crap, you just have to fool with it till it works, like every other system we've all had to get working. Yes. I feel that Carl's new version of the REBOL manual should solve this problem. Fingers crossed! I'd really like that GC problem to be fixed, and some better documentation on 'parse, too. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] Find speed Re:(2)
Alessandro Pini ([EMAIL PROTECTED]) wrote: - Open Your Mind - Quoting from Brian Hawley's message (08-Jul-00 01:31:18). b This either means resorting the list after every b insert, using an incremental insertion sort, or making b sure the data is inserted in order. Hmmm. :- You mean something like this invented example? probe data == [15 98 60 52 10 2] insert/sorted/compare data 15 :method == [98 60 52 15 10 2] I mentioned three methods. Since we were talking about working with key/value pairs... table: [1 "1" 2 "2" 5 "5"] key: 4 value: "4" Resorting the list after every insert: sort/skip append table reduce [key value] 2 Hey, at least the sort is in native code. Depending on the method, it could be optimal when the table is already mostly sorted (read: Not quicksort). Incremental insertion sort (linear search): while [ any [(tail? table) (key = first table)] ] [table: skip table 2] table: head insert table reduce [key value] Binary search would be faster for large tables, but it's a little more complicated. Making sure the input is sorted in the first place: (sort input here) append table reduce [key value] Doesn't work very well when you can't sort the input in the first place. Does that help? Brian Hawley
[REBOL] func[func] Re:(6)
Jeff and Brian, you guys are terrific help, and I really appreciate it. Hopefully some of the other people on the list have the same questions as me and are benefitting from your wisdom, too. Brian, one little interesting point, as you may have seen from Ladislav's generous note: --- Did this used to work in an older rebol without compose? Here you are: REBOL 1.0.3.3 (Win32 x86) TM Copyright 1998 REBOL Technologies Inc. All rights reserved. Send bugs to [EMAIL PROTECTED] Loading internal rebol.r REBOL top level. make-adder: func [x] [func [y] [x + y]] #[function [x] [func [y] [x + y]]] add5: make-adder 5 #[function [y] [x + y]] add6: make-adder 6 #[function [y] [x + y]] add6 1 7 add5 1 6 So, it did used to work in an older Rebol. -- One reason I was thinking the context was bound to the block had to do with a vague memory of a something posted a long time ago. So, is it safe to say that a context is associated only with a word? Or is a word assoc. with a context? Or only words that are functions are associated with a context?? Does each function have one context? What about dynamically generated functions not referred to directly by assigning to some 'word ? Do these automatically have a context, too? Is rebol's use of context similar enough to another language out there that I could get some good guidance by referring to that language's documentation/literature ? - Thanks! to everyone on the list who has been helping me out here with getting a better understanding of Rebol. I am going to print out those notes to study them better. -galt
[REBOL] New REBOL Manual Re:
Yes, Carl, that new manual will really be valuable! Thanks! -galt
[REBOL] Can rebol print files?
Hello, Does anyone know how to let Rebol print staff? My script is generating a new file, how can I let the script print out the generated file? Thanks a lot. Tiana
[REBOL] How to execute a rebol script from an html page?
Hello, In my html page, once user click a button, a rebol scrip will be run at the backgroud. How can I accomplish this? Any suggestion? Thanks in advance. Tiana
[REBOL] REBOL and the unix shell Re:
Quoting [EMAIL PROTECTED] ([EMAIL PROTECTED]): [...] I put up an article I wrote this weekend [...] http://www.cs.unm.edu/~whip/rebol-unix-shell.html Hi Jeff, I know I am late, but it really would be nice to read that. It seems that the article has been censored from the site :) Forbidden You don't have permission to access /~whip/rebol-unix-shell.html on this server. -- Jussi HagmanCS in Åbo Akademi University Studentbyn 4 D 33 [EMAIL PROTECTED] 20540 Åbo [EMAIL PROTECTED] Finland
[REBOL] func[func] Re:(7)
Hi, It sure is interesting that make-adder works with the old Rebol 1 but not with the newer ones. What exactly did we lose? What work-arounds are feasible? My work-arounds are collected in %highfun.r and %sfun.r I assume that the change was some deal with the devil that RT made for more speed. Bind was easier to implement too..., but the speed may even suffer, because the speed-up for the interpreter may mean a slow-down for the compiled code (JIT compiling may be interesting for Rebol and binding a block 1000 times may be more time-consuming, then the more common approach - bind once, do many times) ... a while back somebody was asking for a something like a whitepaper on the language and at the time people either denied it's usefulness, or claimed it would take important developer time away from improving rebol so it couldn't be written, or that nobody there seemed to understand the request. And really we are talking here about the core functionality of the language, not trying to get Rebol to cough up source code nor to dwell on the details of the implementation of web protocols. We just want to know how to think about the process so we can write correct programs based on understanding. The problem may have something in common with the feeling, that the language is still "under development". I still don't even use parse for any but the simplest things. If I had a burning need that nothing else could satisfy I probably would sit down and grind through the details, but short of that I may never go any deeper. The examples available for parse are certainly better today than they used to be, but they are not that easy. This really means that only expert users with a penchant for playing with parse will get much out of it. Regular users will merely boggle. I suspect however that it is actually possible to document parse better so that more people would be able to make it over the hump. Please chime in, everyone! -galt
[REBOL] func[func] Re:(7)
Galt wrote: Jeff and Brian, you guys are terrific help, and I really appreciate it. Hopefully some of the other people on the list have the same questions as me and are benefitting from your wisdom, too. Flatterer :) Brian, one little interesting point, as you may have seen from Ladislav's generous note: --- Did this used to work in an older rebol without compose? Here you are: REBOL 1.0.3.3 (Win32 x86) ... So, it did used to work in an older Rebol. This is interesting! I kind of thought this might be the case, but I didn't check. Learn something old every day! But compose was added much later than this. The initial 2.x versions didn't have it either. The changeover from the Scheme engine to the stack engine didn't have much to do with compose. So, is it safe to say that a context is associated only with a word? Or is a word assoc. with a context? A word is associated with a context, by the bind function or some internal equivalent. Or only words that are functions are associated with a context?? Words are not functions. Functions are first-class values that can be assigned to words like any other value. This distinction is a good one to keep in mind with REBOL. Does each function have one context? By default, yes. When the function is recursed into a new context has to be created to make it reentrant. When that function returns, the new context is lost. The original is still there to be reused, though. Recursive functions are much like using the USE operation, with all of the overhead and GC-related context concerns. What about dynamically generated functions not referred to directly by assigning to some 'word ? Do these automatically have a context, too? Yes. The context is associated with the function value, not any words that may have that value assigned to them. Is rebol's use of context similar enough to another language out there that I could get some good guidance by referring to that language's documentation/literature ? At the high level, REBOL behaves much like Scheme or some other lisp-like language, or maybe Smalltalk. At the low level, it behaves more like an intermediate language for a compiler. Some have said that Forth might be similar, but I haven't verified it. Other aspects of the engine are a bit Forth-like (stack-machine), but the high level REBOL syntax and semantics are quite different. So far, conversations on this mailing list have been the best documentation for low-level aspects of REBOL context handling. Someone should probably codify those some day. It should probably be me. But I've been too busy, or more likely too lazy. I'm waiting for the Official Guide, to see if it covers the subject properly. If not, I'll just have to do it, probably as a page on my web site. It's too minimal a site anyway... Thanks! to everyone on the list who has been helping me out here with getting a better understanding of Rebol. I am going to print out those notes to study them better. Any time! Brian Hawley (There is another Brian on the list, so I have to sign my whole name all the time now...)
[REBOL] REBOL and the unix shell Re:(2)
Sorry. It was taken down as it is being considered for a pubication.. Will deliver news about it soon.. -jeff [...] I put up an article I wrote this weekend [...] http://www.cs.unm.edu/~whip/rebol-unix-shell.html Hi Jeff, I know I am late, but it really would be nice to read that. It seems that the article has been censored from the site :) Forbidden Youdon't have permission to access /~whip/rebol-unix-shell.html on this server. -- Jussi Hagman CS in Åbo Akademi University Studentbyn 4 D 33 [EMAIL PROTECTED] 20540 Åbo [EMAIL PROTECTED] Finland
[REBOL] adding data to hyperlinks, etc. Re:
The next feature I want to add is a commenting system. I want the reader to be able to click on a hyperlink for "comments" which will then execute a .cgi script. The .cgi script will then render a page including all of the comments people have posted in regards to the news article in question. The question I have is, how do I pass a value to a script from a hyperlink so that the script renders the correct set of comments? Encode you hyperlink like this. http://cgi.zipworld.com.au/~bhandley/cgidump.r?your-id=123456789 Which would be the same as if a HTML form was submitted with an input element of "your-id" that value 123456789. I have thought of another option, albeit more cumbersome. During the time the main script creates object expressions for the news articles themselves, the script could create a separate .cgi script just for that article. Probably overkill. But how can I write a script to a directory and then make the script executable all at the same time? I'm thinking the web server will see the .cgi extension and assign it executable status, but I'm not sure that is always the case. I'm little curious about this myself. Hope this was what you wanted. Brett.
[REBOL] adding data to hyperlinks, etc. - RE-SENT
Don't know why this went missing. So here it is again. - Original Message - From: "Brett Handley" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 09, 2000 11:44 AM Subject: Re: [REBOL] adding data to hyperlinks, etc. The next feature I want to add is a commenting system. I want the reader to be able to click on a hyperlink for "comments" which will then execute a .cgi script. The .cgi script will then render a page including all of the comments people have posted in regards to the news article in question. The question I have is, how do I pass a value to a script from a hyperlink so that the script renders the correct set of comments? Encode you hyperlink like this. http://cgi.zipworld.com.au/~bhandley/cgidump.r?your-id=123456789 Which would be the same as if a HTML form was submitted with an input element of "your-id" that value 123456789. I have thought of another option, albeit more cumbersome. During the time the main script creates object expressions for the news articles themselves, the script could create a separate .cgi script just for that article. Probably overkill. But how can I write a script to a directory and then make the script executable all at the same time? I'm thinking the web server will see the .cgi extension and assign it executable status, but I'm not sure that is always the case. I'm little curious about this myself. Hope this was what you wanted. Brett.
[REBOL] Can rebol print files? Re:
Tiana asked: Does anyone know how to let Rebol print staff? If you're using Windows, then this function works for me: Printer: func [Text [string!] /Page] [ secure [ %//prn [allow write] ] write %//prn Text ; Append Carriage Return (CR) and Page Feed. if Page [write/binary %//prn "^(0D)^(page)"] Text ] For unix, it's easier, so I believe. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] Can rebol print files? Re:(2)
Hey Andrew and other Javascript knowlegeble folk, Here's an idea. I haven't got time to chase the javascript for this but I think this might provide a way that we can use the printer across more platforms with better formating, printing with pictures etc. Step 1 Write a html frameset (print.html) with javascript to print the main frame onload. (temp.html) Step 2. Create page layout in html save it as temp.html Step 3. Use browse/only "path-to-print.html" Cheers, Allen K
[REBOL] Can rebol print files? Re:(3)
Allen wrote: Hey Andrew and other Javascript knowledgeable folk, Here's an idea. I haven't got time to chase the javascript for this but I think this might provide a way that we can use the printer across more platforms with better formatting, printing with pictures etc. Step 1 Write a HTML frameset (print.HTML) with javascript to print the main frame onload. (temp.HTML) Step 2. Create page layout in HTML save it as temp.HTML Step 3. Use browse/only "path-to-print.HTML" Brilliant idea, Allen. The JavaScript is: Window.print() which "prints the current document, exactly as if the user had clicked the browser's Print button." It's available in Client-side Navigator 4, according to my reference book (Rhino). That should work in MSIE 5 as well, fingers crossed. I'll have a play with this and see if it works out well, later this afternoon. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] func[func] Re:(7)
Jeff and Brian, you guys are terrific help, and I really appreciate it. Hopefully some of the other people on the list have the same questions as me and are benefitting from your wisdom, too. Most definitely. I've got this leetle folder where I'm squirreling away these important tidbits. Brett.
[REBOL] Can rebol print files? Re:(5)
Allen wrote: Here's a resource that will help in this regard. It covers printing issues relating to JavaScript and different browsers. Thanks to Ed O'Conner for bringing it to my attention. http://developer.irt.org/script/print.htm Thanks for bringing that to my attention as well. There's a Battleship game written in JavaScript here: http://www.irt.org/games/chall/c06/index.htm which would be much quicker in Rebol/View. I remember Carl nailing his hands to the desk, as it were, to stop himself from coding one for Rebol/View. Anyone else want to have a go? Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] func[func] Re:(6)
Hi Jeff You wrote: save-em: copy [] make-adder: func [x][ get in last append save-em make object! [ z: x f: func [y][+ z y] ] 'f ] The above creates new contexts to hold the different values of X in your separate add functions. (It also creates new functions that use those X values). Nice and it works. One can also tidy things up by encapsulating the block of saved items in the function which also illustrates a practical use of the behavior of literal blocks contained in functions. make-add: func [x][ saved: [] get in last append saved make object! [ z: x f: func [y][+ z y] ] 'f ] Cheers -Larry