Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Calculator function

On Jul 27, 11:59am, Peter Stephenson wrote:
> I keep meaning to add this.  Maybe someone has a better one somewhere?

This is pretty nifty.  Questions as they pop into my head:

> +Each line typed is evaluated as an expression.  The prompt shows a number,
> +which corresponds to a positional parameter where the result of that
> +calculation is stored.  For example, the result of the calculation on the
> +line preceeded by `tt(4> )' is available as tt($4).

Why not have the prompt look like `$4= ' instead of `4> '?

> +# Line editing and history are available. A blank line or `q' quits.

Hrm, I'd rather that blank lines were just ignored ... I think ...

> +# To do:
> +# - separate zcalc history from shell history using arrays --- or allow
> +#   zsh to switch internally to and from array-based history.

I posted a function some while back that switches history contexts by
dumping the history to a file, then zeroing and restoring HISTSIZE.  I
can't seem to track it down just now ... there's something sort of like
it in zsh-users/3506.

What were you thinking of, here?

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

Messages sorted by: Reverse Date, Date, Thread, Author