* Yet another literate programming application @ 2013-07-29 12:56 Alan Schmitt 2013-07-29 14:08 ` Eric Schulte 0 siblings, 1 reply; 5+ messages in thread From: Alan Schmitt @ 2013-07-29 12:56 UTC (permalink / raw) To: emacs-orgmode Or rather, I should say a literate algebra and calculating application: http://calca.io/ I'd really like to be able to call such an engine from org-mode. (And I'm secretly hoping something will say that $some_programming_language already does it and is fully integrating with org.) Alan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Yet another literate programming application 2013-07-29 12:56 Yet another literate programming application Alan Schmitt @ 2013-07-29 14:08 ` Eric Schulte 2013-07-29 16:30 ` Alan Schmitt 0 siblings, 1 reply; 5+ messages in thread From: Eric Schulte @ 2013-07-29 14:08 UTC (permalink / raw) To: Alan Schmitt; +Cc: emacs-orgmode Alan Schmitt <alan.schmitt@polytechnique.org> writes: > Or rather, I should say a literate algebra and calculating application: > http://calca.io/ > If this is appealing, it may be worth checking out the "Embedded Mode" of Emacs calc [1]. From what I can tell on the calc.io website, Emacs calc provides the same functionality, but Emacs calc has the benefits of (1) it is open source meaning you can confirm calculations and your answers (in my opinion a must for any peer reviewed publication), and (2) it may be embedded in *any* type of file. > > I'd really like to be able to call such an engine from org-mode. (And > I'm secretly hoping something will say that $some_programming_language > already does it and is fully integrating with org.) > Yes, you can use calc embedded mode in Org-mode files as well. > > Alan > Cheers, Footnotes: [1] (info "(calc)Embedded Mode") -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Yet another literate programming application 2013-07-29 14:08 ` Eric Schulte @ 2013-07-29 16:30 ` Alan Schmitt 2013-07-29 16:57 ` Eric Schulte 0 siblings, 1 reply; 5+ messages in thread From: Alan Schmitt @ 2013-07-29 16:30 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode schulte.eric@gmail.com writes: > Alan Schmitt <alan.schmitt@polytechnique.org> writes: > >> Or rather, I should say a literate algebra and calculating application: >> http://calca.io/ >> > > If this is appealing, it may be worth checking out the "Embedded Mode" > of Emacs calc [1]. From what I can tell on the calc.io website, Emacs > calc provides the same functionality, but Emacs calc has the benefits of > (1) it is open source meaning you can confirm calculations and your > answers (in my opinion a must for any peer reviewed publication), and > (2) it may be embedded in *any* type of file. Embedded calc mode is amazing, thanks for the link! It does not seem as intuitive to work with equations (I've tried doing the Functions and Solving Equations examples in calc), and there are funny results with spaces in names. If someone knows how to do the even/odd example in calc, please let me know. Here is what I got so far: * Variables #+BEGIN_SRC calc m := 42 b := 1000 m x + b => 42 x + 1000 mass of earth := 5.972e24 kg mass of moon := 7.34767309e22 kg mass of earth / (mass of moon) => earth / moon #+END_SRC * Functions #+BEGIN_SRC calc eq := f = 1.8 c + 32 ceq := solve(eq, c) => c = f / 1.8 - 17.7777777778 subst(eq, c, 20) => f = 68. subst(ceq, f, 100) => c = 37.7777777778 even(n) := n = 0 ? true : odd(n - 1) odd(n) := n = 1 ? true : even(n - 1) #+END_SRC Thanks again for pointing me to how great calc can be, Alan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Yet another literate programming application 2013-07-29 16:30 ` Alan Schmitt @ 2013-07-29 16:57 ` Eric Schulte 2013-07-29 18:00 ` Alan Schmitt 0 siblings, 1 reply; 5+ messages in thread From: Eric Schulte @ 2013-07-29 16:57 UTC (permalink / raw) To: Alan Schmitt; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1131 bytes --] Alan Schmitt <alan.schmitt@polytechnique.org> writes: > schulte.eric@gmail.com writes: > >> Alan Schmitt <alan.schmitt@polytechnique.org> writes: >> >>> Or rather, I should say a literate algebra and calculating application: >>> http://calca.io/ >>> >> >> If this is appealing, it may be worth checking out the "Embedded Mode" >> of Emacs calc [1]. From what I can tell on the calc.io website, Emacs >> calc provides the same functionality, but Emacs calc has the benefits of >> (1) it is open source meaning you can confirm calculations and your >> answers (in my opinion a must for any peer reviewed publication), and >> (2) it may be embedded in *any* type of file. > > Embedded calc mode is amazing, thanks for the link! It does not seem as > intuitive to work with equations (I've tried doing the Functions and > Solving Equations examples in calc), Very cool, thanks for sharing. I would note, that one nice thing about embedded mode is that there is no need for the #+begin/end_src calc blocks, rather the formulas may be placed directly in the Org-mode file. So to re-write a small portion of your previous example... [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: calc-examples.org --] [-- Type: text/x-org, Size: 547 bytes --] #+Title: Emacs Calc Embedded Mode Examples * Temperature Conversion (solving equations) Conversion from Celsius to Fahrenheit involves multiplication by 1.8 and the addition of 32 as shown below. eq := f = 1.8 c + 32 Solving for Celsius from Fahrenheit is then. ceq := solve(eq, c) => So, if we know that water boils at 100\deg Celsius, we can find the boiling point of water in Fahrenheit. subst(eq, c, 100) => Or if we know that paper burns at 451\deg Fahrenheit, we can find the burning point of paper in Celsius. subst(ceq, f, 451) => [-- Attachment #3: Type: text/plain, Size: 650 bytes --] Using embedded mode is still fairly awkward for me. I would benefit greatly from some sort of quick reference card explaining the key bindings and maybe an easier way to switch to/from embedded mode. > and there are funny results with spaces in names. If someone knows how > to do the even/odd example in calc, please let me know. Here is what I > got so far: > I'm not clear on how the even/odd example works in calc, could you share a link to the specific manual page you're referencing? I've long felt that calc would be a *very* powerful tool, if only I could climb the learning curve. Thanks, -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Yet another literate programming application 2013-07-29 16:57 ` Eric Schulte @ 2013-07-29 18:00 ` Alan Schmitt 0 siblings, 0 replies; 5+ messages in thread From: Alan Schmitt @ 2013-07-29 18:00 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode schulte.eric@gmail.com writes: > Very cool, thanks for sharing. I would note, that one nice thing about > embedded mode is that there is no need for the #+begin/end_src calc > blocks, rather the formulas may be placed directly in the Org-mode > file. Yes, but I was thinking of exporting the result to something nice, so I wanted to tell org I was in calc mode. In fact, I'm not sure to like how calc deals with delimiters: it's not liking the "#+..." if there is no blank line. I know it's configurable, though. > Using embedded mode is still fairly awkward for me. I would benefit > greatly from some sort of quick reference card explaining the key > bindings and maybe an easier way to switch to/from embedded mode. Yes, I basically read through the info page. The useful shortcuts I picked were: - C-x * u: update the formula (it's almost C-x * e C-x * e, except it will still work if another formula is currently in embedded mode) - C-x * d: duplicate the formula and enter embedded calc mode - s = in calc mode: add the nice => thingy > I'm not clear on how the even/odd example works in calc, could you share > a link to the specific manual page you're referencing? I've long felt > that calc would be a *very* powerful tool, if only I could climb the > learning curve. Well, it does not work as such. I don't know how to define mutually recursive functions in calc, and that was basically my question. (But then one may then use a real programming language at that point.) The manual never really defines functions, and it seems that what I want to do is rewrite things, but I cannot find a way to do it correctly. Alan ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-29 18:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-29 12:56 Yet another literate programming application Alan Schmitt 2013-07-29 14:08 ` Eric Schulte 2013-07-29 16:30 ` Alan Schmitt 2013-07-29 16:57 ` Eric Schulte 2013-07-29 18:00 ` Alan Schmitt
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).