4.24. kink/VAL¶
Provides funs for vals in general.
4.24.1. VAL.val_id(Val)¶
`val_id` returns an int num which identifies `Val`.
Invocations of `val_id` for the same val always return the same num. Invocations of `val_id` for different vals always return different nums. Therefore, identity of the val can be tested using the result of `val_id`.
Example:
:VAL.require_from('kink/')
:test_identity <- {(:X :Y)
if(VAL.val_id(X) == VAL.val_id(Y)
{ stdout.print_line('same') }
{ stdout.print_line('different') }
)
}
:V <- new_val
test_identity(V V) # => same
test_identity(V new_val) # => different
4.24.2. VAL.same?(X Y)¶
`same?` returns whether two parameters, `X` and ``Y`, are the same val.
Example:
:VAL.require_from('kink/')
:test_identity <- {(:X :Y)
if(VAL.same?(X Y)
{ stdout.print_line('same') }
{ stdout.print_line('different') }
)
}
:V <- new_val
test_identity(V V) # => same
test_identity(V new_val) # => different
4.24.3. VAL.var_syms(Val)¶
`var_syms` does var-syms operation, and returns the set of syms of the vars of `Val`.
The result is a set of strs.
Example:
:VAL.require_from('kink/')
:V <- new_val('Data' 42 'fun' {})
stdout.print_line(VAL.var_syms(V).repr) # => (flat_set "Data" "fun" "repr")
4.24.4. VAL.identity(Val)¶
`identity` returns `Val`.
Example:
:VAL.require_from('kink/')
stdout.print_line(VAL.identity('foo').repr) # => "foo"