summaryrefslogtreecommitdiffstats
path: root/lib.c
Commit message (Collapse)AuthorAgeFilesLines
...
* cat-str, split-str: sep can be character.Kaz Kylheku2019-06-141-2/+22
| | | | | | | * lib.c (cat_str, split_str_keep): Support single character separator. * txr.1: Documented.
* select: maintenance.Kaz Kylheku2019-06-141-33/+39
| | | | | | | | | * lib.c (sel): Function converted to seq_info and iterators. Negative indices handled in list case. Self-name corrected to select; the C function is called sel just to avoid clashing with POSIX select. * txr.1: Documentation updated.
* replace-list: negatives in index-list follow convention.Kaz Kylheku2019-06-141-0/+2
| | | | | | | | | | The index-list replacement isn't following the convention that negative index values reference from the end of the target sequence. Let's fix that. * lib.c (replace_list): Likewise. * txr.1: Documentation updated.
* replace-str, replace-vec: remove call to len.Kaz Kylheku2019-06-131-2/+2
| | | | | | * lib.c (replace_str, replace_vec): Remove redundant calculation of input sequence length; there is a len variable bound on entry into the function.
* buffers: replace operation.Kaz Kylheku2019-06-121-1/+1
| | | | | | | | * buf.c (replace_buf): New function. * buf.h (replace_buf): Declared. * lib.c (replace): Wire in.
* sub-vec: optimize no-op case.Kaz Kylheku2019-06-121-0/+2
| | | | | | | | | | * lib.c (sub_vec): If range covers entire vector, just return it. * txr.1: Clarify that the output of sub may share structure with the input regardless of type, not only when the input is a list. This should have been updated when the optimizatin was done in sub-str.
* toseq: remove unused function.Kaz Kylheku2019-06-121-15/+0
| | | | | | * lib.c (toseq): Function removed. * lib.h (toseq): Declaration removed.
* replace-vec, replace-str: refactor with sequence iteration.Kaz Kylheku2019-06-121-97/+53
| | | | | | | * lib.c (replace_vec, replace_str): Don't use dubious toseq on input items, which converts non-sequence atoms into lists of one. Use sequence iterators to reduce number of cases in the code.
* replace_list: revise, fixing several bugs.Kaz Kylheku2019-06-121-49/+37
| | | | | | | | | | | * lib.c (replace_list): Avoid using the dubious toseq function which turns a non-sequence object into a list of one item. This is not documented. Rewrite the assign-to-multiple-indices logic into one loop that uses sequence iterators. A bug is fixed here: failing to step the indices and items in parallel. Don't use list_vec on items; it fails on strings. Strings are now supported properly: they expand into a list of items that is spliced.
* seq iterators: new peek operation.Kaz Kylheku2019-06-121-0/+39
| | | | | | | | | | | | * lib.c (seq_iter_peek_nil, seq_iter_peek_list, seq_iter_peek_vec, seq_iter_peek_hash): New static functions. (seq_geti): New function. (seq_iter_init): Initialize new peek member of seq_iter structure. * lib.h (struct seq_iter): New member, peek. (seq_peek): New inline function. (seq_geti): Declared.
* buffers: allow sub operation.Kaz Kylheku2019-06-111-1/+7
| | | | | | | | | * buf.c (sub_buf): New function. * buf.h (sub_buf): Declared. * lib.c (sub): Hook in BUF type. (replace): Diagnose BUF specially as unsupported.
* bugfix: list length: off-by-one error huge lists.Kaz Kylheku2019-05-311-0/+2
| | | | | | | | | | | | * lib.c (length_list, length_proper_list): Fix off-by-one bug when calculating lengths of lists that overflow the cnum type. Note that we will never see regular lists which hit this situation, because there are more values in the range [0, INT_PTR_MAX] then there are possible pointers in the system, However, lazy lists can be that long or longer, because as we calculate the length of a lazy list, the part we have already traversed can be garbage-collected under the right circumstances.
* C99: get rid of useless inline instantiations.Kaz Kylheku2019-05-021-21/+0
| | | | | | | | | | | * hash.c, lib.c, parser.y, unwind.c: Remove useless declarations that were believed to be C99 inline instantiations. This was mistakenly added at the time the Solaris issue was discovered that _XOPEN_SOURCE values of 600 or greater require compiling in C99 mode. We use "static inline" under C99 for inline functions; instantiation is not applicable at all to inline functions that don't have external linkage.
* lib: more nuanced file access errors.Kaz Kylheku2019-05-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several new more specific exception types are derived from file-error and used. Error handlers can distinguish unexpected non-existence, unexpected existence and permission errors from each other and other errors. * lib.c (path_not_found_s, path_exists_s, path_permission_s): New symbol variables. (obj_init): New variables initialized. * lib.h (path_not_found_s, path_exists_s, path_permission_s): Declared. * parser.c (open_txr_file): Use new errno_to_file_error function to convert errno to exception symbol. * socket.c (open_sockfd): Likewise. * stream.c (open_directory, open_file, open_fileno, open_command, open_process, run, remove_path, rename_path): Likewise, and process-error is used in open_process and run instead of file-error for problems related to creating the process. * sysif.c (errno_to_file_error): New function. (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, mknod_wrap, chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, stat_impl, umask_wrap, ): Use errno_to_file_error to convert errno to exception symbol. (exec_wrap): Use process-error instead of file-error. * sysif.c (errno_to_file_error): Declared. * unwind.c (uw_init): Register path-not-found, path-exists and path-permission as subtypes of file-error. * txr.1: Documented.
* New function: window-mapdo.Kaz Kylheku2019-04-211-12/+40
| | | | | | | | | | | | | | | | * lib.c (enum wmap_op): New enum type. (window_map_list): Use enum wmap_op for last argument instead of Boolean flag. If the argument is WMAP_MAPDO, do not accumulate. (window_map_vec, window_map, window_mapped): Adjust to new enum argument. (window_mapdo): New function. * lib.h (window_mapdo): Declared. * eval.c (eval_init): window-mapdo intrinsic registered. * txr.1: Documented.
* No-op optimization in substring.Kaz Kylheku2019-04-191-0/+2
| | | | | | * lib.c (sub_str): Optimization: if the range spans the entire string, just return it; don't allocate a copy.
* Support max length and depth for object printing.Kaz Kylheku2019-04-181-31/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hash.c (hash_print_op): Implement max length. * lib.c (lazy_str_put, out_lazy_str): Take struct strm_base * parameter and implement max length. (out_quasi_str_sym): Don't use obj_print_impl for symbol's name string; just put_string. The use of obj_print_impl causes symbols appearing as variables in quasiliterals to be truncated when max length is imposed. (out_quasi_str): Implement max length. (obj_print_impl): Implement max length and depth. Note that there is now always a non-null ctx pointer. (obj_print): Always set up context pointer for obj_print_impl. Context now has pointer to low-level stream structure, where we can access max_length and max_depth. It also carries the recursion depth. * lib.h (lazy_str_put): Declaration updated. * stream.c (strm_base_init): Add initializers for max_length and max_depth. (put_string): Pass stream structure to lazy_str_put. (set_max_length, set_max_depth): New functions. (stream_init): set-max-length and set-max-depth intrinsics registered. * stream.h (struct strm_ctx): New members depth and strm. (struct strm_base): New members max_length and max_depth. (set_max_length, set_max_depth): Declared. * txr.1: Documented.
* streams: force-off indent mode.Kaz Kylheku2019-04-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fourth indent mode indent-foff (force off) is introduced. * buf.c (buf_print): Turn on data mode indentation if the current mode is not indent-foff, rather than when it is indent-off. * lib.c (obj_print_impl): The unconditional set_indent_mode calls are replaced with test_neq_set_indent_mode so we only set the mode if it is not forced off. * stream.c (formatv): For the ! directive, turn on data mode identation is not indent-foff, rather than when it is indent-off. (put_string, put_char, width_check): Recognize ident-foff as indentation off. (test_neq_set_indent_mode): New function. (stream_init): Register test-neq-set-indent-mode function and indent-foff variable. * stream.h (indent_mode): New enum constant, indent_foff. (test_neq_set_indent_mode): Declared. * struct.c (struct_inst_print): Turn on data mode indentation if the current mode is not indent-foff, rather than when it is indent-off. * txr.1: Documented.
* debugger: initial backtrace support.Kaz Kylheku2019-04-161-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * debug.c (debug_state): Switch to unsigned, since this is now a bitmask. (sys_print_backtrace_s): New symbol variable. (dbg_clear, dbg_set, dbg_restore): New static functions. (debug_init): Initialize sys_print_backtrace_s. Register dbg-clear, dbg-set, dbg-restore intrinsics. Register dbg-enable, dbg-step, dbg-backtrace and dbg-all bitmask variables, Lisp equivalents of DBG_ENABLE, DBG_SETP, DBG_BACKTRACE and DBG_ALL. (debug_dump_backtrace): New function. * debug.h (opt_debugger): Declaration removed. (debug_state): Declaration updated. (DBG_ENABLE, DBG_STEP, DBG_BACKTRACE, DBG_ALL): New preprocessor symbols. (debug_set_state): Inline function removed. (debug_clear, debug_set, debug_restore): New inline functions. (dbg_backtrace, dbg_fcall_begin, dbg_fcall_end): New macros. (debug_dump_backtrace): Declared. * eval.c (error_trace): Invoke debug_dump_backtrace if support is compiled in and backtraces are enabled. * lib.c (do_generic_funcall): New function, copy of generic_funcall. (generic_funcall): Now a wrapper for do_generic_funcall which registers fcall frames if backtrace support is enabled. (funcall, funcall1, funcall2, funcall3, funcall4): Route to slow generic_funcall path if backtraces are enabled. * lisplib.c (debugger_instantiate, debugger_set_entries): New static functions. (lisplib_init): Autload support for debug module via above new functions. (lisplib_try_load): Save and restore debugger state in new way using debug_set and debug_restore, with specific mask values. * parser.y (parse_once): Disable debugging in new way. * share/txr/stdlib/debug.tl New file. * sighal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST): New macros for saving/restoring debug state. (EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): Reference the above macros to include debug state in extended jump context. * txr.c (help): Document --backtrace and that that -d implies --backtrace. (txr_main): Enable debugger using debug_set. Provide new --backtrace option to enable backtraces only. * unwind.c (args_s): New symbol variable. (fcall_frame_type): New static variable. (unwind_to_exit_point): Save pointer to original frame stack and restore it when calling error_trace. This is so that error_trace can walk the stack to collect a backtrace. (uw_find_frames_by_mask, uw_push_fcall): New functions. (uw_late_init): Initialize args_s and fcall_frame_type. gc-protect fcall_frame_type. Register uw-* variables corresponding to the UW_* frame types. * unwind.h (uw_frtype_t): New enum constant UW_FCALL. (struct uw_fcall): New frame structure. (union uw_frame): New member fc. (uw_push_fcall, uw_find_frames_by_mask): Declared.
* New function: cptr-size-hint.Kaz Kylheku2019-04-061-0/+7
| | | | | | | | | | * eval.c (eval_init): Register cptr-size-hint intrinsic. * lib.c (cptr_size_hint): New function. * lib.h (cptr_size_hint): Declared. * txr.1: Documented.
* Move numeric functions from lib.c to arith.cKaz Kylheku2019-03-251-410/+0
| | | | | | | | | | | | | | | * arith.c, lib.c (num, c_num, c_fixnum, bad_float, flo, c_flo, fixnump, bignump, integerp, floatp, numberp nary_op, nary_simple_op, plusv, minusv, mulv, divv, logandv, logiorv, gtv, ltv, gev, lev, numeqv, numneqv, sumv, prod, exptv, gcdv, lcmv): Function definitions moved from lib.c to arith.c. (nary_op_keyfun, unary_num, unary_arith, unary_int, sumv, prodv, rexpt, abso_self): Static functions moved from libmoved from lib.c to arith.c. (max): New macro in arith.c. (arith_init): Registrations moved from eval.c. * eval.c (eval_init): Registrations moved to arith.c
* float: fix syntax error involving fplassify.Kaz Kylheku2019-03-221-1/+1
| | | | | | * lib.c (bad_float): Add missing parentheses around controlling expression of switch statement. This worked on glibc because it's a macro which expands to parentheses.
* take-until: rewrite with seq_info; elide cons.Kaz Kylheku2019-03-201-16/+13
| | | | | | | | | | * lib.c (take_until_list_fun): Renamed to lazy_take_until_list_fun. (lazy_take_until_list_fun, take_until): take_until upgraded to use seq_info to classify sequence. In the lazy list case, the state cons is elided; the predicate function is passed as the function environment, and the key function and list being traversed are propagated via the lazy cons car and cdr.
* take: rewrite with seq_info; elide cons.Kaz Kylheku2019-03-201-31/+31
| | | | | | | | | | | | | * lib.c (take_list_fun, take_while_list_fun): Renamed to lazy_take_list_fun and lazy_take_while_list_fun respectively. (lazy_take_list_fun, take): take upgraded to use seq_info to classify sequence. In the lazy list case, the state cons is elided; the list is passed as the function environment, and the remaining count is propagated in the lazy cons's car field. (lazy_take_while_list_fun, take_while): Similar changes. * txr.1: Fixed accidental reference to drop function in the documentation for the take function.
* interpose: eliminate state cons.Kaz Kylheku2019-03-181-9/+5
| | | | | * lib.c (lazy_interpose_func, lazy_interpose): Pass list in car of lcons, and separator as function env.
* partition*: optimization.Kaz Kylheku2019-03-181-14/+8
| | | | | | * lib.c (partition_star_func, partition_star): Eliminate state cons. Eliminate wasteful cons updating and destructuring in loop.
* partition, split, split*: eliminate state conses.Kaz Kylheku2019-03-181-30/+31
| | | | | | * lib.c (partition_func, split_func, split_star_func, partition_split_common): Store three context elements in function's env, and lcons car/cdr.
* partition-by: eliminate state conses.Kaz Kylheku2019-03-171-12/+7
| | | | | | * lib.c (partition_by_func, partition_by): Store the three context items in the function's env, and the lcons car and cdr, instead of allocating a two-cons list stored in the env.
* tuples: eliminate state conses.Kaz Kylheku2019-03-151-8/+6
| | | | | | * lib.c (tuples_func, tuples): Store the three context items in the function's env, and the lcons car and cdr, instead of allocating a two-cons list stored in the env.
* flatcar*: eliminate state cons.Kaz Kylheku2019-03-151-5/+5
| | | | | | | * lib.c (lazy_flatcar_func, lazy_flatcar): Here, the state information consists of just one value. We just make that value itself the function's env, and mutate that env as needed.
* flatten*: use lcons for threading state.Kaz Kylheku2019-03-151-5/+6
| | | | | | | * lib.c (lazy_flatten_func, lazy_flatten): Do not allocate a cons to hold the traversal state. In fact, the environment of the function is not used at all; the lcons car and cdr are used to propagate the state.
* append*: save a bit of memory.Kaz Kylheku2019-03-141-9/+8
| | | | | | | | * lib.c (lazy_appendv_func, lazy_appendv): Do not allocate a cons cell for maintaining the state. Use the function environment for one of the two state values, and thread the other state value through the initial car contents of each lazy cons cell.
* New unchecked setter for function environment.Kaz Kylheku2019-03-141-0/+6
| | | | | | | * lib.c (us_func_set_env): New function: func_set_env without the type check. * lib.h (us_func_set_env): Declared.
* oop: make struct symbol supertype of all structs.Kaz Kylheku2019-03-131-0/+2
| | | | | | | | * lib.c (subtypep): If the supertype is struct, then return t if the subtype is the name of a struct type. * txr.1: Update the type graph to show the struct root, adding a note about it.
* lazy conses: support state in car and cdr.Kaz Kylheku2019-03-131-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here we allow application code to take advantage of a trick already used internally. When a lazy cons cell is created, we can temporarily put state information into its car and cdr fields. When these fields are accessed normally, by the car and cdr function, the lazy cons' update function will be invoked, which will populate these fields. If we have a way for that function to retrieve the existing values of those fields, then the function can treat those fields as state information: it can retrieve the values into temporary local variables, overwrite the original values, and then propagate the state information into the car and cdr into the next lazy cons cell being added. Thus lazy list generation that needs two cells of state or less does not require the allocation of a context object. * eval.c (eval_init): make-lazy-cons becomes a three-argument function with two optional parameters. New functions lcons-car and lcons-cdr are registered. * lib.c (make_lazy_cons_pub): New function, wrapping make_lazy_cons_car_cdr with argument defaulting. (lcons_car, lcons_cdr): New functions. * lib.h (make_lazy_cons_pu, lcons_car, lcons_cdr): Declared. * txr.1: Updated doc of make-lazy-cons regarding new arguments. Documented lcons-car and lcons-cdr.
* lib: use accessor for lcons function.Kaz Kylheku2019-03-121-2/+3
| | | | | | | | * hash.c (hash_keys_lazy, hash_values_lazy, hash_pairs_lazy, hash_alist_lazy): Use us_lcons_fun instead of direct lcons->lc.fun access. * lib.c (simple_lazy_stream_func, lazy_stream_func): Likewise.
* lib: introduce new make_lazy_cons variant.Kaz Kylheku2019-03-121-15/+15
| | | | | | | | | | * lib.c (make_lazy_cons_car_cdr): New function. (lazy_where_func, lazy_where_hash_func, where): Use make_lazy_cons_car and the new make_lazy_cons_car_cdr instead of two-step construction and initialization with us_rplaca and us_rplacd. * lib.h (make_lazy_cons_car_cdr): Declared.
* lib: rename make_half_lazy_cons.Kaz Kylheku2019-03-121-2/+2
| | | | | | | | | | | * lib.h (make_half_lazy_cons): Renamed to make make_lazy_cons_car. * lib.c (rem_lazy_rec, make_half_lazy_cons): Follow rename. * hash.c (hash_keys_lazy, hash_keys, hash_values_lazy, hash_values, hash_pairs_lazy, hash_pairs, hash_alist_lazy, hash_alist): Follow rename.
* lib: optimize lazy functions with unchecked accesses.Kaz Kylheku2019-03-121-89/+89
| | | | | | | | | | | | | | | | | | * lib.h (us_lcons_fun): New inline function. (us_cons_bind): New macro. * eval.c (lazy_mapcar_func, lazy_mapcarv_func, range_func, range_star_func, generate_func, giterate_func, ginterate_func, expand_right_fun, repeat_infinite_func, repeat_times_func, pad_func): Use us_cons_bind, us_car, us_cdr, us_rplaca, us_rplacd and us_lazy_cons_func, which skip the type check. * lib.c (lazy_conses_func, lazy_appendv_func, rem_lazy_func, lazy_flatten_func, lazy_flatcar_fund, tuples_func, partition_by_func, partition_func, split_func, split_star_func, partition_star_func, lazy_interpose_fun, take_list_fun, take_while_list_fun, take_until_list_fun, lazy_where_has_func): Likewise.
* where: convert to lazy.Kaz Kylheku2019-03-121-44/+79
| | | | | | | | * lib.c (lazy_where_func, lazy_where_hash_func): New static functions. (where): Rewritten to generate lazy list. * txr.1: Doc updated.
* float: turn out-of-range calculations into exceptions.Kaz Kylheku2019-03-121-4/+24
| | | | | | | | | | | | | | | On platforms that have the C99 fpclassify, we can use it to banish infinity and NaN representations. If such a thing arises, we throw an exception rather than producing an object that prints as #<bad-float>. * configure: add detection for fpclassify. * lib.c (bad_float): New inline function and macro. (flo): If the argument is other than zero, a normal value or a subnormal, then throw an exception. We thereby refuse to admit such objects into our numeric object system.
* New sequence iterator object and functions.Kaz Kylheku2019-03-111-1/+53
| | | | | | | | | | | | | | | | | * eval.c (eval_init): Register seq-begin, seq-next and seq-reset. * lib.c (seq_iter_s): New symbol variable. (seq_iter_mark): New static function. (seq_iter_ops): New static structure. (seq_begin, seq_next, seq_reset): New functions. (obj_init): Intern seq-iter symbol, used as class name for iterators. * lib.h (seq_iter_s, seq_begin, seq_next, seq_reset): Declared. * txr.1: Documented.
* bracket: new function.Kaz Kylheku2019-02-241-0/+13
| | | | | | | | | | * eval.c (eval_init): Register bracket intrinsic. * lib.c (bracket): New function. * lib.h (bracket): Declared. * txr.1: Documented.
* printer: revise package prefix decision.Kaz Kylheku2019-02-231-24/+50
| | | | | | | | | | | | | | | | | | | | | | | * lib.c (symbol_needs_prefix): revisiting the wrongheaded requirements codified in 7bc150f, because the ergonomics is bad. In a package that has a local symbol that has the same name as one in a fallback list, that symbol is always printed with a prefix, which is annoying. The new rules are simple: if the symbol being printed is the one which is visible, then it gets no package prefix. Also, this function now handles the full responsibility for the prefix calculation, including for keyword symbols and uninterned symbools. It returns nil to indicate no prefix is needed, or else a character string. Moreover, logic is added to detect symbols which have a home package, but are uninterned from it, which should be printed with the "#" prefix. Lastly, this function is optimized to avoid unnecessary gethash operations. If a symbol S's home package is P, and P contains no hidden symbols (overwhelmingly common situation), then S is interned in P; no need to do the hash lookup to check this. (obj_print_impl): Symbol printing simplified: if symbol_needs_refix returns non-nil, that string value is the prefix.
* Optimize hash operation with unsafe car/cdr.Kaz Kylheku2019-02-141-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The associative lists that make up the chains of a hash table are guaranteed to be made of conses. We can use unsafe versions of car, cdr, rplaca and rplacd to speed up hash operations. * eval.c (op_dohash): Use unsafe operations on hash cell. * filter.c (trie_compress, regex_from_trie): Likewise. * hash.c (hash_equal_op, hash_print_op, hash_mark, hash_grow, hash_assoc, hash_assql, copy_hash_chain, gethash, inhash, gethash_n, sethash, remhash, hash_next, maphash, do_weak_tables, group_by, group_reduce, hash_keys_lazy, hash_keys, hash_values_lazy, hash_values, hash_pairs_lazy, hash_pairs, hash_alist_lazy, hash_uni, hash_diff, hash_symdiff, hash_isec, hash_subset, hash_update, hash_update_1, hash_revget): Likewise. * lib.c (us_rplaca, us_rplacd): New functions. (package_local_symbols, package_foreign_symbols, where, populate_obj_hash, obj_hash_merge): Use unsafe operations on hash cell * lib.h (us_rplaca, us_rplacd): Declared. * parser.c (circ_backpatch, get_visible_syms): Use unsafe operations on hash cell. * struct.c (method_name, get_slot_syms): Likewise.
* gethash_c: review uses and improve or replace.Kaz Kylheku2019-02-141-8/+7
| | | | | | | | | | | | | | | | | | | | * eval.c (env_fbind, env_vbind, reg_symacro): Use gethash_l instead of gethash_c to eliminate repeated cdr operations on the same cell. * hash.c (sethash): Since new_p is never used, eliminated it and use nulloc. (group_reduce): Use gethash_l instead of gethash_c. * lib.c (obj_init): Replace rplacd(gethash_c(...)) pattern whose return value is not used with with sethash. We lose some diagnosability here since sethash doesn't take a "self" argument. (obj_print_impl, obj_hash_merge): Use gethash_l instead of gethash_c. * parser.y (ensure_parser, parser_circ_def, get_visible_syms, rlset): Use gethash_l instead of gethash_c.
* gethash_f: removing function.Kaz Kylheku2019-02-141-28/+26
| | | | | | | | | | | | | | | | Uses of gethash_f can be replaced with gethash_e, which returns the hash cell directly rather than through a loc argument. Code that needs the value can call cdr itself. * hash.c (inhash, hash_isec, hash_update_1): Replace gethash_f with gethash_e. (gethash_f): Function removed. * hash.h (gethash_f): Declaration removed. * lib.c (use_sym, unuse_sym, find_symbol, unintern, intern_fallback, in, sel, populate_obj_hash): Replace gethash_f with gethash_e.
* symdiff: new function.Kaz Kylheku2019-02-141-0/+43
| | | | | | | | | | | | * eval.c (eval_init): Register symdiff intrinsic. * lib.c (symdiff): New function. * lib.h (us_car_p, us_cdr_p): New inline functions. (symdiff): Declared. * txr.1: Documented, also fixing issues not related to symdiff doc.
* optimizing diff, isec and uni for non-lists.Kaz Kylheku2019-02-131-35/+70
| | | | | | | | | | | | | | | Also, these functions now support hashes. * eval.c (eval_init): Register only the deprecated set-diff to the set_diff function. The diff intrinsic is now going to the new function named diff. * lib.c (diff): New function. (isec, uni): Rewritten to use seq_iter_t. * lib.h (diff): Declared. * txr.1: Documentation updated.
* num: reduce duplicate code.Kaz Kylheku2019-02-131-3/+1
| | | | | * lib.c (num): Use num_fast instead of an expression that is identical to the body of that inline function.