Object
Object[tag]
Object[tag, { { key, val }, ... }]
Creates a new KSL object with the given type tag tag.
-
tagshould be aSymbol(typically in PascalCase). -
If no initial properties are provided, an empty object is created.
-
Properties may be supplied as a list of
{ key, val }pairs, wherekeyis anAtomandvalis any value. -
Returns an
Object.
Object[Person]; (* => Object[Person]{} *)
Object[Person, {
{ #name, "Kevin" },
{ #age, 24 }
}]; (* => Object[Person]{age, name} *)
OpenChannel
OpenChannel[rx, tx]
Opens a new multi‑producer, single‑consumer channel for message passing between threads.
rxandtxare variable names that will be bound to anMpscReceiverand anMpscSender, respectively.- To manually release the underlying resources, use
DropReceiver[rx]andDropSender[tx]. - Returns
Unit[].
OpenChannel[rx, tx];
(* Use SendValue[tx, msg] and ReceiveValue[rx] to communicate *)
DropReceiver[rx];
DropSender[tx];
Or
Or[a, b]
Short‑circuiting logical OR. Evaluates b only if a evaluates to #f.
- Returns the result of
aif it is#t; otherwise returns the result of evaluatingb. - This can often be used as a concise alternative to
If[Not[a], b, Unit[]].
Or[#t, Div[1, 0]]; (* => #t (second argument never evaluated) *)
Or[#f, 42]; (* => 42 *)
Or[#f, #f]; (* => #f *)