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/input-classes|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: eggs]] [[toc:]] == input-classes === Description {{input-classes}} provides type classes for input streams used by [[lexgen]], [[abnf]] and related libraries. The typeclass interface is based on macros defined in the [[typeclass]] library. An input stream type class contains three fields that define: * a predicate that returns true when the input stream is empty * an accessor that returns the first element of the input stream * an accessor that returns the tail of the input stream (i.e. all elements except for the first one) Thus the typeclass definition of an input stream is the following: <enscript highlight="scheme"> (define-class <Input> empty? head tail) </enscript> The simplest instantiation of class {{<Input}} uses lists: <enscript highlight="scheme"> (define-class <Input> null? car cdr) </enscript> {{input-classes}} also defines a typeclass for extended input streams, which inherit from the basic input stream typeclass and provide an interface for converting strings and files to input streams. The extended input stream is defined as follows: <enscript highlight="scheme"> (define-class <Input+> (<Input> input) find string->input-stream file->input-stream) </enscript> The {{find}} procedure must provide semantics to find all non-overlapping instances of its first argument that occur in the second argument. It must have the signature: find :: <Input+> * <Input+> -> (<Input+>, [(<Input+>, <Input+>)]) An example of extended input streams based on strings is: <enscript highlight="scheme"> (define (string-car x) (string-ref x 0)) (define (string-cdr x) (string-drop x 1)) (define string-<Input> (make-<Input> string-null? string-car string-cdr)) (define string-<Input+> (make-<Input+> string-<Input> string-find identity (lambda (x . rest) (read-all x)) )) </enscript> === Requires * [[typeclass]] === Version History * 1.0 Initial release === License Copyright 2010-2012 Ivan Raikov and the Okinawa Institute of Science and Technology. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 17 to 22?