Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: [] Recent changes

From: lmecir:mbox:vol:cz at: 30-Nov-2005 7:09

Tim Johnson napsal(a):
>* Ladislav Mecir <> [051128 19:57]: > >>>[REBOL] [] Recent changes >>> >>>This is an automatic email from, the REBOL Script Library to notify you of recent changes to the Library. >>> >>>=======changes== >>>case.r >>>--change: new script >>>--title: CASE multiple conditional function >>>--owners: cmdicely >>>--author: Christopher M. Dicely >>>--purpose: Provide a generalized multiple conditional function for situations that would otherwise call for >>>deeply nested EITHER blocks. CASE is more general than SWITCH because the conditions can be any >>>DO-able block rather than being based on a single value. This [...] >>>--url: >>> >>> >>> >>> >>> >>CASE is already present in the official REBOL, BTW, and my >>implementation, (known as PIF), which was around for quite some time is >>pretty compatible with it not using blocks as conditions as in the above >>implementation. (I am still using it renamed to CASE for backwards >>compatibility in older interpreter versions. >> >> > > Hmm! I have (for linux) and there is no native or mezzanine > 'case that I can find. > > I've been using Marco's 'case for some time now. > tim >
My version is around since 2000 I think, and was published on this ML. Here it is renamed to CASE: unless value? 'case [ case: func [ [throw catch] args [block!] /local res ] [ either unset? first res: do/next args [ if not empty? args [ ; invalid guard throw make error! [script no-arg case condition] ] ] [ either first res [ either block? first res: do/next second res [ do first res ] [ ; not a block throw make error! [ script expect-arg case block [block!] ] ] ] [ case second do/next second res ] ] ] ] -L