replacing Mathematica was: Polymorphic pretty printing
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  HENRIKSON, JEFFREY <JEFHEN@S...> 
Subject:  replacing Mathematica was: Polymorphic pretty printing 
I agree that polymorphic toplevel printing is a worthy project. I posted on this last month or two and got a "here's how you can keep it polymorphic until you actually plug it into the toplevel" answer. All I wanted to be able to do was print out my double ended queue type. :( Many times I've also wanted to print hashes. > I'm curious why people want to use these kinds of routines. What does > printf style minilanguage printing have to offer compared to just using > plain old Ocaml functions? Sounds like Skaller doesn't like toplevels. Fine with me. I like them. I would also like to see a totally native code toplevel someday, though I understand there are partial solutions and the real solution has big obstacles. > (the evil plan is to replace Mathematica) On the subject of evil plan, I would like to say: if you write yet another symbolic package, make sure to get the derivative notation right! There is an excellent MIT scheme implementation of a derivative algebra. Sussman (of Structure and Interpretation of Computer Programs fame) did it for a class he teaches in Lagrangian mechanics. Everybody has seen the goofy "d by d(q dot)" notation in the traditional physicist's presentation of Lagrangians. Ten hours of getting your head around broken notation to one hour of acutal understanding. Well they took the derivative notation in Spivak "Calculus on Manifolds" and mechanised it. (Spivak points out even the chain rule breaks Leibnitz notation and proposes a solution.) Now with the mechanized version:  The notation they write into scheme to run their simulations is concise enough to also serve the function of blackboard presentation.  If f : R^3 x R^3, then Df is maps R^3 to 3x3 matrix space, right? So what is D(Df)? Easy in their system.  The up tuple/ down tuple notation they use to implement this subsumes the usual tensor notation.  The chain rule and other nice things work in every dimensionality. What's more, they recently published what used to be hard to find course notes, so now there is a "Structure and Interpretation of Classical Mechanics." You can buy it on Amazon and/or read it on the web: http://mitpress.mit.edu/SICM/ Also on the subject of evil plan, I'd like to point out some other useful things which I have considered could be replacing:  SAS  SQL sans concurrency, for analysis only Basically, the main difference being whether you like your analysis database to be ordered or unordered. I need either solution to work outofcore so I can have data bigger than RAM. I would like the toplevel printing to be extended to "here's a GUI widget which gets returned. You can double click it to see the table inside." Like how the LyX TeX frontend does footnotes/references. This is probably a separate application with a toplevel embedded. Is there any public interface to grab the toplevel, put in objects, and get out values? What about can I get out types in MLast trees? Scan the top environment so I can do identifier completion and searching? Does camlp4 interface just by text filtering, reproducing the entire syntactical environment by itself, or does it do something more intertwined? (I don't see how polymorphic printing has to do with this directly, just how useful extending the notion of toplevel could be.) Cheers, Jeff Henrikson Original Message From: ownercamllist@pauillac.inria.fr [mailto:ownercamllist@pauillac.inria.fr] On Behalf Of Andrej Bauer Sent: Monday, October 18, 2004 8:42 AM To: camllist@inria.fr Subject: [Camllist] Polymorphic pretty printing This is a question for gurus. I am contemplating writing an enhanced toplevel that could display graphics as we well as text (the evil plan is to replace Mathematica). The first step seems to be: how to install a pretty printer for a _polymorphic_ type. As an example, consider this: type 'a set = { elements : 'a list } I want a value of this type to print out as {a, b, c, ... d} instead of {elements = [a; b; c; ...; d]} The trouble is, how to print out the elements a, b, c, ..., d since they are of a polymorphic type. According to the somewhat old message at http://caml.inria.fr/archives/200201/msg00234.html I should use Toplevel.print_out_value to do this. But, print_out_value expects an arguments of type Outcometree.out_value, and it is not clear to me where I will get it. Is there another function that converts an arbitrary value (of an arbitrary type!) to an Outcometree.out_value? Am I supposed to rewrite half of toplevel.ml to get this working? It would be helpful if there were, somewhere in the world, a minimal and _complete_ example of how one can actually write a polymorphic pretty printer. This _must_ be an FAQ. Best regards, Andrej  To unsubscribe, mail camllistrequest@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/camlbugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners