Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

ocaml_beginners · Ocaml Beginners

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 31 - 60 of 13890   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#31 From: Remi VANICAT <vanicat+egroups@...>
Date: Fri Feb 8, 2002 11:09 am
Subject: Re: "ocaml_beginners"::[] Copy a text file?
dl_ens
Send Email Send Email
 
stalkern2 <stalkern2@...> writes:

> Yes! what you sent is straigth and simple (and gives 0o664
> permissions) and I don't mind that String.create comes from outside
> the standard library because
> I can rewrite it as

String.create come from the standard library. Not the core one, but
the standard one. You don't have to do anything different for
compiling a program which use any module from the standard library
than for a program which don't use it, so why bother ?

>
> let string_create pattern size =
>   let rec str_cr pattern str size counter =
>     if counter < size
>     then str_cr pattern (str^pattern) size (counter +1)
>     else str
>     in
>     str_cr pattern "" size 0;;
>
> (BTW This shouldn't be very performant, fetching arguments around over and
> over should take more memory than marking imperatively the value of a
> counter... I suppose)

you're wrong, you function is tail recursive (it don't do anything
after calling itself), So it don't use the stack.

the real problem is that each time you do a st1 ^ st2 you copy
(length st1) + (length st2) byte in memory. so if I call

string_create "a" 100 it will make (100)*(100 + 1)/2 = 5000 copy of
one byte. String.create 100 will only allocate the 100 byte, it far
(very far) more effective, and in the standard library.


--
Rémi Vanicat
vanicat@...
http://dept-info.labri.u-bordeaux.fr/~vanicat

#32 From: stalkern2 <stalkern2@...>
Date: Fri Feb 8, 2002 5:34 pm
Subject: Re: "ocaml_beginners"::[] Copy a text file?
stalkern2@...
Send Email Send Email
 
Alle ore 06:09, venerdě 08 febbraio 2002, Remi VANICAT ha scritto:
> String.create 100 will only allocate the 100 byte, it far
> (very far) more effective

Uhm! Is String.create written using the core library?

Ernesto

#33 From: Remi VANICAT <vanicat+egroups@...>
Date: Fri Feb 8, 2002 11:35 am
Subject: Re: "ocaml_beginners"::[] Copy a text file?
dl_ens
Send Email Send Email
 
stalkern2 <stalkern2@...> writes:

> Alle ore 06:09, venerdě 08 febbraio 2002, Remi VANICAT ha scritto:
> > String.create 100 will only allocate the 100 byte, it far
> > (very far) more effective
>
> Uhm! Is String.create written using the core library?

no, it is a primitive (written in C).

You can't make this kind of allocation explicitly in ocaml. (and you
don't have to).
--
Rémi Vanicat
vanicat@...
http://dept-info.labri.u-bordeaux.fr/~vanicat

#34 From: stalkern2 <stalkern2@...>
Date: Mon Feb 11, 2002 3:59 pm
Subject: Question about list policy
stalkern2@...
Send Email Send Email
 
May I ask you: shall we use this list also with the aim of building up a very
basic Ocaml-knowledge-base?
This would mean sending what is not required yet and likely trespassing the
very ocaml domain.

Hear from you
Ernesto

#35 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 12:56 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
doug+ml.ocaml_beginners@...
Send Email Send Email
 
stalkern2 wrote:
> May I ask you: shall we use this list also with the aim of building up a very
> basic Ocaml-knowledge-base?

Do you mean collecting some things together to come up with an OCaml
FAQ written by users?

That sounds like a great idea to me.

And if the activity level ever reaches some critical mass, perhaps an
OCaml users website could be created. I'm thinking of something like
http://my.gnus.org/ or http://perlmonks.org/, which are places where
people share ideas and information about their favorite software :-)

> This would mean sending what is not required yet and likely trespassing
> the very ocaml domain.

I'm not exactly sure what you mean, but if the intention is well-meant,
I would hope any trespass should be forgiven!

cheers,
doug

#36 From: Remi VANICAT <vanicat+egroups@...>
Date: Mon Feb 11, 2002 1:01 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
dl_ens
Send Email Send Email
 
