Enumerators

Proc has broad support for interacting with enumerable values like arrays and cursors.

In the simplest use-cases, enumerators are used to iterate over and mutate enumerable values.

something went wrong :(
Upcasing an array of strings
Setup
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
authorization=PROCAUTH
client.enum.map.call(["foo", "bar", "baz"]) do
  client.type.string.upcase
end
client.enum.map.call(["foo", "bar", "baz"], {}, () => {
  return client.type.string.upcase;
});
curl "https://proc.run/enum/map" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/vnd.proc+json" \
--header "accept: text/plain" \
--data '[[">>", ["%%", ["foo", "bar", "baz"]]], ["$$", "proc", ["{}", ["()", "type.string.upcase"]]]]'
 

["FOO", "BAR", "BAZ"]

Most enum.* procs can be chained together to perform more complex enumerations in a single call.

Cursors are also fully supported by enum.* procs, providing patterns for iterating and mutating large datasets from the key-value store. Learn more about how to interact with cursors in the cursor docs.


Stuck? Want to chat about an idea? Join the community on Discord.