[REBOL] Re: From "C" to Rebol:
From: tim::johnsons-web::com at: 31-Jul-2001 15:50
Okay all: here we go:
On Tue, Jul 31, 2001 at 10:45:39AM -0500, Joel Neely wrote:
> > Now, here's what I propose: If two or three of you "real rebol
> > programmers" would like to participate as mentors:
> > I will provide code that is working rebol code, the mentor(s)
> > will then offer suggestions that will optimize the code,
> > rebol-wise.
> > I would appreciate feedback on this issue:
> I don't claim to be one of the two or three real REBOL
> programmers, but I'd be glad to participate in such a
> series of discussions. My schedule has been a bit chaotic
> lately, so I can't promise immediate turnaround, but would
> be glad to contribute as time permits.
;The function below decodes data read either as a query string
; or from stdin in a form posting
; As you will see: I use 3 variables with cgi-form as an
; intermediate, (as I would do in "C"). Works for me
; but this is an example a function to could use some optimization
; As I said before, I would be happy to create a series of
; before-and-after examples
decode-data: func[/local cgi-form data-string][
if data-string: read-data[
replace/all data-string "+" " "
cgi-form: parse/all data-string "&="
foreach item cgi-form[append pair-list dehex item]
pairs: (length? pair-list) / 2
]; end decode-data
Tim Johnson <[tim--johnsons-web--com]>