* [Caml-list] OCaml as fancy calculator...
@ 2001-08-05 9:16 Oliver Bandel
2001-08-05 11:06 ` Pixel
2001-08-07 14:32 ` John Max Skaller
0 siblings, 2 replies; 10+ messages in thread
From: Oliver Bandel @ 2001-08-05 9:16 UTC (permalink / raw)
To: caml-list
Hello,
in the examples of the introductional texts to OCaml
is mentioned, that OCaml may be used as a fancy
calculator.
Ok, if I take this idea, I want to have some mathematical
libraries, like histograms (frequencies) and the like.
If I write some often-needed mathematical routines,
so that it can be used with file-based OCaml-programs
for compilation, how can I use such files (or the compiled
byte-code or binaries) for interactive sessions with
ocaml?
Is this the first step to use the module system?
Or can I start with things like "include"-statements
in other calculator-like programs? (Including
source-files like an #include in C or load-commands
of some programs.)
I think about writing some mathematical routines
and maybe some output-routines to postscript
(Or maybe I can use cdk for this?).
Maybe this can acchieve things like gnuplot does,
but in a functional way.
So I'm thinking about implementing some simple
routines for loading data-files, doing mathematical
operations and writing the results as ASCII-output and
maybe as postscript-output (or psTricks-Output for including
the reults in LaTeX-documents).
I think as a beginner of FPLs and OCaml, it's too much effort
to write a complete application like a functional-gnuplot.
I want to use this tool for solving some common problems of the day
and I want to learn OCaml (and FP in general) with it.
So, it's ok, if it is only a small tool. But I want to have the
right design decisions for using it as a tool, but one, which is
expandable in future time, when it - maybe - can become a
complete application.
* Any hints, how to plan/design such a project, which
tools I can use and so on...?!
* How can I use it in in interactive mode?
* other things to think about?
TIA,
Oliver
--
Obviously, because programming is a creative activity there is not
going to be a set of rules which will always lead us mechanically
to a solution to a problem.
(Simon Thompson: Haskell - The Craft of Functional Programming)
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] OCaml as fancy calculator...
2001-08-05 9:16 [Caml-list] OCaml as fancy calculator Oliver Bandel
@ 2001-08-05 11:06 ` Pixel
2001-08-05 15:15 ` Oliver Bandel
2001-08-07 14:32 ` John Max Skaller
1 sibling, 1 reply; 10+ messages in thread
From: Pixel @ 2001-08-05 11:06 UTC (permalink / raw)
To: Oliver Bandel; +Cc: caml-list
Oliver Bandel <oliver@first.in-berlin.de> writes:
> So I'm thinking about implementing some simple
> routines for loading data-files, doing mathematical
> operations and writing the results as ASCII-output and
> maybe as postscript-output (or psTricks-Output for including
> the reults in LaTeX-documents).
have a look at mathplot:
http://www.chez.com/prigaux/mathplot.html
http://www.chez.com/prigaux/mathplot_screenshots/
It's written in OCaml using the Tk toolkit for the GUI frontend
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] OCaml as fancy calculator...
2001-08-05 11:06 ` Pixel
@ 2001-08-05 15:15 ` Oliver Bandel
2001-08-05 19:36 ` Pixel
0 siblings, 1 reply; 10+ messages in thread
From: Oliver Bandel @ 2001-08-05 15:15 UTC (permalink / raw)
To: Pixel; +Cc: caml-list
Hello,
On Sun, 5 Aug 2001, Pixel wrote:
> Oliver Bandel <oliver@first.in-berlin.de> writes:
>
> > So I'm thinking about implementing some simple
> > routines for loading data-files, doing mathematical
> > operations and writing the results as ASCII-output and
> > maybe as postscript-output (or psTricks-Output for including
> > the reults in LaTeX-documents).
>
> have a look at mathplot:
> http://www.chez.com/prigaux/mathplot.html
> http://www.chez.com/prigaux/mathplot_screenshots/
>
> It's written in OCaml using the Tk toolkit for the GUI frontend
>
I tried mathplot some weeks ago, but can't compile it.
I think it is written in Caml Light, or it was a very old
version of COaml... I don't remember. But it was not
possible to let it run.
The other point is: If I use ready written software,
I can not learn programming OCaml.....
Ciao,
Oliver
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] OCaml as fancy calculator...
2001-08-05 9:16 [Caml-list] OCaml as fancy calculator Oliver Bandel
2001-08-05 11:06 ` Pixel
@ 2001-08-07 14:32 ` John Max Skaller
[not found] ` <20010807171614.B1646@hars>
1 sibling, 1 reply; 10+ messages in thread
From: John Max Skaller @ 2001-08-07 14:32 UTC (permalink / raw)
To: Oliver Bandel; +Cc: caml-list
Oliver Bandel wrote:
> If I write some often-needed mathematical routines,
> so that it can be used with file-based OCaml-programs
> for compilation, how can I use such files (or the compiled
> byte-code or binaries) for interactive sessions with
> ocaml?
>
> Is this the first step to use the module system?
Yes. First, create a file, say
my_routines.ml
and then compile it to bytecode:
ocamlc my_routines.ml
Note that you have just created a module
My_routines
Note the Capital letter onon the module name and the
lower case letter on the filename.
Now you can use it in the top level, in one or two steps.
First, you must say
#load "my_routines.cmo"
Now you can say:
My_routines.sin 1.2;;
and you'll get your routine 'sin' from module My_routines
called: thats the 'sin' in the file 'my_routines.ml'.
You can avoid typing the prefix 'My_routines' by saying
open My_routines;;
then
sin 1.2;;
but you should note that this will hide any other routine 'sin'
that's hanging around.
If you want to script a series of calculations in a file
my_calcs.ml
you can say
#use "my_calcs.ml"
Note that this is like a C #include: it compiles and executes as it
goes.
Whereas the #load is loading _already_ compiled code.
It's a good idea to run the top level 'ocaml' with
ledit ocaml
if you like keyboard editing. You'll need to download and build ledit
first. [Perhaps this will get built into the top level one day :-]
--
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix http://felix.sourceforge.net
Literate Programming tool Interscript
http://Interscript.sourceforge.net
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2001-08-09 8:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-05 9:16 [Caml-list] OCaml as fancy calculator Oliver Bandel
2001-08-05 11:06 ` Pixel
2001-08-05 15:15 ` Oliver Bandel
2001-08-05 19:36 ` Pixel
2001-08-07 14:32 ` John Max Skaller
[not found] ` <20010807171614.B1646@hars>
2001-08-07 17:34 ` [Caml-list] Re: ledit (was: OCaml as fancy calculator...) Daniel de Rauglaudre
2001-08-09 7:21 ` Florian Hars
2001-08-09 7:30 ` Laurent Chéno
2001-08-09 8:02 ` Ari Heitner
2001-08-09 8:37 ` Sven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox