| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* txr.1: Fix "stream is recorded in a hidden." and revise
some neighboring text for clarity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/constfun.tl (%const-foldable-funs%): Numerous
functions added, mostly new ones.
(%effect-free-funs%): Indentation fixed. Some functions
added, but also removed. We don't want anything in here that
could take a functional argument. The optimizer will blindly
a call to an effect-free function, if its result is not
used, regardless of what the arguments are. It won't take into
consideration that there is a functional argument, which could
be a function that has a side effect, and that is called
by the supposedly effect-free function. So for instance, sort
is out; the comparison or key functions could have side effects.
We could put these functions into a special category.
|
|
|
|
|
| |
* txr.1: Fix bad formatting in syntax synopsis of
command-get-buf.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/getput.tl (sys:maproc-common): new function.
(map-command-lines, map-command-str, map-command-buf,
map-process-lines, map-process-str, map-process-buf):
New functions.
* autoload.c (getput_set_entries): Trigger autoload
of getput module on new function symbols.
* tests/018/getput.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* lib.[ch] (lcons_force): New function.
* eval.c (eval_init): Register lcons-force intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Regenerated.
|
|
|
|
|
|
|
|
| |
* test/012/fini.tl: Pass t to sys:gc to request full
garbage collection. Otherwise the output may be reordered,
due to some of the objects made earlier in the test case
being promoted to the mature generation and thus not
finalized by the (sys:gc) call.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_append2, seq_appendv, seq_nconc2,
seq_nconcv): New functions.
(append2, appendv, nappend2, nconcv): Now implemented
using new functions.
* lib.h (seq_append2, seq_appendv, seq_nconc2,
seq_nconcv): Declared.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): Remark about lecithin.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (window_map_common): New static function formed
from window_map_list.
(window_map_list, window_map_vec): Function removed.
(window_map, window_mappend, window_mapdo): Simplify
to wrappers around window_map_common.
* txr.1: Some wording improved in the window-map
documentation.
|
|
|
|
|
|
| |
* Makefile (STDLIB_EARLY_TLOS): Include place.tlo between
compiler.tlo and asm.tlo. If place is built late, it
has a bad impact on the build time.
|
|
|
|
| |
* txr.1: fix incorrect markup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When tests/012/compile.tl compiles tests/012/seq.tl, there
are now some compiler warnings due to constant expressions
that throw. We introduce a new compiler option to suppress
them, and then use it.
* stdlib/comp-opts.tl: New file. The definitions related
to compiler options are moved here out of compile.tl,
so that optimize.tl can use them.
* stdlib/compiler.tl (compile-opts, %warning-syms%,
when-opt, *compile-opts*, opt-controlled-diag): Moved to
comp-opts.tl. New constant-throws option added to
compile-opts and %warning-syms%.
(safe-constantp): Make the constant expression throws
diagnostic conditional on the new option.
* stdlib/optimize.tl: Load comp-opts file.
(basic-blocks do-peephole-block): Make diagnostic
about throwing situation subject to constant-throws
option.
* tests/012/seq.tl: Turn off constant-throws warning
option before the ref tests that work with ranges.
Fix: one of the expressions calls refs with the
wrong number of arguments, which was unintentional.
* txr.1: Document new diagnostic option.
|
|
|
|
|
|
| |
* lib.c (rfind): We combine the default case with
SEQ_LISTLIKE and use the seq_iter abstraction rather
than car/cdr.
|
|
|
|
|
|
|
| |
* lib.c (find): We retain the optimization for strings when
the comparison is regular equality (eq, eql, equal). The
other cases are handled by seq_iter rather than separate
list-like and vector-like cases.
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Under call function, document that callable
objects need not be functions; the dwim operator
description has the details.
Fix a formatting problem in the dwim operator
syntax synopsis. Under dwim, clarify in more detail
that the behavior for various objects are a consequence
of their function calling semantics, rather than
inherent in the dwim operator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because ranges can be iterated like sequences, and are
identified as vector-like, they have to support indexing.
However, ranges already have semantics as a function:
with a sequence argument, they slice it.
Let's put the semantics into a function called rangeref,
so it can be coherently documented.
* eval.c (eval_init): Register rangeref intrinsic.
* lib.c (generic_funcall): Range as a function works in
terms of rangeref.
(ref): Handle RNG case via rangeref.
(rangeref): New function.
* lib.h (rangeref): Declared.
* tests/012/seq.tl: New tests.
|
|
|
|
|
| |
* lib.c (list_vec): use ucnum rather than int
for the index and length variables.
|
|
|
|
|
|
| |
* lib.c (unique): Build output using seq_build_t, rather
than consing up a list which is then converted to the desired
sequence type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (MAP_ALLOCA_LIMIT): New preprocessor symbol.
(map_common): If the number of args is greater than
MAP_ALLOCA_LIMIT, then allocate the array of seq_iter_t
structures from chk_malloc rather than alloca.
In case an exception might be thrown during the execution
of this function, we bind that memory to a buf object.
If we return normally, we call the new function buf_free
to release it. Otherwise we rely on the garbage collector.
* buf.[ch] (buf_free): New function.
* tests/012/seq.tl: Test case which hits this behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_pa_12_1_v, pa_12_1_v): Static functions removed.
(transposev, transpose): Functions removed.
* lib.c (transposev, transpose): Declarations removed.
* eval.c (join_f): New global variable.
(zip_fun, zipv, transpose): New static functions.
(eval_init): gc-protect join_f, and initialize it.
Registration of zip intrinsic goes to zipv rather
than transposev. sys:fmt-join and join registered
with help of global join_f rather than local.
* tests/012/seq.tl: New zip test cases.
|
|
|
|
|
|
|
|
| |
* txr.1: All arguments that give a list of indices into a
sequence are called index-seq, because they are not required
to be lists. Only the COMPATIBILITY section refers to
index-list arguments, mentioning that those arguments are
now called index-seq.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_func, split_func, split_star_func):
Indices passed through lazy cons are now iterator,
rather than a sequence accessed via car and cdr,
which is inefficient for nonlists.
(partition-split-common): Use iter-begin to convert
indices to iterator, which becomes the cdr field of
the lazy cons.
* txr.1: Update documentation for these functions to clarify
that the second argument is a sequence. The inaccurate
text claiming that "if the second argument is an atom
other than a function" is rewritten. This doesn't describe
the behavior that is implemented, where the test applied
is seqp, not atom. The indices can be a vector of integers,
which is an atom.
|
|
|
|
|
| |
* lib.c (partition_if_func): Instead of list_collect_decl
and make_like, use seq_build.
|
|
|
|
|
|
|
|
| |
* lib.c (partition_by_func): The seq object is now
an iter object: use iter_more, iter_item and iter_step
rather than non-null test, car and cdr.
(partition_by): Obtain iterator for sequence using
iter_begin, and use that in its place.
|
|
|
|
|
| |
* lib.c (partition_by_func): Use seq_build instead of
list_collect_decl and make_like.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's have both a seq_pend and seq_nconc, where seq_nconc
can reuse the pieces of list passed to it.
* lib.h (struct seq_build_ops): New member, nconc.
(seq_build_ops_init): Add nconc parameter and initializer.
(seq_nconc): Function declared.
* lib.c (seq_build_list_pend): Switch to list_collect_append,
otherwise mappend behaves destructively.
(seq_build_list_nconc): New function.
(sb_vec_ops, sb_str_ops, sb_buf_ops, sb_struct_ops,
sb_carray_ops): Use seq_build_generic_pend for nconc
operation.
(sb_list_ops): Use new seq_build_list_nconc for nconc
operation.
(sb_finished_ops): Use null pointer for nconc operation.
(seq_nconc): New function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We want to use the list_collect functions for consistency.
For instance, these functions allow an atom to be added
to an improper list if the terminating atom is a sequence.
(append '(1 . "abc") "d") yields (1 . "abcd").
* lib.h (struct seq_build): New member, tail.
* lib.c (seq_build_list_add): Use list_collect.
(seq_build_list_pend): Use list_collect_nconc.
(seq_build_list_finish): Nothing to do here, except
call seq_build_convert_to_finished since bu->obj
is the head of the list at all times now.
(seq_build_improper_add, seq_build_improper_pend):
Functions removed.
(sb_improper_ops): Structure removed.
(seq_build_convert_to_improper): Function removed.
(seq_build_convert_to_list): Different strategy needed
here now. The list just goes into bu->obj, and we have
to set up the tail to either point to the last cons
cell's cdr, or else to bu->obj if the list is empty.
(seq_build_init): Initialize bu->tail in the three cases
that set up list collection.
|
|
|
|
| |
* lib.c (sb_vec_ops): fix indentation.
|
|
|
|
|
|
| |
* lib.c (seq_build_struct_finish, seq_build_carray_finish):
Do not call seq_build_convert_to_finished, since
seq_build_list_finish has already done that.
|
|
|
|
|
|
|
|
| |
* lib.c (seq_build_improper_finish): Function removed.
(sb_improper_ops): Replace seq_build_improper_finish
with null pointer. The seq_finish function checks for
null and avoids calling, so we don't need the noop
implementation.
|
|
|
|
|
|
|
|
| |
* lib.c (seq_build_convert_to_finished): New function.
(seq_build_list_finish): call seq_build_convert_to_finished.
(sb_finished_ops): New static struct. All operations
except mark are null pointers so this will crash if
used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (mapcar): Implement with seq_iter and seq_build,
rather than relying on mapcar_listout and make_like.
(mappend): Replace list_collect_decl and make_like
with seq_build.
* eval.c (map_common): Replace list_collect_decl and
make_like with seq_build. The collect_fn is now a pointer
to either seq_add or seq_pend rather than list_collect
or list_collect_append.
(mapcarv, mappendv): Pass seq_add and seq_pend to
map_common, rather than list_collect and list_collect_append.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To be useful for some operations, the seq_build framework
must handle the pend operation on lists specially.
The appended piece must only be treated as a sequence if
it is a cons. Moreover, if it is an atom, or of it is
an improper list, then the list terminates. Subsequent
add and pend operations must fail. The atom must appear
as the terminator. We meet these objectives by switching
the object's operations, sb_list_ops, to a new set of
operations, sb_improper_ops.
* lib.c (seq_build_list_pend): New static function.
This individually adds all items from the input
list, until it hits a terminating atom. If the
atom isn't nil, it converts the seq_build_t object
to improper operations.
(seq_build_improper_add, seq_build_improper_pend):
New static functions. These throw an error:
adding anything to an improper list is impossible.
(seq_build_improper_finish): New function, which
does nothing: the improper list is finished already.
(sb_list_ops): Use the seq_build_list_pend operation
rather than the generic one.
(sb_improper_ops): New static structure.
(seq_build_convert_to_improper): New static function.
Finishes the list, giving it the specified terminating
atom, and then switches to sb_improper_ops so that
adding is no longer possible.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (tuples_func): Replace list accumulation
with make_like with seq_build.
* tests/012/seq.tl: Fix one test case here which no
longer errors out. It produces a tuple which is not
a string, due to the inclusion of a non-character
object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the make_like function, the list is converted to
string or buffer if the first element of the list
is a character, or integer. We need similar logic in
seq_build. We can make it better. When any item is
added which is incompatible, we can convert what we
have so far to a list, change the seq_build type
to list, and keep going.
* lib.c (seq_build_convert_to_list): New static
function.
(seq_build_str_add, seq_build_buf_add): If the item
is incompatible, convert the string or buffer to
a list and pass to seq_build_convert_to_list.
Then call bu->ops->add to add the item, now as a list.
(seq_build_buf_pend): Function removed.
(sb_buf_ops): Use the seq_build_generic_pend function
for the pend operation. This is because we have to
check each item one by one; we cannot use replace_buf.
|
|
|
|
|
|
|
| |
* lib.c (seq_build_struct_finish, seq_build_carray_finish):
These functions are still wrongly assuming that the list
is finished by nreverse. We intead call seq_build_list_finish
for that, which puts the list back into bu->obj.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (struct seq_build): New member, self.
(struct seq_build_ops): Remove self parameter from
pend function.
(seq_build_init, seq_pend): Declarations updated.
* lib.c (seq_build_generic_pend): Drop self parameter,
take the value from structure.
(seq_build_buf_pend): Drop self parameter.
(seq_build_init): New self parameter. Pass recursively.
(seq_pend): Self parameter dropped.
(rem_impl, rem_if_impl, keep_keys_if, separate, separate_keys):
Pass self to seq_build_init.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_build_list_add, seq_build_list_finish):
We use the trick that bu->obj (if not nil) points
to the tail cons cell of the list being built, and
the cdr of that tail always points back to the head.
To finish the list, all we do is nil out that head
pointer, so the list is properly terminated, and then
plan the head as bu->obj.
|
|
|
|
| |
* lib.h (struct seq_build): Remove inf member.
|
|
|
|
| |
* lib.c (separate_keys): Rewrite using seq_info and seq_build.
|
|
|
|
|
| |
* lib.c (separate): switch statement with type-specific
coding replaced with generic sequence iteration and building.
|
|
|
|
|
|
| |
* lib.c (seq_build_init): Replicate a feature of make_like:
if the reference object is an iterator, then we recurse: we
initialize according to the object it is iterating.
|
|
|
|
|
| |
* lib.c (keep_keys_if): Replace with generic sequence
iteration and building.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just as the "seq_iter" iterators help to condense
the code for iterating any kind of sequence, "seq_builder"
objects solve the problem of producing a sequence of the
same kind as an input sequence.
Until now, two approaches have been taken for this. One
was to have separately coded cases: code iterating over
a string building up a string, and so on. The other has
been to produce a list, which is then coerced to the
right sequence type using make_like.
The approach introduced here is similar to using
make_like, but without wastefully consing up a temporary
list.
The remove-if, remqual, remql, remq and keep-if functions
are retargetted to this new abstraction.
* lib.h (struct seq_build, seq_build_t): New struct type.
(struct seq_build_ops): New struct type.
(seq_build_ops_init): New macro.
(seq_build_init, seq_add, seq_pend, seq_finish): Functions
declared.
* lib.c (seq_build_generic_pend, seq_build_obj_mark,
seq_build_struct_mark, seq_build_carray_mark,
seq_build_vec_add, seq_build_str_add, seq_build_buf_add,
seq_build_buf_pend, seq_build_buf_finish, seq_build_list_add,
seq_build_list_finish, seq_build_struct_finish,
seq_build_carray_finish): New static functions.
(sb_vec_ops, sb_str_ops, sb_buf_ops, sb_struct_ops,
sb_carray_ops, sb_list_ops): New static structs.
(seq_build_init, seq_add, seq_pend, seq_finish): New
functions.
(rem_impl, rem_if_impl): Reworked in terms of seq_iter
and seq_build, becoming much shorter, and handling all
iterable objects.
|
|
|
|
|
|
|
| |
* lib.c (rem_if_impl): New static function, based on renaming
remove_if, and adding a self parameter.
(remove_if): Now wrapper around rem_if_impl.
(keep_if): Retarget to rem_if_impl, passing "keep-if" name.
|
|
|
|
|
|
| |
* txr.1: Add Rationale: section to let and let* clarifying
that the decision to make let parallel is for compatibility
with other dialects like ANSI CL and Elisp.
|
|
|
|
| |
* quips.tl (%quips%): New dad humor.
|
|
|
|
|
| |
* txr.1: Fix typo: for -> form; add missing leading
indentation in example.
|
|
|
|
|
|
| |
* stdlib/compiler.tl (simplify-variadic-lambda): Use
cons-count to find occurrences of the rest variable
rather than flatten and count.
|