 |
Bay Six Software Beyond the Basics
|
View previous topic :: View next topic |
Author |
Message |
Brent Site Admin
Joined: 01 Jul 2005 Posts: 790
|
Posted: Mar 3rd, 2012, 6:48pm Post subject: Experiment - List of strings |
|
|
This is another thought experiment.
Code: | require stdStreams, stdContainers
list(string) #cities, "New York", "Chicago", "Los Angeles"
#cities add("London", "Paris", "Rome")
#cities: add("Tokyo"): add("Beijing"): add("Moscow")
for each city$ in #cities
#out line(city$)
end for
end |
Code: | Module StdContainers
class list(T) is container(T)
'...
constructor arr() as T
'...
end constructor
method add x() as T
'...
end method
end class |
_________________ Brent |
|
Back to top |
|
 |
STPendl Full Member
Joined: 20 Aug 2007 Posts: 161 Location: Austria
|
Posted: Mar 4th, 2012, 2:29pm Post subject: Re: Experiment - List of strings |
|
|
Yes, linked lists would be very handy.
To be able to create lists of types would enable using lists of custom structures, which makes some things really easy for a user of that language. _________________ Stefan
Any code I post can be freely used, just give credit. |
|
Back to top |
|
 |
|
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|