[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using `eval-expression' for math

From: reader
Subject: Using `eval-expression' for math
Date: Thu, 03 Apr 2008 07:52:51 -0500
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Can someone show me how to do math with the eval-expression tool?

(+ 2 2) and such simple problems I can do of course but when it comes
to combining things like:

52 * 32 / 12

  Trying (* 52 32 ( / 12)) 

        (/  12 ( * 52 32 ))

Goes nowhere fast, and from there I can't really imagine how else to
arrange the parens.

I get completely lost with the paren arrangement.  Obviously my lisp
skills are non-existent but I'm guessing there are a few basic rules
that will allow me to do basic math like the problem above quickly
without having to resort to my old stand by:
  awk 'BEGIN{print ((52 * 32) / 12)}'

Or simply:

  awk 'BEGIN{print (52 * 32 / 12)}'

Using awk takes longer to get it done than a quick `eval-expression' inside
emacs would take.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]