-
Notifications
You must be signed in to change notification settings - Fork 0
/
truthy.m
29 lines (28 loc) · 794 Bytes
/
truthy.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function out = truthy(varargin)
% truthy : Bind the value to either `Truthiness` or `Falsiness`.
%
% Actually, this function instantiates `LazyLogical` first.
% After calling `LazyLogical::bind`, the value is bound to either
% `Truthiness` or `Falsiness`.
%
% See Also: TRUTHINESS, FALSINESS, LAZYLOGICAL
if nargin >= 2
warning( ...
"DeprecationWarning: " ...
+ "call `resolveTruthinessChain`" ...
+ "if you want to use a legacy `truthy`.");
error( ...
"ArgumentError: " ...
+ "The number of input arguments must be 1.");
end
if nargin == 1
in = varargin{1};
out = LazyLogical(in);
return
end
if nargin == 0
out = LazyLogical(true);
return
end
end
%%