| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce a mapfun argument to these functions so that they
can additionally transform the accumulated values.
The keep-keys-if function is now implemented through the same
helper function as keep-if but with the mapfun argument
defaulting to a copy of the keyfun argument.
* eval.c (eval_init): Update registrations of remove-if,
keep-if and keep-keys-if to new arities of C functions.
* lib.c (rem_if_impl): Implement new optional mapfun
parameter.
(remove_if, keep_if): Add mapfun parameter.
(keep_keys_if): Implement via rem_if_impl, and add
mapfun argument. We do the defaulting of keyfun here,
so that we can then use that argument's value to default
mapfun.
* lib.h (remove_if, keep_if, keep_keys_if): Declarations
updated.
* tests/012/seq.tl: Couple of test cases exercising mapfun
argument of keep-if and remove-if.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zip and transpose should allow non-character data
when the leftmost column is a string, falling back
on making lists, like seq_build.
We can't use seq_build as-is because of the special
semantics of transpose/zip with regard to strings.
We introduce a "strcat" variant of seq_build
for this purpose.
* lib.c (seq_build_strcat_add): New static function.
(sb_strcat_ops): New static structure like sb_str_ops,
but with seq_build_strcat_add as the add operation,
which allows string arguments to be appended to the
string rather than switching to a list.
(seq_build_strcat_init): New function.
* lib.h (seq_build_strcat_init): Declared.
* eval.c (zip_strcat): New static function; uses
seq_build_strcat_init.
(zipv): Only recognize strings specially; all else goes
through the existing default case.
Strings use zip_strcat.
* tests/012/seq.tl: New test case.
* txr.1: Describe special semantics of zip/tranpose;
previously only documented in one example.
Clarify that the rows are only sequences of the
same kind as the leftmost column if possible,
otherwise lists. Remove text which says that it's an error
for the other columns to contain non-string, non-character
objects if the leftmost column is a string.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (make_like): Simplify implementation using seq_build,
which also lets it handle more cases.
* tests/012/seq.tl: New tests. Some existing test fixed,
including one for tuples*.
* txr.1: Documentation updated: mainly that make-like
doesn't strictly require a list argument.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (zip_fun): Renamed to seq_like.
(zipv): Follow rename of zip_fun.
(eval_init): Register seq-like intrinsic.
* tests/seq.tl: Some tests for make-like and seq-like,
revealing a difference: make-like needs to be
rewritten to use seq_build.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.h (struct parser): New member, read_json_int.
* parser.c (read_json_int_s): New symbol variable
for *read-json-int* symbol.
(parser_common_init): Look up value of *read-json-int*
and store in read_json_int struct member.
(parse_init): Initialize read_json_int_s with interned
symbol and also register the dynamic variable.
* parser.l (grammar): Extend the {JNUM} rule to check
the read_json_int flag and produce an integer value if
the lexeme does not contain a decimal point, e or E.
* tests/010/json.tl: New tests.
* txr.1: Documented.
* lex.yy.c.shipped: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.h (slotset_s, static_slot_s, static_slot_set_s): New
symbol variables declared.
(enum special_slot): New enum symbols: slot_m, slotset_m,
static_slot_m, static_slot_set_m.
* struct.c (slotset_s, static_slot_s, static_slot_set_s): New
symbol variables.
(special_sym): Associate new symbols with new enums.
(struct_init): Intern slotset, static-slot and static-slot-set
symbols, initializing the variables. Change the registrations
of the same-named functions to use the variables.
(slot, maybe_slot, slotset, static_slot, static_slot_set):
In the no-such-slot case, check for the special method and
call it.
* tests/012/oop.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New intrinsic functions find-maxes and
find-mins.
* lib.[ch] (find_maxes, find_mins): New function.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): register intrinsics wheref, whereq,
whereql and wherequal.
* lib.c (wheref_fun): New static function.
(wheref, whereq, whereql, wherequal): New functions.
* lib.h (wheref, whereq, whereql, wherequal): Declared.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_func, split_func, split_star_func):
When negative indices occur after the sequence has already
been shortened, the conversion to positivce must take into
account the base. This must be added so that the positive
index produced is relative to the original length of the input
sequence. When index_rebased is calculated, the base is
subtracted out again. If we based the positive index off the
shortened length, it's as if we are subtracting base twice.
* tests/012/seq.tl: Dubious test cases for split* are replaced
with the new results that make sense. Additional test cases
are added which cover this issue, for not only split* but
split and partition.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_func, split_Star_func): Ignore indices greater
than the length of the sequence, the same as negative indices
are ignored which don't become nonnegative after adding the
length.
* tests/012/seq.tl: Fix questionable test cases, which
now confirm the right behavior.
|
|
|
|
| |
* tests/012/seq.tl: New tests.
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_star_func): In empty index case, convert
sequence via sub(seq, zero, t), so that ranges are properly
expanded. This was done in split_func and partition_func in
recent commits.
* tests/012/seq.tl: Test cases added.
|
|
|
|
|
|
| |
* tests/012/seq.tl: Add tests for split* that were lost
in some editing. Corresponding tests exist for split
already and for partition.
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_func): In empty index case, convert
sequence via sub(seq, zero, t), so that ranges are
properly expanded. This was done in partition_func
in the previous commit.
* tests/012/seq.tl: Test cases added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_func): In empty index list case, run
the sequence through sub(seq, zero, t) so that ranges
are expanded: e.g. 1..3 becomes (1 2).
The corresponding code in split_func
and split_star_func also needs this fix, but the
current test cases don't reproduce a problem.
(partition_split_common): Likewise here.
* tests/012/seq.tl: Tests for split, split* and partition.
Some tests have questionable results. We accept these
as they are for now; will address these.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is like @(scan) but collects all matches over the
suffixes of the list.
* autoload.c (match_set_entries): Intern scan-all symbol.
* stdlib/match.tl (compile-scan-all-match): New function.
(compile-match): Dispatch compile-scan-all-match on scan-all
symbol.
* tests/011/patmatch.tl: Tests for scanall and also missing
tests for scan.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (iter_begin, iter_more, iter_item, iter_step,
iter_reset, copy_iter): Handle FLNUM like NUM, so that we
don't wastefully return a dynamic iterator object.
* tests/012/iter.tl: Test cases for numeric and character
iteration. Test cases for iter-begin on some basic types.
copy-iter test for floats.
|
|
|
|
|
| |
* tests/012/iter.tl: Test copy-iter for lists, vectors,
integers, characters, strings, string ranges, numeric ranges.
|
|
|
|
| |
* tests/015/comb.tl: New tests.
|
|
|
|
|
|
|
| |
* test/012/oop-seq.tl: Add tests that verify that an OOP iter
without a copy method cannot be copied with copy-iter,
and that one which has the method can be copied, in
accordance with the requirements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* combi.c (permi_get, permi_peek): Fix algorithm.
(permi_mark): New static function.
(permi_ops): Reference permi_mark for mark operation.
(permi): Initialize it->ul.next to nao as required by
new get/peek algorithm.
(rpermi_get, rpermi_peek): Fix algorithm.
(rpermi_mark): New static function.
(rpermi_ops): Reference permi_mark for mark operation.
(rpermi): Initialize it->ul.next to nao as required
by new get/peek algorithm.
(combi_get, combi_peek, combi_mark, combi_clone): New static
functions.
(combi_ops): New static structure.
(combi): New function.
(rcombi_get, rcombi_peek, rcombi_mark, rcombi_clone): New
static functions.
(rcombi_ops): New static structure.
(rcombi): New function.
* combi.h (combi, rcombi): Declared.
* tests/015/comb.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we get rid of the wrongheaded notion that a
string range, as such, is ascending or descending. In fact,
the corresponding character positions are individually
ascending or descending.
* lib.c (seq_iter_get_range_str): Either increment or
decrement the character in the step string depending on
whether that position is in order or reversed.
(seq_iter_get_rev_range_str): Static function removed.
(si_rev_range_str_ops): Static structure removed.
(seq_iter_init_with_info): For string ranges, use
si_range_str_ops regardless of the strings being
lexicographically reversed.
* test/012/iter.tl: New test case.
* txr.1: Redocumented string ranges.
|
|
|
|
|
|
|
|
|
| |
* combi.c (rperm, comb, rcomb): In the default
case for generic sequences, check k, like
in the other cases and return the special
case result.
* tests/015/comb.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_iter_ops): Use copy_hash_iter as the clone
operation.
(copy_hash_iter): New function.
* hash.h (copy_hash_iter): Declared.
* tests/010/hash.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (struct cobj_ops): New function pointer, clone.
(cobj_ops_init, cobj_ops_init_ex): Add clone argument to macros.
* lib.c (seq_iter_cobj_ops): Use copy_iter as the clone operation.
(cptr_ops): Use copy_cptr as clone operation.
(copy): Replace if statements by check whether COBJ has a clone
operation. If so, we use it to copy the object.
* struct.h (enum special_slot): New member, copy_m.
* struct.c (copy_s): New symbol variable.
(special_sym): Associate copy_m enum value with copy symbol.
(struct_init): Initialize copy_s with interned symbol.
(struct_inst_clone): New static function.
(struct_type_ops): Specify no clone operation via null pointer.
(struct_inst_ops): Specify struct_inst_clone as clone
operation.
* arith.c (psq_ops): Indicate no clone operation via null pointer.
* buf.c (buf_strm_ops): Likewise.
* chksum.c (sha1_ops, sha256_ops, md5_ops): Likewise.
* ffi.c (ffi_type_builtin_ops, ffi_type_struct_ops,
ffi_type_ptr_ops, ffi_type_enum_ops, ffi_closure_ops,
union_ops): Likewise.
(carray_borrowed_ops, carry_owned_ops, carray_mmap_ops):
Specify copy_carray as clone operation.
* gc.c (prot_array_ops): Indicate no clone operation via
null pointer.
* gzip.c (gzio_ops_rd, gzip_ops_wr): Likewise.
* hash.c (hash_iter_ops): Likewise.
(hash_ops): Specify copy_hash as clone operation.
* parser.c (parser_ops): Indicate no clone operation via
null pointer.
* rand.c (random_state_clone): New static function.
(random_state_ops): Use random_state_clone as clone function.
* regex.c (char_set_obj_ops, regex_obj_ops): Indicate no clone
operation via null pointer.
* socket.c (dgram_strm_ops): Likewise.
* stream.c (null-ops, stdio_ops, tail_ops, pipe_ops,
dir_ops, string_in_ops, byte_in_ops, strlist_in_ops,
string_out_ops, strlist_out_ops, cat_stream_ops,
record_adapter_ops): Likewise.
* strudel.c (strudel_ops): Likewise.
* sysif.c (cptr_dl_ops, opendir_ops): Likewise.
* syslog.c (syslog_strm_ops): Likewise.
* unwind.c (cont_ops): Likewise.
* vm.c (vm_desc_ops, vm_closure_ops): Likewise.
* tree.c (tree_ops): Use copy_search_tree for clone
operation.
(tree_iter_ops): Use copy_tree_iter for clone operation.
* genchksum.txr: Changes in chksum.c specified in one
place here.
* tests/012/oop.tl: Couple of new tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this commit, output variables in the TXR Pattern language and
in TXR Lisp quasiliterals now support separator strings for values
that are strings and buffers. Values which are buffers appear
differently: they are rendered as a sequence of lower case hex
digit pairs. When a string-valued variable specifies a separator,
the separator appears between characters of the string value.
Previously, the separator was ignored. When a buffer-valued
variable specifies a separator. the separator appears between
pairs of digits, not between digits. For instance if ethaddr
is a variable holding #b'08:00:27:79:c7:f5', then the quasiliteral
`@ethaddr` produces "08002779c7f" whereas `@{ethaddr ":"}`
produces "08:00:27:79:c7:f5".
* buf.[ch] (buf_str_sep): New function.
* lib.[ch] (fmt_str_sep): New function.
* eval.c (fmt_cat): If the argument is a string, and a separator
is present, replace the value with the result of calling
fmt_str_sep. If the argument is a buffer, and a separator is
present, use buf_str_sep to convert to a string, otherwise
use tostringp.
* txr.1: Section on Output Variables updated.
* tests/012/readprint.tl: New tests.
|
|
|
|
|
|
|
| |
* lib.c (interpose): non-list cases consolidated into
one, which uses generic iteration and building.
* tests/012/seq.tl: New tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The pprint semantics of buffers is that the
raw bytes are dumped into the stream. This is poor.
It was hastily designed based on analogy with
strings, which pprint by just sending their contents
to the stream; but for strings this is justified
because they represent text.
We also fix the semantics of buffer values being
rendered by quasiliteral notation. Currently, the
are treated as sequences, and so they explode into
individual decimal integers.
* buf.c (buf_pprint): Print the bytes as pairs of
lower-case hex digits, with no line breaks.
In 294 compatibility or lower, put out bytes as before.
* eval.c (fmt_cat): When not in 294 compatibility
mode, treat a buffer object via tostringp, which
will render it to hexadecimal via buf_pprintf.
In compatibility mode, treat it as before, which is
as a sequence: the individual values of the buffer
are converted to text, thus decimal values in the
range 0 to 255, catenated using the given separator.
* tests/012/readprint.tl: New tests.
* txr.1: Documented. Also expanding on what pretty printing
means in TXR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register iter-cat intrinsic.
* lib.h (struct seq_iter): New union member dargs.
(iter_catv): Declared.
* lib.c (seq_iter_get_cat, seq_iter_peek_cat): New
static functions.
(si_cat_ops): New static structure.
(iter_catv): New function.
* tests/012/iter.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register cons-count intrinsic.
* lib.c (cons_count_rec): New static function.
(cons_count): New function.
* lib.h (cons_count): Declared.
* tests/012/cons.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (cons_find): Static function removed; a new one is
implemented in lib.c.
(eval_init): Register cons-find intrinsic.
* lib.c (cons_find_rec): New static function.
(cons_find): New function.
* lib.h (cons_find): Declared.
* tests/012/cons.tl: New file.
* txr.1: Documented cons-find together with tree-find.
Document that tree-find's test-fun argument is optional,
defaulting to equal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The end pattern in @(sme) and @(end) does not have to be a
list pattern, dotted or otherwise. It should support any
pattern whatsoever for a single object, which should match the
terminating atom. The documentation says that, though not very
clearly; it is reworded also.
* stdlib/match.tl (check-end): Remove this function, since
the end pattern can be any pattern.
(pat-len): Bugfix: we are using the meq function incorrectly.
The object being compared against several alternatives
must be the leftmost argument of meq. This bug prevents a
pattern like @(evenp @x) to be correctly considered of
length zero.
(sme, end): Remove calls to check-end, and just refer to
original end variable.
* tests/011/patmatch.tl: New tests.
* txr.1: clarify that the end pattern may be any pattern,
which can match just the terminating atom or a possibly
dotted suffix.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register hist-sort-by intrinsic.
* lib.c (hist_sort_by): New function.
(hist_sort): Wrapper for hist_sort_by now.
* lib.h (hist_sort_by): Declared.
* tests/012/sort.tl: Tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_eql): Use hash_traversal_limit for
the initial value of the limit rather than zero.
Commit 84e9903c27ede099e2361e15b16a05c6aa4dc819 in October
2019 fixed eql_hash to actually make use of the limit, which
broke the assumption that we could use zero.
* tests/010/hash.tl: Add a few tests for hash-equal and
hash-eql.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Structure objects can be used to implement lazy structures
such as sequences. It is undesirable to take the length of
a lazy sequence because it forces all of its elements to
exist. Moreover, if the sequence is infinite, it is
impossible. There are situations in which it is only necessary
to know whether the length is less than a certain bound,
and for that we have the length-< function. That works on
infinite sequence such as lazy lists, requiring them to be
forced only so far as to determine the truth value of the
test. We need objects that implement lazy sequences to work
with this function.
* struct.h (enum special_slot): New member length_lt_m.
* lib.h (length_lt_s): Symbol variable declared.
* struct.c (special_sym): New entry in this table, associating
the length_lt_m enum with the length_lt_s symbol variable.
* lib.c (length_lt_s): Symbol variable defined.
(length_lt): Handle COBJ objects that are structures.
we test whether they have a length-< method, or else length
method. If they don't have either, we throw. We don't
fall back on the default case for objects that don't have
a length-< method, because the diagnostic won't be good
if they don't have a length method either; the programmer
will be informed that the length function couldn't find
a length method, without mentioning that it was actually
length-< that is being used.
* eval.c (eval_init): Register length-< using the length_lt_s
symbol variable rather than using intern.
* txr.1: Documented.
* tests/012/oop-seq.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/007/except-4.txr: The portable way to get a shell
command that exits with a signal is to execute kill -KILL $$.
If we use a signal that the shell catch like SIGTERM or
SIGINT, we get nonportable behaviors. Some shells seem to
catch the signal and then raise it again so they terminate
with that signal. Some shells terminate normally, but create
an exit status by OR-ing 0x80 with the caught signal.
Let's use kill -KILL here and drop the tests for BSD and
Solaris.
* tests/007/except-3.txr: Fix the kill command here also.
While this test wasn't failing on those platforms, it succeeds
vacuously, since the exception being ignored by :nothrow
is not actually thrown.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/014/socket-basic.tl: Test for :openbsd also
were we test for :bsd.
* tests/014/glob-carray.tl: Likewise.
* tests/017/glob-zarray.tl: Likewise.
* tests/017/mmap.tl: Likewise.
* tests/018/chmod.tl: Likewise.
|
|
|
|
|
|
|
|
| |
* tests/common.tl (os-symbol): Add :openbsd.
* tests/007/except-4.txr: Skip.
* tests/018/crypt.tl: Skip unsupported salts, i.e., without leading "$".
* tests/018/gzip.tl: Add -f to gzip command to force compression even if
it does not make the file smaller.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
perm doesn't generate items of the right type. We need
to add the original sequence to the state vector and
use make_like.
The new generic sequence support in rperm is broken, too.
* combi.c (perm_while_fun, perm_gen_fun_common): Rename p
variable to vec.
(perm_init_common): Rename to perm_init. Take one more
argument and store in new fourth element of state vector.
(perm_vec, perm_list, perm_str): Pass nil to new parameter
of perm_init.
(perm_seq_gen_fun): Use perm_list_gen_fun to get list
permutations, and coerce each one to the same type as
the sequence with make_like.
(rcomb_seq_gen_fun): Remove redundant call to
rcomb_gen_fun_common. The rcomb_list_gen_fun function
is called, which does this already, so we lose every
other sequence element.
* tests/015/comb.tl: New tests.
|
|
|
|
| |
* tests/015/comb.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The comb function is broken; some combinations of items
are missing in the output. This is because the iteration
reset step in comb_gen_fun_common handles only one
column of the state, neglecting to reset the other
columns: what is now done by the for (j = i ...
loop. I'm changing the representation of the state from
a list of lists to a vector of lists. Moreover, it is not
reversed. This allows the loop in comb_gen_fun_common
to perform random access.
* combi.c (k_conses): Return a vector, that is not
reversed.
(comb_init): New helper function to slightly abstract
the use of k_conses.
(comb_while_fun): Termination now occurs if the state
vector is nil (degenerate case, like k items chosen
from n, when k > n), or if the vector has nil in
element zero (special flag situation).
(comb_gen_fun_common): Rewritten, with correction.
The logic is similar. Since we have random access,
we don't need the "prev" variable. When we reset
a column iterator, we now also populate all the
columns to the right of it. For instance, if a
given column resets to (a b c), the one to the right
must reset to (b c), and so on. In the broken function,
this is what was not done, resulting in missing
items due to, say, a column resetting to (a b c)
but the one next to it remaining at (c).
(comb_list_gen_fun): Drop nreverse.
(comb_vec_gen_fun, comb_str_gen_fun, comb_hash_gen_fun):
Use the same i iterator for the state and the output object,
accessing the vector directly.
(comb_list, comb_vec, comb_str, comb_hash): Use comb_init.
* tests/015/comb.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've run into situations in which I wanted a comment in a
big JSON quasiliteral to explain some embedded piece of code.
We support only semicolon comments, and no #; ignore notation.
* parser.l (grammar): Recognize Lisp comments in the JSON
state also. That does it.
* tests/010/json.tl: One modest little test.
* txr.1: Documented.
* lex.yy.c.shipped: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_objects_common): New static function, formed
from read_objects_from-string.
(read_objects_from_string): Now wrapper for read_objects_common.
(read_objects): New function.
* parser.h (read_objects): Declared.
* eval.c (eval_init): Register read-objects intrinsic.
* autoload.c (getput_set_entries): Add three new symbols:
file-get-objects, file-put-objects and file-append-objects.
* stdlib/getput.tl (put-objects): New system function.
(file-get-objects, file-put-objects, file-append-objects):
New functions.
* txr.1: Documented.
* tests/018/getput.tl: New file.
|