[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Coussement Christophe
Hi Gerard, I once use this little trick for handling a variable number of argument: f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b][a]] f 1 2 == 3 f 1 == 1 Please remark that the type of the argument must be explicitely declared, otherwise: f: func [a b][either value?

[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Cyphre
[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 8:12 AM Subject: [REBOL] Re: [Function] with [Variable number of args] Hi Gerard, I once use this little trick for handling a variable number of argument: f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b

[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Robert M. Münch
On Tue, 6 Apr 2004 08:12:01 +0200, Coussement Christophe [EMAIL PROTECTED] wrote: I once use this little trick for handling a variable number of argument: f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b][a]] Hi, clever! This is a very cool trick... I hope I remember it.

[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Volker Nitsch
On Dienstag, 6. April 2004 11:13, Robert M. Münch wrote: On Tue, 6 Apr 2004 08:12:01 +0200, Coussement Christophe [EMAIL PROTECTED] wrote: I once use this little trick for handling a variable number of argument: f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b][a]]

[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Anton Rolls
Of course, one has to be careful that the result of the expression following this magical function does not get eaten up by mistake. In this case, you should wrap in parens. Example (imagine in a script): (f 1) ; now let's do some real work ; lots of comments...

[REBOL] Re: [Function] with [Variable number of args]

2004-04-06 Thread Gerard Cote
Thanks to you all, Christophe, Cyphre, Volker, Anton and indirectly others too for your comments and vision about how to effectively use REBOL for solving the daily challenges we all have as programmers ... Your solutions will be studied diligently since they also showed me other interesting

[REBOL] Re: [Function] with [Variable number of args]

2004-04-05 Thread Ashley Trter
Hi Gerard, Two ways of passing a variable number of arguments [that I know of] are blocks and refinements. Block usage: f: func [v [integer! block!]][...] f 1 f [1 2] or refinements: f: func [v1 [integer!] /var v2 [integer!]][...] f 1 f/var 1

[REBOL] Re: [Function] with [Variable number of args]

2004-04-05 Thread Gerard Cote
Hi Ashley and Maxim, From Ashley: = Two ways of passing a variable number of arguments [that I know of] are blocks and refinements. Block usage: f: func [v [integer! block!]][...] f 1 f [1 2] or refinements: f: func [v1 [integer!] /var v2 [integer!]][...] f 1 f/var 1 2

[REBOL] Re: [Function] with [Variable number of args]

2004-04-05 Thread Maxim Olivier-Adlhoch
I have already seen somebody here redefine the REBOL PRINT for use its own PRINT substitute with extensions instead and when leaving his own context put back the normal PRINT so everything seems normal after. slim includes (as part of its basic toolset) a very advanced print mechanism,

[REBOL] Re: function?

2004-03-22 Thread Gabriele Santilli
Hi Tim, On Monday, March 22, 2004, 7:51:08 PM, you wrote: function? 'forall TJ == false function? :forall == true type? 'forall == word! function? get 'forall == true Regards, Gabriele. -- Gabriele Santilli [EMAIL PROTECTED] -- REBOL Programmer Amiga Group Italia sez. L'Aquila ---

[REBOL] Re: function?

2004-03-22 Thread Maxim Olivier-Adlhoch
I'll add that a word of the form :word is a get-word! datatype. and using your (and my) example, the following form also works if you are in the global namespace (like when you're in the console) function? get 'forall get returns value of the word instead of evaluating it. -MAx

[REBOL] Re: function?

2004-03-22 Thread Maxim Olivier-Adlhoch
function? :forall you must supply a function VALUE for function to return true. if you don't prepend the function name by a colon, then the function is -obviously- evaluated. function? get in system/words 'forall is another way to do it... it even lets you find functions in objects. -MAx

[REBOL] Re: function?

2004-03-22 Thread Tim Johnson
* Maxim Olivier-Adlhoch [EMAIL PROTECTED] [040322 10:41]: I'll add that a word of the form :word is a get-word! datatype. and using your (and my) example, the following form also works if you are in the global namespace (like when you're in the console) Thanks to Max and

[REBOL] Re: function to object?

2003-11-07 Thread Didec
Subject: [REBOL] Re: function to object? -- snip-- A collegue once described to me his moment of enlightenment when a professor had drawn on the blackboard a table showing relationships between some functions and data structures, something like: |Fn0|Fn1|...|Fnx

