--- "Sherlock, Ric" <[EMAIL PROTECTED]> wrote:

> > [mailto:[EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> > 
> > This is a good point. It is address under HTTP Parameters in
> >   http://www.jsoftware.com/jwiki/CGI/Design
> > 
> > In other words, the "qparam key" will return the first value, 
> > where as a number of additional accessors will take care of 
> > arrays of grouped parameters: qparamList key - for same 
> > names; qparamPrefix prefix - for cluster of parameters with 
> > the same prefix (good for representing isolated entities on 
> > the same page, like DB records, paging/sorting, etc.)
> 
> Would these definitions work for qparamList & qparamPrefix?
> Not sure if the type coercion makes much sense for qparamPrefix though.
> 
> qparamList=: ''&$: : (4 : 0)
>   if. 0 > i=. (~.qkeys'') ndx_1 boxopen y do. x return. end.
>   (boxopen x) coerce each i{:: CGIKEYS</.CGIVALS
> )
> 
> qparamPrefix=: ''&$: : (4 : 0)
>   prefs=. (#y){. each qkeys''
>   if. 0 > i=. (~.prefs) ndx_1 boxopen y do. x return. end.
>   (boxopen x) coerce each i{:: prefs</.CGIKEYS,.CGIVALS
> )

The meaning of list and prefix can be illustrated so:

   k=. ;:'one two one one three'
   v=. ;:'v11 v22 v12 v13 v33'
   
NB. list returns values of the same key
   v #~ k = <,  'one'
+---+---+---+
|v11|v12|v13|
+---+---+---+
   
NB. prefix returns table of k-v pairs with given k prefix
   (#&k ,. #&v) (-:"1 k {.&>~ #) ,  't'
+-----+---+
|two  |v22|
+-----+---+
|three|v33|
+-----+---+
   (#&k ,. #&v) (-:"1 k {.&>~ #) ,  'o'
+---+---+
|one|v11|
+---+---+
|one|v12|
+---+---+
|one|v13|
+---+---+

> Also according to the API there should be a verb 'qparamKeys'. I'm
> thinking this is the same as 'qkeys' so should there be an entry as
> follows? 
> 
> qparamKeys=: qkeys
> 
> 'qkeys' could be renamed but that would break current implementations
> and qkeys is nice & short for use in other verbs.

qparamKeys is more correct, because qkeys are made when
there was only one collection: (HTTP) keys and params (values).
Now having cookies and headers, etc. it's better to keep them
separate. At this point it would be reasonable to deprecate
and then remove qkeys.



      
____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to