9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: roger peppe <rogpeppe@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] hoc output format
Date: Thu, 13 May 2010 17:08:20 +0100	[thread overview]
Message-ID: <AANLkTikWE25guj0T3ltwcZzyDEkUTL5bttSGlOYBcNUd@mail.gmail.com> (raw)
In-Reply-To: <34C68D51-B2FF-4D3A-B4A0-C4B539CAD060@fastmail.fm>

On 13 May 2010 16:54, Ethan Grammatikidis <eekee57@fastmail.fm> wrote:
> what do you mean by "its output isn't suitable for use as input"? i'm just
> curious, have never used it that way. hum... having asked that question i
> tried some operations producing very lare numbers and they started to be
> printed with backslash-newlines in them. not nice, but such a form is
> suitable for input back to dc.

i mean that if you print output in hex, for example, the numbers
aren't tagged as such (with an 0x prefix), so you'll get corruption
or an error if you feed them back in without setting the input base
correctly.

> fc does look good for strictly command line use (scripts, perhaps?) i
> usually want to fire up a calculator in a window of its own & refer to it as
> needed.

i find it works nicely inside acme. the reverse polish input means
that if you execute it and get an output, you can just append an
operation to the end to operate on the resulting number, while
still keeping the original expression intact.

when i'm working out off the cuff sums (e.g. for household expenditure),
i'll make a text document which records the items, with little
fc fragments dotted here and there that record the actual
calculations. a poor man's spreadsheet i guess :-)

and it is good in scripts too. to take rudolf sykora's example
from earlier:
> v = `{hoc -e $min+$step'*('$i-1')'}

using fc it looks like this:

v = `{fc $min $step $i 1 - x +}

which i would argue is nicer.



  reply	other threads:[~2010-05-13 16:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 10:24 Rudolf Sykora
2010-05-12 10:41 ` Alexander Sychev
2010-05-12 18:06   ` Akshat Kumar
2010-05-13  7:51     ` Alexander Sychev
2010-05-13 13:24       ` erik quanstrom
2010-05-13 14:06         ` Alexander Sychev
2010-05-13 14:23           ` erik quanstrom
2010-05-13 15:04             ` Ethan Grammatikidis
2010-05-13 15:09             ` Gorka Guardiola
2010-05-13 15:37               ` erik quanstrom
2010-05-13 15:16             ` roger peppe
2010-05-13 15:31               ` erik quanstrom
2010-05-13 15:53                 ` roger peppe
2010-05-13 16:06                   ` erik quanstrom
2010-05-13 16:16                     ` roger peppe
2010-05-13 15:54               ` Ethan Grammatikidis
2010-05-13 16:08                 ` roger peppe [this message]
2010-05-13 15:20             ` Rudolf Sykora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikWE25guj0T3ltwcZzyDEkUTL5bttSGlOYBcNUd@mail.gmail.com \
    --to=rogpeppe@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).