Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== SRFI-137: Minimal Unique Types This SRFI provides a simple hook to create new data types at run time that are disjoint from all existing types. Subtypes can be created from any existing type created with this library. [[toc:]] == SRFI Description This page includes excerpts from [[https://srfi.schemers.org/srfi-137/srfi-137.html|SRFI 137: Minimal Unique Types]]. For further information on the design and rationale of this library, see the SRFI document. == Specification <procedure>(make-type type-payload) → type-accessor constructor predicate accessor make-subtype</procedure> Calling {{make-type}} on {{type-payload}}, which can be any Scheme object, returns five values, all of which are procedures. They are distinct (in the sense of {{eqv?}}) from each other and from any other procedures returned by other calls to {{make-type}}. In brief, the five functions respectively: * return {{type-payload}} * return newly allocated objects of a disjoint type known as instances, each associated with an instance payload * return {{#t}} iff an object is an instance of this type * return the instance payload * return five more procedures associated with a subtype of this type Details are given for a sample type in the next section. The type payload might contain metadata (such as field names or class variables) associated with the type as a whole. === Sample procedures for a type For the purposes of this section, we will suppose that <enscript highlight="scheme">(define-values (reia-metadata make-reia reia? reia-ref make-reia-subtype) (make-type 'reia))</enscript> has been evaluated, and document each of the five variables that it binds. "Reia" is an acronym for "remarkably 'evil' in appearance", and has no particular significance. Fnord! <procedure>(reia-metadata) → object</procedure> Returns the symbol {{reia}}. <procedure>(make-reia instance-payload)→ reia</procedure> Returns a newly allocated instance associated with instance-payload. This association is single and immutable, but it is possible to make use of an appropriate container payload in order to effectively associate the instance with more than one value. To make the association effectively mutable, use a mutable payload such as a box, list or vector. Instances belong to a type that is disjoint from any existing Scheme type, including types created by other calls to {{make-type}}. <procedure>(reia? object)→ boolean</procedure> Returns {{#t}} iff object was returned by a call to {{make-reia}} or any constructor created as part of a direct or indirect subtype of the {{reia}} type. <procedure>(reia-ref reia) → object</procedure> Returns the instance payload of {{reia}}. It is an error if {{reia}} does not satisfy {{reia?}}. <procedure>(make-reia-subtype type-payload)→ type-accessor constructor predicate accessor make-subtype</procedure> Returns five new procedures with the same semantics as {{make-type}}, such that the objects returned by constructor satisfy {{reia?}} and their payload can be accessed using {{reia-ref}}. == Implementation The implementation of SRFI 137 provided by this egg is built on top of {{define-record-type}}. Thus, instances are records, and all of CHICKEN's [[/records-and-oop|existing record-type sugar]] can be used with SRFI 137 types. == About This Egg === Authors SRFI 137 was written and shepherded by John Cowan. The implementation provided by this egg was created by Marc Nieper-Wißkirchen. Ported to CHICKEN Scheme 5 by Sergey Goldgaber. === Maintainer Wolfgang Corcoran-Mathe Contact: {{<wcm at sigwinch dot xyzzy minus the zy>}} === Repository [[https://github.com/Zipheir/srfi-137|GitHub]] === Version history ; [[https://github.com/diamond-lizard/srfi-137/releases/tag/0.1|0.1]] : Ported to Chicken Scheme 5 ; 0.2 : (2022-01-07) Change maintainer info, port tests to [[test]] egg. === Copyright Copyright (C) John Cowan, Marc Nieper-Wißkirchen (2016). All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 5 from 14?