[O] Re: [Orgmode] Possible Calc support for Org-Babel?
Eric Schulte schulte.e...@gmail.com writes: [...] Alright, I've made two changes, first, it is now possible to pass elisp vectors through to code blocks, e.g., #+begin_src emacs-lisp :var data=[1 2 3] (elt data 1) #+end_src #+results: : 2 Second, I've added a slightly hackey but seemingly necessary post-processing step to a call to calc-eval in ob-calc to remove quotes from vectors. This allows vector processing to take place---at least as far as my limited calc knowledge is concerned. For example; #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : [3, 6, 9] Hope this helps -- Cheers -- Eric Indeed. Works very well. Thanks! -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.4 (release_7.4.646.g57806)
[O] Re: [Orgmode] Possible Calc support for Org-Babel?
Eric S Fraga e.fr...@ucl.ac.uk writes: Eric Schulte schulte.e...@gmail.com writes: Eric S Fraga e.fr...@ucl.ac.uk writes: [...] Further on this, any suggestions on how to pass a vector variable to calc using babel? I tried #+begin-src org #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+end_src but get an error that says : Bad format in variable contents: Expected a number I've tried putting the vector in quotes but that doesn't help either. Is this maybe not possible? With the newest version of Org-mode, I'm now getting the following output. #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : (3, 6) Does this look correct? Best -- Eric This does not look correct: assuming my knowledge of calc is correct, the result should be the scalar 3 multiplied by each of the vector elements. I don't understand how =(3, 6)= can be the output of =3 y=... The strange thing is that this doesn't work at all for me (with git as of a few minutes ago): I still get the error message : byte-code: Bad format in variable contents: Expected a number However, if I put the vector in double quotes, it works: #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : [3, 6, 9] *but* if I subsequently remove the double quotes, it doesn't work and if put them back, it no longer works either. I am confused... there's like a hysteresis loop in org babel :( Any suggestions on how to debug this are welcome, of course. Oh, I just got an even stranger result, with the latest from git... #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : 3 hline something is most certainly wrong... Alright, I've made two changes, first, it is now possible to pass elisp vectors through to code blocks, e.g., #+begin_src emacs-lisp :var data=[1 2 3] (elt data 1) #+end_src #+results: : 2 Second, I've added a slightly hackey but seemingly necessary post-processing step to a call to calc-eval in ob-calc to remove quotes from vectors. This allows vector processing to take place---at least as far as my limited calc knowledge is concerned. For example; #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : [3, 6, 9] Hope this helps -- Cheers -- Eric ___ 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
[O] Re: [Orgmode] Possible Calc support for Org-Babel?
Eric Schulte schulte.e...@gmail.com writes: [...] Alright, I've made two changes, first, it is now possible to pass elisp vectors through to code blocks, e.g., #+begin_src emacs-lisp :var data=[1 2 3] (elt data 1) #+end_src #+results: : 2 Second, I've added a slightly hackey but seemingly necessary post-processing step to a call to calc-eval in ob-calc to remove quotes from vectors. This allows vector processing to take place---at least as far as my limited calc knowledge is concerned. For example; #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : [3, 6, 9] Hope this helps -- Cheers -- Eric It does indeed. It all seems to work just fine now. I don't necessarily know much more emacs calc than you but the little I know seems to work just fine. It's such a powerful package sitting there mostly idle and org babel is probably the best way to release it for general use! Especially for inline calculations... Time to re-read the calc manual again and play. Thanks, eric -- Eric S Fraga (: http://www.homepages.ucl.ac.uk/~ucecesf/ :) ___ 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
[O] Re: [Orgmode] Possible Calc support for Org-Babel?
Eric Schulte schulte.e...@gmail.com writes: Eric S Fraga e.fr...@ucl.ac.uk writes: [...] Further on this, any suggestions on how to pass a vector variable to calc using babel? I tried #+begin-src org #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+end_src but get an error that says : Bad format in variable contents: Expected a number I've tried putting the vector in quotes but that doesn't help either. Is this maybe not possible? With the newest version of Org-mode, I'm now getting the following output. #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : (3, 6) Does this look correct? Best -- Eric This does not look correct: assuming my knowledge of calc is correct, the result should be the scalar 3 multiplied by each of the vector elements. I don't understand how =(3, 6)= can be the output of =3 y=... The strange thing is that this doesn't work at all for me (with git as of a few minutes ago): I still get the error message : byte-code: Bad format in variable contents: Expected a number However, if I put the vector in double quotes, it works: --8---cut here---start-8--- #+begin_src calc :var y=[1 2 3] 3 y #+end_src #+results: : [3, 6, 9] --8---cut here---end---8--- *but* if I subsequently remove the double quotes, it doesn't work and if put them back, it no longer works either. I am confused... there's like a hysteresis loop in org babel :( Any suggestions on how to debug this are welcome, of course. -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.4 (release_7.4.553.g83b7.dirty) ___ 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