From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Allan Webber Subject: Re: Possible Calc support for Org-Babel? Date: Wed, 26 Jan 2011 18:39:59 -0600 Message-ID: <87hbcvnpr4.fsf@dustycloud.org> References: <878w1ani4w.fsf@ucl.ac.uk> <87eib1dxll.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=42340 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiFu7-0004Eo-Rg for emacs-orgmode@gnu.org; Wed, 26 Jan 2011 19:40:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiFu6-0001rQ-46 for emacs-orgmode@gnu.org; Wed, 26 Jan 2011 19:40:03 -0500 Received: from li28-75.members.linode.com ([75.127.72.75]:34292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiFu5-0001pq-To for emacs-orgmode@gnu.org; Wed, 26 Jan 2011 19:40:02 -0500 In-Reply-To: <87eib1dxll.fsf@gmail.com> (Eric Schulte's message of "Thu, 04 Nov 2010 07:24:16 -0600") 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 Schulte Cc: Matthew Oesting , Eric S Fraga , emacs-orgmode@gnu.org (failed to wide-reply initially) I just had use for this for some quick calculations I wanted to add to one of my files, but... Any idea why variables inside of parentheses don't work, but variables outside of them do? #+BEGIN_SRC calc :var testvar=3D9000 testvar - 200 #+END_SRC #+results: : 8800 #+BEGIN_SRC calc :var testvar=3D9000 (testvar - 200) 800 #+END_SRC #+results: : 800 testvar - 160000 "Eric Schulte" writes: > 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=3D8 > 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=3D9 > 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 th= at >>>> 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. > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > --=20 --=20 =F0=9D=93=92=F0=9D=93=B1=F0=9D=93=BB=F0=9D=93=B2=F0=9D=93=BC=F0=9D=93=BD=F0= =9D=93=B8=F0=9D=93=B9=F0=9D=93=B1=F0=9D=93=AE=F0=9D=93=BB =F0=9D=93=90=F0= =9D=93=B5=F0=9D=93=B5=F0=9D=93=AA=F0=9D=93=B7 =F0=9D=93=A6=F0=9D=93=AE=F0= =9D=93=AB=F0=9D=93=AB=F0=9D=93=AE=F0=9D=93=BB