BRiX
Advanced Computing Environment
Hosted by SourceForge
brix-os project page

Previous: Lists ----- Up: Contents ----- Next: Types

Functions

By default, functions evaluate to Function objects which are nothing more than a pointer to the function. The Function type contains the input/output interface for the function object.

	// reference an operator or extension via anonymous function
	f := def (a,b) return a + b
	a := f(1, 2)

	// declare a function interface
	foo := def (f:(Number,Number) -> Number, a:Number, b:Number)
	  return f(a,b)
	foo(def (a:Number,b:Number) return a + b, 1, 2)
	foo(def (a:Number,b:Number) return a - b, 1, 2)

Usage

Function(input, output)
  • input -- input type interface
  • output -- output type interface

Interfaces

Slots

Methods

Properties

Operators


Sample Definition

	// operator
	defop`infix -> (left, right) -> Function(left, right)

Previous: Lists ----- Up: Contents ----- Next: Types