<<< Kleene plus adaptor ( direct parser )     Lambda Home     Value translators >>>

Common Text Transformation Library http://cttl.sourceforge.net/

Higher-order functions


  1. higher_order_function.cpp
  2. Higher-order function interface
  3. Higher-order function example: itos
  4. integer_2_string_conversion.cpp


Higher-order function interface


Expression Description
  • Assignment

     H = x
    
  • Compiles to a delayed call H.push( x ), which triggers a chain of nested calls

       S.push( f( g( h( ... m( x ) ... ) ) ) )
    

    where x is an object acceptable as an argument of the innermost
    nested function m().

  • Prefix
    Increment

     ++H
    
  • Same as H = true.
    Compiles to a delayed H.push( true ), which triggers

       S.push( f( g( h( ... m( true ) ... ) ) ) )
    
  • Prefix
    Decrement

     --H
    
  • Same as H = false.
    Compiles to a delayed H.push( false ), which triggers

       S.push( f( g( h( ... m( false ) ... ) ) ) )
    
    • Note: the implementation of prefix decrement operator for literal translators, for example,

         --( scalar( 0 )^atoi^"123" )
      

      is customized to act as an internal adaptor of CTTL_LAMBDA_ASSERT debugging macro. As such, prefix decrement of a literal translator should be avoided in application programs, because it always triggers

      
         assert( false );
      
      

      (unless NDEBUG is defined.)


Higher-order function example: itos


Keywords: integer_2_string_conversion.cpp, CTTL_TRACE_DEPOSITS, CTTL_LAMBDA_ASSERT


Copyright © 1997-2009 Igor Kholodov mailto:cttl@users.sourceforge.net.

Permission to copy and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.


 

 

<<< Kleene plus adaptor ( direct parser )     Lambda Home     Value translators >>>