Sha256: 2aef28dc794597bcd6c39e71eff324a8b53a0e2e83fec19ac1fd24ff08a9dc63

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

.. meta::
   :robots: index,follow
   :description: libndtypes documentation

.. sectionauthor:: Stefan Krah <skrah at bytereef.org>


Functions
=========

Most library functions are for creating types. The functions in this section
operate *on* types.


Copying
-------

.. topic:: ndt_copy

.. code-block:: c

   ndt_t *ndt_copy(const ndt_t *t, ndt_context_t *ctx);

Create a copy of the argument. This is an important function, since types
should be immutable.


Equality
--------

.. topic:: ndt_equal

.. code-block:: c

   int ndt_equal(const ndt_t *t, const ndt_t *u);

Return 1 if *t* and *u* are structurally equal, *0* otherwise.


Pattern matching
----------------

.. topic:: ndt_match

.. code-block:: c

   int ndt_match(const ndt_t *p, const ndt_t *c, ndt_context_t *ctx);

Match concrete candidate *c* against the (possibly abstract) pattern *p*.

This is the main function used in type checking.



Type checking
-------------

.. topic:: ndt_typecheck

.. code-block:: c

   ndt_t *ndt_typecheck(const ndt_t *f, const ndt_t *args, int *outer_dims, ndt_context_t *ctx);

Take a function type *f*, check if it can accept the concrete type *args*.
*args* must be a tuple type that contains the individual arguments.

The return value is the inferred return type.

Store the number of outer dimensions that need to be traversed before applying
the function kernel.


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ndtypes-0.2.0dev8 ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst
ndtypes-0.2.0dev6 ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst
ndtypes-0.2.0dev5 ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst
ndtypes-0.2.0dev4 ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst