Mucking around with whitespace is necessary with the current version of the maxima() function : something here doesn't like to receive empty lines. Furthermore, Maxima grammar, a bit Lisp-like (minus parentheses), doesn't differentiate betw een quantities of whitespace (in other words, it isn't Python :-). So it was simpler to condensate all this whitespace.Of course, the present version will have problems for example with strings containing semicolons...
Some comments below : Le lundi 4 mai 2015 16:35:53 UTC+2, Volker Braun a écrit : > > I also noticed that ctrl-d doesn't work (probably captured by the browser) > so interactive subshells can't be left. > Confirmed:-(. Ditto for %r. But in this case, %%R works better (not perfectly : it only returns the *last* printed output only (but all graphs. Go figure...). > This ought to be a general IPython notebook question, but I don't know the > answer. > Neither do I:-(. As you said, IPython distinguishes single percent = line, and double > precent = cell magics. > > IMHO we should do as little processing on the cell magic as possible. Why > muck around with whitespace, what if somebody wants to work with a Maxima > string containing multiple consecutive spaces, etc. Same for semicolons. > Just require valid Maxima input in a %%maxima cell. > Meaning we need either a Maxima lexer/parser before calling maxima() or a better way yo treat Maxima answers to incorrect or incomplete response. Non-trivial in both cases. I plan to muck around the command-line version to see how it behaves in this respect (but when ?). Maybe also the code fpr the (cell-)magic %r and %maxima of the Sage notebook, which do The Right Thin (TM) (if I can make head or tail of the code...). HTH, -- Emmanuel Charpentier On Monday, May 4, 2015 at 4:17:10 PM UTC+2, Emmanuel Charpentier wrote: > > Dear list, > > I noticed an annoyance in the IPython notebook (I mean Sage's Ipython > notebook, not IPython ° %load_ext sage...). a line magic %maxima exists, > but seems to open an interactiove contol woth Maxima, that one cannot exit > of. > > What I'd like to have is somthing close to the %%R cell magic offered by > %rmagic (which, BTW, uses rpy2, which is not available directly) : the text > of the cell is sent to R and the (last) answer is printed out. > > I have created a first approximation of what I'd like to have in the > attached IPython worksheet. Il scans a (multiline) text, splits it on > semicolons, replaces all whitespace by a single space, sends it line by > line to maxima and records the answers, which are in fine returned. > > What do you think ? > > HTH, > -- > Emmanuel Charpentier > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.