Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/srfi-99|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == SRFI-99 [[toc:]] === Author [[/users/thomas chust|Thomas Chust]] === Requirements None === Provided Modules The extension consists of a single library, {{srfi-99}}, that provides a number of public modules. ==== srfi-99 A convenience module that re-exports the bindings from all the other modules so that (require-extension srfi-99) works as expected. ==== srfi-99-records A convenience module that re-exports the bindings from all the other {{srfi-99-records-...}} modules. ==== srfi-99-records-procedural The procedural interface to record type descriptors. <procedure>(make-rtd NAME FIELDS [[#:parent] PARENT #f] [#:uid UID (gensym NAME)] [#:sealed SEALED? #f] [#:opaque OPAQUE? #f] [#:property RTP VALUE] ...)</procedure> Create a new record type descriptor. <procedure>(rtd? V)</procedure> Test whether {{V}} is a record type descriptor. <procedure>(rtd-constructor RTD [FIELDS])</procedure> Obtain a constructor procedure for records of the type described by {{RTD}}, optionally restricting the {{FIELDS}} to be initialized. <procedure>(rtd-predicate RTD)</procedure> Obtain a predicate procedure for records of the type described by {{RTD}}. <procedure>(rtd-accessor RTD NAME)</procedure> Obtain an accessor procedure for the field called {{NAME}} in records of the type described by {{RTD}}. If the field is mutable, the accessor procedure has an attached SRFI-17 setter. <procedure>(rtd-mutator RTD NAME)</procedure> Obtain a mutator procedure for the mutable field called {{NAME}} in records of the type described by {{RTD}}. ==== srfi-99-records-inspection Access to reflective information about records. <procedure>(record? V)</procedure> Test whether {{V}} is some kind of record. <procedure>(record-rtd V)</procedure> Obtain the record type descriptor corresponding to {{V}}'s type or return {{#f}} if {{V}} is not an instance of a transparent record type. <procedure>(rtd-name RTD)</procedure> Determine the descriptive name of a record type. <procedure>(rtd-uid RTD)</procedure> Determine the unique identifier used to tag instances of a record type. <procedure>(rtd-sealed? RTD)</procedure> Test whether a record type is sealed and cannot have subtypes. <procedure>(rtd-opaque? RTD)</procedure> Test whether a record type is opaque and cannot be extracted from instances using {{record-rtd}}. <procedure>(rtd-parent RTD)</procedure> Determine the parent type descriptor of {{RTD}}. <procedure>(rtd-field-names RTD)</procedure> Compute a vector of fields defined directly by {{RTD}}. <procedure>(rtd-all-field-names RTD)</procedure> Compute a vector of fields defined by {{RTD}} or its supertypes. <procedure>(rtd-field-mutable? RTD NAME)</procedure> Test whether the field called {{NAME}} in records of type {{RTD}} is mutable. <procedure>(make-rtp [DEFAULT #f])</procedure> Create a new record property accessor. <procedure>(rtd-properties RTD)</procedure> Compute a list of record properties attached directly to {{RTD}}. <procedure>(rtd-all-properties RTD)</procedure> Compute a list of all record properties attached to {{RTD}} or its supertypes. ==== srfi-99-records-syntactic Syntactic sugar to facilitate the definition of record types. <syntax>(define-record-type (RTD OPTION ...) CONSTRUCTOR PREDICATE FIELD ...)</syntax> <syntax>(define-record-type RTD CONSTRUCTOR PREDICATE FIELD ...)</syntax> Defines a new record type {{RTD}}, optionally passing a set of {{OPTION}}s to {{make-rtd}}. The record has fields described by the given {{FIELD}} specifications. If {{CONSTRUCTOR}} is not {{#f}}, a constructor procedure for the new record type is defined using {{define-record-constructor}}, if {{PREDICATE}} is not {{#f}} a predicate procedure for the new record type is defined using {{define-record-predicate}}. Accessors and mutators for the record type's fields are defined using {{define-record-field}}. <syntax>(define-record-constructor RTD (NAME FIELD ...))</syntax> <syntax>(define-record-constructor RTD NAME)</syntax> <syntax>(define-record-constructor RTD #t)</syntax> Defines {{NAME}} as a constructor procedure for instances of {{RTD}}, optionally restricting the set of initialized {{FIELD}}s. If the only argument is {{#t}}, the name is formed by prepending {{make-}} to {{RTD}}. <syntax>(define-record-predicate RTD NAME)</syntax> <syntax>(define-record-predicate RTD #t)</syntax> Defines {{NAME}} as a predicate procedure for instances of {{RTD}}. If the only argument is {{#t}}, the name is formed by appending {{?}} to {{RTD}}. <syntax>(define-record-field RTD (NAME ACCESSOR MUTATOR))</syntax> <syntax>(define-record-field RTD (NAME))</syntax> <syntax>(define-record-field RTD (NAME ACCESSOR))</syntax> <syntax>(define-record-field RTD NAME)</syntax> Defines accessor and possibly mutator procedures for the field {{NAME}} in instances of {{RTD}}. If the accessor name is not specified (in the second or fourth form), it is formed by appending {{RTD}}, {{-}} and {{NAME}}. If the mutator name is not specified (in the second form), it is formed by appending {{RTD}}, {{-}}, {{NAME}} and {{-set!}}. <syntax>(define-record-property RTP [DEFAULT])</syntax> Defines a new record property accessor {{RTP}}, optionally passing a {{DEFAULT}} to {{make-rtp}}. <syntax>(define-record-printer (RTD . ARGS) . BODY)</syntax> <syntax>(define-record-printer RTD EXPR)</syntax> Defines a record printer for direct instances of {{RTD}}. In contrast to the built-in form of this macro provided by the CHICKEN standard library, {{RTD}} is interpreted as an identifier bound to a record type descriptor, not as the unique identifier used to tag instances of the record type. ==== srfi-99-variants Syntactic sugar to facilitate the definition of variant types. <syntax>(define-variant-type (RTD OPTION ...) PREDICATE (VARIANT FIELD ...) ...)</syntax> <syntax>(define-variant-type RTD PREDICATE (VARIANT FIELD ...) ...)</syntax> Defines a new record type {{RTD}}, optionally passing a set of {{OPTION}}s to {{make-rtd}}. The record has no fields. If {{PREDICATE}} is not {{#f}} a predicate procedure for the new record type is defined using {{define-record-predicate}}. Variant subtypes of {{RTD}} are defined using {{define-variant-constructor}} for each {{VARIANT}} clause. <syntax>(define-variant-constructor RTD (VARIANT FIELD ...))</syntax> Defines a constructor for a new variant subtype of {{RTD}}. The subtype has the given immutable {{FIELD}}s and the constructor initializes all fields of the record. The variant subtype is sealed and it is opaque iff {{RTD}} is opaque. The UID of the subtype is formed by appending the UID of {{RTD}}, {{-}} and {{VARIANT}}. The record type descriptor of the variant subtype is attached to the constructor {{VARIANT}} as extended procedure data. <syntax>(variant-case RTD V ((VARIANT FIELD ...) . BODY) [(else . BODY)])</syntax> The form first ensures that {{V}} is indeed an instance of {{RTD}}, raising a type error otherwise. Each {{VARIANT}} designates a variant subtype constructor, each {{FIELD}} is an identifier to be bound to the corresponding, identically named field of the variant instance. If any of the variant clauses matches the type of {{V}}, the corresponding {{BODY}} is evaluated and the result is returned from the variant-case form. If none of the variant clauses match the type of {{V}}, the else clause's {{BODY}} is evaluated instead. If no else clause is present either, an error is raised indicating that no matching variant was found. === Official Documentation The [[http://srfi.schemers.org/srfi-99/|SRFI-99 standard document]] describes the basic functionality. The [[https://chust.org/repos/chicken-srfi-99/|repository site]] documents extensions provided by this implementation. === License Copyright (C) 2011 Thomas Chust <chust@web.de>. 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 ASIS, 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 add 3 to 20?