swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
declaration/definition  

define infix-function

 
 

Syntax

  define return-type infix-function
   ( value type name
   operator
   value type name
   as function-body) | elsewhere


Purpose

You can use define infix-function to define an infix function or operator. An infix function is a function that takes exactly two arguments. The function name is placed between the first and the second argument. The function name may be an OmniMark name or symbol.

The following example defines an infix function to determine the distance between two characters in the ASCII character set:

  define integer infix-function
   value stream a
   distance
   value stream b
   as
     assert length of a = 1 & length of b = 1
      message "Single characters only please."
     return binary b - binary a

  process

     output "d" % ("A" distance "Q")  

An infix function must return a value. The arguments to an infix function must be passed as value arguments.

Infix functions may be overloaded but not dynamic or external.

    Related Syntax
   define function
   define conversion-function
   define overloaded function, dynamic, overridding
 
Related Concepts
   Functions
   Functions: infix
   Functions: overloaded
   Names and symbols
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:10 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.