Moto

1 program Added 2026-02-27T12:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit 22ca2ab4ab · authored 2026-02-27T08:00:10+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

Motoko (0.56)Koto (0.33)MIT Proto (0.29)Morpho (0.27)Mobl (0.20)

LLM-contributed programs

String Set Operations

Provenance: commit 22ca2ab4ab · authored 2026-02-27T08:00:10+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
code.moto · license: GPL-2.0 · added: 2026-02-27T12:00:00Z
${
	/* Subtracts the elements of set B from set A */

	Stringset subtract(Stringset A, Stringset B)
	{
		Stringset result = new Stringset();
		Enumeration e;

		for(e=A.elements(); e.hasNext();)
			result.add(<String>e.next());
		for(e=B.elements(); e.hasNext();)
			result.remove(<String>e.next());

		return result;
	}

	/* Returns the Union of the elements of set B and set A */

	Stringset union(Stringset A, Stringset B)
	{
		Stringset result = new Stringset();
		Enumeration e;

		for(e=A.elements(); e.hasNext();)
			result.add(<String>e.next());
		for(e=B.elements(); e.hasNext();)
			result.add(<String>e.next());

		return result;
	}

	/* Takes a pipe delimited String of ids and converts it to a Stringset */

	Stringset deSerializeSet(String ids)
	{
		String curID;
		Stringset result = new Stringset();
		Tokenizer tok = new Tokenizer(ids,'|');

		while((curID = tok.next())!=null )
			result.add(curID);

		return result;
	}

	/* Takes a Stringset and serializes it to a pipe delimited String */

	String serializeSet(Stringset A)
	{
		StringBuffer result = new StringBuffer();
		Enumeration e;
		for(e=A.elements(); e.hasNext();) {
			result.append(<String>e.next());
			result.append('|');
		}
		return result.toString();
	}

	/* Takes a query that selects a single String and builds a Stringset out of it */

	Stringset selectSet (String query)
	{
		Stringset result = new Stringset();
		rset = conn.query(query);
		while(rset.next())
			result.add(rset.getString(0));
		return result;
	}

}$

Contribute — propose a file extension

Tell us where to find evidence about Moto (mapped to pl/moto). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Moto/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← motif-software Motoko →