[REBOL] Curious Re:(2)
[EMAIL PROTECTED] wrote: > > Yup. That's a bug. I forwarded your message to feedback so > it will get put into our Rebol Automated Master Bug > Organizer. R.A.M.B.O.? lol > I'm surprised that that one hasn't shown up before for > someone... or maybe it did and they didn't realize what was > happenening. Yes, I wasn't sure whether it was supposed to be 'none or index.html is just used as a filler until it actually has a value (from site perhaps?). index.html did seem like a logical choice to me as well, hence the query first. Thanks Jeff. Regards, Deryk
[REBOL] return doesn't work as documented Re:(2)
My mistake. I had not realized the select/switch mistake. Thanks! David Logan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Saturday, June 17, 2000 12:43 PM To: [EMAIL PROTECTED] Subject: [REBOL] return doesn't work as documented Re: Hi David, return works but switch does not, the throw attribute is missing. This is a correct version of switch from REBOL/View: switch: func [ "Selects a choice and evaluates what follows it." [throw] value "Value to search for." cases [block!] "Block of cases to search." /default case "Default case if no others are found." ][ either value: select cases value [do value] [ either default [do case] [none]] ] -- Michal Kracik [EMAIL PROTECTED] wrote: > > The Rebol/Core Dictionary states that return "Returns a value from a > function." But the following example shows this is not true: > > >> z: func [][switch "i" ["z" [print "Z"] "i" [print "Here" return "Hello"]] > return "Goodbye"] > >> z > Here > == "Goodbye" > > It appears as though return returns from a block scope, not a function > scope. Examination of the Users guide did not provide any additional clues, > nor did the online FAQ (except the fact that all of the examples in the > Users guide had a return at the function scope.) > > Any ideas? > David Logan
[REBOL] A data inconsistency Re:
It's a problem with the declaration of CHANGE, like this: f: func [x][] g: func [x [any-type!]][] >> f ** Script Error: f is missing its x argument. ** Where: f >> g >> > Hi, > > did anyone report The following? > > >> head insert copy [] () > == [unset] >> change copy [1] () ** Script Error: change is > missing its value argument. ** Where: change copy [1] () > > Ladislav > > >
[REBOL] return doesn't work as documented Re:
Hi David, return works but switch does not, the throw attribute is missing. This is a correct version of switch from REBOL/View: switch: func [ "Selects a choice and evaluates what follows it." [throw] value "Value to search for." cases [block!] "Block of cases to search." /default case "Default case if no others are found." ][ either value: select cases value [do value] [ either default [do case] [none]] ] -- Michal Kracik [EMAIL PROTECTED] wrote: > > The Rebol/Core Dictionary states that return "Returns a value from a > function." But the following example shows this is not true: > > >> z: func [][switch "i" ["z" [print "Z"] "i" [print "Here" return "Hello"]] > return "Goodbye"] > >> z > Here > == "Goodbye" > > It appears as though return returns from a block scope, not a function > scope. Examination of the Users guide did not provide any additional clues, > nor did the online FAQ (except the fact that all of the examples in the > Users guide had a return at the function scope.) > > Any ideas? > David Logan
[REBOL] Re: pseudo-globals? Re:(2)
Hello [EMAIL PROTECTED]! On 16-Giu-00, you wrote: G> p.s. Is there any way to do the same thing, even if G> "result" were a local var and not global? You can set r/result to whatever; but perhaps you are interested in something like the following? r-spec: [ x: func [] [system/words/x result] y: func [] [system/words/y result] z: func [] [system/words/z result] append: func [str] [system/words/append result str] ] f: func [/local result] [ ; ... r: make object bind r-spec 'result ; ... do bind [ x y z append "stuff" ] in r 'self ; ... ] Be careful in using r outside of f tough. G> Also, I have 7 functions, and I would need to do this trick in G> each one. Is it possible to create some other routine outside You could create the object r on the fly. r-spec: clear [] args-of: func [f [any-function!]] [ copy/part f: first :f any [find f refinement! tail f] ] foreach function [x y z append] [ insert tail r-spec compose/deep [ (to-set-word function) func [(args: next args-of get function)] [ (make path! reduce ['system 'words function]) result (args) ] ] ] ; here you have the same r-spec as above; you can add ; 'result to it (insert tail r-spec [result: system/words/result]) ; or use it like in the function f above. HTH, Gabriele. -- Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] Curious Re:
Howdy, Deryk: > Now, knowing that index.html is _usually_ the desired > target, it isn't _always_ the target itself. Index files > can be almost anything the web server has support for, > i.e. .php, .php3, .asp, .shtml, etc. Why was this chosen > to be a fillin and not what the server itself returns to be > the _actual_ target? Yup. That's a bug. I forwarded your message to feedback so it will get put into our Rebol Automated Master Bug Organizer. I'm surprised that that one hasn't shown up before for someone... or maybe it did and they didn't realize what was happenening. -jeff
[REBOL] return doesn't work as documented Re:
> The Rebol/Core Dictionary states that return "Returns a value from a > function." But the following example shows this is not true: > > >> z: func [][switch "i" ["z" [print "Z"] "i" [print "Here" return "Hello"]] > return "Goodbye"] > >> z > Here > == "Goodbye" > > It appears as though return returns from a block scope, not a function > scope. Examination of the Users guide did not provide any additional clues, > nor did the online FAQ (except the fact that all of the examples in the > Users guide had a return at the function scope.) > > Any ideas? > David Logan > Hi, the problem (already solved in Rebol/View) is, that Switch is a function, which executes the Return in question. You can see its source code by executing: source switch If you would do the same code in Rebol/View, you would experience one attribute in Switch definition - [throw], which is essentially an instruction for Switch to tell the calling function Return has been evaluated. Ladislav
[REBOL] return doesn't work as documented
The Rebol/Core Dictionary states that return "Returns a value from a function." But the following example shows this is not true: >> z: func [][switch "i" ["z" [print "Z"] "i" [print "Here" return "Hello"]] return "Goodbye"] >> z Here == "Goodbye" It appears as though return returns from a block scope, not a function scope. Examination of the Users guide did not provide any additional clues, nor did the online FAQ (except the fact that all of the examples in the Users guide had a return at the function scope.) Any ideas? David Logan
[REBOL] A data inconsistency
Hi, did anyone report The following? >> head insert copy [] () == [unset] >> change copy [1] () ** Script Error: change is missing its value argument. ** Where: change copy [1] () Ladislav
[REBOL] teeny bits of time Re:
Ryan, Have you tried the view version ... maybe its there. -Larry [EMAIL PROTECTED] wrote: > Wouldn't this be cool? > > >> > >> current-time: now/time > == 20:37:33 > >> print current-time/hour > 20 > >> print current-time/minute > 37 > >> print current-time/second > 33 > >> print current-time/millisecond > 14 > >> print current-time/microsecond > 57 > >> print current-time/nanosecond > 98 > > Any idea if this would even be possible? > > -Ryan
[REBOL] Learning to live as a Rebolian Re:(2)
Yes I am blue from holding my breath. :-) Larry [EMAIL PROTECTED] wrote: > > All, > > > > I find Rebol very useful and use parts of it all the time but ... > > > > I would like to have a better handle on Dialects, objects, and system > > variables. > > I think this could be useful ... any suggestions how to learn to use > > them. > > > > Many of the programs/document are too complex to learn from. > > > > I have look at all the available documents at the Rebol site. > > > > There are some parts of the language that are more obvious in their use > > than others. > > > > There are things that look like they would behave in out way but are > > designed behave in a much different manner. > > > > Thanks for any help. > > > > Hi Larry... there are a couple of good books on REBOL coming out soon. They > should help. > > --Ralph
[REBOL] CSV Files Re:
Now this is cool. The use of a language is the use of idioms/functions ... Maybe some one could collect all of them from the list and put them somewhere where they could be easily found. Larry [EMAIL PROTECTED] wrote: > I seem to continue to use CSV files in just about all the > REBOL programming I've done so far. > I have a handy little code snippet that will do the parse > correctly. > this is a better solution than the kludge I used before. > > > > spread: read/lines %file.csv > linetoblock: func [ > arg1 blk1 > /local line > ] [ > foreach line arg1 [ either "," = back tail line [ append > blk1 parse/all line ","append blk1 " " ] > [ append blk1 parse/all line "," ] > ] > ] > > > this one works. > Bill.
[REBOL] Re: Parsing tab delimited text files
>- Open Your Mind -< Quoting from Doug's message (17-Jun-00 06:29:24). d> For reasons unknown this doesn't work: d> d> page: read/lines %textfile.txt d> foreach line page [ d>line: parse/all line tab d> ] tab is a char!, while parse expects a block!, string! or none! second argument. Two solutions immediately jump to mind: line: parse/all line to-string tab line: parse/all line "^-" Notice the difference between "^-" (string!) and #"^-" (char!). BTW!, with! all! these! exclamation! marks!, I! feel! like! I'm! Captain! Kirk! :-)! Alessandro Pini ([EMAIL PROTECTED]) "Don't tell me! You're from outer space!" "No, I'm from Iowa, I only work in outer space." (Gillian & Kirk)
[REBOL] Parsing tab delimited text files Re:
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Saturday, June 17, 2000 12:29 AM > To: [EMAIL PROTECTED] > Subject: [REBOL] Parsing tab delimited text files > > > I am parsing a number of tab delimited text files. > > For reasons unknown this doesn't work: > > page: read/lines %textfile.txt > foreach line page [ > line: parse/all line tab > ] > Your problem is that tab is a character, i.e.: >> print type? tab char The parse function is looking for a string, so just give it the tab as a string value: page: read/lines %textfile.txt foreach line page [ line: parse/all line "^-" ] and it will work like the true champ that REBOL is. Enjoy. --Ralph Roberts
[REBOL] Curious
Tooling around, I noticed the following: >> port-spec: make port! [ [ scheme: 'tcp [ timeout: 0:10 [] >> net-utils/url-parser/parse-url port-spec http://www.iitowns.com/ == none >> print port-spec/host www.iitowns.com >> print port-spec/target index.html Now, knowing that index.html is _usually_ the desired target, it isn't _always_ the target itself. Index files can be almost anything the web server has support for, i.e. .php, .php3, .asp, .shtml, etc. Why was this chosen to be a fillin and not what the server itself returns to be the _actual_ target? Not that any of this affects anything I'm doing, I'm just curious is all. :) Regards, Deryk