| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
the input is a list, and not handling the case
atom -> (atom) like its non-lazy counterpart.
This broke @(next :list expr).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
character literals as hex escapes, followed by semicolon if
necessary. Don't use iswprint function since it is locale-specific
and concludes that non-ASCII characters are unprintable.
Changed print syntax for lazy strings.
(obj_pprint): Changed print syntax for lazy strings.
* parser.l: Bugfix in hex/octal character constant.
num_esc(yytext) was called rather than num_esc(yytext+1).
* parser.y (chrlit): Bugfix: missing case for hex and octal
constants which are given by a LITCHAR token.
* stream.c (vformat): Bugfix: strings were being printed as if using ~a
even under ~s.
|
|
|
|
|
|
|
| |
(sub_str): Bugfix: handle t values of from from and to, and negative
indices, just like sub_vec. Special handling for lazy strings
introduced. If to is the value t, then the a lazy string can be
produced.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(do_eval_args): Allow calls specified by improper lists
like (x y . z) where the z expression must evaluate to a list
that turns into addition arguments to be applied.
(transform_op, expand_op): New static functions.
(expand): Call expand_op.
(eval_init): Initialize rest_s and op_s. Use rest_s
to register rest function.
* lib.c (gensym): New function based on gensymv.
(gensymv): Now calls gensym.
* lib.h (gensym): Declared.
* parser.l: Parse @ followed by digits as a new kind of token,
METANUM.
* parser.y (METANUM): New token.
(meta_expr, exprs): Missing rlcp's added.
(expr): METANUM variant introduced.
(yybadtoken): Handle METANUM.
* txr.1: Documented one-symbol argument list of lambda.
Documented op. Closed some unbalanced parentheses.
* txr.vim: Highlight op.
|
|
|
|
|
|
|
|
| |
passing in an object that is not a hash results in corruption
or crashing behavior.
* lib.c (class_check): Improved to a one-step check with a clear
message.
|
|
|
|
| |
* lib.c (replace_list): Fix code that is valid C++ but not C.
|
|
|
|
|
|
|
|
|
|
|
| |
even in the trivial case that an empty list is being replaced.
Allow a string to be the replacement (split into a list of
characters).
(replace_str): Bugfix in assignment from vector; wrong index
used over source vector.
(split_str): If the splitting set is empty, just split the
string into characters instead of getting into an infinite loop.
(replace_vec): Allow replacement source to be a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (dwim_loc): Assignments to string indices and ranges
supported. New arguments for this purpose.
(op_modplace): Use new dwim_loc interface for returned value.
(op_dwim): Support assignment to string ranges.
(eval_init): replace_str registered.
* lib.c (string_extend): If the argument is a number, let it
specify the amount by which to extend the string.
(replace_str): New function.
* lib.h (replace_str): Declared.
* txr.1: Updated.
* txr.vim: Updated.
|
|
|
|
| |
consistent with vecref and ranges.
|
|
|
|
| |
is not a character or string instead of silently returning nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of range arguments. They are already evaluated since the cons
expression is evaluates as part of the dwim arglist.
Replaced some open code with function calls to the new listref
and listref_l functions.
(tostring, tostringp): made extern and moved to lib.c.
* lib.c (listref, listref_l): New functions.
(tostring, tostringp): moved here from eval.c.
* lib.h (listref, listref_l, tostring, tostringp): Declared.
* match.c (format_field): Handle index and range references.
* txr.1: Documented new output variable syntax.
|
|
|
|
|
|
|
| |
* lib.c (sub_list, replace_list, sub_vec, replace_vec):
Allow the value t to specify one element past the end, so that t t
refers to zero-length sequence just past the end of the array or list.
Also, fixed out of bounds memmoves in replace_vec.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (sub_list, replace_list, vectorp): New functions.
(sub_vec): Allow negative indices from end of array.
(replace_vec): New function.
* lib.h (sub_list, replace_list, vectorp, replace_vec): Declared.
* parser.l (DOTDOT): Scan .. as new token.
* parser.y (DOTDOT): New token.
(expr): New syntax with DOTDOT.
(yybadtoken): Handle DOTDOT.
* txr.vim: Added new functions. Also missing append* and dwim.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(dwim_loc, op_dwim): New static functions.
(op_modplace): Support assignment to dwim forms
with the help of dwim_loc.
(expand_place): Handle dwim places.
(eval_init): Initialize dwim_s. Register dwim operator
in op_table.
* eval.h (dwim_s): Declared.
* lib.c (chr_str, chr_str_set): Allow negative indices to index
backwards from end of string.
(vecref, vecref_l): Allow negative indices to index from
rear of array.
(obj_print, obj_pprint): Render (dwim ...) forms as [...].
* parser.l: Peoduce new METABKT token type for @[,
and '[', ']' tokens.
* parser.y (METABKT): New token. %type declaration for '['.
(list): Support square-bracket style of list, translated
into dwim form.
(meta_expr): Support @[...] variant.
(yybadtoken): Handle METABKT in switch.
* txr.1: Documented [...] syntax and dwim operator.
* txr.vim: Updated.
|
|
|
|
| |
force function if it is already nil, and set it to nil afterward.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (list_str): New function.
* lib.h (list_str): Declared.
* txr.1: Doc stub section created.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (prog1_s, gen_s, generate_s, delay_s, promise_s): New symbol
variables.
(eval_prog1, op_prog1, expand_gen, expand_delay): New static functions.
(expand): Handle gen and delay.
(lazy_mapcar_func, lazy_mapcar, lazy_mapcarv_func, lazy_mapcarv,
lazy_mappendv): New static functions.
(rangev_func, rangev, generate_func, generate, repeat_infinite_func,
repeat_times_func, repeatv, force): New static functions.
(eval_init): New operators and functions interned.
lazy-flatten renamed to flatten*.
* lib.c (null_f): New global variable.
(ltail, lazy_appendv): New functions.
(lazy_appendv_func): New static function.
(obj_init): null_f protected and initialized.
* lib.h (null_f, ltail, lazy_appendv): Declared.
* txr.1: Documented.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
| |
* lib.c (gensym_counter): New variable.
(gensymv): New function.
(obj_init): Initialize gensym_counter.
* lib.h (gensym_counter, gensymv): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c:x (lazy_flatten_scan, lazy_flatten_func): New static functions.
(lazy_flatten): New function.
* lib.h (lazy_flatten): Declared.
* match.c (v_next): Use lazy_flatten instead of flatten for
processing a :list source. This means that @(next :list ...)
can be used to process infinite lazy lists.
* txr.1: Documented lazy-flatten.
|
|
|
|
|
|
|
|
|
|
|
| |
(some_satisfy): Return the first non-nil result, rather than t.
(all_satisfy): Return the value of the last item, if all items
are processed.
* lib.h (memql): Declared.
* txr.1: Documented memq, memql, memqual, tree-find, some,
all, none, eq, eql and equal.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: Includes rand.h header.
(eval_init): New variable and functions from rand module registered.
* lib.c: Includes rand.h header.
(init): Call rand_init.
* rand.c: New file.
* rand.h: New file.
|
|
|
|
|
|
|
|
| |
* lib.c (cat_vec): New function.
* lib.h (cat_vec): Declared.
* txr.1: Documentation stub.
|
|
|
|
|
|
|
|
| |
* lib.c (copy_vec, sub_vec): New functions.
* lib.h (copy_vec, sub_vec): Declared.
* txr.1: Stub sections created.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Registered new functions: symbol-function,
func-get-form, func-get-env, functionp, interp-fun-p.
* lib.c (nappend2, getplist_f, improper_plist_to_alist):
tail variable renamed to avoid clash in macro.
(func_get_form, func_get_env, interp_fun_p): New functions.
* lib.h (func_get_form, func_get_env, interp_fun_p): Declared.
(list_collect): Fix macro not to throw error, but handle the case.
* match.c (vars_to_bindings, extract_bindings): tail variable
renamed to avoid clash in macro.
* txr.1: Documentation stubs.
|
|
|
|
| |
(vector_list): Wrong zero used, resulting in vector(nil) being called.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy_list): Use list_collect_append rather than
list_collect_terminate.
(append2, appendv): Simplified using new list_collect_append.
(nappend2): Simplified using new list_collect_nconc.
* lib.h (list_collect): Added check for accidental usage
of list_collect after list_append, since PTAIL has different
semantics.
(list_collect_nconc, list_collect_append): Semantics fixed so that
append collecting works more like the Common Lisp append function,
allowing trailing atoms or a lone atom. The meaning of PTAIL is
changed, however. Now PTAIL actually tracks the head of the most
recently appended segment. Each append operation has to first
traverse the previously added piece to get to the end.
(list_collect_terminate): Macro removed.
* match.c (v_gather): Removed useless use of list_collect_terminate.
* parser.y: Some headers added that are needed by list_collect.
* txr.1: Documented append, list, atom, null, not, consp, make-lazy-cons,
lcons-fun, listp, proper-listp, length-list, mapcar, mappend, and apply.
|
|
|
|
|
|
|
|
| |
after calling it.
(rplacd): Do not set the lazy cons function to nil
in.
* txr.1: Documented a bunch of functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renamed vec_set_fill to vec-set-length.
* hash.c (equal_hash): vec_fill to vec_length name change.
(hash_grow, make_hash): No need to call vec_set_length.
* lib.c (equal, vecref, vec_push, length_vec, list_vector,
obj_print, obj_pprint): vec_fill to vec_length name change.
(vector): Argument now represents actual length, not just allocated
size.
(vec_get_fill): Function removed; did exactly the same thing
as length_vec.
(vec_set_fill): Function renamed to vec_set_length.
(vector_list): Allocate a 0 length vector initially.
* lib.h (enum vecindex): member changes name from vec_fill
to vec_length.
(vector): Parameter name changed.
(vec_set_fill): Redeclared.
(vec_get_fill): Declaration removed.
* txr.1: Doc stubs updated.
|
|
|
|
|
|
|
|
| |
Ignore the return value of the lazy cons function: do not
return nil if the function returns nil.
This useless behavior was a source of inconvenience in lazy
cons programming, requiring the lazy function to return
non-nil in addition to installing the car and cdr fields.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions interned.
* lib.c (num_chr, chr_num): New functions.
* lib.h (num_chr, chr_num): Declared.
* txr.1: Documentation stubs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(abso, isqrt): New functions.
(isqrt_fixnum): New static function.
* eval.c (eval_init): Registered abs, sqrt and numberp instrinsics.
* lib.c (numberp): New function.
* lib.h (numberp, abso, isqrt): Declared.
* mpi-patches/series: New patch added.
* mpi-patches/faster-square-root: New patch added.
* txr.1: Documentation stubs for new functions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registering new intrinsic functions,
reduce-left, reduce-right and expt.
* lib.c (minusv): Return one instead of num(1).
(exptv, reduce_right): New functions.
* lib.h (expt, exptv, reduce_right): Declared.
* txr.1: Blank sections for new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with bignum support.
* eval.c (eval_init): Added bignump and zerop as intrinsic function.
Renamed numberp to fixnump.
* lib.c (zerop, gt, lt, ge, le): Functions removed.
(numeq): Unused function removed.
* lib.h (numeq): Declaration removed.
* txr.1: Sections for zerop and bignump created. Changed reference
to numberp to fixnump.
|
|
|
|
|
|
| |
(mod): New function, reimplementation of removed mod from lib.c.
* lib.c (mod): Function removed.
|
|
|
|
|
|
|
|
|
|
|
| |
code like 1 << n, where n exceeds the width of the type int.
* arith.c (trunc): New function, reimplementation of removed
trunc from lib.c.
* lib.c (trunc): Removed.
* mpi-patches/fix-bad-shifts: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c: Regenerated.
* arith.txr (CNUM_BIT): New constant.
(bignum, bignum_dbl_ipt): New static functions.
(@{add-fname}): Use bignum function.
(mul): New functions, rewrite of mul from lib.c.
* lib.c (mul): Function removed.
* mpi-patches/add-mp-set-intptr (mp_set_intptr): Revised patch.
Local variable v should be int_ptr_t not unsigned long.
Also, the mp_set interface doesn't set the sign; it's an unsigned
interface. We must do that ourselves.
* mpi-patches/fix-mult-bug: The main multiplication function is
also broken in the same way, requiring the cast.
* mpi-patches/mpi-set-double-intptr: Fixed use of wrong type for
local variable v.
|
|
|
|
| |
with an initial element of 1.
|
|
|
|
| |
with an initial element of zero.
|
|
|
|
|
|
|
|
|
|
|
| |
(NOOP): New macro.
(plus): Use NOOP macro.
(minus, neg): Function moved here from lib.c and rewritten
for bignum support.
* lib.c (minus, neg): Functions removed.
* arith.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bignums, based on Michael Fromberger's MPI library, are integrated
into the input syntax, stream output, equality testing, the garbage
collector, and hashing.
The plus operation handles transitions between fixnums and bignums.
Other operations are still fixnum only.
* Makefile (CFLAGS): Add mpi directory to include file search.
(OBJS): Include new arith.o module and all of MPI_OBJS.
(MPI_OBJS, MPI_OBJS_BASE): New variables.
* configure (mpi_version, have_quilt, have_patch): New variables.
Script detects whether patch and quilt are available. Unpacks
mpi library, applies patches. Detects 128 bit integer type.
Records more information in config.h about the sizes of types.
* dep.mk: Updated.
* depend.txr: Make work with paths that have directory components.
* eval.c (eval_init): Rename of nump to fixnump.
* gc.c (finalize, mark_obj): Handle BGNUM case.
* hash.c: (hash_c_str): Changed to return unsigned long
instead of long.
(equal_hash): Handle BGNUM case.
(eql_hash): Handle bignums with equal-hash, but other
objects as eq.
* lib.c (num_s): Variable renamed to fixnum_s.
(bignum_s): New symbol variable.
(code2type): Follow rename of num_s. Handle BGNUM case.
(typeof): Follow rename of num_s.
(eql): Handle bignums using equal, and other types using eq.
(equal): Handle BGNUM case.
(chk_calloc): New function.
(c_num): Wording change in error message: is not a fixnum.
(nump): Renamed to fixnump.
(bignump): New function.
(plus): Function removed, reimplemented in arith.c.
(int_str): Handle integers which are too large for wcstol
using bignum conversion. Base 0 is no longer passed to
wcstol but converted to 10 because the special semantics
for 0 would be inconsistent for bignums.
(obj_init): Follow rename of num_s. Initialize bignum_s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enter stopped working. This was broken by recent bugfixes in the
string splitting functions, which introduced a semantics change.
* eval.c (flip_s, vecref_s): New symbol variables.
(op_modplace): New places (vecref ...) and (flip ...). Bugfix: dec
operator was incrementing.
(expand_place): Handle vecref and flip. Bugfix: pop has no
third argument and so is now handled by the same case as flip.
Bugfix: if a modify form has no third argument, then do not
resynthesize it with a nil third argument.
(eval_init): Initialize new symbol variables.
Register new flip operator. Register new list_vectory function
as intrinsic.
* lib.c (rplacd): When modifying the cdr field of a lazy cons,
then lapse the lazy function to nil! This is needed by user-defined
lazy conses, and it makes sense to do it this way rather than
put in some explicit interface.
(list_vector): New function.
* lib.h (list_vector): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): New intrinsics.
* hash.c (struct_hash): assoc_fun parameters reversed.
(gethash, gethash_f, gethash_n): Likewise.
* lib.c (assoc, assq): Reversing parameters.
(find_package, acons_new, acons_new_l, aconsq_new): Reversing
arguments to assoc adn assq.
* lib.h (assoc, assq): Declarations updated.
* match.c (dest_set, dest_bind, h_var, h_coll, h_parallel, h_fun,
subst_vars, do_txeval, v_next, v_parallel, v_gather, v_collect,
v_flatten, v_cat, v_output, v_filter, f_fun, match_funcall):
Reversing arguments to assoc.
* unwind.c (uw_get_func, uw_exception_subtype_p, uw_register_subtype):
Reversing arguments to assoc.
* txr.1: Blank sections created for new functions.
|
|
|
|
|
|
| |
* lib.c (chr_toupper, chr_tolower): New functions.
* lib.h (chr_toupper, chr_tolower): New functions declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (c_num): Generalized to convert characters to numbers also.
This allows functions like gt and lt to work with characters.
(chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl, chr_isdigit,
chr_isgraph, chr_islower, chr_isprint, chr_ispunct, chr_isspace,
chr_isupper, chr_isxdigit): New functions added.
* lib.h: (chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl,
* chr_isdigit, chr_isgraph, chr_islower, chr_isprint, chr_ispunct,
* chr_isspace, chr_isupper, chr_isxdigit): New functions declared.
(c_true): New macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
warning.
(eval_init): New functions registered: typeof and vector functions,
as well as length_list.
* lib.c (length): Function renamed to length_list, because it is
list specific.
(length_vec, size_vec, vector_list): New functions.
(length): New function, generic over lists, vectors and strings.
* lib.h (length_list, length_vec, size_vec, vector_list): Declared.
* match.c (h_var, h_fun, robust_length, v_deffilter, v_fun): Use
length_list instead of length.
* parser.l: Introduced # token.
* parser.y (vector): New nonterminal.
(expr): vector is a kind of expr.
(chrlist): Bugfix: single-character syntax was not working;
for instance #\x to denote the charcter x.
(lit_char_helper): Use length_list instead of length.
* stream.c (string_in_get_line): Bugfix: this was using
the wrong length function: length was being applied to a string.
The genericity of length makes that correct now, but changing
to length_str anyway.
* txr.1: Blank sections created for functions. Vector syntax
documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New intrinsic functions.
* lib.c (rplaca, rplacd, lcons_fun): New functions.
(make_lazycons): Renamed to make_lazy_cons, relocated
and turned into external function.
(lazy_stream_func, lazy_stream_cons): Follow rename
of make_lazycons.
* lib.h (rplaca, rplacd, make_lazy_cons, lcons_fun):
Declared.
* txr.1: Stub sections created.
|
|
|
|
| |
the input string.
|
|
|
|
| |
at all.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the sequencing! Making it an inline function broke the tests.
But we can't have multiple evaluation either, so it's going to use
a temporary lexical variable.
(uses_or2): Macro which declares the lexical variable needed by or2.
* debug.c (debug): add uses_or2.
* eval.c (eval_intrinsic, op_modplace): Likewise.
* lib.c (lazy_str, lazy_str_force_upto, lazy_str_get_trailing_list):
Likewise.
* match.c (h_parallel, v_freeform, v_parallel, v_output): Likewise.
* parser.y (unquotes_occur): Likewise.
* stream.c (format): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
conditionally generated in config.h.
* gc.c (break_obj): New static variable.
(mark_obj): Debugging feature: if the object is the one stored in
break_obj and not yet reached, then call breakpt.
(deheap): New debugging function for viewing regions of the heaps.
* lib.c (breakpt): New function.
* lib.h (breakpt): Declared.
|