@@ -6761,6 +6761,40 @@ public static DataObject combXFFunction(
67616761 ), SCOPE_ID );
67626762 }
67636763
6764+ @ LangFunction ("combXN1" )
6765+ @ CombinatorFunction
6766+ @ LangInfo ("Combinator execution: a(b(c))(d)" )
6767+ public static DataObject combXN1Function (
6768+ LangInterpreter interpreter , int SCOPE_ID ,
6769+ @ LangParameter ("$a" ) @ AllowedTypes (DataObject .DataType .FUNCTION_POINTER ) DataObject a ,
6770+ @ LangParameter ("$b" ) @ AllowedTypes (DataObject .DataType .FUNCTION_POINTER ) DataObject b ,
6771+ @ LangParameter ("$c" ) DataObject c ,
6772+ @ LangParameter ("$d" ) DataObject d
6773+ ) {
6774+ FunctionPointerObject aFunc = a .getFunctionPointer ();
6775+ FunctionPointerObject bFunc = b .getFunctionPointer ();
6776+
6777+ DataObject retB = interpreter .callFunctionPointer (bFunc , b .getVariableName (), Arrays .asList (
6778+ c
6779+ ), SCOPE_ID );
6780+
6781+ DataObject retA = interpreter .callFunctionPointer (aFunc , a .getVariableName (), Arrays .asList (
6782+ LangUtils .nullToLangVoid (retB )
6783+ ), SCOPE_ID );
6784+ retA = LangUtils .nullToLangVoid (retA );
6785+
6786+ if (retA .getType () != DataType .FUNCTION_POINTER )
6787+ return interpreter .setErrnoErrorObject (InterpretingError .INVALID_FUNC_PTR , "The value returned by a(b(c)) must be of type " + DataType .FUNCTION_POINTER , SCOPE_ID );
6788+
6789+ FunctionPointerObject retAFunc = retA .getFunctionPointer ();
6790+
6791+ return interpreter .callFunctionPointer (retAFunc , retA .getVariableName (), LangUtils .separateArgumentsWithArgumentSeparators (
6792+ Arrays .asList (
6793+ d
6794+ )
6795+ ), SCOPE_ID );
6796+ }
6797+
67646798 @ LangFunction ("combY" )
67656799 @ CombinatorFunction
67666800 @ LangInfo ("Combinator execution: (x -> f(x(x)))(x -> f(x(x)))" )
0 commit comments