[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
On 17-Oct-03, Andrew Martin wrote: Earlier I wrote: X[2] == b It looks like I'm solving problems which not yet exist. But it got me thinking anyway, so would this be useful... blk: [a b c d e] == [a b c d e] blk/[1 4 5] == [a d e] ? -- Carl Read -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
A bit of history... aha.. Thank you for filling me in one corner of a decidedly odd mystery - to wit: If Rebol is so cool [we know it is] then why its authors [RT] don't demo and present that better? Why is there is no About this site which makes it clear that Rebol is tangibly useful for web sites? Meanwhile, do you have any insights about how to create a Rebol web server suitable for running Vanilla? What's been attempted, incentives, obstacles, pros/cons, recommendations ?? thanks for any thoughts on this - Jason -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
If Rebol is so cool [we know it is] then why its authors [RT] don't demo and present that better? Why is there is no About this site which makes it clear that Rebol is tangibly useful for web sites? My apologies - that just sounds much more cranky than intended. Glad to see there are a few improvements at rebol.com. I realize that in most respects Rebol is aimed at implementing a post-web browser vision. But we aint there yet and web servers and web sites are still pretty damn useful. Anyone know how much traffic AltME can handle? Is it 100% Rebol? - Jason -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
Jason: Search would seem to tbe one of the things Rebol excels at. So I assumed wrongly [again] that rebol.com would try and seriously demonstrate that. The search on rebol.com is pretty basic and could do with some work as both you and Bo suggest. REBOL _is_ good at website searches, as the tool built by Gregg and Volker from some initial code from Carl on REBOL.ORG shows. Try these searches at REBOL.org (type into the Find scripts box) ;; any script with the word parse anywhere: parse ;; any script with parse in its title: parse in title ;; find small scripts: size = 1000 ;; find very recent scripts: date 01-oct-2003 It can't do boolean combinations of search parameters yet, so you can't find all of Gregg's recent additions... date 01-sep-2003 and gregg in author ;; doesn't work but it should give you some idea of what is possible in REBOL for building a website search function. Online help page with more examples at: http://www.rebol.org/cgi-bin/cgiwrap/rebol/boiler.r?display=introduction.html Sunanda. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
Carl Read wrote: Earlier I wrote: X[2] == b It looks like I'm solving problems which not yet exist. But it got me thinking anyway, so would this be useful... blk: [a b c d e] == [a b c d e] blk/[1 4 5] == [a d e] blk: [a b c d e] == [a b c d e] picks blk [1 4 5] == [a d e] :) Andrew J Martin Grail Jedi ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
Sunanda REBOL _is_ good at website searches, as the tool built by Gregg and Volker from some initial code from Carl on REBOL.ORG shows. ooh cool :-) Thanks for the heads-up. As you see, I've been away from Rebol for a while. Very nice to see this site now-- well done! Can you describe the site design and contents formatting in more detail please What do the actual entries look like? thanks - Jason -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: dbase files under rebol ???
Gregg Irwin wrote: Hi Petr, PK I think it is possible, but I would not use such solution. I actually think it would be great to have a free REBOL dBase module, and I don't think it would be that hard (especially since Franois and Gabriele have given us starting points). Yes, there are some variations to account for, but handling 95% of the cases shouldn't be too much. well, it always starts the easy way and complicates later. All I wanted to say is - that any such stuff without support for indexing, updating databases, sharing/locking, is not practically of much use. And once you decide to reimplement CA-Clipper of FoxPro in Rebol not even having open/skip working, let me know, it will be at least interesting to watch :-) Just kidding - not trying to distract from any such activity ... cheers, -pekr- I have a folder set aside for doing it, but it hasn't made it to the top of my list. :) -- Gregg -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
Try these searches at REBOL.org (type into the Find scripts box) Please can you point me to the actual search script which is running on the site? thanks - Jason -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
On 17-Oct-03, A J Martin wrote: Carl Read wrote: Earlier I wrote: X[2] == b It looks like I'm solving problems which not yet exist. But it got me thinking anyway, so would this be useful... blk: [a b c d e] == [a b c d e] blk/[1 4 5] == [a d e] blk: [a b c d e] == [a b c d e] picks blk [1 4 5] == [a d e] :) ? picks No information on picks (word has no value) ? (Tried in View up to 1.2.10) -- Carl Read -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] reduce/deep
Hi, I have been triggered by Robert and Cyphre to think about reduce/deep. I think I can do this by recursively traversing a block and its subblocks and reducing them on the mezzanine level. Anybody interested and having feature requests for this? --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] nargs
Here is a nargs function that also counts the optional arguments if you use refinements (e.g. nargs copy == 1 nargs copy/part == 2). Enjoy it. --- nargs: func [ {Returns the total number of args of a function (with and without refinements)} f [word! lit-path!] /local argc f-blk f-ref f-sig ref-pos next-ref-pos ] [ ;The total number or arguments argc: 0 ;We either have a path or a function ;If we have a path, we count the number ;of arguments of the supplied refinements first. either path? f [ ;Translate the path to a block f-blk: to-block f ;Is it a function? if not any-function? get/any first f-blk [throw make error! Rugby error: invocation not on a function] bind f-blk 'do ;The refinements used f-ref: next head f-blk ;the function signature f-sig: first get first f-blk ;Now get the number of arguments foreach refinement ;and add them to argc repeat ref f-ref [ ;Find the ref refinement ref-pos: find/tail f-sig to-refinement ref ;If succeed in the find if not none? ref-pos [ ;try to find the next one next-ref-pos: find ref-pos refinement! if not none? next-ref-pos [ argc: argc + ((index? next-ref-pos) - (index? ref-pos)) ];if not none next-ref-pos ];if not none? ref-pos ];foreach ref f-ref ];either path? f first clause [ if not any-function? get/any f [ throw make error! Rugby error: invocation not on a function ] f-sig: first get f ];either path? f second clause ;Add the number of function arguments argc: argc + -1 + index? any [ find f-sig refinement! tail f-sig ] ];nargs -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
Jason, ooh cool :-) Thanks for the heads-up. As you see, I've been away from Rebol for a while. Very nice to see this site now-- well done! Glad you like it. Thanks! Can you describe the site design and contents formatting in more detail please Take a look at this script in the Library http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=cookie-example .r It uses many routines lifted direct from the REBOL.org CGIs, and demonstrates some of techniques we use -- techniques that could be common to almost any website built in REBOL: -- HTML templates with place-holders for variable substitution (RSP does it better; if I was starting the site over again, I'd be tempted to use RSP) -- Making an object out of the CGI input fields -- Defusing CGI input fields to prevent XSS attacks, or just weird output formatting -- Validating CGI input fields -- Setting a cookie for session control -- Using the cookie to retrieve user data --Wrapping all the code in an error? try so you get an apology message rather than a server error if the code goes off-rail. Please can you point me to the actual search script which is running on the site? What do the actual entries look like? The indexing and searching code isn't mine, so I'll have to pass on the request to publish it -- it's Carl's code with a lot of changes by Gregg. But I can give you a peek at the files it uses. The indexing builds two files. The first is mainly the scripts' header information and looks like this: === [file %3kbnewsreader.r size 4605 title 3KB News Reader author Ryan C. Christiansen date 30-Aug-2003 version 0.1.1 purpose Simple CLI news reader. library [level 'intermediate platform none type 'Tool domain 'other-net tested-under none support none license none]] [file %accumulate.r size 1098 title Accumulate author Andrew Martin date 30-Aug-2003 version 1.0.1 purpose {Cumulates values in a block together, by successively applying the function to each value in Series.} library [level 'intermediate platform none type 'function domain 'math tested-under none support none license none]] [file %add-link.r size 2295 title Link Maintainer author Anonymous date 30-Aug-2003 version 1.0.0 purpose Cgi for maintaining links to REBOL materials library [level 'advanced platform none type 'Tool domain 'cgi tested-under none support none license none]] etc And the second is an index of all words found, and looks like this: = exponent 312 exponential 125 export 15 72 122 182 183 262 expose 359 361 362 363 expose-list 362 Exposed 359 362 = Where the numbers are indexes to script names. So six scripts contain the word export. This scheme works well with around 500 scripts of total size nearly 2MB. Gregg is working on some improvements so we keep ahead of the curve as the dataset grows. Sunanda. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
Carl Read wrote: ? picks No information on picks (word has no value) Hmmm, seems to work OK for me: :-) source picks picks: func [ [catch throw] {Returns the values at the specified positions in the series.} Series [series! pair! event! money! date! time! object! port! tuple! any-function!] Indexes [block!] ][ foreach Index Indexes collect/full/only [ if not number? Index [ throw make error! reduce ['script 'expect-arg 'Picks 'Indexes mold [any number!]] ] pick Series Index ] ] Of course, you'll need the source for 'collect as well: source collect collect: func [ Collects the results of block evaluations. Block [block!] The block to 'do. /Only Inserts the result as a series. /Full Don't ignore none! values. /Initial Type [series! datatype!] Specifies the type of the result. ][ use [Break Result Results] [ Break: func [ Breaks out of the 'Collect. /Return Forces the loop function to return a Value. Value [any-type!] ] [ system/words/break/return either Return [ Value ] [ Results ] ] Results: any [ all [ datatype? Type make Type 0 ] Type copy [] ] compose/deep [ if not any [ unset? set/any 'Result do [(bind Block 'Break)] (pick [[none? :Result] []] not Full) ] [ (pick [insert insert/only] not Only) tail Results :Result Results ] Results ] ] ] Enjoy! Andrew J Martin Grail Jedi ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: reduce/deep
Maarten wrote: I think I can do this by recursively traversing a block and its subblocks and reducing them on the mezzanine level. Anybody interested and having feature requests for this? I'm assuming that this would work on tree structured blocks, not blocks that are are recursively 'insert-ed into each other? Andrew J Martin Grail Jedi ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: nargs
Maarten wrote: Here is a nargs function that also counts the optional arguments if you use refinements (e.g. nargs copy == 1 nargs copy/part == 2). [Snip large chunk of code.] Ouch! That's a large amount of code. Isn't this easier? length? Arguments :copy == 1 source Arguments Arguments: func [ {Returns the arguments of the function as a block of word! values.} F [any-function!] The Function ][ head clear any [ find first :F refinement! tail first :F ] ] And if one needs the length of a path: length? 'copy/part == 2 Or perhaps I've misunderstood something? Andrew J Martin Grail Jedi ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
The indexing and searching code isn't mine, so I'll have to pass on the request to publish it -- it's Carl's code with a lot of changes by Gregg. But I can give you a peek at the files it uses. The indexing builds two files. The first is mainly the scripts' header information and looks like this: ---8-snip--- Thanks very much :-) Jason -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: nargs
Hi Maarten, Not sure if this is better/complete solution version but I just hacked for fun simmilar function with the same functionality and it also proper counts the /local words ;-) example: nargs 'copy == 1 nargs 'copy/deep == 0 nargs 'copy/part == 1 nargs 'copy/local == 0 start of code-- nargs: func [f [word! path!] /local loc? ref? args refs fn rf][ fn: either word? f [ get f ][ rf: to-refinement first next to-block f get first f ] args: copy [] refs: copy [] parse third :fn [ any [ set w word! ( either ref? [ insert tail last refs w ][ insert tail args w ] ) | m: refinement! ( ref?: true insert tail refs reduce [m/1 copy []] ) | skip ] to end ] return either rf [ length? any reduce [select refs rf []] ][ length? args ] ] ---end of code enjoy it, Cyphre - Original Message - From: Maarten Koopmans [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 17, 2003 11:53 AM Subject: [REBOL] nargs Here is a nargs function that also counts the optional arguments if you use refinements (e.g. nargs copy == 1 nargs copy/part == 2). Enjoy it. --- nargs: func [ {Returns the total number of args of a function (with and without refinements)} f [word! lit-path!] /local argc f-blk f-ref f-sig ref-pos next-ref-pos ] [ ;The total number or arguments argc: 0 ;We either have a path or a function ;If we have a path, we count the number ;of arguments of the supplied refinements first. either path? f [ ;Translate the path to a block f-blk: to-block f ;Is it a function? if not any-function? get/any first f-blk [throw make error! Rugby error: invocation not on a function] bind f-blk 'do ;The refinements used f-ref: next head f-blk ;the function signature f-sig: first get first f-blk ;Now get the number of arguments foreach refinement ;and add them to argc repeat ref f-ref [ ;Find the ref refinement ref-pos: find/tail f-sig to-refinement ref ;If succeed in the find if not none? ref-pos [ ;try to find the next one next-ref-pos: find ref-pos refinement! if not none? next-ref-pos [ argc: argc + ((index? next-ref-pos) - (index? ref-pos)) ];if not none next-ref-pos ];if not none? ref-pos ];foreach ref f-ref ];either path? f first clause [ if not any-function? get/any f [ throw make error! Rugby error: invocation not on a function ] f-sig: first get f ];either path? f second clause ;Add the number of function arguments argc: argc + -1 + index? any [ find f-sig refinement! tail f-sig ] ];nargs -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: nargs
Nargs returns the actual number of arguments depending upon your invocation: e.g. nargs 'open/lines or nargs 'open/lines/binary etc. with object detection. As you can see it is a Rugby excerpt. --Maarten -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A J Martin Sent: vrijdag 17 oktober 2003 12:41 To: [EMAIL PROTECTED] Subject: [REBOL] Re: nargs Maarten wrote: Here is a nargs function that also counts the optional arguments if you use refinements (e.g. nargs copy == 1 nargs copy/part == 2). [Snip large chunk of code.] Ouch! That's a large amount of code. Isn't this easier? length? Arguments :copy == 1 source Arguments Arguments: func [ {Returns the arguments of the function as a block of word! values.} F [any-function!] The Function ][ head clear any [ find first :F refinement! tail first :F ] ] And if one needs the length of a path: length? 'copy/part == 2 Or perhaps I've misunderstood something? Andrew J Martin Grail Jedi ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Liquid Project : connection with datas...
On Thu, 16 Oct 2003 00:14:18 -0400, Maxim Olivier-Adlhoch [EMAIL PROTECTED] wrote: sorry for the time it took to reply, and then, in the code, before or after building a liquid-vid layout, you use the attach method to attach one valve to another valve's pipe. Hi, maybe a bit off-topic but Max, you should pick other words. Even your words are quite creative, there is no hint for someone with IT background what it's all about. Further I think it makes talking about this stuff unnecessary complicated. To me this all looks like a graph. So we have nodes, links or edges, sources and destenations, handle-functions and that's it. gui: layout [ across styles lvid-style value-sldr: slider 200x20 min 1 max 100 field attach value-sldr 50 ] valve: liquify liquid/valve! [] valve/attach value-sldr/valve ; attach this valve to that slider valve/handle [ print data + 20 ] valve/refill none ; calls an update just on this valve with the pipe's current value. How about such a syntax: gui: layout [ across styles lvid-style sldr: slider 200x20 min 1 max 100 output: field ] edge: link value-sldr/value output/text [ print value + 20 ] IMO much easier to read. Robert -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
On Tue, 14 Oct 2003 19:18:36 -0400, Brian Parkinson [EMAIL PROTECTED] wrote: I want to set up (say) a Rugby server, which will accept client connections and process them. I'd like each connection to be handled in its own thread (let's keep it simple and leave thread pools, resource utilization and the like out of this) as I need each client's response to be in reasonable time (pretend the processing involves I/O or something). I'm kinda astonished that I can't do this in Rebol proper. Unless I'm missing something real obvious, the only way that I can do this is to rely on code that implements a cooperative multitasking queue (a la Rugby) or roll my own (!). Hi, don't bee fooled by all this multi-threading hype. For example, have a look at www.xitami.com and theire LRWP protocol. This is done using a cooperative multi-tasking. Very cool and fast, and it can be coupled with Rebol quite easy. Remember: multi threading won't solve performance problems just because it's multi threaded... -- Robert M. Münch Management IT Freelancer Mobile: +49 (177) 245 2802 http://www.robertmuench.de -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Friday, October 17, 2003, 2:11:47 PM, Robert wrote: On Tue, 14 Oct 2003 19:18:36 -0400, Brian Parkinson [EMAIL PROTECTED] wrote: I want to set up (say) a Rugby server, which will accept client connections and process them. I'd like each connection to be handled in its own thread (let's keep it simple and leave thread pools, resource utilization and the like out of this) as I need each client's response to be in reasonable time (pretend the processing involves I/O or something). I'm kinda astonished that I can't do this in Rebol proper. Unless I'm missing something real obvious, the only way that I can do this is to rely on code that implements a cooperative multitasking queue (a la Rugby) or roll my own (!). Hi, don't bee fooled by all this multi-threading hype. For example, have a look at www.xitami.com and theire LRWP protocol. This is done using a cooperative multi-tasking. Very cool and fast, and it can be coupled with Rebol quite easy. The problem I see w/ coop multi-tasking (and I've implemented two coop mt server frameworks in REBOL) is that it's a viral, an all-or-nothing approach. If I have e.g. disk IO, I've to impl a simple file IO in a coop way, i.e. decompositing it into a state machine w/ small tasks that preferrably don't block. If I've some computing intensive algorithm, once more, I've to state it in a coop way. And I (my very personal opinion based on my experiences with that kind of stuff in REBOL) find that decomposition rather boring and the result quite hard to maintain. Imho, first class continuations would help in this situation, but that's another topic. So, when you control the whole application, it's at least possible to completely adhere to a coop oriented programming approach. Once I want to cleanly integrate with external apps or other libraries, yeah, problems may arise - who guarantees that the library of my choice does not use blocking IO, for example? I'm in no way an expert in the theoretical issues surrounding this topic, nor am I a REBOL guru. So it may well be that I've missed some nifty ways to write something that won't require complete changes in all my coding habits. So - questions, corrections and suggestions are welcome :) -- Best regards, Andreas -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: nargs
nargs 'copy/deep == 0 ?? --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
-Original Message- From: Carl Read [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 2:02 AM To: [EMAIL PROTECTED] Subject: [REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions? On 17-Oct-03, Andrew Martin wrote: Earlier I wrote: X[2] == b It looks like I'm solving problems which not yet exist. But it got me thinking anyway, so would this be useful... blk: [a b c d e] == [a b c d e] blk/[1 4 5] == [a d e] now you're talking it even looks rebolish... add python's list notation which is nice (I must admit, and is missing altogether in rebol). examples (with equivalent rebol line after): series[5:10] - return a series starting at 5 ending at 10 copy/part at series 5 at series 10 series[5]- return element 5 series/5 (I'd rather keep series/5 and add /[5] which returns a block with only the fifth element in it series[:10] - return everything up to element 10 copy/part series at series 10 series[5:] - return everything starting a element 5 at series 5 you can even use negative indexes to reverse the direction... so: series[-5:-10] reverse at series (length? series - 10) at series (length? series - 5) the advantage of the python notation is that it is much more unified. It is also often much shorter and more visual I'm not saying scrap the current system (we needs its versatility and oppeness), just adding some equivalent to the python method in the way Carl just wrote it. We'd all benefit from shorter, often, more redeable scripts. I know we can write a function for it... but that adds a word in the source which really isn't needed if its supported in the base syntax. Only RT can do that. the way carl just describes it, added with added range notation does not break any current rebol syntax I can remember, yet it makes our lives much simpler. What do you all think? -MAx -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Hi Andreas, The problem I see w/ coop multi-tasking (and I've implemented two coop mt server frameworks in REBOL) is that it's a viral, an all-or-nothing approach. If I have e.g. disk IO, I've to impl a simple file IO in a coop way, i.e. decompositing it into a state machine w/ small tasks that preferrably don't block. If I've some computing intensive algorithm, once more, I've to state it in a coop way. And I (my very personal opinion based on my experiences with that kind of stuff in REBOL) find that decomposition rather boring and the result quite hard to maintain. Imho, first class continuations would help in this situation, but that's another topic. So let's do first-class continuations on the mezzanine level, re-implementing reduce as block interpreter that recursively evaluates the values supplied. And then redo 'do ;-) , retrofit load etc. Anybody interested? And when we have done that, why not make'em first class distributed in our full reflexive meta-language? Now that's GRID computing on steroids! I'm in no way an expert in the theoretical issues surrounding this topic, nor am I a REBOL guru. So it may well be that I've missed some nifty ways to write something that won't require complete changes in all my coding habits. So - questions, corrections and suggestions are welcome :) Same here, but if you really want to, you'll learn what you need to know ;-) --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Maarten Koopmans wrote: Hi Andreas, The problem I see w/ coop multi-tasking (and I've implemented two coop mt server frameworks in REBOL) is that it's a viral, an all-or-nothing approach. If I have e.g. disk IO, I've to impl a simple file IO in a coop way, i.e. decompositing it into a state machine w/ small tasks that preferrably don't block. If I've some computing intensive algorithm, once more, I've to state it in a coop way. And I (my very personal opinion based on my experiences with that kind of stuff in REBOL) find that decomposition rather boring and the result quite hard to maintain. Imho, first class continuations would help in this situation, but that's another topic. So let's do first-class continuations on the mezzanine level, re-implementing reduce as block interpreter that recursively evaluates the values supplied. And then redo 'do ;-) , retrofit load etc. Anybody interested? And when we have done that, why not make'em first class distributed in our full reflexive meta-language? Now that's GRID computing on steroids! how fast can it be? Well, anyway - I am not expert on such things, but - if your aproach will prove, why not take them down to native level? And if we follow such thinking, why Rebol 2.0 family took step away from 1.0 model, which supported continuations? I e.g. remember Holger stating that if Rebol would not be done the way it is, something like View would not be easily possible (or would be slow?) ... ... just curious, as R# plans on such thing as continuations IIRC ... -pekr- I'm in no way an expert in the theoretical issues surrounding this topic, nor am I a REBOL guru. So it may well be that I've missed some nifty ways to write something that won't require complete changes in all my coding habits. So - questions, corrections and suggestions are welcome :) Same here, but if you really want to, you'll learn what you need to know ;-) --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: nargs
Ups, posting in hurry brings always bugs ;) Here is the fixed version: example: nargs 'open == 1 nargs 'open/binary == 1 nargs 'open/binary/mode == 2 nargs 'open/binary/mode/with == 3 etc. --start of code nargs: func [f [word! path!] /local rslt loc? ref? args refs fn rf][ fn: either word? f [ get f ][ rf: copy next to-block f get first f ] args: copy [] refs: copy [] parse third :fn [ any [ set w word! ( either ref? [ insert tail last refs w ][ insert tail args w ] ) | m: refinement! ( ref?: true insert tail refs reduce [m/1 copy []] ) | skip ] to end ] return either rf [ rslt: 0 (length? args) + foreach a rf [ rslt: rslt + length? any reduce [select refs to-refinement a []] ] ][ length? args ] ] --end of code-- - Original Message - From: Maarten Koopmans [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 17, 2003 2:41 PM Subject: [REBOL] Re: nargs nargs 'copy/deep == 0 ?? --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Hi Andreas, The problem I see w/ coop multi-tasking (and I've implemented two coop mt server frameworks in REBOL) is that it's a viral, an all-or-nothing approach. If I have e.g. disk IO, I've to impl a simple file IO in a coop way, i.e. decompositing it into a state machine w/ small tasks that preferrably don't block. If I've some computing intensive algorithm, once more, I've to state it in a coop way. And I (my very personal opinion based on my experiences with that kind of stuff in REBOL) find that decomposition rather boring and the result quite hard to maintain. Imho, first class continuations would help in this situation, but that's another topic. I agree at all. Writing cooperative code without continuations is very hard. A dialect can be used to handle particular cases of continuations in Rebol (i should say cooperative continuations). Else the resulting code is a very big FSM, which among the other things, should have a clear idea of time costs of all operations and this is hard to know for a script which should run without any change on every system and with different data input. I'm in no way an expert in the theoretical issues surrounding this topic, nor am I a REBOL guru. So it may well be that I've missed some nifty ways to write something that won't require complete changes in all my coding habits. So - questions, corrections and suggestions are welcome :) I'm not an expert, but surely with do/next can be emulated a preemptive multitasking environment. The result is probably a very slow program. I think that it is not the Rebol language the best level in which multitasking must be handled. I have also seen at least one program which implements what seems a multitasking dispatcher/scheduler. But the code for this stuff is 1) very long 2) hard to read 3) hard to change 4) sometime slow (i think). So some of the best reasons to use Rebol are totally lost with also simple multitasking emulation. The lack of async i/o on files makes more hard to write this kind of scripts. --- Ciao Romano -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: reduce/deep
Hi Andrew, you wrote: I'm assuming that this would work on tree structured blocks, not blocks that are are recursively 'insert-ed into each other? Andrew J Martin Grail Jedi actually, even cyclic (or recursive, whatever you prefer) blocks can be handled as I have proven in http://www.fm.vslib.cz/~ladislav/rebol/identity.html#section-24 , but the usefulness of such structures is questionable. Anyway, if you need such a construct, it is a matter of minutes for me. -L -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Hi, Robert, A couple of thoughts on the other side... Robert M. Münch wrote: Hi, don't bee fooled by all this multi-threading hype. For example, have a look at www.xitami.com and theire LRWP protocol. This is done using a cooperative multi-tasking. Very cool and fast, and it can be coupled with Rebol quite easy. I don't know what you mean by hype, nor what that has to do with speed. I've never thought of parallelism in terms of the speed of a single task, but as a design/expressiveness issue. Remember: it's possible to express *any* computation in terms of only sequence, alternation, and iteration (e.g. block, IF, and WHILE) but few of us choose to restrict ourselves to only those mechanisms. For that matter, most of us would prefer to write (e.g.): foo: func [b [block! n [integer!] ...] [ ... expressions with B and N ... ... final expression with B and N ] ... blort: foo someblock 23 instead of foo-b: foo-n: foo-result: none foo-exprs: [ ... expressions with B and N ... foo-result: ... final expression with B and N ] ... foo-b: someblock foo-n: 23 do foo-exprs blort: foo-result The gain in expressiveness from having functions renders irrelevent the contention that we could find other ways to get the job done without them. There are some problems whose solution can be most naturally expressed in recursive terms. Likewise, there are some problems which can be expressed most clearly as a collection of distinct processes with well-defined collaboration patterns. Consider the popularity of | as a means of structuring computations via the *nix shell. Of course, anything that can be done with | can also be done in a single-threaded program, but then the programmer has to concern herself/himself with implementation/algorithm details that are simply irrelevant at the level of the original problem (e.g. buffering, distinguishing push-driven and pull-driven variations of the same algorithm, etc.) Finally, there are cases in which one of a set of collaborating activities should be allowed to stall for a time without forcing all others to wait. The fact that we can (sometimes!) deconstruct our code in a scheme to allow this to be managed in a single thread only means that we now have to add the issues of that scheme to the things to consider in doing our design, instead of being able to keep our focus on the top problem. I've recently been involved in several (very hard-core practical) projects where parallelism made significant contribution to the simplicity of the solution, overall performance, or both. Remember: multi threading won't solve performance problems just because it's multi threaded... Agreed, but... Remember: single-threading won't solve design problems just because only one thing is happening at a given instant! ;-) -jn- -- -- Joel NeelyjoelDOTneelyATfedexDOTcom 901-263-4446 Counting lines of code is to software development as counting bricks is to urban development. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] continue word
is there any word (I haven't found any) which skips one iteration of a loop at current point. like in: foreach number [ 8 0 2 4 0 5][ if number = 0 [continue] print 100 / number ] TIA! -MAx --- You can either be part of the problem or part of the solution, but in the end, being part of the problem is much more fun. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Cunning use of [], () {} in R# and in future? Rebol versions?
Hi all - This thread reminds me of some of the very nice MATLAB notation for referencing matrix or array elements: A(1:10) - elements 1 thru 10 A(:,5:10) - all rows, only columns 5 thru 10 A(5:10,:) - all columns, only rows 5 thru 10 A(:) - all elements A'- all elements transposed (cols switched with rows) dimension r x c becomes c x r It might be nice to accommodate the two dimensional idea as an enhancement; n-dimensional referencing might be nice too... A REBOL shorthand for block or series referencing in this flavor might be very helpful -- at least I think it would. On the other hand, I've got a long way to go before I appreciate the subtleties of REBOL ... Mike SNIP now you're talking it even looks rebolish... add python's list notation which is nice (I must admit, and is missing altogether in rebol). examples (with equivalent rebol line after): series[5:10] - return a series starting at 5 ending at 10 copy/part at series 5 at series 10 series[5]- return element 5 series/5 (I'd rather keep series/5 and add /[5] which returns a block with only the fifth element in it series[:10] - return everything up to element 10 copy/part series at series 10 series[5:] - return everything starting a element 5 at series 5 you can even use negative indexes to reverse the direction... so: series[-5:-10] reverse at series (length? series - 10) at series (length? series - 5) the advantage of the python notation is that it is much more unified. It is also often much shorter and more visual I'm not saying scrap the current system (we needs its versatility and oppeness), just adding some equivalent to the python method in the way Carl just wrote it. We'd all benefit from shorter, often, more redeable scripts. I know we can write a function for it... but that adds a word in the source which really isn't needed if its supported in the base syntax. Only RT can do that. the way carl just describes it, added with added range notation does not break any current rebol syntax I can remember, yet it makes our lives much simpler. What do you all think? -MAx -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: continue word
Hi Maxim, On Friday, October 17, 2003, 5:10:46 PM, you wrote: MOA is there any word (I haven't found any) which skips one MOA iteration of a loop at current point. Not that I know of. MOA like in: MOA foreach number [ 8 0 2 4 0 5][ MOAif number = 0 [continue] MOAprint 100 / number MOA ] You could use THROW and CATCH to implement CONTINUE... Regards, Gabriele. -- Gabriele Santilli [EMAIL PROTECTED] -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/ -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: reduce/deep
Hi Ladislav, Don't take away my hobby project ;-) I assume you'd traverse the block structure recursively using tail-func with the block and the last position that was evaluated? --Maarten -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ladislav Mecir Sent: vrijdag 17 oktober 2003 16:56 To: [EMAIL PROTECTED] Subject: [REBOL] Re: reduce/deep Hi Andrew, you wrote: I'm assuming that this would work on tree structured blocks, not blocks that are are recursively 'insert-ed into each other? Andrew J Martin Grail Jedi actually, even cyclic (or recursive, whatever you prefer) blocks can be handled as I have proven in http://www.fm.vslib.cz/~ladislav/rebol/identity.html#section-24 , but the usefulness of such structures is questionable. Anyway, if you need such a construct, it is a matter of minutes for me. -L -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] tail recursion, continuations, and other tricks --
Hi List, See below, reposted with permission. If we only can get RT to include Ladislav's or my tail-func... Hi Maarten, This used to be in REBOL (tail recursion, continuations, and other tricks -- using some of the most advanced optimization concepts invented). Problem was, it caused REBOL to use many times more memory, and it was many times slower. We had to take it all out. Continuations are a cool concept in theory. Since I first learned about them in 1984, they have seemed like a useful idea. Problem is, not every useful idea is practical. Continuations often reference a huge context (hence is not allowed to be GC'd), even if your code exited the context long ago. If you think REBOL gobbles memory for contexts now, it was really bad in the continuation days. Tail recursion is another issue. I've implemented it before in other languages (e.g. Amiga Logo) and found that it was a bit tricky. It's one of those things I'd like to put back into REBOL, but there are other, more severe restrictions in recursion that have higher priority. For example, there's a GC protection stack that I think overly limits recursion in the current interpreter. We've actually removed it in an experimental version, but its untested and we worry that it may make REBOL unstable so we've not released it (testing takes so much time compared to coding!) Let me know how it goes. Best regards, -Carl PS: Feel free to repost this message if you want/need to. Hi Carl, I would like to build a REBOL evaluator in REBOL, for fun and learning. In the end I want to see if I can get first class continuations in this toy interpreter. Now REBOL is... amazing when you think about its language model. Is there any hint that you can give me? My idea is to re-implement reduce using my tail recursion elimination trick and the current reduce. And then redo 'do , load etc. softREBOL would be a nice environment for language experiments IMHO. But REBOL is not described in any way that makes this easy to get. --Maarten -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: reduce/deep
Hi Maarten, Don't take away my hobby project ;-) I assume you'd traverse the block structure recursively using tail-func with the block and the last position that was evaluated? --Maarten I am not sure we understand each other. I think, that Andrew meant cyclic blocks like a: [1] insert/only a a I wouldn't use tail-func probably, but you are close. -L -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: dbase files under rebol ???
Hi Petr, PK well, it always starts the easy way and complicates later. All I wanted PK to say is - that any such stuff without support for indexing, updating PK databases, sharing/locking, is not practically of much use. And once you PK decide to reimplement CA-Clipper of FoxPro in Rebol not even having PK open/skip working, let me know, it will be at least interesting to PK watch :-) Yes, certain things complicate matters (SKIP being one of my main deterrents on things like this), but I used to use a dBase engine--under VB1--that was written entirely in pure VB and it worked extremely well, with support for indexes, memos, etc.. Of course, I wasn't going against 50M DBs... :) Without SKIP working properly, it would be a real PAIN just because of how you'd have to make it work. -- Gregg -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: CMS in REBOL?
Hi Jason, JC Please can you point me to the actual search script which is running on the JC site? If you download the REBOL version of the librarian from REBOL.org, it contains all the code you're interested in. The support/librarian-lib.r module contains the search-related code. -- Gregg -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Multithreading with Rebol
Hi Andreas, AB The problem I see w/ coop multi-tasking (and I've implemented two coop AB mt server frameworks in REBOL) is that it's a viral, an all-or-nothing AB approach. I agree. One of the biggest issues--at least for me--was getting over the initial hurdle of realizing that. The other difficulty is that you often won't realize any benefits in simple applications, so it's easier just to do things directly in response to UI events and such. AB If I have e.g. disk IO, I've to impl a simple file IO in a AB coop way, i.e. decompositing it into a state machine w/ small tasks AB that preferrably don't block. If I've some computing intensive AB algorithm, once more, I've to state it in a coop way. For me, it's largely an issue of can I mentally walk through a sequence of events and visualize how the code is going to behave? For me, the cooperative approach, especially combined with FSMs, tends to make things very clear (and it's portable too! :). For pre-emptive threading, it's very hard to be sure that you're code is really correct. i.e. that it will work correctly in all cases. One reason I find it hard, is that you can't duplicate exact timing or interrupt scenarios. With a cooperative system, it's predictable and reproducible. That is, my I/O may block, and cause a delay, but it won't work most of the time and do something potentially *very* bad when it doesn't work--depending on exactly what you're doing of course. AB I'm in no way an expert in the theoretical issues surrounding this AB topic, nor am I a REBOL guru. So it may well be that I've missed some AB nifty ways to write something that won't require complete changes in AB all my coding habits. I'm not an expert on this either. My bias comes--I think--from how effectively I've used each technique without having to become an expert. For me, the FSM-based stuff I've done for this kind of thing *does* require a different mindset, and I don't use it for very simple things (which is most of what we do I'd guess). For more complex things, I really think it helps me. I have a project with a dynamic UI, that can request various types of remote data (project keys, etc. via Rugby) and display incoming MJPG data. At its core is an FSM. These various event sources feed a queue much like a coop system would work. It may not be the best solution, but it's easy to understand, reliable, and performs well. For testing, I can stuff events into the queue; even create entire test scenarios of event sequences. Of course, what works for me may not work for you. :) -- Gregg -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Liquid Project : connection with datas...
Hi Gregg, and all, Gregg Irwin wrote: Hi Robert, RMM Hi, maybe a bit off-topic but Max, you should pick other words. Even your RMM words are quite creative, there is no hint for someone with IT background RMM what it's all about. Further I think it makes talking about this stuff RMM unnecessary complicated. I agree. I know that when I sit down to look at Steel, the first thing I'll have to do is learn what valve means and such. out of the 4 page output of dict valve: From WordNet (r) 2.0 [wn]: valve n 1: a structure in a hollow organ (like the heart) with a flap to insure one-way flow of fluid through it 2: device in a brass wind instrument for varying the length of the air column to alter the pitch of a tone 3: control consisting of a mechanical device for controlling the flow of a fluid I hope that helps ;-) Ingo -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] set jinman@uwf.edu digest
-- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: continue word
Hi Maxim. The example you bring: foreach number [ 8 0 2 4 0 5][ if number = 0 [continue] print 100 / number ] could just as well (better? ;-) ) be written as foreach number [ 8 0 2 4 0 5][ [ if number 0 [ print 100 / number ] ] I wonder if the combination of if, either and any, all enables us to cover any and all relevant cases? Elan Maxim Olivier-Adlhoch wrote: is there any word (I haven't found any) which skips one iteration of a loop at current point. like in: foreach number [ 8 0 2 4 0 5][ if number = 0 [continue] print 100 / number ] TIA! -MAx --- You can either be part of the problem or part of the solution, but in the end, being part of the problem is much more fun. -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Liquid Project : connection with datas...
-Original Message- From: Ingo Hohmann [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 3:01 PM To: [EMAIL PROTECTED] Subject: [REBOL] Re: Liquid Project : connection with datas... Hi Gregg, and all, Gregg Irwin wrote: Hi Robert, From WordNet (r) 2.0 [wn]: valve n 1: a structure in a hollow organ (like the heart) with a flap to insure one-way flow of fluid through it 2: device in a brass wind instrument for varying the length of the air column to alter the pitch of a tone 3: control consisting of a mechanical device for controlling the flow of a fluid LOL, yep, the third is Exactly the meaning DAMN, I should have called it fluid ... not liquid... now I know why everyone is mislead(strangely that was almost the case). thanks for the support Ingo ;-) No, really, liquid stems its name from the term data flow... I wanted to make it have its own language so that once assimilated, when following a discussion or especially writting about the relationship a liquid object (or valve) has with the rest of the code, it is clear. when you say the valve is connected to your object there is absolutely no ambiguity. One is live, the other isn't. It also stems from the fact that in previous versions of liquid.r there was a base object called container. consider the next phrase: filling liquid into a container through a pipe, this makes a lot of sense and deftly resumes exactly what is happening. you can thus continue by if a valve is open, it spills liquid This being the actual event (or action), depending on what is connected to the valve, will either splash data to the user or silently put it in the container (an object's attribute?), for later reference. I'm sorry this means the methods and attributes have their own world but if you think of it, many other programming things have borrowed names from real world items... By looking at the liquid-vid tutorials, http://www.rebol.it/~steel/liquid-vid/tutorials.html Most things about liquid are explained in enough detail, I hope. I have not received one comment on them. either no one went, or those that did, found it clear enough for their understanding (I hope its the later ;-). I understand Robert and Gregg, and I sympathise, but sooo much tought went into it (including other things not yet available) that I feel, its too late. Once you use it a little, you'll see that there isn't alot of words to actually learn and even then, they really are obvious. On top of that, within a liquid-vid block, pretty much only the connect and attach words are needed. I hope that the naming won't keep people from trying it out and understanding the concept. I'm hard at word every other night, hacking away at code that eventually, I hope, you'll all benefit from, much like vanilla, rugby, and make-doc-pro and all the others cool tools. I can't wait for all my tools to be v1.0 but there is s much to do. Right now, I am working on the v1.0 of open-library which allows of us to package our code as shared modules. Much like python has a standard code sharing system. Soo stay tuned, it won't be long before I submit it for all of us to tear at, bitch about, improve, and eventually adopt. have fun! -MAx - Steel project coordinator http://www.rebol.it/~steel - -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: continue word
-Original Message- From: Elan [mailto:[EMAIL PROTECTED] The example you bring: [...] could just as well (better? ;-) ) be written as foreach number [ 8 0 2 4 0 5][ [ if number 0 [ print 100 / number ] ] I was just keeping the example simple ;-) I wonder if the combination of if, either and any, all enables us to cover any and all relevant cases? they usually do... but nests get deep and it sometimes gets messy to edit... its like if the return word did not exist... sometimes its easier just to return a function when we know the rest is pointless... you can often just chain tests one after another... in the end, this is slower, but I rarely am able to notice the difference between .1 and .2 seconds ;-) I just used a temporary variable instead, like: ; success: true if whatever [ success: false ] if unless something else [ success: false ] if success [ do what I need ] ;--- I tried using any and all and in certain situations but in my problem, it became overly complex to maintain, so basically, I guess its a case by case decision on the method... having a continue word would allow me to skip the rest of the code whenever I find something I know is bad, without having to try and build it up in a fancy mutliple level if/either/any/all block. -Maxim -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: Liquid Project : connection with datas...
Max wrote: By looking at the liquid-vid tutorials, http://www.rebol.it/~steel/liquid-vid/tutorials.html Most things about liquid are explained in enough detail, I hope. I have not received one comment on them. either no one went, or those that did, found it clear enough for their understanding (I hope its the later ;-). I downloaded the zip file from: http://www.rebol.it/~steel/downloads/packages.html then I unzipped Steel so that all the files appeared like this: change-dir %/c/Rebol/Steel/ == %/c/Rebol/Steel/ list-dir colorbox.r library_setup.rliquid-vid.r liquid.r open-library.r sheet-metal_old.r steel-console.rsteel-utils.r steel.r Then I added these lines to my %User.r: steel-library-path: [%/C/Rebol/Steel/ %/C/Rebol/Steel/] do %/C/Rebol/Steel/open-library.r That's because I couldn't get %library_setup.r to work properly for me. (It kept making paths to %Steel/Library/ which didn't exist.) Then after running Rebol/View, you need to 'do these lines: liquid-vid: open-library 'liquid-vid 0 stylesheet: liquid-vid/style Then the tutorials at: http://www.rebol.it/~steel/liquid-vid/tutorial-hello.html and: http://www.rebol.it/~steel/liquid-vid/tutorial-slider.html The library part seems very complicated to me. :-/ I don't know what advantage the library system system has over a simple 'do? Steel/Liquid seems really good. Andrew J Martin Steel learning... ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
[REBOL] Re: continue word
Maxim wants foreach number [ 8 0 2 4 0 5][ if number = 0 [CONTINUE] print 100 / number ] which is not available, but foreach number [ 8 0 2 4 0 5][ catch[ if number = 0 [throw 'continue] print 100 / number ] ] does the trick. use catch/name , throw/name if you need to catch other stuff too. -Volker Am Freitag, 17. Oktober 2003 23:31 schrieb Maxim Olivier-Adlhoch: -Original Message- From: Elan [mailto:[EMAIL PROTECTED] The example you bring: [...] could just as well (better? ;-) ) be written as foreach number [ 8 0 2 4 0 5][ [ if number 0 [ print 100 / number ] ] I was just keeping the example simple ;-) I wonder if the combination of if, either and any, all enables us to cover any and all relevant cases? they usually do... but nests get deep and it sometimes gets messy to edit... its like if the return word did not exist... sometimes its easier just to return a function when we know the rest is pointless... you can often just chain tests one after another... in the end, this is slower, but I rarely am able to notice the difference between .1 and .2 seconds ;-) I just used a temporary variable instead, like: ; success: true if whatever [ success: false ] if unless something else [ success: false ] if success [ do what I need ] ;--- I tried using any and all and in certain situations but in my problem, it became overly complex to maintain, so basically, I guess its a case by case decision on the method... having a continue word would allow me to skip the rest of the code whenever I find something I know is bad, without having to try and build it up in a fancy mutliple level if/either/any/all block. -Maxim -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.