Arity provides information about the arguments needed to activate a value.

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
kind = "Arity"
taking:everything = Arity_0x6328EDF2
taking:nothing = Arity_0x141DDDBA
Active cells (details)
apply(...)

Invoke arguments with this message without evaluating them

macro(
  arguments(call message) 
  )
applyOn(...)

First argument must be an evaluated value, rest is the message arguments. arguments will be evaluated on the first argument.

macro(
  on = call argAt(0) 
  msg = call arguments rest inject('(apply), m, a, m <<(a)) 
  arguments(msg, context: on) 
  )
arguments(message, context: nil, signalErrors: false)

Obtain arguments from message according to this arity. If a context is given, the arguments will be evaluated on context. This method returns an Arguments object, see its documentation for available cells. If the message arguments contain an splatted argument and no context is given, an Condition Error Invocation NotSpreadable condition will be signaled.

method(message, context: nil, signalErrors: false, 
  req = required 
  o = Arguments mimic(message arguments) 
  o given = message arguments 
  arg = nil 
  signalError = fn(+(r), +:(k), 
      if(signalErrors, 
        error!(*(r), *(k), message: message, context: context, 
          receiver: self, given: arg, info: o))) 
  addKeyword = fn(key, value, 
      cond(
        takeNothing?, o extraKeywords [](key) = value, 
        takeEverything?, o krest [](key) = value, 
        keywords include?(key), o keywords [](key) = value, 
        krest, o krest [](key) = value, 
        o extraKeywords [](key) = value)) 
  addPositional = fn(value, 
      cond(
        takeNothing?, o extraPositional <<(value), 
        takeEverything?, o rest <<(value), 
        o positional length <(positionals(true) length), o positional <<(value), 
        rest, o rest <<(value), 
        o extraPositional <<(value))) 
  message arguments each(arg, 
    cond(
      arg keyword?, 
      name = :(arg name asText [](0 ..(-(2)))) 
      arg = if(context, arg next evaluateOn(context), arg next) 
      addKeyword(name, arg), 
      arg name ==(:("*")) &&(arg arguments length ==(1)), 
      arg = arg arguments first 
      if(context, 
        arg = arg evaluateOn(context) 
        case(arg 
          List, 
          arg each(a, addPositional(a)) 
          Dict, 
          arg each(p, addKeyword(p key, p value)) 
          
          o notSpreadable <<(arg) 
          signalError(Condition Error Invocation NotSpreadable)), 
        o notSpreadable <<(arg) 
        signalError(Condition Error Invocation NotSpreadable)), 
      arg = if(context, arg evaluateOn(context), arg) 
      addPositional(arg) 
      )) 
  if(o positional length <(min), 
    o missing = required [](o positional length ..(-(1))) 
    o order = -(1) *((o missing length)) 
    signalError(Condition Error Invocation TooFewArguments, howMany: o missing length), 
    if((o extraPositional length) +((o extraKeywords size)) >(0), 
      o order = (o extraPositional length) +((o extraKeywords size)) 
      if(o extraPositional empty?, 
        signalError(Condition Error Invocation MismatchedKeywords, howMany: o extraKeywords size), 
        signalError(Condition Error Invocation TooManyArguments, howMany: o order)), 
      o order = 0)) 
  o 
  )
asText()

returns the text representation of this arity

from(+[arguments])

Create an Arity object from the given messages. The list of unevaluated messages given to this method will be used as if they were the arguments part of a DefaultMethod definition.

fromArgumentsCode(argumentsCode)

nil

method(argumentsCode, 
  case(argumentsCode, 
    or(nil, ""), taking:nothing, 
    "...", taking:everything, 
    msg = Message fromText("from(#{argumentsCode})") 
    if(msg next, error!("Invalid argumentsCode: " +(argumentsCode))) 
    msg sendTo(self)) 
  )
keywords()

returns the names for keyword arguments

krest()

returns the symbol name for the krest argument.

max()

Return the maximum number of positional arguments. A negative value indicates rest positional arguments.

method(
  cond(takeNothing?, 0, 
    takeEverything?, -(1), 
    rest, -(1) *((positionals(true) length +(1))), 
    positionals(true) length) 
  )
min()

Return the minimun number of positional arguments

method(
  positionals(false) length)
optional()

Return the names of optional positional arguments.

method(
  positionals(true) -(positionals(false)))
positionals(includeOptionals true)

returns the names for positional arguments

required()

Return the names of required positional arguments.

method(
  positionals(false))
rest()

returns the symbol name for the rest argument.

satisfied?(...)

nil

macro(
  call resendToMethod(:apply) order ==(0))
satisfiedOn?(...)

nil

macro(
  call resendToMethod(:applyOn) order ==(0))
takeEverything?()

Return true if this arity takes everything. As is the case for macros or created from argumentsCode ... , it's also the arity needed to activate a non-activatable value

method(
  self ==(taking:everything))
takeKeyword?(keyword)

nil

method(keyword, 
  if(krest, true, 
    keywords include?(keyword)))
takeNothing?()

Return true if this arity takes nothing. For things that take no arguments at all.

method(
  self ==(taking:nothing))