Changeset b63e376 for src/examples/prolog.c
- Timestamp:
- Mar 8, 2016, 10:24:43 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- ae357ec
- Parents:
- 4040425
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/prolog.c
r4040425 rb63e376 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 18:11:18201613 // Update Count : 212 // Last Modified On : Tue Mar 8 22:09:39 2016 13 // Update Count : 5 14 14 // 15 15 16 extern "C" { extern int printf( const char *fmt, ... ); } 16 #include <fstream> 17 17 18 void printResult( int x ) { printf( "int\n" ); }19 void printResult( double x ) { printf( "double\n" ); }20 void printResult( char * x ) { printf( "char*\n" ); }18 void printResult( int x ) { sout | "int" | endl; } 19 void printResult( double x ) { sout | "double" | endl; } 20 void printResult( char * x ) { sout | "char*" | endl; } 21 21 22 22 void is_arithmetic( int x ) {} … … 25 25 void is_integer( int x ) {} 26 26 27 trait ArithmeticType( type T ) {27 trait ArithmeticType( otype T ) { 28 28 void is_arithmetic( T ); 29 29 }; 30 30 31 trait IntegralType( type T | ArithmeticType( T ) ) {31 trait IntegralType( otype T | ArithmeticType( T ) ) { 32 32 void is_integer( T ); 33 33 }; 34 34 35 forall( type T | IntegralType( T ) | { void printResult( T ); } )35 forall( otype T | IntegralType( T ) | { void printResult( T ); } ) 36 36 void hornclause( T param ) { 37 37 printResult( param );
Note: See TracChangeset
for help on using the changeset viewer.