From: Ron Jeffries Date: 2002-03-04T09:17:12+09:00 Subject: Re: string to array and back On Sun, 03 Mar 2002 20:44:08 GMT, Dave Thomas wrote: >Ron Jeffries writes: > >> There must be a good, simple way to do what I'm up to. But I don't >> see it yet. > >Possibly if you explained what you wanted to do with the bytes, there >may be a more direct way from here to there. > >Otherwise, if all you want to do is iterate, there's each_byte. I'll try. It's part of the set theory thing I'm working on, and part of my problem is that I'm not clear enough on what I want, and not clear enough on how to get the strings and arrays to act the same, and not clear enough on why I'm confused. So I'm just tugging on threads thinking that after I clear some of them the rest may be easy. Let's see if I can sort of explain. In this program I'm working on, Sets are like classical sets, except that each element has a "scope", an associated value that is not unlike a field name, generalized to have mathematical meaning. I'm working on the theoretical operation that would convert a plain string like 'MIjeffries' into a "record" (I use the term informally) that would look like { 'MI'[state], 'jeffries'[name] } where the { } are set brackets, not hash brackets, and [foo] means that the scope (field name?) is foo. This is wanting to take place in two steps, for theoretical and atomic operation reasons, the first step being to convert to { 'MI'[0], 'jeffries'[1] } The scopes here are actual integers. The scopes above are strings. To do this operation, I need to connect the original set with a "control" set that will look like { {0,1}[0], { 2,3,4,5,6,7,8,9}[1] } So my deal is that in one and the same context, I've got some sets that look like string information and some that look like collections of numbers, and they need to inter-operate. I can probably either write my own iterator or wrap them in something to get what I want. So I bet that's helpful, right? ;-> Mostly looking for something easy to chip away at the problem until I see what I really want. Thanks, Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com I'm giving the best advice I have. You get to decide whether it's true for you.