[REBOL] blocks inside strings Re:(2)
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes >Hi Graham, > >you're right, it appears that functionality is still missing. > I'll fire a bug report off to feedback then. --- Regards,Graham Chiu gchiucompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[REBOL] Q on Array of Objects Re:(3)
Hi wwink2, you wrote: >print same? :xarr/1/myfun :xarr/2/myfun >** Script Error: xarr is missing its x argument. >** Where: print same? :xarr/1/myfun :xarr/2/myfun Try: same? get in xarr/1 'myfun get in xarr/2 'myfun You will find that same? returns falls. Elan
[REBOL] blocks inside strings Re:
Hi Graham, you're right, it appears that functionality is still missing. At 08:08 PM 11/28/99 +1200, you wrote: > >The user's guide says with regard to string values > >^[words...] executes a block > >yet, print "^[print now]" on 2.2.0.3.1 > >results in > [print now] > >rather than executing the block. > >--- >Regards,Graham Chiu >gchiucompkarori.co.nz >http://www.compkarori.com/dynamo - The Homebuilt Dynamo >http://www.compkarori.com/dbase - The dBase bulletin > > >
[REBOL] blocks inside strings
The user's guide says with regard to string values ^[words...] executes a block yet, print "^[print now]" on 2.2.0.3.1 results in >>>[print now] rather than executing the block. --- Regards,Graham Chiu gchiucompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[REBOL] amiga pipebridge 2.0
for those interested, I've updated the Amiga pipebridge and GUI for it, so it works with rebol v2.2.0.1.1 the new version is at http://www.mindspring.com/~timrue/pbgui2.0.lha If it's not there when you try, then try again later. It'll get there. (it's done, I just need to update my web site). Who knows, maybe rebol updates won't break it next time. :) For those that don't know what it is, it's a bridge between rebol and the Amiga OS and Arexx ports. Allowing Rebol to send and receive to/from Amiga applications. --- *3 S.E.A.S - Virtual Interaction Configuration (VIC) - VISION OF VISIONS!* *~ ~ ~ Advancing How we Perceive and Use the Tool of Computers!* Timothy Rue What's *DONE* in all we do? *AI PK OI IP OP SF IQ ID KE* Email @ mailto:[EMAIL PROTECTED] >INPUT->(Processing)->OUTPUT>v Web @ http://www.mindspring.com/~timrue/ ^<<9<<
[REBOL] listening at ports Re:(2)
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] DU writes >You might want to try Sterling's proxy (avail. on rebol.org) with a small >modification to save to a file all data passed through. I'd imagine that this >shouldn't be difficult, although I haven't looked at the code recently. Good >luck! Looks like it's what I needed - though I have managed to nail my script now. --- Regards,Graham Chiu gchiucompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[REBOL] cookies Re:(2)
>From: [EMAIL PROTECTED] >You could use my cookie-client script that is somewhere on rebol.org. It >allows you to read access webpages while sending them cookies. >I'm planning when I have a few minutes free on revising it to work a bit >more nicely and automatically remember cookies and the like. Sort of a >smart read http:// ... Hi, I got it going after hacking it a bit. Since I didn't really understand how the script worked, I experimented. There was a problem as the set-cookie: header that comes from the server is the only header that is repeated ( multiple cookies ), whereas the http-cookie only saves the last set-cookie: header. Anyway, I've got it so that the script logs on to MTNSMS's password page, grabs the session and persistent cookies, and then posts the message with these cookies to the send-message asp script. End result - my cellphone rings with a text message! It looks ugly, but it works. --- Graham Chiu __ Get Your Private, Free Email at http://www.hotmail.com
[REBOL] Encouraging functional programming Re:(8)
Jordan, I am impressed with your clever function. It seems to take only 10% more time than my non-recursive version. Jerry
[REBOL] Re: Tail recursion in REBOL 2.0
Hello John On 27-Nov-99, you wrote: >>> If I've comprehended that correctly, a good language should >>> eliminate tail >>> recursion and replace it by iteration. This is a feature of most >>> CommonLISP systems and Scheme. > >> Well, that would probably require some static analysis of the >> REBOL program, something which is probably not part of the >> philosophy of the REBOL interpreter. (Am I mistaken?) > > You don't need to do static analysis, you just have to notice > that the current function is calling another function, and that > the result of that call is only going to be returned, i.e., you > are making a function call followed immediately by a return. > If you replace the CALL/RET pair with a JMP, and adjust the stack, > you should be all set. That's definitely what I would consider static analysis. Additionally, remember that in REBOL you can define 'return to do so much else than simply return a value (in fact, 'return is just a value like everything else, and thus can be redefined), so you will never know what the value of 'return will be just after returning from a function call. Though you should be able to remove tail recursion in the specific example of return some-function arg1 arg2 ... argn But using 'return isn't the only means of returning a value. Consider this (untested, though): fac1: func [n] [ either (n > 1) [return n * fac1 n - 1] [return 1] ] fac2: func [n] [ either (n > 1) [n * fac2 n - 1] [1] ] fac1 and fac2 are semantically identical. But how would you dynamically see that you should eliminate tail recursion in fac2? Sure, you could do it by looking forward some bytes (seeing that there isn't anything more to do in the body of the function), but if you should do this properly, program execution will probably be slowed down. Regards Ole
[REBOL] Q on Array of Objects Re:(3)
>> o!: make object! [ [s: "OneTwoThree" [St: func [] [s] [] >> o1: make o! [ [o1: "O1" [] >> o2: make o! [ [o2: "O2" [] >> probe o2 make object! [ s: "OneTwoThree" St: func [][s] o2: "O2" ] >> o2/St: "Hello" == "Hello" >> probe o2 make object! [ s: "OneTwoThree" St: "Hello" o2: "O2" ] >> probe o1 make object! [ s: "OneTwoThree" St: func [][s] o1: "O1" ] Words in objects which refer to functions are copied. Therefore the object will be bigger than expected. Andrew Martin Who believes simplicity is a virtue... [EMAIL PROTECTED] http://members.xoom.com/AndrewMartin/ Online @ 33,600 Baud! -><-
[REBOL] cgi Re:(2)
I am not an expert on this, and I don't have rebol working under Apache (yet) but the following thoughts occur to me: 1.
[REBOL] Q on Array of Objects Re:(2)
I tried this in the script/run included here. It doesn't seem to work when the functions are methods in an object - or else the syntax is a little more complex. I've tried a couple of variations of the syntax, but still get error msgs rather than an answere one way or the other. Lasislav wrote: > Actually, the functions are not replicated. Cf: > > a: func [] [print "done"] > b: :a > same? :a :b > > The functions are the same as in the former example. HTH > > Ladislav > [EMAIL PROTECTED] wrote: > > I am considering writing an app that would create several hundred or > a few thousand copies of a single object. One way to keep track of them > is to use an array. A script that tests this syntax is below along with > a run which does a "print mold" on the array. It appears that the > functions(methods) in the object are replicated for each instance > of the object in the array. Is this true? Is this efficient? I am more > used to OO languages like C++ where only the data fields would > be replicated and there would be only one copy of the functions > for all the instances of the class. Is there a better way to do this? > = start of script REBOL [ Title: "test05 " Author: " ww " ] count-x: 1 myobj: [ x: (count-x) y: 5 myfun: func [ x ] [ return x ] myfun2: func [ ] [ return y ] ] xarr: array 5 for i 1 5 1 [ do rejoin compose ["xarr/" (i) ": (make object! myobj ) " ] count-x: count-x + 1 ] print "demo: show myfun exists/works" print join "xarr/1/myfun : " xarr/1/myfun 7 print join "xarr/2/myfun : " xarr/2/myfun 7.43 print " are they the same? " print same? :xarr/1/myfun :xarr/2/myfun = end of script = start of run Script started on Sat Nov 27 14:10:20 1999 l >> do load %t05.r demo: show myfun exists/works xarr/1/myfun : 7 xarr/2/myfun : 7.43 are they the same? ** Script Error: xarr is missing its x argument. ** Where: print same? :xarr/1/myfun :xarr/2/myfun >> q Script done on Sat Nov 27 14:10:41 1999 = end of run
[REBOL] Encouraging functional programming Re:(7)
Brent, I'm confused. You seem to say that test: func [n /local sum] [sum: 0 for i 1 n 1 [sum: sum + i]] is not functional since it contains an index. On the other you seem to say it is functional in that the output depends only on the input without any side effects. Where did I go wrong? Jerry
[REBOL] Q on Array of Objects Re:(2)
Correcting myself, the functions in objects are really different, if you want to have only one copy of any function, you must write it outside of the object. Ladislav You wrote: I am considering writing an app that would create several hundred or a few thousand copies of a single object. One way to keep track of them is to use an array. A script that tests this syntax is below along with a run which does a "print mold" on the array. It appears that the functions(methods) in the object are replicated for each instance of the object in the array. Is this true? Is this efficient? I am more used to OO languages like C++ where only the data fields would be replicated and there would be only one copy of the functions for all the instances of the class. Is there a better way to do this? (rest snipped)
[REBOL] Encouraging functional programming Re:(7)
<[EMAIL PROTECTED]> wrote: Jordan, I calculate the Fibonnacci numbers without recursion using REBOL. For example >> fib 100 == 3.54224848179262E+20 >> How would you calculate it with recursion? Jerry fib: func [first second n] [ either n = 1 [first] [ either n = 2 [second] [ fib second first + second n - 1 ] ] ] >> fib 1.0 1.0 100 == 3.54224848179262E+20 Ladislav
[REBOL] listening at ports Re:
You might want to try Sterling's proxy (avail. on rebol.org) with a small modification to save to a file all data passed through. I'd imagine that this shouldn't be difficult, although I haven't looked at the code recently. Good luck! -- Andrew Grossman http://web.dartmouth.edu/~grossman/pgp.html --- [EMAIL PROTECTED] wrote: Does anyone have a simple listen script? I want to see what my web browser is sending to the web server. I tried the various examples I've seen, and followed the howtos on rebol.com, but can't get it to function. Thanks, --- end of quote ---
[REBOL] listening at ports Re:
Graham Chiu wrote: > Does anyone have a simple listen script? I want to see what my web browser is sending to the web server. I'm sure there's some useful scripts at: http://www.rebol.org Try the proxy. That might serve your puposes. Andrew Martin [EMAIL PROTECTED] http://members.xoom.com/AndrewMartin/ Online @ 33,600 Baud! -><-
[REBOL] Interface and Implementation Re:(4)
Elan wrote: > Hope this helps,... Thanks, Elan. I've been comparing my REBOL code too closely to my C++ code and forgetting that REBOL words are far more "smarter" than C++ variables. The closest relative in C++ is smart pointers. Andrew Martin [EMAIL PROTECTED] http://members.xoom.com/AndrewMartin/ Online @ 33,600 Baud! -><-
[REBOL] listening at ports
Does anyone have a simple listen script? I want to see what my web browser is sending to the web server. I tried the various examples I've seen, and followed the howtos on rebol.com, but can't get it to function. Thanks, --- Regards,Graham Chiu gchiucompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[REBOL] Encouraging functional programming Re:(6)
I've been following this thread on functional vs imperative programming, and it has raised some questions in my mind. For example: >> I just wanted to point out that recursion generally is not a >> benefit at >> all. >The benefit of recursion is economy of expression. In some cases >a recursive solution is clearer and more maintainable than it's >iterative equivalent. >Econonomy of expression, along with portability, is the primary reason we >use high level programming languages. It seems to me that if you want to do something to all the leaves of a tree structure of arbitrary branching and depth that recursion is not only the nice way to do it; but also that an iterative program for doing the same thing would effectively have to do the same thing as the recursive program - namely save the state at the branch points so that it could backtrack. So in that sense there would be no space or time difference for well interpreted or compiled recursive and iterative progs. However, the recursive program would be much easier to read and understand because it would hide the details of saving the state. Am I correct in this? >> It is also no special sign of functional programming >> languages, you >> can do recursion in most imperative languages as well. >Recursion is associated with functional programming in that one >typically implements iterative constructs with recursion in >functional programming languages. Many functional programming >languages allow for iteration without recursion, but recursion >is the typical way of implementing iterative algorithms in >functional programming languages. Functional programming languages have a theoretical advantage in that they can be proved correct by algortithmic (mechanical) procedures. This is because each function's output depends only on it's input and not on the value of any other variables that may have been changed by some other part of the program. Of course such 'pure' functional languages are impractical since one often wants to execute something for it's side effects (like 'print'). So all real languages have some extra-functional commands. Iteration is inconsistent with pure functional programming since, at least within the iterative loop, what happens depends on the value of side variables (e.g. the index). However, as noted, if the recursive call is at the 'tail' then it can always be replaced by an iterative construct. This will be more efficient and does not invalidate any proof of correctness. Brent Meeker
[REBOL] Encouraging functional programming Re:(6)
Jordan, I calculate the Fibonnacci numbers without recursion using REBOL. For example >> fib 100 == 3.54224848179262E+20 >> How would you calculate it with recursion? Jerry
[REBOL] Q on Array of Objects Re:
You wrote: I am considering writing an app that would create several hundred or a few thousand copies of a single object. One way to keep track of them is to use an array. A script that tests this syntax is below along with a run which does a "print mold" on the array. It appears that the functions(methods) in the object are replicated for each instance of the object in the array. Is this true? Is this efficient? I am more used to OO languages like C++ where only the data fields would be replicated and there would be only one copy of the functions for all the instances of the class. Is there a better way to do this? (rest snipped) Actually, the functions are not replicated. Cf: a: func [] [print "done"] b: :a same? :a :b The functions are the same as in the former example. HTH Ladislav
[REBOL] Encouraging functional programming Re:(5)
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Saturday, November 27, 1999 5:57 AM > To: [EMAIL PROTECTED] > Subject: [REBOL] Encouraging functional programming Re:(4) > > > >My understanding was that tail recursion ( or its optimized > implementation ) > >gives a (properly written) recursive program the efficiency of an > >iterative program. > > Yes, because such implementations avoid "real" recursion, > i.e. when they > encounter tail recursive function calls they do not push some kind of > return address on a stack. Of course, such an implementation of tail > recursion is desirable, but it is iteration, in fact. > > I just wanted to point out that recursion generally is not a > benefit at > all. The benefit of recursion is economy of expression. In some cases a recursive solution is clearer and more maintainable than it's iterative equivalent. Econonomy of expression, along with portability, is the primary reason we use high level programming languages. > It is also no special sign of functional programming > languages, you > can do recursion in most imperative languages as well. Recursion is associated with functional programming in that one typically implements iterative constructs with recursion in functional programming languages. Many functional programming languages allow for iteration without recursion, but recursion is the typical way of implementing iterative algorithms in functional programming languages. While you can perform recursion in most imperative languages, you would only resort to recursion in cases where it's clearly the obvious clean solution. In functional languages, you use recursion more often. Many functional programming languages have no iterative construct except recursion. It would be difficult to program in an imperative language with recursion as your only interative construct, it's usually unnatural in functional languages to use anything but recursion for this. Thus, recursion and functional programming are often associated together. > The > good thing about > functional programming languages is merely the fact that symbols are > evaluated regardless wether they're bound to data or to a > function. This > allows high level of data and functional abstraction without having to > extend the core language. > > BTW, with trow and catch it should theoretically be possible > to implement > multitasking. Does anybody know how the "evaluation loop" at > top level of > REBOL works? (not that I want to implement multitasking, > that's far beyond > my capabilities, I'm just curious...) > > Greetings, > > Erich > > > -Jordan Henderson [EMAIL PROTECTED]
[REBOL] Encouraging functional programming Re:(5)
Erich, I timed three methods of filling a block with successive integers from ` 1 to 1000. The times are for 1000 iterations. It would seem that head recursion is rather slow. Jerry, >> time-block/reps [a: array 0 for i 1 1000 1 [insert tail a i]] 1000 0:00:11 >> time-block/reps [a: array 0 for i 1000 1 -1 [insert a i]] 1000 0:00:31 >> time-block/reps [a: array 1000 for i 1 1000 1 [poke a i i]] 1000 0:00:09 >> a == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... >>
[REBOL] cgi Re:
Well ... I have been waiting for a reply to the message below. Has there been a reply and I missed it? I have been trying to use rebol for CGI scripts which is the main reason why I started to use it. People have send CGI examples to me, which work for them but they don't work for me. I have by now tried to run rebol cgi scripts on WIN95 and PWS4, WIN98 and PWS4, Windows NTWS and PWS4, Windows NT Server and even tried it on a SuSe Linux and Apache. But nothing has worked for me so far. A previous message to the list said that rebol cgi did not need any setting up on the server, it only needs to have the rebol.exe in a directory where the scripts are. - Doesn't work for me. I have also seen an example of rebol to be used as follows ...
[REBOL] Encouraging functional programming Re:(4)
>My understanding was that tail recursion ( or its optimized implementation ) >gives a (properly written) recursive program the efficiency of an >iterative program. Yes, because such implementations avoid "real" recursion, i.e. when they encounter tail recursive function calls they do not push some kind of return address on a stack. Of course, such an implementation of tail recursion is desirable, but it is iteration, in fact. I just wanted to point out that recursion generally is not a benefit at all. It is also no special sign of functional programming languages, you can do recursion in most imperative languages as well. The good thing about functional programming languages is merely the fact that symbols are evaluated regardless wether they're bound to data or to a function. This allows high level of data and functional abstraction without having to extend the core language. BTW, with trow and catch it should theoretically be possible to implement multitasking. Does anybody know how the "evaluation loop" at top level of REBOL works? (not that I want to implement multitasking, that's far beyond my capabilities, I'm just curious...) Greetings, Erich