doug+ml.ocaml_beginners@... writes:

> stalkern2 wrote:
> > May I ask you: shall we use this list also with the aim of building up a
very
> > basic Ocaml-knowledge-base?
>
> Do you mean collecting some things together to come up with an OCaml
> FAQ written by users?
>
> That sounds like a great idea to me.

yes it is.

--
Rémi Vanicat
vanicat@...
http://dept-info.labri.u-bordeaux.fr/~vanicat

#37 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 2:06 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Remi VANICAT wrote:
> > Do you mean collecting some things together to come up with an OCaml
> > FAQ written by users?
> >
> > That sounds like a great idea to me.
>
> yes it is.

One thing that I thought about doing before was to take some FAQs for
other popular languages C/C++/Perl/Python, and extract some common
questions, or translate relevant ones into OCaml. This is because there
are certain things that people wish to do, no matter what language they
are using.

Another good source would be to wade through the OCaml list archives,
and extract some tidbits that are particularly useful, but maybe not
fully documented already.

In a related vein, I have a little place on my web site for small
essays written by a beginner (me) for beginners:

  http://www.bagley.org/~doug/ocaml/Notes/

It's sort of like my own little OCaml knowledge base where I try to
write down things that I found interesting. I currently have essays for
Hashtbls, Lazy Eval(unfinished), OCaml's lack of a "range" function,
and a little bit of my silly humor too.

If anyone wants to give me ideas on more topics, or tell me if I have
made some big mistakes already, please let me know.

cheers,
doug

#38 From: Johann Spies <jspies@...>
Date: Mon Feb 11, 2002 2:20 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
jspies@...
Send Email Send Email
 
On Mon, Feb 11, 2002 at 08:06:10AM -0600, doug+ml.ocaml_beginners@...
wrote:
> Remi VANICAT wrote:
> > > Do you mean collecting some things together to come up with an OCaml
> > > FAQ written by users?
> > >
> > > That sounds like a great idea to me.
> >
> > yes it is.
>
> One thing that I thought about doing before was to take some FAQs for
> other popular languages C/C++/Perl/Python, and extract some common
> questions, or translate relevant ones into OCaml. This is because there
> are certain things that people wish to do, no matter what language they
> are using.
>

If we can use this list to add to the Ocaml Cookbook
(http://pleac.sourceforge.net), it will be of great help to newbies
like me.

Regards.

Johann


--
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

      "Make a joyful noise unto the LORD, all ye lands.
       Serve the LORD with gladness; come before his presence
       with singing. Know ye that the LORD he is God; it is
       he that hath made us, and not we ourselves; we are his
       people, and the sheep of his pasture."
                                         Psalms 100:1-3

#39 From: stalkern2 <stalkern2@...>
Date: Mon Feb 11, 2002 9:02 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
stalkern2@...
Send Email Send Email
 
I can actually explain why did I propose that.
Ocaml is the first multi-purpose programming language that I'm dealing with
(I live and think outside of mathematics, computing , computers and sciences
in general, and I think that I can't be accused of prejudices and favors
towards this or that artificial language). Now, I'm discovering something
great for me... and probably silly for most of you; that is, buffers, I/O,
processes, forking, pipes, channels, threads. I am still confused and I feel
it as a challenge. And I would like to post a paper about that when my ideas
well be clear, to allow others to go faster next time. This happened with the
question about the "functions with no arguments" and I've been very happy
with that discussion, I think that something like that can help a lot.

But I think that:
	 1) questions shouldn't be necessary to provoke such discussions
	 2) one should feel free to post traces of his own learning
	 3) an ocaml beginner could be a computing beginner also

One more thing: I've seen that linguists also are given Ocaml classes.
Personally, I'm studying alone and I use only "Développement d'Applications
avec Objective Caml" by Chailloux, Manoury and Pagano, published by O'Reilly
France, and the documentation accessible through ocamlbrowser.
May I ask you: how did you learn this language? I mean, what was your route?
How do you perceive the other Ocaml users?
BTW, I don't earn anything with promoting Ocaml, I just think that Ocaml is
below a "critical Internet mass" and I support it because I think that it's
clever (and also Linux-friendly). Well, there's an issue with security also.
Life in rich countries is tigthly controlled by software: I don't want to
enter wars because of a Somesoft Visual Basic bug! ;-))

