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

[REBOL] Re: New version of AT

From: massung::gmail::com at: 21-Mar-2006 8:52

Yes they do! :-) Thank you very much. Sometimes little tidbits like this are hard to find in the documentation. But I am always quite surprised at how REBOL usually has a way to do "what I want". Thanks again! Jeff M. On 3/21/06, Karol Go¼liński <kgozlinski-neokartgis.com.pl> wrote:
> > sorry there is lack of link > you can read about New Path Forms in Version 2.5.55 in > http://www.rebol.net/article/0025.html > > Karol > > ----- Original Message ----- > From: "Karol Go¼liński" <kgozlinski-neokartgis.com.pl> > To: <rebolist-rebol.com> > Sent: Tuesday, March 21, 2006 8:36 AM > Subject: [REBOL] Re: New version of AT > > > > > Hi! > > Does New Path Forms in Version 2.5.55 suits your needs? > > In the same way you can access multi-dimentional blocks > > like this : > > > >>> data: [ [7 9] [5 3]] > > == [[7 9] [5 3]] > >>> i: 1 > > == 1 > >>> n: 2 > > == 2 > >>> data/(i)/(n) > > == 9 > >>> data/(i)/(i + 1): 13 > > == 13 > >>> data/:i/:n > > == 13 > >>> data/:i/:i: 19 > > == 19 > >>> data > > == [[19 13] [5 3]] > > > > Karol > > > > > > ----- Original Message ----- > > From: "Jeff Massung" <massung-gmail.com> > > To: <rebolist-rebol.com> > > Sent: Tuesday, March 21, 2006 1:34 AM > > Subject: [REBOL] New version of AT > > > > > >> So, one of the few frustrations I've had with REBOL has been in regards > >> to > >> multi-dimentional array manipulation. I haven't found anything in the > >> REBOL > >> dictionary to do what I want, so I put together a simple utility > function > >> (PEEK, my own version of AT). I thought I'd post it here real quick, > and > >> see > >> if the basic functionality I'm looking for already exists (and if not, > >> why?). > >> > >> The basic idea is to use one function to both access and set values in > >> multi- (or one-) dimensional array. I'm kind of borrowing this from > >> Lisp's > >> (aref ...) and (setf (aref ...) value). The general idea being that you > >> can > >> pass an integer, a pair, or a block of indices and it will traverse the > >> array and finally get or set the value. > >> > >> peek: func [ "Gets/sets the value from a multi-dimensional array." > >> block [ block! ] "Multi-dimensional array" > >> index [ integer! pair! block! ] "Offset(s) into the array" > >> /! value [ any-type! ] "Value to replace index with" > >> ] [ > >> either ! [ > >> switch type?/word index [ > >> integer! [ change at block index value ] > >> pair! [ change at pick block first index second index value > ] > >> block! [ > >> either (length? index) = 1 [ > >> change at block first index value > >> ] [ > >> peek/! pick block first index next index value > >> ] > >> ] > >> ] > >> ] [ > >> switch type?/word index [ > >> integer! [ pick block index ] > >> pair! [ pick pick block first index second index ] > >> block! [ > >> either (length? index) = 1 [ > >> pick block first index > >> ] [ > >> peek pick block first index next index > >> ] > >> ] > >> ] > >> ] > >> ] > >> > >> As I'm still learning REBOL, I'm hoping for some critiques and > >> suggestions. > >> But any hints as to why this functionality isn't there to begin with > (if > >> it > >> isn't that is), would be good too. :-) > >> > >> Thanks! > >> > >> Jeff M. > >> > >> -- > >> massung-gmail.com > >> > >> -- > >> To unsubscribe from the list, just send an email to > >> lists at rebol.com with unsubscribe as the subject. > >> > > > > -- > > To unsubscribe from the list, just send an email to > > lists at rebol.com with unsubscribe as the subject. > > > > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. >
-- massung-gmail.com