| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (arithp): Declared.
(plus_s): Existing symbol declared.
* arith.c (arithp): New function.
* struct.h (special_slot): New enum member plus_m.
* struct.c (special_sym): Register plus_s together as
the [plus_m] entry of the array.
* tests/016/arith.tl
* tests/016/ud-arith.tl: Tests for arithp.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/arith-each.tl (sys-arith-each): Remove :form param.
* stdlib/awk.tl (awk-state :fini): Suppress unused warning
in dohash form by using an uninterned symbol for this
variable. This is a useful technique worth documenting.
(awk-expander): Remove unused varaible in a predicate
pattern.
(awk-code-move-check): Lose the unused awc and aws-sym.
(awk-mac-let): Don't pass the unused parameters to
awk-code-move-check.
* stdlib/conv.tl (conv-expand): Remove unused gensym.
* stdlib/debugger.tl (fcall-frame loc,
fcall-frame print-trace, expand-frame print-trace):
Mark unused parameters ignored.
* stdlib/defset.tl (defset-expander-simple): Remove
unused parameter.
(defset): Drop argument from defset-expander-simple
call, and also fix unused warning in tree-case form.
* stdlib/doc-lookup.tl (detached-run): Remove unused
variable from a pattern matching predicate.
It's not in the rightmost position so we have to
revers the comparison. I will enhance the pattern
matcher to support @nil in a predicate.
(toplevel): Ignore a parameter of the not-implemented
version of the open-url function.
* stdlib/doloop.tl (expand-dooloop): Replace unused
variable in a tree binding pattern with the t
symbol.
* stdlib/each-prod.tl (expand-each-prod*): Remove
unused let variable.
* stdlib/except.tl (expand-handle): Put else variable
in tree bind pattern to use.
* stdlib/getopts.tl (opt-desc (basic-type-p, cumul-type-p)):
Replace unused catch-all variable in tree bind pattern
with t symbol.
(opt-processor parse-opts): Remove unused args argument.
The object holds the args, prepared at construction time.
(getopts, option-base getopts): Don't pass args to parse-opts.
(define-option-struct): Replace unused treee pattern
variable with t.
* stdlib/ifa.tl (if-to-cond): Put catch-all else variable
to use.
* stdlib/keyparams.tl (param-expander): Mark unused parameter
ignored. Replace unused variables in tree-case with t.
* stdlib/match.tl (compile-struct-match, compile-predicate-match,
compile-require-match, compile-as-match, compile-with-match,
compile-or-match, compile-and-match, compile-not-match,
compile-hash-match, compile-scan-match, compile-exprs-match):
Address unused variables in mac-param-bind and tree-bind
patterns.
(match-case): Likewise, and also remove unused let variables.
(while-match-case, while-true-match-case): Remove unused
:env parameter.
(expand-lambda-match): Remove unused let variable.
(defun-match): Remove unused variable in tree-bind.
(define-param-expander): Mark menv parameter ignored.
Unused variables in tree-bind.
(defmatch): Replace lambda variable with a gensym.
(loosen, pat-len): Remove unused parameter.
(sme, end): Fix calls to loosen and pat-len.
(non-triv-pat-p): Mark parameter ignored in the
temporary version of this function.
(expand-quasi-match): Address unused variables in patterns,
and remove unused gensyms.
* stdlib/op.tl (op-rec-p): Unused variable in tree-case.
(op-alpha-rename): Remove f parameter.
(op-ignerr): Mark catch handler parameter ignored.
(op-expand): Remove argument from calls to op-alpha-rename.
* stdlib/path.test (if-windows, if-native-windows): The
compiler complains here about the unused variable
due to constant folding. We use the use function
to indicate that the variable is not ignored, but used.
* stdlib/pic.tl (expand-pic-num): Remove unused let variable.
(pic): Remove unused :env parameter.
* stdlib/place.tl (macroexpand-1-place): Ignore unused
env parameter.
(pset): Ignore some tree-bind variables. Not replacing
them with t because their names help code readability.
Lots of tricky code in place.tl.
(shift): Replace unused variable with t in tree-case.
(vecref, chr-str, ref, sub): Deal with unused expander
parameters.
(gethash): Deal with unused place parameter.
(dwim): Remove unused env parameter, and deal with
unused place parameters.
(get-fun-getter-setter): Unused variables in tree-bind.
(read-once, define-modify-macro): Remove unused gensyms.
(placelet-1): Mark ignored a parameter of an update
expander lambda.
* stdlib/pmac.tl (macroexpand-params): Fix unused
catch-all in tree-case.
* stdlib/struct.tl (prune-missing-inits): Mark
tree-bind unused variable ignored.
(defstruct): Unused tree-case variable.
(qref): Unused tree-case catch-all variables.
(rslot): Unused parameter removed.
(:delegate): Unused tree-case variables.
* stdlib/tagbody.tl (tagbody): Drop unused :env param.
Mark ignored the threaded-2 let variable, which cannot
be removed because its init-form performs a needed
side effect.
* stdlib/trace.tl (trace-leave): Remove unused param.
(trace): Don't pass argument to unused param of trace-leave.
(untrace): Use gensym in dohash to suppress unused
variable warning.
* stdlib/type.tl (typecase-expander): Unused variable
in tree-case.
* stdlib/with-resources.tl (with-resources): Likewise.
* stdlib/yield.tl (hlet-expand): Remove two unused locals.
* tests/012/lambda.tl: Fix test cases that break the
tests due to unused variable warnings.
* tests/016/arith.tl: Add test case for each-prod*.
At first I thought a bug was found in it but it turned
out that the init-forms variable that was removed
was really superfluous.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (gcd): New implementation which uses arithmetic
in the unsigned type ucnum if both operands are in that
type's range. This uses Stein's algorithm a.k.a.
binary GCD. The mpi_gcd function is used only if at least
one argument is a bignum whose value doesn't fit into
a ucnum.
* tests/016/arith.tl: gcd test cases added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (arith_each_set_entries): Trigger autoload on
new symbols.
* stdilb/arith-each.tl (sys:arith-each): Generalize macro to
handle short-circuiting logical operations. The op-iv
parameter, which is a cons, is spread into two op and iv
parameter.
One new argument appears, short-circ. This specifies a code
for short-circuiting behavior: t means iteration continues
while the result is true; nil means it continues while it is
nil, and + means iteration continues while the accumulator is
nonzero. A new convention is in effect: the operator has
to be specified as a list in order to request accumulating
behavior, e.g (+) or (*). Otherwise the operator specifies a
predicate that is applied to the forms, without taking into
account the prior value.
(sum-each, sum-each*, mul-each, mul-each*): Spread the op-iv
arguments. Wrap the op argument in a list to request
accumulation. In the case of mul-each and mul-each*, specify +
for the short-circ argument, which means that iteration stops
when the accumulator becomes zerop. sum-each and sum-each*
specify : for the short-circ argument which is unrecognized,
and so ther is no short-circuiting behavior.
(each-true, some-true, each-false, some-false): New macros.
* tests/016/arith.tl: New tests.
* txr.1: Documented new macros and added note about possible
short-circuiting in mul-each and mul-each*.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/arith-each.tl (sys:arith-each): If there are no vars,
then just reduce to the identity element value.
This is alreading happening fine for the each-prod family
of operators.
* tests/016/arith.tl: Test cases covering the no vars
and empty iteration identity element cases for sum-each and
mul-each, as well as the *-prod variants.
* txr.1: Document empty iteration and empty vars behavior
for arithmetic each operators as well as the each-prod
family.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/common.tl (sstest): New macro. Like stest, but the right hand
side is an object which the macro turns to a string, rather than
expecting a string.
* tests/016/arith.tl: Use the sstest macro for the main quantile
test to compare the result and expected value as character strings
rather than objects. Specify the expected values using no more
than 14 decimal digits of precision, and over the scope of the test
case, restrict floating-point printing to 14 digits. Thus, we
effectively have quick and dirty epsilon comparison to 14 digits
that recurses over the list, without having to write that as a function.
|
|
|
|
|
| |
* arith.tl: Somehow I committed some wrong expected numbers in
a quantile test, yet didn't catch the test failure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (arith_each_instantiate, arith_each_set_entries): New
functions.
(each_prod_set_entries): Add sum-each-prod, sum-each-prod*,
mul-each-prod and mul-each-prod* as autoload triggers for
each-prod.tl, where those macros are now defined.
(lisplib_init): Register autoloading of arith-each.tl via the
two new functions.
* stdlib/arith-each.tl: New file.
* stdlib/each-prod.tl (sys:expand-each-prod*): Handle sum-each-prod* and
mul-each-prod* in the same way, by mapping to their parallel binding
counterparts.
(sys:expand-arith-each-prod): New function.
(sym-each-prod, mul-each-prod, sum-each-prod*, mul-each-prod*): New
macros.
* tests/016/arith.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (psquare.o): New object file.
* arith.c (psq_ops): New static structure.
(quant_fun): New static function.
(quantile): New function.
(arith_init): Register quantile intrinsic.
* arith.h (quantile): Declared.
* psquare.c, psquare.h: New files.
* tests/016/arith.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue, reported by Paul A. Patience, is that
code like (< 1 "abc") is successfully producing a result.
The root cause is that 1 is an iterable object, and so
is treated as a sequence opposite to the "abc" operand.
We should allow only true sequences in this situation.
* arith.c (seq_lt_compat_check): New static function. Checks
that neither of two sequences is SEQ_NOTSEQ or SEQ_HASHLIKE.
(seq_lt, seq_le): Use seq_lt_compat_check to reject dubious
inputs.
* txr.1: Minor wording change in the related documentation,
removing a gratuitous adjective.
* tests/016/arith.tl: Inequality tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (nary_op_keyfun): Static function removed.
(nary_op_seq, nary_op_seq_keyfun): New static functions.
(sumv, prodv): Static functions removed.
(sum, prod): Reimplement using nary_op_seq and
nary_op_seq_keyfun. Conversion of sequence to
list smuggled via args is gone.
* tests/016/arith.tl: new sum and prod tests.
* txr.1: Note about sum and prod taking an iterable sequence
added.
|
|
|
|
|
|
| |
* tests/016/arith.tl: Test providing coverage for the most
negative two's complement integer, #x-800...00 in various
sizes. The 64 bit cases are failing.
|
|
|
|
|
|
| |
* tests/016/arith.tl: Add tests covering the fixnum/bignum
knee, and ffi operations of various sizes that provide
coverage of various conversion routines.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by user vapnik spaknik.
* lib.c (bracket): Don't rely on the index variable to step
through the arguments, because it only counts fixed arguments.
The args_get function doesn't increment the index beyond
args->fill; when popping arguments from args->list, index
stays unmodified.
* tests/016/arith.tl: Tests for bracket added.
|
|
|
|
| |
* tests/016/arith.tl: Add various digits tests.
|
|
* Makefile (TXR_DBG_OPTS): Suppress for new directory
tests/016.
* tests/016/arith.tl: New file.
* tests/016/arith.expected: New file.
|