Ciao
Ernesto

Alle ore 09:06, lunedě 11 febbraio 2002, doug+ml.ocaml_beginners@...
ha scritto:
> Remi VANICAT wrote:
> > > Do you mean collecting some things together to come up with an OCaml
> > > FAQ written by users?

#40 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 3:13 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Johann Spies wrote:
> If we can use this list to add to the Ocaml Cookbook
> (http://pleac.sourceforge.net), it will be of great help to newbies
> like me.

If you have question about a particular Pleac snippet, why not ask
it here? Maybe we can find a good OCaml solution to submit or
perhaps figure out if it makes sense in OCaml to begin with. I
think that in some cases the code snippets in Perl do not make
sense to translate directly to OCaml, since it may be possible
that you avoid that construction completely in the context of
solving some larger problem in the "OCaml way".

Also, in some cases of the snippets at Pleac, where Perl uses some
available Perl module, it might be better if we had an analogous
module in OCaml to begin with (I'm thinking of the date calculation
modules in Perl in particular, but there are other instances).

cheers,
doug

#41 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 3:25 pm
Subject: Re: "ocaml_beginners"::[] Question about list policy
doug+ml.ocaml_beginners@...
Send Email Send Email
 
stalkern2 wrote:
> But I think that:
>  1) questions shouldn't be necessary to provoke such discussions
>  2) one should feel free to post traces of his own learning
>  3) an ocaml beginner could be a computing beginner also

That all sounds very reasonable to me. It's a list for beginners, so
maybe few rules are needed. People should feel free to post whatever
occurs to them.

> May I ask you: how did you learn this language? I mean, what was your route?

I started with the OCaml tutorial and reference manual, then read
Jason Hickey's intro book. I also read other people's OCaml code.
There are a couple sections on ocaml.org with pointers to intro
material. I attempted to collect the essence here:

  http://www.bagley.org/~doug/ocaml/#Learn

> How do you perceive the other Ocaml users?

Hmm, I perceive that they occupy a place where I would also like to be
:-)

> BTW, I don't earn anything with promoting Ocaml, I just think that
> Ocaml is below a "critical Internet mass" and I support it because
> I think that it's clever (and also Linux-friendly).

I agree!

> Well, there's an issue with security also. Life in rich countries is
> tigthly controlled by software: I don't want to enter wars because
> of a Somesoft Visual Basic bug! ;-))

Truly you shall succeed because your quest is just :-)

cheers,
doug

#42 From: Martin Jambon <m.jambon@...>
Date: Mon Feb 11, 2002 4:32 pm
Subject: Interactive learning
m.jambon@...
Send Email Send Email
 
Hello list,

What about a CGI-based learning manual for Ocaml?

I mean an HTML manual or FAQ with text forms that play the role of the
Ocaml interpreter command-line. There would be a form for each paragraph
(and a paragraph per page), and clicking the Submit button would evaluate
the input and insert the result in the page.

I think it could be nice for any curious person to begin playing with
Ocaml with a very minimum of efforts.
Well, ocaml is not so hard to install on mostly used platforms, but
putting some mysterious software into your own sweet machine is something
that psychologically requires a great motivation :-)

All we would need is a kind of latex2html_for_caml and a web server to run
the CGI programs.

Martin

#43 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 4:58 pm
Subject: Re: "ocaml_beginners"::[] Interactive learning
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Martin Jambon wrote:
> Hello list,
>
> What about a CGI-based learning manual for Ocaml?
>
> I mean an HTML manual or FAQ with text forms that play the role of
> the Ocaml interpreter command-line. There would be a form for each
> paragraph (and a paragraph per page), and clicking the Submit button
> would evaluate the input and insert the result in the page.

Well, there would have to be some kind of security, maybe a "chrooted
jail" if the server is unix. I don't know about you, but the idea of
letting people run arbitrary code on my web server gives me nightmares!
:-)

