emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Matthew Oesting <oestingm@me.com>,
	Eric S Fraga <ucecesf@ucl.ac.uk>,
	emacs-orgmode@gnu.org
Subject: Re: Possible Calc support for Org-Babel?
Date: Wed, 26 Jan 2011 18:39:59 -0600	[thread overview]
Message-ID: <87hbcvnpr4.fsf@dustycloud.org> (raw)
In-Reply-To: <87eib1dxll.fsf@gmail.com> (Eric Schulte's message of "Thu, 04 Nov 2010 07:24:16 -0600")

(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=9000
testvar - 200
#+END_SRC

#+results:
: 8800


#+BEGIN_SRC calc :var testvar=9000
(testvar - 200) 800
#+END_SRC

#+results:
: 800 testvar - 160000

"Eric Schulte" <schulte.eric@gmail.com> 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=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 <ucecesf@ucl.ac.uk> writes:
>
>> Forgot to CC the list et al.
>>
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>
>>> Eric S Fraga <ucecesf@ucl.ac.uk> 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.
>
> _______________________________________________
> 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
>

-- 


-- 
𝓒𝓱𝓻𝓲𝓼𝓽𝓸𝓹𝓱𝓮𝓻 𝓐𝓵𝓵𝓪𝓷 𝓦𝓮𝓫𝓫𝓮𝓻

  parent reply	other threads:[~2011-01-27  0:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 22:42 Possible Calc support for Org-Babel? Eric S Fraga
2010-11-04 13:24 ` Eric Schulte
2010-11-04 14:13   ` Eric S Fraga
2010-11-04 14:42   ` Sébastien Vauban
2010-11-04 15:33     ` Eric Schulte
2010-11-04 16:02       ` Sébastien Vauban
2010-11-04 16:23         ` Eric Schulte
2011-01-27  0:39   ` Christopher Allan Webber [this message]
2011-02-23  4:35     ` Eric Schulte
2011-02-24 10:13       ` Eric S Fraga
2011-02-27 21:32         ` Eric Schulte
2011-02-28 18:16           ` Eric S Fraga
2011-03-01 17:34             ` Eric Schulte
2011-03-01 20:10               ` Eric S Fraga
2011-03-07  9:16               ` Eric S Fraga
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01 20:48 orgmode
2010-10-22 17:17 Matthew Oesting
2010-10-26 18:37 ` Eric Schulte
2010-10-29  6:42   ` Eric Schulte
2010-10-29  7:13     ` Carsten Dominik
2010-10-29 11:14     ` Eric S Fraga
2010-10-29 14:43       ` Eric Schulte
2010-10-29 16:22         ` Eric Schulte
2010-10-29 19:53         ` Eric S Fraga
2010-10-29 20:26           ` Eric Schulte
     [not found]             ` <87hbg4pooh.fsf@ucl.ac.uk>
     [not found]               ` <871v7879x5.fsf@gmail.com>
2010-10-30 20:54                 ` Eric S Fraga
2010-11-03 20:10                   ` Eric Schulte
2010-10-29 11:27     ` Sébastien Vauban

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87hbcvnpr4.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=oestingm@me.com \
    --cc=schulte.eric@gmail.com \
    --cc=ucecesf@ucl.ac.uk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).