public CommandResult executeCommand(final Command command) throws FunctionParseException,
            UnknownCommandException, ExpressionExecuteException {
        switch (command.getType()) {
            case DefineFunction:
                putFunction(command.getParam(), command.getContent());
                return new EmptyResult();
            case DefineConstant:
                putConstant(command.getParam(), command.getContent());
                return new EmptyResult();
            case Delete:
                deleteFunctionOrConstant(command.getParam());
                return new EmptyResult();
            case Clear:
                clear();
                return new EmptyResult();
            case ClearAll:
                clearAll();
                return new EmptyResult();
            case Save:
                final String name = command.getParam();
                putConstant(name, getResult());
                return new EmptyResult();
            case Print:
                return new FunctionListResult(functionRepository.getFunctions());
            case PrintBuiltin:
                return new FunctionListResult(functionRepository.getBuiltinFunctions());
            default:
                throw new UnknownCommandException();
        }
    }