> I think it could be nice for any curious person to begin playing with
> Ocaml with a very minimum of efforts. Well, ocaml is not so hard to
> install on mostly used platforms, but putting some mysterious software
> into your own sweet machine is something that psychologically requires
> a great motivation :-)
>
> All we would need is a kind of latex2html_for_caml and a web server
> to run the CGI programs.

Lowering the barrier for entry is always a very good thing.

My personal preference along these lines would be to set up a web
page for "OCaml advocacy". As in, it should demonstrate shortly and
succinctly, why OCaml is great. I think if people see some short
examples of the neat things OCaml can do, they might be willing to
install it.

cheers,
doug

#44 From: Martin Jambon <m.jambon@...>
Date: Mon Feb 11, 2002 5:35 pm
Subject: Re: "ocaml_beginners"::[] Interactive learning
m.jambon@...
Send Email Send Email
 
On Mon, 11 Feb 2002 doug+ml.ocaml_beginners@... wrote:

> Well, there would have to be some kind of security, maybe a "chrooted
> jail" if the server is unix. I don't know about you, but the idea of
> letting people run arbitrary code on my web server gives me nightmares!
> :-)

Sure, but I didn't say it would be "my" web server :-)

I admit I've been a little naive, but maybe it would be possible to
restrict the set of OCaml instructions to make it safe: suppress
input/output except those on stdout, suppress Unix, Obj, Marshal, unsafe_*
functions and so on.


Martin

#45 From: "Mattias Waldau" <mattias.waldau@...>
Date: Mon Feb 11, 2002 5:47 pm
Subject: RE: "ocaml_beginners"::[] Question about list policy
mattias.waldau@...
Send Email Send Email
 
Nice examples. A comment: ML-programmers like curried functions so
unless the have
to, they don't use anonymous lambdas. For example, often they write

lseq 4 ((+) 2);;

instead of the (clearer)

lseq 4 (fun x -> x + 2);;

where (+) makes + behave as any function, i.e. not infix anymore.

> In a related vein, I have a little place on my web site for
> small essays written by a beginner (me) for beginners:
>
  http://www.bagley.org/~doug/ocaml/Notes/

#46 From: "William D. Neumann" <wneumann@...>
Date: Mon Feb 11, 2002 7:06 pm
Subject: ocamlmktop (can you feel the pain?)
wneumann@...
Send Email Send Email
 
OK, here's my problem...

I'm trying to make a toplevel enviornment that contains hooks into some C
code for various crytpo algorithms so I can run some experiments...  Right
now I've got blowfish.ml, blowfish.mli, and libbf.lib (MS static library
containing blowfish C code).  All of the OCaml code needed is in the files
blowfish.mli and blowfish.ml.  So, to create the toplevel I do the
following:

ocamlc -c blowfish.mli
ocamlc -c blowfish.ml
ocamlmktop -o bftest.exe -custom blowfish.cmo -cclib -lbf

This works fine on my machine, I have all of the functionality I
want.  However, when I copied bftest.exe to my co-worker's machine, I
ran bftest and tried "open Blowfish;;" I received an "Unbound module
Blowfish" error...

If I recompile blowfish.{mli,ml} and rerun ocamlmktop on her machine, all
is well...  What's the deal -- I thought that all of the module
information was contained within bftest.  Do I have to distribute the .cmi
file as well?  If so, is there any way to create a toplevel that doesn't
require distribution of the .cmi files?  It is a minor annoyance, but I am
a lazy, lazy man...


<here beginith the whining>
These are the kind of issues that really need to be addressed a bit better
in the manual or FAQs.  Items like this just aren't discussed very clearly
anywhere...<grumble, grumble, grumble>

One sentence in section 9.5 of the manual would clear all of this up...
<here endith the whining>

Thanks,
William D. Neumann


---

