Changeset 39555 in project


Ignore:
Timestamp:
01/29/21 17:31:33 (4 weeks ago)
Author:
dieggsy
Message:

chibi-generic: add info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/chibi-generic

    r37367 r39555  
    99Original page here: [[http://synthcode.com/scheme/chibi/lib/chibi/generic.html]]
    1010
    11 === Usage
     11=== API
    1212
     13==== define-generic
    1314<syntax>(define-generic name)</syntax>
    1415
    1516Define a new generic function named {{name}}.
    1617
     18
     19==== define-method
    1720<syntax>(define-method (name params ...) body ...)</syntax>
    1821
    19 Each parameter in {{params}} should be either a single identifier or a list of the 
    20 form {{(param type)}} where {{param}} is the parameter name and {{type}} is a 
    21 predicate which returns true if it's argument is of the correct type. 
    22 Parameters without a predicate will always match. If multiple methods 
    23 satisfy the arguments, the most recent method will be used. The special 
    24 form {{(call-next-method)}} can be invoked to call the next most recent 
     22Each parameter in {{params}} should be either a single identifier or a list of the
     23form {{(param type)}} where {{param}} is the parameter name and {{type}} is a
     24predicate which returns true if it's argument is of the correct type.
     25Parameters without a predicate will always match. If multiple methods
     26satisfy the arguments, the most recent method will be used. The special
     27form {{(call-next-method)}} can be invoked to call the next most recent
    2528method with the same arguments.
    2629
     30==== make-generic
    2731<procedure>(make-generic name)</procedure>
    2832
    2933Create a new first-class generic function named {{name}}.
    3034
     35==== generic-add!
    3136<procedure>(generic-add! g preds f)</procedure>
    3237
    33 Extend the generic {{g}} with a new method {{f}} that applies when all parameters 
     38Extend the generic {{g}} with a new method {{f}} that applies when all parameters
    3439match the given list of predicates {{preds}}.
    3540
     41=== Maintainer
     42
     43Diego A. Mundo
     44
     45=== Repository
     46
     47[[https://github.com/dieggsy/chibi-generic]]
     48
     49=== Version History
     50
     51; 0.1.3 : Properly exit tests
     52; 0.1.2 : Separate implementation and module
     53; 0.1.1 : Add egg synopsis
     54; 0.1.0 : Initial release
     55
     56
     57=== License
     58
     59 Copyright (c) 2009-2018 Alex Shinn
     60 Copyright (c) 2019-2021 Diego A. Mundo
     61 All rights reserved.
     62 
     63 Redistribution and use in source and binary forms, with or without
     64 modification, are permitted provided that the following conditions
     65 are met:
     66 1. Redistributions of source code must retain the above copyright
     67    notice, this list of conditions and the following disclaimer.
     68 2. Redistributions in binary form must reproduce the above copyright
     69    notice, this list of conditions and the following disclaimer in the
     70    documentation and/or other materials provided with the distribution.
     71 3. The name of the author may not be used to endorse or promote products
     72    derived from this software without specific prior written permission.
     73 
     74 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     75 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     76 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     77 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     78 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     79 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     80 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     81 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     82 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     83 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     84
Note: See TracChangeset for help on using the changeset viewer.