# Copyright 2003 Chris Hibbert under the terms of the MIT license # found at http://www.opensource.org/licenses/mit-license.html # Chris Hibbert can be reached at copyright@mydruthers.com // upcoming: // def EList := def EList := .asType() /****************************************************************************** Description of an issue in a market. Includes a list of positions on the issue. Provides a representation for subsets of the positions, which allows participants to make assumptions about the values assigned to each position.

******************************************************************************/ def makeIssueDescription(desc :Twine, pos :EList) :any { require(pos.size() > 1, "must be at least two positions in an issue.") def positions := pos.snapshot() def issueDescription { to desc() :Twine { desc } to indexes() :any { positions.asMap().domain() } to cardinality() :int { positions.size() } to contains(pos) :boolean { positions.contains(pos) } to indexOf(issue) :int { positions.lastIndexOf1(issue) } to positions() :EList { positions.snapshot() } to printOn(w :TextWriter) { w.print(`Issue("${desc}"${positions})`) } } } ? def mID := > def rain := mID("Rain Tomorrow", [false, true]) > def sprinkler := mID("Sprinkler On", [false, true]) > def weather := mID("Weather", ["clear", "cloudy", "rain", "snow"])