From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Possible Calc support for Org-Babel? Date: Thu, 04 Nov 2010 07:24:16 -0600 Message-ID: <87eib1dxll.fsf@gmail.com> References: <878w1ani4w.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=54855 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDzuf-00010C-KG for emacs-orgmode@gnu.org; Thu, 04 Nov 2010 09:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDzua-0005x4-K0 for emacs-orgmode@gnu.org; Thu, 04 Nov 2010 09:31:33 -0400 Received: from mail-qw0-f41.google.com ([209.85.216.41]:38632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDzua-0005sH-Gb for emacs-orgmode@gnu.org; Thu, 04 Nov 2010 09:31:28 -0400 Received: by mail-qw0-f41.google.com with SMTP id 2so1292792qwi.0 for ; Thu, 04 Nov 2010 06:31:28 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric S Fraga Cc: emacs-orgmode@gnu.org, Matthew Oesting Alright, I've just pushed up support for variables. The following should all work as expected (or at least as I would expect them to). Note that most all of these blocks would have an effect on the calc stack. I think the next step would be to allow different sessions to specify different stacks. ** playing with calc support #+begin_src emacs-lisp :results silent (require 'ob-calc) #+end_src #+begin_src calc :var some=8 some some '* 1 '+ #+end_src #+results: : 65 #+begin_src calc 2*(8+8) #+end_src #+results: : 32 #+begin_src calc 2*e #+end_src #+results: : 5.43656365692 #+begin_src calc :var something=9 2*something #+end_src #+results: : 18 There are very likely some bugs, and as always I'm eager for a calc power user to show me the light of how this support could be make more "calc idiomatic". Cheers -- Eric Eric S Fraga writes: > Forgot to CC the list et al. > > "Eric Schulte" writes: > >> Eric S Fraga writes: > > [...] > >>> I now wonder if it would be worthwhile discussing the choices you have >>> made regarding stack versus algebraic evaluation. I would rather have >>> the quote mean an algebraic expression, just from the simple reason that >>> these will be longer than stack operations and so the overhead of a >>> quote is smaller as a percentage of keystrokes... >>> >> >> Hmm, one point against prefixing the algebraic expressions is that they >> would be more likely to be used by themselves in an inline code block. > > Yes, I guess so. My initial thoughts were that we have plenty of > algebraic languages available already through babel (octave, R, python, > ...) so why not support a stack based one more directly. However, the > real benefit of calc is that it is *emacs* and not external! Algebraic > is more natural to most people so making it easy for them to express > themselves makes sense.