summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* hash: hash-revget now defaults to equal.Kaz Kylheku2021-01-221-1/+10
| | | | | | | | | * hash.c (hash_revget): Default to equal, except in compatibility mode. (hash_keys_of): Also default to equal. This function is too new to bother with compatibility switching. * txr.1: Documented, with compat notes.
* matcher: existing variables in @(all) now backref.Kaz Kylheku2021-01-221-3/+26
| | | | | | | | | | | | | | | | | | This commit fixes the inadequacy that all variables occurring in a pattern under @(all ...) or @(coll ...) are blindly collated into lists, ignoring the fact that they may be previously bound variables that must back-reference and not be colleced into lists (just like in the TXR Pattern language!) * share/txr/stdlib/match.tl (compile-loop-match): Calculate the subset of variables in the pattern that have been freshly bound. Only generate the collection gensyms for those variables and only collect and nreverse those variables. * tests/011/patmatch.tl: Some test cases that backreference into an @(all). * txr.1: Documented.
* doc: fix wrong year in document date.Kaz Kylheku2021-01-211-1/+1
| | | | * txr.1: 2020 -> 2021.
* matcher: new @(coll) operator.Kaz Kylheku2021-01-211-1/+29
| | | | | | | | | | | | | * share/txr/stdlib/match.tl (compile-loop-match): Implement coll semantics. coll fails if it collects nothing, which uses common logic with all*. We just have to move the flipping of the loop-iterated-var into the match, and not do it unconditionally for every iteration. (compile-match): Hook in the coll operator. * tests/011/patmatch.tl: Test case copied from doc example. * txr.1: Documented.
* matcher: @(some) and @(all) work with sequences.Kaz Kylheku2021-01-211-6/+7
| | | | | | | | | | Relax the restrictions in these operators so they work with sequences rather than specifically lists. * share/txr/stdlib/match.tl (compile-loop-match): Make the necessary adjustments so that abstract iteration is used. * txr.1: Documented.
* doc: document new check in iter-step.Kaz Kylheku2021-01-211-1/+36
| | | | | | * txr.1: Document recently introduced check against crossing over into infinite iteration on the terminator of an improper list.
* matcher: allow variables to back-reference.Kaz Kylheku2021-01-201-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | Multiple occurrences of variables unify using equal. * share/txr/stdlib/match.tl (var-list): New struct type. Used for tracking what variables have been defined. (compile-struct-match, compile-vec-match, compile-atom-match, compile-op-match, compile-cons-structure, compile-require-match, compile-let-match, compile-loop-match, compile-parallel-match, compile-not-match): Take var-match argument and pass it down. (compile-parallel-match): Take var-match argument and pass copies of it down to the compile jobs of the branches, since they do not unify. (compile-var-match, comiple-let-match, compile-op-match): Handle variables carefully: check for variable already being defined and generate a backreference instead of a new binding match. (compile-match): Take optional var-list argument, instantiating the object if it is missing, pass down to all recursive compile unctions. * txr.1: Documented.
* doc: another .code typo.Kaz Kylheku2021-01-201-1/+1
| | | | txr.1: Again under the @(not) operator, .cond instead of .code.
* matcher: bugfix and interface change in @(require).Kaz Kylheku2021-01-201-10/+27
| | | | | | | | | | | | | | * share/txr/stdlib/match.tl (compile-require-match): The bug here is that the condition is placed before the match.test-expr, which is incorrect. The conditions can only be evaluated if match.test-expr has succeeded, because otherwise the variables are not validated to have the correctly matching value. Also, in the documentation, the synax insinuates there can be more than one expression. So let's just make it work: require takes multiple expressions and combines them with an implicit and. * txr.1: Documentation updated.
* Version 248txr-248Kaz Kylheku2021-01-201-3/+3
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* New function: hash-keys-of.Kaz Kylheku2021-01-201-1/+10
| | | | | | | | | * hash.c (hash_keys_of): New function. (hash_init): Register hash-keys-of intrinsic * hash.h (hash_keys_of): Declared. * txr.1: Documented.
* doc: misspelled .code macro.Kaz Kylheku2021-01-201-1/+1
| | | | * txr.1: Under @(not) operator, .cond instead of .code.
* Version 247txr-247Kaz Kylheku2021-01-191-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Bumped from incorrect 245 to 247. * txr.vim, tl.vim: Regenerated. * protsym.c: Regenerated.
* doc: clarification about finalization.Kaz Kylheku2021-01-191-1/+9
| | | | | * txr.1: GC-driven finalization will not iterate on new finalizer registrations.
* doc: fix defmacro exampleKaz Kylheku2021-01-191-4/+4
| | | | | * txr.1: Fix the bungled dolist macro definition, as well as the incorrect example illustrating its usage.
* matcher: add @(not) operator.Kaz Kylheku2021-01-181-0/+34
| | | | | | | * share/txr/stdlib/match.tl (compile-not-match): New function. (compile-match): Hook in not operator. * txr.1: Documented.
* doc: add warning to Pattern Matching section.Kaz Kylheku2021-01-181-0/+9
| | | | | | | | | * txr.1: Pattern Matching is new. Though it works, the programmer-visible, documented requirements may have to be adjusted to make it better, and it would be nice to do that without caring about backward compatibility. In other words, the feature is currently in "beta": it is expected to be reliable, but the syntax and semantics are not written in stone.
* doc: document lambda-match and defun-match.Kaz Kylheku2021-01-181-0/+86
|
* doc: document when-match, if-match and match-case.Kaz Kylheku2021-01-181-0/+118
| | | | | | * tests/011/patmatch.tl: Add match-case test. * txr.1: Document when-match, if-match and match-case.
* doc: document @(op) and predicate operator.Kaz Kylheku2021-01-181-0/+81
|
* doc: fix "he" typos.Kaz Kylheku2021-01-171-2/+2
| | | | | * txr.1: Fix "the" mistyped as "he" in the new pattern matcher documentation, as well as under call-finalizers.
* doc: document @(and)/@(or) pattern operators.Kaz Kylheku2021-01-171-0/+55
|
* doc: document @(some) pattern operator.Kaz Kylheku2021-01-171-0/+28
|
* doc: document @(all)/@(all*) pattern operators.Kaz Kylheku2021-01-171-0/+48
|
* doc: document @(let) and @(require) pattern ops.Kaz Kylheku2021-01-171-0/+88
|
* doc: bad syntax in FFI type struct.Kaz Kylheku2021-01-171-1/+1
| | | | * txr.1: Fix << that should be <.
* doc: fix doc for @(struct ...) pattern operator.Kaz Kylheku2021-01-171-3/+3
| | | | | | | * txr.1: The operator is struct not structure. Formalize the heading as Pattern operator. * checkman.txr: Recognize the new Pattern operator heading.
* matcher: support loose mode for structures.Kaz Kylheku2021-01-171-6/+65
| | | | | | | | | * share/txr/stdlib/match.tl (compile-struct-match): Allow a pattern instead of a struct type name, in which case the object can be of any struct type which has the slots required by the pattern. * txr.1: Documented.
* doc: start of pattern matching documentation.Kaz Kylheku2021-01-161-0/+270
| | | | | * txr.1: New Structurl Pattern Matching major section with new subsections.
* Copyright year bump 2021.Kaz Kylheku2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * METALICENSE: 2020 copyrights bumped to 2021. Added note about SHA-256 routines from Colin Percival. * LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl, share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl, share/txr/stdlib/package.tl, share/txr/stdlib/param.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl, share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2021.
* doc: stray functions in heading and syntaxKaz Kylheku2021-01-051-3/+1
| | | | | | | | * txr.1: The documentation section for makunbound also erroneously lists the fmakunbound and mmakunbound functions in the heading and syntax block. They are not documented there, but in their own section which follows and has its own heading, so these references to them must be removed.
* progn, prog1, prog2: now also functions.Kaz Kylheku2021-01-011-5/+28
| | | | | | | | | | | | * eval.c (progn_fun, prog1_fun, prog2_fun): New static functions. (eval_init): Wire progn, prog1 and prog2 function bindings to new functions. * txr.1: Documented. * checkman.txr (check-func): Recognize Macro/function and Operators/functions heading.
* New macro: prog2Kaz Kylheku2021-01-011-4/+45
| | | | | | | | | | | | * eval.c (prog2_s): New symbol variable. (me_prog2): New macro expander function. (eval_init): Initialize prog2_s variable with interned symbol. Register prog2 macro expander. * txr.1: Maintain the documentation for progn and prog1, improving the wording and adding a dialect note . Document prog2.
* gc: do finalizers completely on one phase.Kaz Kylheku2021-01-011-6/+24
| | | | | | | | | | | | | | | | | | | | | | * gc.c (call_finalizers_impl): Iterate over the finalizer registrations until no more finalizers are identified, performing additional rounds, as necessary. Thus if finalizers register more finalizers that are eligible for processing according to the criteria of he current phase, those are done in the current phase. (gc_finalize): We must now carefully set the reachable flag to 1 for a new finalization entry. This was always the right thing to do and is logically correct: if an object is being passed to finalize, it is necessarily reachable. Leaving the 0 initialization would do bad things now, as follows. If any object whatsoever has a finalizer registered against it during GC-driven finalization, its finalizer will be called. This is bad if the object isn't garbage. Secondly, the object may be moved into generation 0, and put into the freshobj list. This is extremely bad if the object is reachable by generation 1 objects, which is now a wrong-way reference. * txr.1: Updated.
* Version 246txr-246Kaz Kylheku2020-12-311-3/+3
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* gc: add finalization count to objects.Kaz Kylheku2020-12-311-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | With the finalization count, we don't have to scan the freshobj array for duplicates when calling finalizers. However, the limited range of the counter limits how many times we can register a finalizer against an object. * gc.c (make_obj): Reset the new fincount field to zero for a newly minted object. (call_finalizers_impl): Decrement the fincount for each object. Only run the freshobj-related logic when the count hits zero. (gc_finalize): Bump the fincount of a registered object. If the counter overflows, throw an exception. * lib.h (obj_common): Add new field fincount for the finalization count. * tree.c (tr_rebuild): Fix up dummy object initializer to accommodate the new member. * txr.1: Document that there is a limit on the number of times an object can be registered for finalization.
* doc: improve awk fconv documenation.Kaz Kylheku2020-12-311-0/+16
| | | | | | * txr.1: List the no-conversion - operator among the shortcuts, so it is easier to discover. Add a note that that fconv is potentially applicable to non-string fields.
* doc: note for awk macro fconv.Kaz Kylheku2020-12-291-0/+11
| | | | * txr.1: Add usage note to the fconv macro.
* shuffle/nshuffle: take optional random state argument.Kaz Kylheku2020-12-291-3/+5
| | | | | | | | | | | | | * eval.c (eval_init): Register shuffle and nshuffle as two-argument functions with optional argument. * lib.c (nshuffle): Take random-state argument, defaulting to value of random_state special variable. (shuffle): Take random-state argument, pass down to nshuffle. * lib.h (shuffle, nshuffle): Declarations updated. * txr.1: Updated.
* doc: correction in dialect notes for symbol-macroKaz Kylheku2020-12-271-3/+5
| | | | | * doc: Common Lisp has a function like symbol-macro function; it is called macro-function.
* Version 245txr-245Kaz Kylheku2020-10-101-7/+7
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. Fixed repeated word in documentation under env-hash. * share/txr/stdlib/ver.tl: Bumped from incorrect 243 value to 245.
* env-hash: now persistent and synced with setenv.Kaz Kylheku2020-10-161-3/+63
| | | | | | | | | | | | | | * sysif.c (env_hash): Function renamed to get_env_hash and a static variable named env_hash introduced. Function returns a previously allocated hash table, if it exists, except in compat mode. (getenv_wrap): Stash the result into the hash also. (setenv_wrap): Keep the hash up-to-date with the action of setenv. (unsetenv_wrap): Also delete from the hash. (sysif_init): Protect the env_hash variable from gc. * txr.1: Documented, with compat notes.
* doc: add missing detail to env function.Kaz Kylheku2020-10-161-0/+8
| | | | | | * txr.1: The env function actually returns a cached list. Spell out that the function is not required to construct a new list.
* Version 244txr-244Kaz Kylheku2020-10-101-3/+7
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: missing info about compiled file version 5.Kaz Kylheku2020-10-091-1/+3
| | | | | * txr.1: TXR 216 bumped the compiled file version from 4 to 5, but this was not documented.
* New function: time-nsec.Kaz Kylheku2020-10-071-1/+16
| | | | | | | | | | | | * configure: Test for clock_gettime, generating HAVE_CLOCK_GETTIME symbol in config.h. * time.c (time_sec_nsec): New function. (time_init): time-nsec intrinsic registered. * time.h (time_sec_nsec): Declared. * txr.1: Documented.
* random: correctly refer to WELL512a everywhere.Kaz Kylheku2020-10-071-5/+5
| | | | | | * rand.c: Refer to "WELL512a" in comment, not "WELL 512". * txr.1: Replace "WELL 512" with "WELL512a" everywhere.
* random: bugfix: incorrect WELL512a.Kaz Kylheku2020-10-071-0/+8
| | | | | | | | | | | | | | | | | | | * rand.c (rand32_bug): New static function formed by renaming the original buggy rand32. (rand32_good): Copy of rand32 with two bugfixes. The term involving variable r2 must be only left shifted by 28 bits, and not xor-ed with the original value. The order of operations is wrong in the term that contains the & operation. (rand32): New static function pointer variable, serving as the rand32 function. Points to rand32_good by default. (rand_compat_fixup): Test for 243 or lower compatibility, under which rand32 is made point to rand32_bug. This is done before the call to make_random_state for replacing *random-state*, which has to use the old function. * txr.1: compat note added. * tests/013/maze.expected: Updated.
* doc: out of order compat entries.Kaz Kylheku2020-10-071-6/+6
| | | | * txr.1: Fix out-of-order compatibility 247 and 242 entries.
* New functions trim-left and trim-right.Kaz Kylheku2020-10-051-0/+71
| | | | | | | | | * regex.c (trim_left, trim_right): New static functions. (regex_init): New intrinsics registered. * tests/015/trim.tl, tests/015/trim.expected: New files. * txr.1: Documented.