Giter VIP home page Giter VIP logo

strict-function's Introduction

strict-function

Utility of function definition

The original implementation can be found at http://common-lisp.net/project/qitab/archives/quux-2013-09-24.tar.bz2 (quux/lisp/quux/strict-functions.lisp)

Example

(define-strict-function func-ordinary-1 (:inputs ((a fixnum) (b fixnum)))
  (+ a b))

(define-strict-function func-rest-1 (:inputs ((a fixnum "a is fixnum")
                                              (b fixnum "b is fixnum")
                                              &rest (numbers list
                                                             "proper-list of fixnum")))
  (+ a b (apply #'+ numbers)))

(define-strict-function func-outputs-1 (:inputs ((arg integer))
                                        :outputs (integer 0 *))
  arg)

(define-strict-function func-outputs-2 (:inputs ((values list))
                                        :outputs (values (integer 0 *)
                                                         boolean))
  (apply #'values values))

(define-strict-function func-optional-1 (:inputs (&optional (a integer)))
  a)

(define-strict-function func-optional-2 (:inputs (&optional ((a 100) integer)))
  a)

(define-strict-function func-optional-3 (:inputs (&optional ((a "test") integer)))
  a)

(define-strict-function func-optional-4 (:inputs (&optional ((a #\a) character))
                                         :use-supplied-vars t)
  (list a a-supplied-p))

(define-strict-function func-optional-5 (:inputs (&optional ((a 1 a-p) integer)))
  (list a a-p))

(define-strict-function func-key-1 (:inputs (&key (a string)))
  a)

(define-strict-function func-key-2 (:inputs (&key ((a "default") string)))
  a)

(define-strict-function func-key-3 (:inputs (&key ((a 1 a-p) integer)))
  (list a a-p))

(define-strict-function func-key-4 (:inputs (&key ((a "default") integer)))
  a)

(define-strict-function func-key-5 (:inputs (&key (x integer) (y integer))
                                    :use-supplied-vars t)
  (list x x-supplied-p
        y y-supplied-p))

(define-strict-function func-key-6 (:inputs (&key (x integer) &allow-other-keys))
  x)

(define-strict-function func-aux-1 (:inputs (&aux (x string)))
  x)

(define-strict-function func-aux-2 (:inputs (&aux ((x "foo") string)))
  x)

(define-strict-function func-aux-3 (:inputs (&aux ((x "foo") string)
                                                  ((y 12) number)))
  (list x y))

LICENSE

MIT

strict-function's People

Contributors

cxxxr avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.