[Grace-core] Library Structures

Andrew P Black black at cs.pdx.edu
Fri May 23 04:59:22 PDT 2014


As I mentioned on the teleconference yesterday, I've just committed a revision of the collections library, that contains objects that implement lists, sets, dictionaries, ranges and iterators (streams of values).  There are also a fair number (120) of tests.  

I'm quite pleased with the structure of map, fold and filter, which operate on iterators as well as on "concrete" collections, and the way that iterators can be reified as concrete collections.

Right now the files are in the gUnit project, because I don't know how to put it in a separate directory and still import gUnit.  Probably all of this code should be moved to the same tree as minigrace, and then there would not be a problem.   Is there any documentation on the changes to import that took place over the NZ summer?

I'm considering splitting the collection module into separate list, range, set, etc modules.   So one would be able to just

	import "list" as aList

	def attendees = aList.with("Andrew", "James", "Oscar")

If I do that, I imagine that we will still want a consolidated collection module, that imports and re-exports the individual kinds of collection.

	import "collections" as coll

	def attendees = coll.aList.with("Andrew", "James", "Oscar")
	def aSet = coll.aSet
	def diceThrows = aSet.with(3, 4, 3, 6, 2, 3, 4)

My question is: what should I call the types?  Should we do something like Modula-3 and write
(in the module list)  

	type T<e> = type {first -> e, addAll(_:Collection<e>) -> T<e> ... }

so that clients can refer to it as aList.T  Or should be say 

	type TListe> = type {first -> e, addAll(_:Collection<e>) -> T<e> ... }

so that clients can refer to it as aList.List?

	Andrew






More information about the Grace-core mailing list