package org.metaborg.meta.interpreter.framework;

import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.interpreter.terms.ITermFactory;

import com.github.krukow.clj_ds.PersistentMap;

public class MapUtils {

	public static <K, V> PersistentMap<K, V> plus(PersistentMap<K, V> one,
			PersistentMap<K, V> other) {
		PersistentMap<K, V> nmap = one;
		for (K key : other.keySet()) {
			nmap = nmap.plus(key, other.get(key));
		}
		return nmap;
	}
	
}

@@ -54,150 +54,112 @@
 ort 
-org.spoofax.interpreter.terms.IStrategoTerm;%0Aimport org.spoofax.interpreter.terms.ITermFactory;%0A%0Aimport com.github.krukow.clj_ds.PersistentMap
+com.github.krukow.clj_ds.PersistentMap;%0Aimport com.oracle.truffle.api.CompilerDirectives.TruffleBoundary
 ;%0A%0Ap
@@ -182,16 +182,34 @@
 tils %7B%0A%0A
+%09@TruffleBoundary%0A
 %09public 
@@ -435,12 +435,151 @@
 map;%0A%09%7D%0A
-%09
+%0A%09@TruffleBoundary%0A%09public static %3CK, V%3E PersistentMap%3CK, V%3E add(PersistentMap%3CK, V%3E map,%0A%09%09%09K key, V val) %7B%0A%09%09return map.plus(key, val);%0A%09%7D
 %0A%7D%0A

Add map utilities and mark them as TruffleBoundary