core.set
0.000000

Sets an argument value.

Arguments
namerequired
The argument name to set a value for.
value
The argument value. Required if proc is not provided.
proc
The composition used to obtain a value. Required if value is not provided.
Return Value
The original input given to set.
something went wrong :(
Setting and using an argument
Setup
authorization=PROCAUTH
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
composition = client.core.set(name: "string") {
  client.type.string.reverse
} >> client.core.echo(:string)

composition.call("hello")
let composition = client.core.set(undefined, {name: "string"}, () => {
  return client.type.string.reverse;
}).compose(client.core.echo(
  client.arg("string")
));

composition.call("hello");
curl "https://proc.run/core/exec" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/vnd.proc+json" \
--header "accept: text/plain" \
--data '[["$$", "proc", ["{}", [">>", ["%%", "hello"]], ["()", "core.set", ["$$", "name", ["%%", "string"]], ["$$", "proc", ["{}", ["()", "type.string.reverse"]]]], ["()", "core.echo", [">>", ["@@", "string", {}]]]]]]'
 

olleh


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