[REBOL] Re: function to object?

2003-11-05 Thread SunandaDH
Bryan: When suddenly I wondered, can one convert a function to an object in rebol? You can easily *add* a function to an object. a-function: func [a b /local c] [c: a + b print c] a-function 19 21 ;; test it works an-object: make object! [a-function-in-an-object: :a-function]

[REBOL] Re: function to object?

2003-11-05 Thread Volker Nitsch
Am Mittwoch, 5. November 2003 13:53 schrieb bryan: Am reading a little rant against object orientation http://www.bluetail.com/~joe/vol1/v1_oo.html When suddenly I wondered, can one convert a function to an object in rebol? means what? f: func[][alert hi] o: context[f: none] o/f: :f o/f ;?

[REBOL] Re: function to object?

2003-11-05 Thread Joel Neely
Hi, Bryan, bryan wrote: Am reading a little rant against object orientation http://www.bluetail.com/~joe/vol1/v1_oo.html Rant being the operative word. One can tell from the title that this is somebody venting his spleen and not contributing to any objective discussion of programming

[REBOL] Re: function to object?

2003-11-05 Thread Jason Cunliffe
Thanks for that wonderful post -- all of it ! - Jason - Original Message - From: Joel Neely [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 5:26 PM Subject: [REBOL] Re: function to object? -- snip-- A collegue once described to me his moment of enlightenment

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-13 Thread [EMAIL PROTECTED]
WAIT shouldn't be a problem except in VID, as Gabriele pointed out. My little test is very simple, and was based on an FSM engine I built. The engine itself does event dispatching and, on my P900, processes about 10,000 events/sec. There's no need to WAIT for anything. Just do things in

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-13 Thread Christopher Dicely
--- [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I think their special $49 pricing on View/Pro is gone, so it might be $99 now, but still not an outrageous fee if you need those features. --Gregg However... in this mailing-list many people ask to Carl to make free-of-charge some

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-13 Thread Christopher Dicely
--- [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If the two Rebol programs can't communicate directly, have them write to a .TXT file, and the other would look for keywords do do something, write something else to the file, etc,etc. I have tried and used Rebol for about 2 years

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread [EMAIL PROTECTED]
Hi Gregg, how do you think you can implement multitasking (even cooperative, but enough efficient, with an enough fast task-switching) in Rebol Core? Using WAIT instruction? And in View that the documentation suggest NOT TO USE wait command? If the standard Rebol/Core (royalty free version,

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread Gabriele Santilli
Hi Alessandro, On Wednesday, June 12, 2002, 9:13:22 AM, you wrote: rei how do you think you can implement multitasking (even cooperative, but rei enough efficient, with an enough fast task-switching) in Rebol Core? rei Using WAIT instruction? And in View that the documentation suggest NOT rei

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread Petr Krenzelok
[EMAIL PROTECTED] wrote: Hi Gregg, how do you think you can implement multitasking (even cooperative, but enough efficient, with an enough fast task-switching) in Rebol Core? Using WAIT instruction? And in View that the documentation suggest NOT TO USE wait command? If the standard Rebol/Core

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread Maarten Koopmans
And you can get rugby at www.rebolforces.com/~erebol --maarten Gabriele Santilli wrote: Hi Alessandro, On Wednesday, June 12, 2002, 9:13:22 AM, you wrote: rei how do you think you can implement multitasking (even cooperative, but rei enough efficient, with an enough fast

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread [EMAIL PROTECTED]
-pekr- Wrote: Alessandro - you have to be new here, no? :-) Look, rebol base is just one - so - even your View contains sound, shell and library components. They are locked by license key. Ok... and where is the difference for me?! I have two options... 1) View does not contain sound,

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread [EMAIL PROTECTED]
Thank you! --Alessandro-- = Hi Alessandro, On Wednesday, June 12, 2002, 9:13:22 AM, you wrote: rei how do you think you can implement multitasking (even cooperative, but rei enough efficient, with an enough fast task-switching) in

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread Gregg Irwin
Hi Alessandro, 2) View contain sound, shell, etc... but they are locked. I think their special $49 pricing on View/Pro is gone, so it might be $99 now, but still not an outrageous fee if you need those features. --Gregg -- To unsubscribe from this list, please send an email to [EMAIL

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-12 Thread Izkata
If the two Rebol programs can't communicate directly, have them write to a .TXT file, and the other would look for keywords do do something, write something else to the file, etc,etc. I have tried and used Rebol for about 2 years now (at least, it seems like 2 years... I first started using it

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-11 Thread Gabriele Santilli
Hi Mark, On Tuesday, June 11, 2002, 6:30:46 AM, you wrote: MC 1) Agree a lot of the function needed can not be implemented well without MC true multitasking especially a lot of Network programming that need MC multithreads. I'd like to point out, that multithreading would only be needed

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-11 Thread [EMAIL PROTECTED]
Hi Gabriele, I partially agree with you. Multitasking is not needed only to develop server processes, since there could be many occasions where I should need more than one process in parallel at-a-time, even in client applications. I wish to simplify the life of Rebol developers, so I can say I

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-11 Thread Gregg Irwin
Hi Allesandro, I wish to simplify the life of Rebol developers, so I can say I can use every instrument to create multiprocesses: multiprocess (like a FORK), multithread (Ms Windows-style) either preemptive or cooperative (even if the last one is not the best system... however is a good

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread [EMAIL PROTECTED]
Thank you (sigh!). When a Rebol version will include a multiprocessing/multithreading feature?! It is a very important feature in a programming language! True multitasking! Python already does! Java already does! And... how about low level socket programming? Is Rebol an Internet programming

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread Maarten Koopmans
REBOL has low-level socket programming via ports and set-modes --Maarten [EMAIL PROTECTED] wrote: Thank you (sigh!). When a Rebol version will include a multiprocessing/multithreading feature?! It is a very important feature in a programming language! True multitasking! Python already

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread [EMAIL PROTECTED]
Where can I find documentation or infos about it? REBOL has low-level socket programming via ports and set-modes --Maarten [EMAIL PROTECTED] wrote: Thank you (sigh!). When a Rebol version will include a multiprocessing/multithreading feature?! It is a very important feature in a

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread Maarten Koopmans
Network programming: core 2.3 user guide set-modes: Core 2.5 release notes --Maarten [EMAIL PROTECTED] wrote: Where can I find documentation or infos about it? REBOL has low-level socket programming via ports and set-modes --Maarten [EMAIL PROTECTED] wrote: Thank you (sigh!). When a

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread Christopher Dicely
FWIW, my earlier message on this thread represented an incorrect understanding; launch can be used in the console and scripts launched through the console, but not in scripts invoked via the REBOL command line; not sure about using the /View interface. This makes it, as others have noted, less

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-10 Thread Mark Chang
1) Agree a lot of the function needed can not be implemented well without true multitasking especially a lot of Network programming that need multithreads. 2) Low level socket programming is available in Rebol. However, good proper documentation is not available (or I don't know), making

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-07 Thread Gregg Irwin
Hi Allesandro, I was very interested to the function launch (I didn't know it). But I didn't find enought documentation about it. Can someone tell me more about launch refiniments? (this function could be used to simulate a multiprocessing system!). Launch is fairly limited in practice

[REBOL] Re: Function LAUNCH - Usage questions

2002-06-07 Thread Christopher Dicely
--- Gregg Irwin [EMAIL PROTECTED] wrote: Hi Allesandro, I was very interested to the function launch (I didn't know it). But I didn't find enought documentation about it. Can someone tell me more about launch refiniments? (this function could be used to simulate a multiprocessing

[REBOL] Re: Function Keys in a sensor

2002-02-17 Thread philb
Hi, Answering my own message here got the syntax view layout [field Test sensor 0x0 keycode [f1] [print f1 pressed]] Cheers Phil === Original Message === Hi, What is the syntax for testing for function keys f1,f2 etc in a sensor? (I assume it is possible) Cheers Phil -- To

[REBOL] Re: Function Context Query

2001-12-07 Thread Gabriele Santilli
Larry Palmiter wrote: 3) function application time Only after g has been executed, is the word 'a' set to NONE. The local words in the function only get values when the function is applied. If the values are determined by the arguments or refinements, or by the use of SET or a set-word in

[REBOL] Re: Function Context Query

2001-12-06 Thread Romano Paolo Tenca
Hi Mark WHY is setting words in functions to 'none by default useful? When you create the function, all the words (args, refinements, args of refinements) are binded at a new hidden context and the starting value of words in context is the unset value. When you execute the function, all the

[REBOL] Re: Function Context Query

2001-12-06 Thread Ladislav Mecir
Hi Romano, Romano (...) An unset word is a word with the value unset. It is like any other value and any other word. If you use it where a function ask a value, Rebol triggers an error. But Rebol triggers the same error if you pass an argument of type integer! where a function ask for a value of

[REBOL] Re: Function Context Query

2001-12-06 Thread Robbo1Mark
Romano, I understand how and what happens when words which are local to functions are not defined, they are defined to the 'none value when REBOL evalautes the function, however my contention is that REBOL should not do this and leave all local words unset if they are not defined, just as

[REBOL] Re: Function Context Query

2001-12-06 Thread Romano Paolo Tenca
Hi, Marck My preference would be all words are defined as local to their context, including words defined in objects, functions and use contexts. All undefined words are intitialised to the 'unset value and are testable with the value? or unset? get/any 'word functions. Well, a question of

[REBOL] Re: Function Context Query

2001-12-04 Thread Robbo1Mark
Joel Neeely/ everybody, perhaps you misunderstood my previous post, my concern was that uninitialised local words are treated differently between contexts and function-contexts. Please see below, use [my-word] [print unset? get/any 'my-word] true my-func: has [my-word] [print unset? get/any

[REBOL] Re: Function Context Query

2001-12-04 Thread Joel Neely
Hi, Mark, [EMAIL PROTECTED] wrote: Joel Neeely [sic]/ everybody, perhaps you misunderstood my previous post, Perhaps the wording of the previous post was capable of being understood in different ways... my concern was that uninitialised local words are treated differently between

[REBOL] Re: Function Context Query

2001-12-04 Thread Romano Paolo Tenca
Hi Mark, I don't see a reason or logic for the distinction, can anybody please explain why these contexts are treated differently, as from what I can see it is possible to use uninitialised words in function contexts, well they're not actually uninitialised as REBOL sets them to 'none during

[REBOL] Re: Function Context Query

2001-12-04 Thread Robbo1Mark
Hi Romano, surely it would be just as easy to test whether local words or refinements are set, ie with the function Unset? as opposed to none?. Iam not particularly bothered by this now that I know about it, it was just the oddity inexplicable difference about it that initially concerned me.

[REBOL] Re: Function Context Query

2001-12-04 Thread Romano Paolo Tenca
Hi Mark, surely it would be just as easy to test whether local words or refinements are set, ie with the function Unset? as opposed to none?. Mine is only an idea, i'm not sure this is the true reason, but a none value can be used directly in expression like: if ref [...] either ref [][]

[REBOL] Re: Function Context Query

2001-12-04 Thread Larry Palmiter
that value, otherwise they are set to NONE. Cheers -Larry - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 1:21 AM Subject: [REBOL] Re: Function Context Query Joel Neeely/ everybody, perhaps you misunderstood my previous post, my concern

[REBOL] Re: Function Context Query

2001-12-04 Thread Gregg Irwin
Hi Romano, et al Mine is only an idea, i'm not sure this is the true reason, but a none value can be used directly in expression like: if ref [...] either ref [][] An unset value would generate an error in these cases. That's exactly what I was thinking. I have no clue about the inner

[REBOL] Re: Function Context Query

2001-12-03 Thread Romano Paolo Tenca
Hi, Mark Surely this is incorrect? a: has [b c] [ print b print c] a none none a/local 3 4 3 4 Amazing! At least for me! This demostrates that /local is a refinement like any other, only for convention it is used for defining local. One can use another one. The only difference is

[REBOL] Re: Function Context Query

2001-12-03 Thread Joel Neely
Hi, Mark, [EMAIL PROTECTED] wrote: Surely this is incorrect? a: has [b c] [ print b print c] a none none a/local 3 4 3 4 Surely local words default value should be unset until they are defined? Also in the second case is it correct to be able to pass values to local words

[REBOL] Re: Function Context Query

2001-12-03 Thread Romano Paolo Tenca
PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 03, 2001 10:07 PM Subject: [REBOL] Re: Function Context Query Seems pretty clear: source has has: func [ {A shortcut to define a function that has local variables but no arguments.} locals [block!] body [block

[REBOL] Re: Function to decode POST

2001-04-09 Thread GS Jones
From: "Rondon Andrade" Does anybody has a function do decode post ? I've seen just to decode cgi-query-string. Hi, Rondo, I have several approaches that I've used. One of these does not work with older versions of REBOL, but I can't seem to remember which right now. The second example