File: src/eMacros/Runtime/GenericFunction.php

Recommend this page to a friend!
  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: 7 years ago
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 $scope, GenericList $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);
}

For more information send a message to info at phpclasses dot org.