"The magnum opus of rms and his Foundation is called 'GNU', a project to
completely rewrite the propritorially soiled Unix operating system.
(Apparently, 'GNU' stands for "Gnu's Not Unix", and is proudly held to be
the world's first 'recursive acronym'. Which, of course, proves that rms
didn't get out enough in his youth.)

	 -- Nick Roberts

#47 From: doug+ml.ocaml_beginners@...
Date: Mon Feb 11, 2002 7:22 pm
Subject: RE: "ocaml_beginners"::[] Question about list policy
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Mattias Waldau wrote:
> they don't use anonymous lambdas. For example, often they write
>
> lseq 4 ((+) 2);;
>
> instead of the (clearer)
>
> lseq 4 (fun x -> x + 2);;

Ah, I'm ignorant of such style issues ...

> where (+) makes + behave as any function, i.e. not infix anymore.

I do use that notation when I want to illustrate a concise qsort, for
instance:

let rec qsort = function
  [] -> [] | h::t -> qsort(filter((>) h) t) @ [h] @ qsort(filter((<=) h) t);;

(It's probably not the fastest implementation, but it's short :-)

cheers,
doug
--
http://www.bagley.org/~doug/contact.shtml

#48 From: Remi VANICAT <vanicat+egroups@...>
Date: Mon Feb 11, 2002 7:43 pm
Subject: Re: "ocaml_beginners"::[] ocamlmktop (can you feel the pain?)
dl_ens
Send Email Send Email
 
"William D. Neumann" <wneumann@...> writes:

[...]

> This works fine on my machine, I have all of the functionality I
> want.  However, when I copied bftest.exe to my co-worker's machine, I
> ran bftest and tried "open Blowfish;;" I received an "Unbound module
> Blowfish" error...
>
> If I recompile blowfish.{mli,ml} and rerun ocamlmktop on her machine, all
> is well...  What's the deal -- I thought that all of the module
> information was contained within bftest.  Do I have to distribute the .cmi
> file as well?

No, I believe (not sure) that bftest only contain information on how
the module is implemented, not the Information type, which are contain
in the .cmi file.

> If so, is there any way to create a toplevel that doesn't require
> distribution of the .cmi files?  It is a minor annoyance, but I am a
> lazy, lazy man...

None I'm aware of.
--
Rémi Vanicat
vanicat@...
http://dept-info.labri.u-bordeaux.fr/~vanicat

#49 From: Michel Quercia <michel.quercia@...>
Date: Mon Feb 11, 2002 8:30 pm
Subject: Re: "ocaml_beginners"::[] ocamlmktop (can you feel the pain?)
michel.quercia@...
Send Email Send Email
 
Le Mon, 11 Feb 2002 12:06:21 -0700 (MST)
"William D. Neumann" <wneumann@...> a écrit :

> Do I have to distribute the .cmi
> file as well?

Yes, the cmi file contains information about types and values exported by your
module, while the cmo file only contains machine code (actually byte-code).

--
Michel Quercia
23 rue de Montchapet, 21000 Dijon
http://michel.quercia.free.fr (maths)
http://pauillac.inria.fr/~quercia (informatique)
mailto:michel.quercia@...

#50 From: "Matthew O'Connor" <matthew.oconnor@...>
Date: Mon Feb 11, 2002 10:54 pm
Subject: Re: "ocaml_beginners"::[] Parameterized classes and types.
matthew.oconnor@...
Send Email Send Email
 
Rémi,

What you have shown works for the simple example however it does
not do what I wanted.

I want to be able to create objects of type 'a and run the supplied
function over any object of type 'a that was created in my class.

To answer my own question I could clone or copy the object and
then ensure that the function I supplied required  an 'a object as
a parameter to run upon.  In that way the function would run on the
new version of the 'a object.

eg.

class ['a] myList x fn =
     object (self)
       val mutable _x = Oo.copy(x: 'a)
       val mutable _fn = (fn : 'a -> unit)
       method go = _fn _x
     end;;

Cheers and thanks for you help,

Matthew O'Connor


On Fri, 8 Feb 2002 09:28, you wrote:
> "Matthew O'Connor" <matthew.oconnor@...> writes:
> > Hi,
> >
> > Firstly thanks to everyone for there responses on my
> > first posting. They were very helpful and I am glad that
> > this mail list was created.
> >
> > Coming from a C++ background when I create a template
> > class I can pass in a type and then a pointer to a function of
> > that type.
> >
> > eg.  myList<Apples, Apples::bite> myListApple
> >
> > Where Apples is a class type and bite is a method on an
> > Apples. Inside myList I can instantiate an Apples and run the
> > method bite on it. I don't actually have to pass an instantiated
> > Apples in.
> >
> > eg.   { T* myT = new T; T->fn(); }
> >
> > How would I do the same thing in OCaml?
>
> very easily, for example :
>
> class ['a] myList (x : 'a) (f : 'a -> unit) =
> object
>   var an_obj = x
>
>   method apply () = f x
> end

#51 From: "Matthew O'Connor" <matthew.oconnor@...>
Date: Mon Feb 11, 2002 11:39 pm
Subject: Default implementation of virtual function call.
matthew.oconnor@...
Send Email Send Email
 
Hi!

In C++ I can specify a virtual function and also supply a default
implementation for it. This becomes the generalised behaviour
of the class heirarchy.

Can I, in OCaml, mark a method as virtual and still supply an
implementation for it?

eg.

class virtual x alpha =
     object (self)
       val name = (alpha:string)
       method virtual print_name  =
         printf "Name = %s" name
     end;;

Cheers,

Matthew O'Connor

#52 From: Remi VANICAT <vanicat+egroups@...>
Date: Mon Feb 11, 2002 11:45 pm
Subject: Re: "ocaml_beginners"::[] Default implementation of virtual function call.
dl_ens
Send Email Send Email
 
"Matthew O'Connor" <matthew.oconnor@...> writes:

> Hi!
>
> In C++ I can specify a virtual function and also supply a default
> implementation for it. This becomes the generalised behaviour
> of the class heirarchy.

there is a problem of definition here :
what ocaml name a virtual method, C++ name it an abstract method
what ocaml name a method, C++ name it a virtual method

So the answer is yes.


--
Rémi Vanicat
vanicat@...
http://dept-info.labri.u-bordeaux.fr/~vanicat

#53 From: "Matthew O'Connor" <matthew.oconnor@...>
Date: Tue Feb 12, 2002 12:50 am
Subject: Re: "ocaml_beginners"::[] Default implementation of virtual function call.
matthew.oconnor@...
Send Email Send Email
 
Thankyou Remi,

I tried your suggestions out on the interpreter and you are correct.

Thanks again,

Matthew O'Connor

On Tue, 12 Feb 2002 10:45, you wrote:
> "Matthew O'Connor" <matthew.oconnor@...> writes:
> > Hi!
> >
> > In C++ I can specify a virtual function and also supply a default
> > implementation for it. This becomes the generalised behaviour
> > of the class heirarchy.
>
> there is a problem of definition here :
> what ocaml name a virtual method, C++ name it an abstract method
> what ocaml name a method, C++ name it a virtual method
>
> So the answer is yes.

#54 From: doug+ml.ocaml_beginners@...
Date: Tue Feb 12, 2002 4:31 am
Subject: an OCaml module for benchmarking run-times of functions
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Hi,

I'm trying out my new Makefiles and packaging stuff, and so I've built
a small package for a module I've been working on: benchmark. There is
a tarball here, along with HTML docs generated with ocamldoc from the
.mli file:

  http://www.bagley.org/~doug/ocaml/benchmark/

or you can download the tarball directly:

  http://www.bagley.org/~doug/ocaml/benchmark/benchmark-0.00.tar.bz2

It's a fairly straight port of the Perl module: Benchmark.

The basic idea is to be able to easily run latency (how much time to
do X) or throughput (how many X can be done in given time) performance
tests on some functions whose run-times you want to compare.

If anyone would care to try it out and give me feedback that would be
great.  It may still be a little rough around the edges :-)

Here's a very short sample of output to show what it can do:
(perftest.opt is a test I wrote using Benchmark to test the
performance of some string scanning functions I wrote):

./perftest.opt 10 /var/tmp/dat
Latencies for 5 iterations of custom, pcre, scanner, strscan, each for
at least 5.0 CPU secs ...
    strscan:  5 WALL ( 4.73 usr +  0.22 sys =  4.95 CPU) @  1.01/s (n=5)
    scanner:  4 WALL ( 3.95 usr +  0.20 sys =  4.15 CPU) @  1.20/s (n=5)
     custom:  3 WALL ( 2.15 usr +  0.10 sys =  2.25 CPU) @  2.22/s (n=5)
       pcre:  4 WALL ( 4.46 usr +  0.21 sys =  4.67 CPU) @  1.07/s (n=5)

           Rate strscan    pcre scanner  custom
strscan 1.01/s      --     -6%    -16%    -55%
    pcre 1.07/s      6%      --    -11%    -52%
scanner 1.20/s     19%     13%      --    -46%
  custom 2.22/s    120%    108%     84%      --

cheers,
doug
--
http://www.bagley.org/~doug/contact.shtml

#55 From: Johann Spies <jspies@...>
Date: Tue Feb 12, 2002 6:31 am
Subject: Re: "ocaml_beginners"::[] Interactive learning
jspies@...
Send Email Send Email
 
On Mon, Feb 11, 2002 at 05:32:17PM +0100, Martin Jambon wrote:
>
> All we would need is a kind of latex2html_for_caml and a web server to run
> the CGI programs.

Do you know hevea?  It is a very fast and capable latex --> html
convertor or even latex --> text and it is written in Ocaml.

Johann
--
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

      "When I consider thy heavens, the work of thy fingers,
       the moon and the stars, which thou hast ordained; What
       is man, that thou art mindful of him? and the son of
       man, that thou visitest him? For thou hast made him a
       little lower than the angels, and hast crowned him
       with glory and honour."            Psalms 8:3-5

#56 From: Martin Jambon <m.jambon@...>
Date: Tue Feb 12, 2002 10:26 am
Subject: Re: "ocaml_beginners"::[] Interactive learning
m.jambon@...
Send Email Send Email
 
On Tue, 12 Feb 2002, Johann Spies wrote:

> On Mon, Feb 11, 2002 at 05:32:17PM +0100, Martin Jambon wrote:
> >
> > All we would need is a kind of latex2html_for_caml and a web server to run
> > the CGI programs.
>
> Do you know hevea?  It is a very fast and capable latex --> html
> convertor or even latex --> text and it is written in Ocaml.

Yes, in fact I thought of some kind of hevea extension to support
dynamic generation of web pages: links would point to a CGI program that
inputs (1) the user's code (2) the identifier of the page to be displayed
(hidden parameter).
Therefore, a "page" would not be a definitive HTML file but an HTML
template with a hole to be filled by the CGI program with Caml toplevel
information.
The CGI program and the HTML templates would be generated automatically
from the source document and replace respectively "index.html" and other
HTML files.

By the way, HeVeA's page is
   http://pauillac.inria.fr/~maranget/hevea/doc/index.html

Martin

#57 From: stalkern2 <stalkern2@...>
Date: Tue Feb 12, 2002 5:22 pm
Subject: Re: "ocaml_beginners"::[] let's put a rule for first announcements and beta software
stalkern2@...
Send Email Send Email
 
...great tool but shall we decide that beta software

> If anyone would care to try it out and give me feedback that would be
> great.  It may still be a little rough around the edges :-)

and first announcements
should use the OTHER list? Beginners would like to start with stable
software, I think.

Cheers
Ernesto



Alle ore 23:31, lunedě 11 febbraio 2002, doug+ml.ocaml_beginners@...
ha scritto:
> Hi,
>
> I'm trying out my new Makefiles and packaging stuff, and so I've built
> a small package for a module I've been working on: benchmark. There is
> a tarball here, along with HTML docs generated with ocamldoc from the
> .mli file:
(...)

#58 From: "Ryan Tarpine" <rtarpine@...>
Date: Tue Feb 12, 2002 11:21 am
Subject: Re: "ocaml_beginners"::[] Interactive learning
rtarpine
Send Email Send Email
 
>From: Martin Jambon <m.jambon@...>
>Reply-To: ocaml_beginners@yahoogroups.com
>To: <ocaml_beginners@yahoogroups.com>
>Subject: Re: "ocaml_beginners"::[] Interactive learning
>Date: Mon, 11 Feb 2002 18:35:22 +0100 (CET)
>
>On Mon, 11 Feb 2002 doug+ml.ocaml_beginners@... wrote:
>
> > Well, there would have to be some kind of security, maybe a "chrooted
> > jail" if the server is unix. I don't know about you, but the idea of
> > letting people run arbitrary code on my web server gives me nightmares!
> > :-)
>
>Sure, but I didn't say it would be "my" web server :-)
>
>I admit I've been a little naive, but maybe it would be possible to
>restrict the set of OCaml instructions to make it safe: suppress
>input/output except those on stdout, suppress Unix, Obj, Marshal, unsafe_*
>functions and so on.
>
>
>Martin
>

It might be a good idea to see how Ruby does this type of thing.  Luckily,
there's the entire text of everyone's favorite Ruby book (_Programming
Ruby_) online.  Unfortunately, the site's down  :(  Here's the google cache
of the most relevant page:

http://www.google.com/search?q=cache:nHLswR8t-YUC:www.rubycentral.com/book/taint\
.html+&hl=en&start=1

It's kind of interesting, keeping track of where certain objects came from
(e.g., strings in the program itself are treated like normal, but strings
you read in from the user are "tainted").  Someone please enlighten me if
this was not original (I doubt it was) to the language that "started it all"

The problem is, of course, that this functionality is built into the Ruby
language.  It's not a library or a couple functions that do it all.

Ryan Tarpine, rtarpine@...
"To err is human, to compute divine.  Trust your computer but not its
programmer."
   - Morris Kingston



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

#59 From: doug+ml.ocaml_beginners@...
Date: Tue Feb 12, 2002 1:01 pm
Subject: Re: "ocaml_beginners"::[] let's put a rule for first announcements and beta software
doug+ml.ocaml_beginners@...
Send Email Send Email
 
stalkern2 wrote:
> and first announcements
> should use the OTHER list? Beginners would like to start with stable
> software, I think.

Okay, but since I am a beginner, and this is my first attempt at
packaging a module, I was hoping to get some feedback before bothering
the other list.  I was going to announce it to caml-list when I felt
more confident about the packaging.

Also, I don't think it would be inappropriate for beginners to discuss
how to package a module, there doesn't seem to be much standardization
there in OCaml, and so it can be a little confusing.

cheers,
doug
--
http://www.bagley.org/~doug/contact.shtml

#60 From: doug+ml.ocaml_beginners@...
Date: Tue Feb 12, 2002 5:52 pm
Subject: Re: "ocaml_beginners"::[] Interactive learning
doug+ml.ocaml_beginners@...
Send Email Send Email
 
Ryan Tarpine wrote:
> It might be a good idea to see how Ruby does this type of thing.  Luckily,
> there's the entire text of everyone's favorite Ruby book (_Programming
> Ruby_) online.  Unfortunately, the site's down  :(  Here's the google cache
> of the most relevant page:
>
>
http://www.google.com/search?q=cache:nHLswR8t-YUC:www.rubycentral.com/book/taint\
.html+&hl=en&start=1
>
> It's kind of interesting, keeping track of where certain objects came from
> (e.g., strings in the program itself are treated like normal, but strings
> you read in from the user are "tainted").  Someone please enlighten me if
> this was not original (I doubt it was) to the language that "started it all"

I think "tainting" comes from Perl.

> The problem is, of course, that this functionality is built into the Ruby
> language.  It's not a library or a couple functions that do it all.

Yes, I believe that in Ruby and Perl the "taintedness" is stored in a
flag field in the variable itself. So that implementation probably
won't translate to OCaml well.

But I think it's a very interesting idea for OCaml.

Maybe it could be done with Camlp4 and the type system? That would
definately be the coolest. If it could be done, it would beat the
pants off of Perl/Ruby's run-time checking.

Could Camlp4 wrap all data from tainted sources in some kind of
"Tainted type"? If so, then if your program uses that data unsafely,
without explicitly unwrapping it first to remove the taintedness, it
won't even compile.

Alternatively a run-time check could be done by wrapping the tainted
expression in something that will throw a Tainted exception unless it
is explicitly ignored.

It may be difficult to identify all the places where you need to taint
stuff though. But it might be doable.

cheers,
doug
--
http://www.bagley.org/~doug/contact.shtml

Messages 31 - 60 of 13890   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help