Login   Register  
PHP Classes
elePHPant
Icontem

File: src/eMacros/Runtime/GenericFunction.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Emmanuel Antico  >  eMacros  >  src/eMacros/Runtime/GenericFunction.php  >  Download  
File: src/eMacros/Runtime/GenericFunction.php
Role: Class source
Content type: text/plain
Description: Class source
Class: eMacros
PHP LISP language interpreter
Author: By
Last change:
Date: 2014-01-13 05:17
Size: 580 bytes
 

Contents

Class file image Download
<?php
namespace eMacros\Runtime;

use 
eMacros\Applicable;
use 
eMacros\GenericList;
use 
eMacros\Scope;
use 
eMacros\Expression;

abstract class 
GenericFunction implements Applicable {    
    final public function 
apply(Scope $scopeGenericList $arguments) {
        
$args = array();
        
        foreach (
$arguments as $arg) {
            
$args[] = $arg->evaluate($scope);
        }
    
        return 
$this->execute($args);
    }
    
    public function 
__invoke() {
        
$args func_get_args();
        return 
$this->execute($args);
    }
    
    abstract function 
execute(array $arguments);
}