[REBOL] Getting a function body block from standard input Re:(3)
Hi, AP wrote: Here is some of my code... prin y: load ask ["What is your function? y = "] yfunc: func [x] [y] I enter [2 * x + 1] Later code for x xmin xmax step [ print [x " " yfunc x] ] Then I get as output 0 2 * x + 1 5 2 * x + 1 10 ... yfunc is not evaluating. [snip] I'm stuck. you were almost there... Try these changes: probe y: load ask ["What is your function? y = "] yfunc: func [x] y etc... Regards, Ladislav
[REBOL] R: under HTML Re:(2)
In einer eMail vom 22.03.00 18:40:13 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: Re: [REBOL] [REBOL] under HTMLHi Paolo thank for the suggestion. Just for training I'm trying to make a script for downloading all the scripts from those .org-directories. But I need simply to know why a common example like inthtml.r, for the script embedding, doesn't work with IE 5.0 (it causes no one effect absolutely and no one message). Really is it due to my browser IE 5.0, not supporting rebol in script-tag ? Or is my rebol setup incomplete ? Carlo Petriccione [EMAIL PROTECTED] Do you see the script-text in the browser? then somewhere in explorer application-settings is rebol-script : text/plain . similar like .txt. if you clear text/plain, it will use the typical application, with open/save question and that. Volker
[REBOL] [REBOL] Error Message Re:(2)
Hi another_bob, I believe I've seen this error message when I've used hidden contexts. Were experimenting or using a use block, something like this? use [a b] [a: 1 b: 2 [a b]] I believe it's an error that is not supposed to happen and indicates that REBOL's garbage collection has been corrupted. At 05:41 PM 3/23/00 +1200, you wrote: another_bob wrote: What is the meaning of this error message? How can I avoid it? Invalid data type during recycle ** Press enter to quit. It could be a bug. Send a copy of the script to the list. Or run the feedback script. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- ;- Elan [: - )]
[REBOL] [REBOL] Error Message Re:(3)
In einer eMail vom 23.03.00 15:52:35 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: Hi another_bob, I believe I've seen this error message when I've used hidden contexts. Were experimenting or using a use block, something like this? use [a b] [a: 1 b: 2 [a b]] I believe it's an error that is not supposed to happen and indicates that REBOL's garbage collection has been corrupted. Have a crash after use too, and read somewhere it has a bug (script at rebol.org?) use and /local have another bug: you can't look in after an error! i fixed (?) this yesterday with my 'local : it creates an object for the context and returns it. locals are set to none initially. if all /locals moved in the 'local -level, last bug's values are available. a question: [a: do [print "1"]] does not work, how can i handle this too? i wanted to return the result of [do b] this way, with some lines after it [.. e: do b if a-option [..] "return" e ] ? "code" local: func[a "vars" b "script" /local c d ][ c: copy[] foreach i a[ append c to set-word! i] append c none d: make object! c bind b in d 'selfdo b d] "test" do [ a: "-a" b: "-b" probe the-locals: local[a b][ a: 10 b: 20] probe a probe b probe the-locals ] Volker
[REBOL] telnet server
Hi all, I've got a wild idea to write a simple Telnet server via REBOL. That is, a person could connect to the server from a remote machine via telnet and communicate with the server until "logging out". Thing is, I'd like the server to handle multiple connections at once. Does anyone know how to keep track of the different connections? I've been told (at least) one way to handle this is to use a single port and keep track of the different connections via sockets. Can I access this level of communication via REBOL, or is there some other nice way that REBOL handles it? Michael Jelinek IS - Data Warehouse CalFarm Insurance [EMAIL PROTECTED] 924-4068
[REBOL] [REBOL] Error Message Re:(4)
Hi Volker, you wrote: use and /local have another bug: you can't look in after an error! I'm not sure how you were trying to "look in": f: func [/local a] [a: 1 1 / 0] will cause a divide by zero error: f ** Math Error: Attempt to divide by zero. ** Where: 1 / 0 Now let's look at the value of a: first second :f == a: get first second :f == 1 "Looked in" and saw that a evaluates to 1. You must mean something quite different? a question: [a: do [print "1"]] does not work, how can i handle this too? i wanted to return the result of [do b] this way, with some lines after it [.. e: do b if a-option [..] "return" e ] ? print returns nothing, and nothing is a value of type unset!: type? print "hello" hello == unset! type? do [print "hello"] hello == unset! print mold do [print "hello"] hello ** Script Error: mold is missing its value argument. ** Where: print mold do [print "hello"] When type? returns the datatype unset! it is reporting that there was no value: type? == unset! There is no value to assign to 'a in your example. Otherwise it works as you expect (?): f: func [] [a: do [1 + 1] return a] f == 2 "code" local: func[a "vars" b "script" /local c d ][ c: copy[] foreach i a[ append c to set-word! i] append c none You could simplify your foreach loop: foreach i a [ append c compose [(to set-word! i) none] ] d: make object! c bind b in d 'selfdo b d] "test" do [ a: "-a" b: "-b" probe the-locals: local[a b][ a: 10 b: 20] probe a probe b probe the-locals ] Volker ;- Elan [: - )]
[REBOL] [REBOL] Error Message Re:(5)
In einer eMail vom 23.03.00 23:25:19 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: Hi Volker, you wrote: use and /local have another bug: you can't look in after an error! I'm not sure how you were trying to "look in": f: func [/local a] [a: 1 1 / 0] will cause a divide by zero error: f ** Math Error: Attempt to divide by zero. ** Where: 1 / 0 Now let's look at the value of a: first second :f == a: get first second :f == 1 "Looked in" and saw that a evaluates to 1. You must mean something quite different? No. I meant that. Just have not known this way. thanks. a question: [a: do [print "1"]] does not work, how can i handle this too? i wanted to return the result of [do b] this way, with some lines after it [.. e: do b if a-option [..] "return" e ] ? print returns nothing, and nothing is a value of type unset!: type? print "hello" hello == unset! type? do [print "hello"] hello == unset! print mold do [print "hello"] hello ** Script Error: mold is missing its value argument. ** Where: print mold do [print "hello"] When type? returns the datatype unset! it is reporting that there was no value: type? == unset! There is no value to assign to 'a in your example. Otherwise it works as you expect (?): f: func [] [a: do [1 + 1] return a] f == 2 My problem is: i dont know the arg of 'do. its a parameter. type? destroys the result. i can not store it before, because this can cause an error. i can not [try [a: do b] because the error can be caused by code in 'b . maybe something like [try [ a: try [b]], but this gets complicated. hm. someone more clever than me? "code" local: func[a "vars" b "script" /local c d ][ c: copy[] foreach i a[ append c to set-word! i] append c none You could simplify your foreach loop: foreach i a [ append c compose [(to set-word! i) none] ] Ah! Volker
[REBOL] Newbie question #2 - Pattern making and using?
Ok... how do i make a pattern so that one word eg cat: can mean cat feline tiger etc. The following works, but this code looks imperfect. x: none cat: "feline" cat: "kitty" fact: "I have a kitty" if found? find fact cat [x: "found it"] if found? x [print x] unset 'x How can i make the 2 values of cat: into a pattern that can be used in this script? Also, the rest of this script stinks... THERE MUST BE A BETTER WAY!!! Humbly, T Brownell __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] [REBOL] Error Message Re:(6)
Hi Volker, you wrote: My problem is: i dont know the arg of 'do. its a parameter. type? destroys the result. i can not store it before, because this can cause an error. i can not [try [a: do b] because the error can be caused by code in 'b . maybe something like [try [ a: try [b]], but this gets complicated. Not very elegant, but this works: unset 'a result: [] == [] insert result do [print "hi"] hi == [] if not unset? first result [a: first result] clear head result == [] value? 'a == false insert result do [1 + 1] == [] if not unset? first result [a: first result] clear head result == [] value? 'a == true a == 2 Hope this helps, ;- Elan [: - )]
[REBOL] Newbie question #2 - Pattern making and using? Re:
Hi T Brownell you wrote: x: none cat: "feline" cat: "kitty" fact: "I have a kitty" if found? find fact cat [x: "found it"] if found? x [print x] unset 'x A few remarks: x: none this line is not necessary. But it's not a bad idea. cat: "feline" cat: "kitty" Now cat evaluates to "kitty" only! cat no longer evaluates to "feline"! If you try this code against fact: "I have a feline" find will fail! Given: cat: "feline" cat: "kitty" fact: "I have a kitty" you could say: if found? find fact cat [print x: "found it"] How can i make the 2 values of cat: into a pattern that can be used in this script? Also, the rest of this script stinks... THERE MUST BE A BETTER WAY!!! fact: "I have a kitty" rule:[ [thru "kitty" (x: "found kitty")] | [thru "feline" (x: "found feline") ] to end ] if parse fact rule [print x] found kitty fact: "I have a feline" if parse fact rule [print x] found feline To identify both in any order: fact-1: "The feline I have is a kitty." fact-2: "I have a kitty which is a feline" one possible approach is: rule:[ marker: [thru "kitty" (x-kitty: "found kitty")] :marker [thru "feline" (x-feline: "found feline") ] to end ] unset 'x-feline unset 'x-kitty if parse fact-1 rule [ if value? 'x-feline [print x-feline] if value? 'x-kitty [print x-kitty] ] unset 'x-feline unset 'x-kitty if parse fact-2 rule [ if value? 'x-feline [print x-feline] if value? 'x-kitty [print x-kitty] ] unset 'x-feline unset 'x-kitty if parse fact-1 rule [ [ if value? 'x-feline [print x-feline] [ if value? 'x-kitty [print x-kitty] [] found feline found kitty unset 'x-feline unset 'x-kitty if parse fact-2 rule [ [ if value? 'x-feline [print x-feline] [ if value? 'x-kitty [print x-kitty] [] found feline found kitty Hope this helps. ;- Elan [: - )]
[REBOL] Newbie question #2 - Pattern making and using? Re:(2)
Here's an approach. cat: ["cat" "feline" "kitty" "lion"] == ["cat" "feline" "kitty" "lion"] fact: "I have a kitty" == "I have a kitty" foreach wrd parse fact none [if found? find cat wrd [prin "found " print wrd]] found kitty This is a bit simplified. If fact: "My kitty cat ate a mouse." == "My kitty cat ate a mouse." foreach wrd parse fact none [if found? find cat wrd [prin "found " print wrd]] found kitty found cat == false The == false is the result of words after the search words. Perhaps, in place of 'if, 'either could be used with [] for the "else" action block. Yeah! That works! Also if fact: "I have a kitty." it fails because the simple parse generates ["I" "have" "a" "kitty."] Parse needs to be modified to dump the period. Russell [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 23, 2000 8:46 PM Subject: [REBOL] Newbie question #2 - Pattern making and using? Re: Hi T Brownell you wrote: x: none cat: "feline" cat: "kitty" fact: "I have a kitty" if found? find fact cat [x: "found it"] if found? x [print x] unset 'x A few remarks: x: none this line is not necessary. But it's not a bad idea. cat: "feline" cat: "kitty" Now cat evaluates to "kitty" only! cat no longer evaluates to "feline"! If you try this code against fact: "I have a feline" find will fail! Given: cat: "feline" cat: "kitty" fact: "I have a kitty" you could say: if found? find fact cat [print x: "found it"] How can i make the 2 values of cat: into a pattern that can be used in this script? Also, the rest of this script stinks... THERE MUST BE A BETTER WAY!!!