Re: Basic Euphoria Sequences
- Posted by don cole <doncole at pacbell.net> Feb 10, 2006
- 465 views
Some Slacker wrote: > > don cole wrote: > > I'm not sure what your trying to do but I would think: > > > > </eucode> {{{ > > --Writing: > > seq[1][1]=atom_data > > seq[1][5]=seq_data > > > > --Reading: > > > > for x=1 to 14 do > > if atom(seq[1][x]) then > > treat_as_atom() > > elsif sequence(seq[1][x]) then > > treat_as_sequence() > > end for > > > > --or > > > > for x=1 to 14 do > > if length(seq[1][x])=1 then > > treat_as_atom() > > elsif length(seq[1][x])>1 then > > treat_as_sequence() > > end for > > > > Hope this helps, > > > > Don Cole > > This is somewhat helpful, but I'm still unsure how to best start > this sequence. To be more specific the 14 elements will all be sequences > for things like timestamps, strings, numbers, more strings, more numbers > etc. > > now for some of the strings i need to be able to seperate out the strings > to be a list(for a listview, or a combo box for example) so that some > of the elements of the sequence are single strings or just atoms, or > formatted for time or currency etc. and some of the elements are themselves > their own list of strings... > > if the data could look something like... > > {{{time},{time2},{time3},{time4},{string},{string2},{atom},{atom (formatted > for currency)}, {atom (again currency)}, {string3} etc. }} > > now what if the strings are lists for a combo box, can i just add elements > to each of these strings? > > > {{{time},{time2},{time3},{time4},{{string1},{string1a}},{{string2},{string2a}}, > {atom},{atom (formatted for currency)}, {atom (again currency)}, > {string3} etc. }} > > I hope this makes my problem just a bit clearer, I know I'm unclear, > but I don't know what it is I want, I just know I want it!!! LOL! > > thanks again, > Some (Serious) Slacker Hello Some Slacker, I have similar thing I am doing to keep track of Movie inventory.
rec[1]=movie_num rec[2]-title rec[11]=history rec[11][1]=date rec[11][2]=item--purchased ,sold,rented,traded etc. rec[11]3]=amount --as you can see record 11 could be of any length. A movie could be bought, --sold, bought back again ,rented 3 times and then sold again. A long history.
The best way to keep track of everything is with an index. For my index I use movie number. Maybe you could use something like transaction number. Make that rec[1].
--add a new movie database=append(database,rec) index=append(index,rec[1]) --find a movie a=find(movie_num,index) title=database[a][2]
So on and so forth. There are A lot of database programs in the Archives you could look over. But for your purposes it would be best to construct your own. Starting off with transaction num being rec[1] and building on that. Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.