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

[REBOL] Re: New Type of Variable

From: joel::neely::fedex::com at: 20-Apr-2002 8:31

Hi, Philippe, How does your desired feature differ from the existing STRING! (and more generally, SERIES!) capabilities? Philippe Oehler wrote:
> Hi! > > I want to know if someone has an idea how to add some datatypes. > > I like the idea of having for the pair datatype the /path 1 and 2 > to extract the first and second part of the pair, besides the X. > Same thing for time datatype, with /minute and hour refinement. > Is it possible to make it the same easily for other "string". > > I.e. it should be interesting of having a x-number of part of a > string separated by a > symbol : 34,45,34,67,45,56 > This "datatype" would be access like that : > thestring/6 and the result will 45.. > And the modification will be easy, too thestring/6: 23 >
Copied directly from my console transcript:
>> foo: "bletch"
== "bletch"
>> foo/3
== #"e"
>> foo/3: #"o"
== "blotch"
> The long introduction to say that I often use the parse and the > join function to parse a string and then to rejoin only to change > some of its componants.. > If someone has a easy and reliable method to "add datatype" or > something like that.. >
Can you provide an example of a problem of the sort you're thinking about? Perhaps there are nice solutions already. I certainly have had the experience of working out a "brute force" solution for some small task, only to discover later that REBOL already has some nice tool in its toolkit that handles the case nicely! (Of course, that is not *always* the case, but it's worth rummaging around... ;-) -jn- -- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]