java.lang.Object
org.kink_lang.kink.FunHelper
A helper for funs.
- See Also:
 
- 
Method Summary
Modifier and TypeMethodDescription<T> Tcompile(Locale locale, String programName, String programText, BindingVal binding, Function<? super FunVal, ? extends T> onSucc, Function<? super CompileError, ? extends T> onError) Compiles a program text to a top level fun.Returns a constant fun: which is a 0-ary fun returning the val constantly.make()Returns a builder of a host fun.Returns a builder of a host fun, with the description of the fun. 
- 
Method Details
- 
compile
public <T> T compile(Locale locale, String programName, String programText, BindingVal binding, Function<? super FunVal, ? extends T> onSucc, Function<? super CompileError, ? extends T> onError) Compiles a program text to a top level fun.If the program text is successfully compiled to a top level fun,
onSuccis called with the fun.If the program text cannot be compiled and causes a compile error,
onErroris called with the compile error.- Type Parameters:
 T- the type of the result.- Parameters:
 locale- the locale to generate compile error messages.programName- the name of the program.programText- the program text.binding- the binding of the top level fun.onSucc- the function which is called when the program is successfully compiled.onError- the function which is called when the program causes a compile error.- Returns:
 - the result of onSucc or onError.
 
 - 
make
Returns a builder of a host fun.Calling this method is equivalent to calling
make("(fun)").See
org.kink_lang.kink.hostfunfor detail.- Returns:
 - a builder.
 
 - 
make
Returns a builder of a host fun, with the description of the fun.See
org.kink_lang.kink.hostfunfor detail.- Parameters:
 desc- the description of the fun, which is used in arity error messages.- Returns:
 - a builder.
 
 - 
constant
Returns a constant fun: which is a 0-ary fun returning the val constantly.- Parameters:
 val- the constant val.- Returns:
 - a constant fun.
 
 
 -