com.github.basking2.sdsai.itrex.packages.IteratorPackage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdsai-itrex Show documentation
Show all versions of sdsai-itrex Show documentation
An S-Expression inspiried library focused on iterators.
package com.github.basking2.sdsai.itrex.packages;
import com.github.basking2.sdsai.itrex.Evaluator;
import com.github.basking2.sdsai.itrex.functions.FlattenFunction;
import com.github.basking2.sdsai.itrex.functions.FunctionInterface;
/**
* This package groups functions that operate on iterators or lists.
*/
public class IteratorPackage implements Package {
@Override
public void importTo(final Evaluator evaluator, final String packageName) {
if (packageName == null || packageName.isEmpty()) {
evaluator.register("flatten", new FlattenFunction());
}
else {
evaluator.register(packageName + ".flatten", new FlattenFunction());
}
importFlatten2(evaluator, packageName);
}
/**
* Build and register the "flattten2" function.
*
* This requires the curry and flatten functions to already be registered.
*
* @param evaluator The evaluator to register flatten2 against.
*/
public void importFlatten2(final Evaluator evaluator, final String packageName) {
@SuppressWarnings("unchecked")
final FunctionInterface
© 2015 - 2025 Weber Informatics LLC | Privacy Policy