Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] == type-extensions [[toc:]] == Description Miscellaneous extensions for CHICKEN's type system. The source for this egg is available [[https://git.foldling.org/chicken-type-extensions.git|here]]. == Requirements * [[matchable]] == Usage {{type-extensions}} should be loaded as a compiler extension with the {{-extend}} (or {{-X}}) flag to {{csc}}: $ csc -extend type-extensions <file> === API <syntax>(define-type name)</syntax> Shorthand for {{(define-type name (struct name))}}. <syntax>(define-type (name var ...) type)</syntax> Defines a complex type alias that can be used in place of {{type}}. In each usage, all instances of {{var}} in {{type}} will be replaced by the corresponding form from {{(name var ...)}}. <enscript highlight="scheme"> (define-type (pair-of a) (pair a a)) (: pair (forall (a) (a -> (pair-of a)))) (define (pair x) (cons x x)) (compiler-typecase (pair 1) ((pair-of fixnum) (print '(pair-of fixnum))) (else (print 'else))) </enscript> As with CHICKEN's built-in {{define-type}} form, type aliases defined inside a module are not visible outside of that module. === Type Syntax <syntax>(list . type)</syntax> <syntax>(list type ...)</syntax> A dotted tail or ellipsis at the end of a {{list}} type form is shorthand for a sequence of pairs followed by {{(list-of type)}}. <enscript highlight="scheme"> ;; The following types are equivalent: (define-type a (list fixnum float . number)) (define-type b (list fixnum float number ...)) (define-type c (pair fixnum (pair float (list-of number)))) </enscript> == Author [[/users/evan-hanson|Evan Hanson]] == Repository [[https://git.foldling.org/chicken-type-extensions/|https://git.foldling.org/chicken-type-extensions/]] == License 3-Clause BSD
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 3 to 1?