1. For Rob: Range object?
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 25, 2000
- 403 views
Rob: This has been mentioned in the past, but I am running into a lot of places where I could use: object x x = [2..5] puts(s,x} Since an object can hold "anything else", it would be nice if we could use it to hold ranges, or better, multiple ranges, such as x = [3..5, 7, 9..11] As an actual example, I have a sequence (Customers) made up of: {customer#, name, street, city/state/zip, current, 30days, 60days, 90days, phone, and so on for 15 or 20 more fields.....} It would be nice to declare MAILING_ADDRESS = [2.4] or ACCOUNT_STATUS = {2, 5..8} In conjunction with an ability to do "vertical" slicing, this could become really powerful: Contact_list = Customers ||2, 9|| -- returns a sequence containing name, phone# pairs from the entire Customer list. If we could also pass vertical slices to functions such as printf(), which would then treat them as if they were in a "foreach" ... "do" loop, then, well, you get the picture. Regards, Irv
2. Re: For Rob: Range object?
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Jan 25, 2000
- 408 views
Hello all, Irv Mullins <irv at ELLIJAY.COM> wrote: >Rob: > >This has been mentioned in the past, but I am running into a lot of places >where I could use: > >object x >x = [2..5] > >puts(s,x} I like this idea. However, why couldn't ranges be stored in sequences? sequence x x = {1,2,3,4,5,6,7,8,9,10,11} object e e = 2 ? x [e] -- this works already; output: 2 e = {2,4} ? x [e] -- this would be new; output: {2,3,4} >Since an object can hold "anything else", it would be nice if we could use >it to hold ranges, or better, multiple ranges, such as x = [3..5, 7, 9..11] e = {{3,5},7,{9,11}} ? x [e[3]] -- output: {9,10,11} Lewis Townsend ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
3. Re: For Rob: Range object?
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 25, 2000
- 386 views
On Tue, 25 Jan 2000, you wrote: > Hello all, > > Irv Mullins <irv at ELLIJAY.COM> wrote: > > >Rob: > > > >This has been mentioned in the past, but I am running into a lot of places > >where I could use: > > > >object x > >x = [2..5] > > > >puts(s,x} > > I like this idea. However, why couldn't ranges be stored in > sequences? > > sequence x x = {1,2,3,4,5,6,7,8,9,10,11} > object e e = 2 > ? x [e] -- this works already; output: 2 > e = {2,4} > ? x [e] -- this would be new; output: {2,3,4} They can. I've written functions to return slices denoted by sequences already.. To return x[2..4], I can define e = {2,4} and call the function as follows: ? slice(x,e) This returns {2,3,4} > >Since an object can hold "anything else", it would be nice if we could use > >it to hold ranges, or better, multiple ranges, such as x = [3..5,7, 9..11] > > e = {{3,5},7,{9,11}} > ? x [e[3]] -- output: {9,10,11} Err - not really. The items I wanted from x were 3 thru 5, then 7, then 9 thru 11, which would be the sequence {3,4,5,7,9,10,11} If I try the example above as ? x[e], I get a "subscript must be an atom" error. Of course, I could use my own function to return the items, as follows: a = {3,5} b = 7 c = {9,11} s = slice(x[a]) & x[b] & slice(x[c]) ? s but this is somehow lacking elegance, and if later I decide b should = {7,8}, my code above which assembles the slices must also be changed wherever it appears. In a program of 12 - 15,000 lines, this gets tedious. The whole idea behind this is to lose numeric indexing and be able to slice and dice sequences by name: i.e. MAIL_ADDR = Customer[NAME..ZIP] or PHONE_LIST = Customer[NAME,PHONE,PAST_DUE90] Note that the first example is now possible, if the data is contiguous, while the second is not. I can't see any reason why it wouldn't work, and it is certainly clearer than PHONE_LIST = slice(Customer,NAME) & slice(Customer,PHONE) & Customer[PAST_DUE90] especially when used in a printf() Irv
4. Re: For Rob: Range object?
- Posted by Robert Craig <rds at ATTCANADA.NET> Jan 25, 2000
- 400 views
- Last edited Jan 26, 2000
Irv Mullins writes: [suggestions about ranges and vertical slicing] Thanks for the suggestions. I'll add them to my list. (but don't hold your breath ) Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
5. Re: For Rob: Range object?
- Posted by Everett Williams <rett at GVTC.COM> Jan 28, 2000
- 441 views
>PHONE_LIST = slice(Customer,NAME) & slice(Customer,PHONE) & >Customer[PAST_DUE90] >especially when used in a printf() > >Irv If we're asking for things, you seem to have crossed the line between namespace and structures(as will and should happen). To wit, why not the following: PHONE_LIST = Customer.NAME & Customer.PHONE & Customer.PAST_DUE90 Where Customer is a structure previously defined. The construct with Customer[NAME..ZIP] appears to be chancy at best with the noted dependency on contiguity. If one was selecting for fields for an address label and only one address field was to be printed and later on, somebody came back and added ADDR2 to the fields and put it where one would expect right after ADDR1, the label printing code would choke. Far better to use your second method and specifically select required fields. Everett L.(Rett) Williams rett at gvtc.com