[Caml-list] ICFP08 Call for Participation

2008-08-05 Thread Matthew Fluet (ICFP Publicity Chair)
=
Call for Participation

The 13th ACM SIGPLAN International Conference
on Functional Programming (ICFP 2008)

http://www.icfpconference.org/icfp2008

  Victoria, BC, Canada, 22-24 September 2008
=

ICFP 2008 provides a forum for researchers and developers to hear
about the latest work on the design, implementations, principles, and
uses of functional programming. The conference covers the entire
spectrum of work, from practice to theory, including its peripheries.

Preliminary program:
 * http://www.icfpconference.org/icfp2008/schedule.html
 * Invited speakers:
   + Butler Lampson, Microsoft Research;
 Lazy and Speculative Execution in Computer Systems
   + Olivier Danvy, University of Aarhus;
 Defunctionalized Interpreters for Higher-Order Languages
   + Mark Jones, Portland State University;
 Polymorphism and Page Tables -- Systems Programming From a
 Functional Programmer's Perspective

Schedule including related workshops:
 * Sep 20: ACM SIGPLAN Workshop on Generic Programming
 * Sep 20: ACM SIGPLAN Workshop on Mechanizing Metatheory
 * Sep 20: ACM SIGPLAN Workshop on Scheme and Functional Programming
 * Sep 21: ACM SIGPLAN Workshop on ML
 * Sep 21: ACM SIGPLAN Functional and Declarative Programming in Education
 * Sep 22-24: ICFP08
 * Sep 25: ACM SIGPLAN Haskell Symposium
 * Sep 25: Functional Programming Developer Tracks
 * Sep 26: Commercial Users of Functional Programming
 * Sep 27: ACM SIGPLAN Erlang Workshop
 * Sep 27: Functional Programming Developer Tracks

Registration information:
 * http://www.regmaster.com/conf/icfp2008.html
 * Early registration deadline: August 20, 2008

Conference hotel accommodation information:
 * http://www.deltahotels.com/groups/online/VIC/acm.php
 * Conference rate deadline: August 18, 2008
 * Wiki page to coordinate room-sharing:
   http://www.icfpconference.org/pmwiki/pmwiki.php?n=Main.ICFP08RoomShare


Conference organizers:
 * General Chair: James Hook (Portland State University)
 * Program Chair: Peter Thiemann (Universität Freiburg)
 * Local Arrangements Chair: George Tzanetakis (University of Victoria)
 * Workshop Co-Chairs: Michael Sperber (DeinProgramm)
   and Graham Hutton (University of Nottingham)
 * Programming Contest Co-Chairs: John Reppy (University of Chicago)
   and Tim Sheard (Portland State University)
 * Publicity Chair: Matthew Fluet (Toyota Technological Institute at Chicago)

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] newbie: how to call a function with multiple parameters?

2008-08-05 Thread asmadeus77
Hello,
semicolons are separator inside sentences, that is, just like in C
(you've had theses right)
double semicolons are to tell the compiler you're ending a sentence;
theses can be ommited when there is no ambiguity in the syntax, that
is when there is another main let after it. Here, you need them on
line 4.

As for arguments, ocaml works by passing one argument, then gives back
another function, then takes another argument, returns another
function, etc... If you wanted to have a tuple, you'd define the
function with let print_logic (a, b) =
Here, since you've defined it with a b, you need to call it with a
THEN with b. That is : print_logic true false

Hope this helps,
Asmadeus

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] newbie: how to call a function with multiple parameters?

2008-08-05 Thread micha
On Monday 04 August 2008 20:32:36 Ben Aurel wrote:
 hi
 yeah - the question is low, but I-m struggling on different frontiers

 Questions:
  (* Q1 *): Somehow I don't get the concept with ; and ;;. On line
 4 do I need to end the statement with semicolon double-semicolon or
 nothing?

the double semicolon ends the definition of types / functions / objects...
the single semicolon ends a statement. So to end the definition of print_logic 
you need the double semicolon in your example.
There are cases where you can omit the double semicolon, I write them allways, 
for visual aid ( and I can search for them in my editor).

  (* Q2 *): How can I pass those parameters?

the same way as to printf, without delimiters:
print_logic true false

 Michael


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Brighten Godfrey

Hi,

Suppose you are given a data structure, and you want to retrive one  
element -- any one element.  Sounds simple... and it is, if you have  
a list (List.hd list) or an array (arr.(0)).  But how about a  
hashtable, if we don't know a priori any of the keys in the hashtable?


The best way I've thought of so far is to begin iterating through all  
the hashtable's elements, but then break out with an exception:


exception Done
let get_one ht =
let el = ref None in
(try (
Hashtbl.iter (fun i _ -
el := Some i;
raise Done)
ht;
)
with Done - ());
match !el with
None - raise Not_found
| Some x - x


But this seems clumsy.  Any better ideas?

Thanks,
Brighten Godfrey

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Richard Jones
On Tue, Aug 05, 2008 at 05:05:46AM -0700, Brighten Godfrey wrote:
 Suppose you are given a data structure, and you want to retrive one  
 element -- any one element.  Sounds simple... and it is, if you have  
 a list (List.hd list) or an array (arr.(0)).  But how about a  
 hashtable, if we don't know a priori any of the keys in the hashtable?

It's very unclear what you're trying to do.

For List and Array those methods won't work if the data structure is
empty, but I guess that's expected.  Hashtbl isn't designed with the
get an/any element usage in mind -- your loop/exception is probably
the best way given that you've made a poor choice of data structure in
the first place.  But this still comes back to the question, what are
you trying to do?

Rich.

-- 
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Brighten Godfrey

On Aug 5, 2008, at 5:16 AM, Richard Jones wrote:


On Tue, Aug 05, 2008 at 05:05:46AM -0700, Brighten Godfrey wrote:

Suppose you are given a data structure, and you want to retrive one
element -- any one element.  Sounds simple... and it is, if you have
a list (List.hd list) or an array (arr.(0)).  But how about a
hashtable, if we don't know a priori any of the keys in the  
hashtable?


It's very unclear what you're trying to do.


I think you've interpreted me correctly.  I want a function that,  
given a hashtable, returns any element of the hashtable (assuming  
it's not empty).  This is the same as the function choose in the  
Set module.



For List and Array those methods won't work if the data structure is
empty, but I guess that's expected.  Hashtbl isn't designed with the
get an/any element usage in mind -- your loop/exception is probably
the best way given that you've made a poor choice of data structure in
the first place.  But this still comes back to the question, what are
you trying to do?


A hashtable is not a poor choice of a data structure, because this  
choose functionality is not the only requirement for my data  
structure: I also want constant time search.  OCaml's Set data  
structure has O(log n)-time search.


Thanks,
~Brighten

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; '

2008-08-05 Thread Richard Jones
On Sun, Aug 03, 2008 at 08:46:32PM -0400, Ben Aurel wrote:
 print_int fac(6);;

Read this: http://www.ocaml-tutorial.org/the_basics

Rich.

-- 
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I think this is pretty standard.  At least, I see it in ExtLib and I do it on 
a regular basis.  In fact I have a function to do this for me so I don't have 
to do it over and over again.  Eg.

  let get_one ht = mkGetOne Hashtbl.iter ht

Peng

On Tuesday 05 August 2008 08:05:46 am Brighten Godfrey wrote:
 Hi,

 Suppose you are given a data structure, and you want to retrive one
 element -- any one element.  Sounds simple... and it is, if you have
 a list (List.hd list) or an array (arr.(0)).  But how about a
 hashtable, if we don't know a priori any of the keys in the hashtable?

 The best way I've thought of so far is to begin iterating through all
 the hashtable's elements, but then break out with an exception:

 exception Done
 let get_one ht =
  let el = ref None in
  (try (
  Hashtbl.iter (fun i _ -
  el := Some i;
  raise Done)
  ht;
  )
  with Done - ());
  match !el with
  None - raise Not_found

  | Some x - x

 But this seems clumsy.  Any better ideas?

 Thanks,
 Brighten Godfrey

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFImFPifIRcEFL/JewRAreVAKCOxjyr8uXNIOknO4zmL+i0La4RCQCcDLV1
OXN2V4ZiS8oxC5hQOf5phYU=
=ZXwI
-END PGP SIGNATURE-

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] newbie: how to call a function with multiple parameters?

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

You don't pass arguments like you do in C or Java.  In those languages you 
might do:

  somefunction(arg1, arg2, arg3)

In OCaml, you do:

  somefunction arg1 arg2 arg3

In OCaml, (arg1, arg2, arg3) means create a 3-tuple.  somefunction(arg1, 
arg2, arg3) is interpreted as make a 3-tuple and call somefunction on that 
tuple.

You code, therefore, should look like this:


  let print_logic a b =
Printf.printf a and b is %B\n (a  b);
Printf.printf a or b is %B\n (a || b);
Printf.printf not a is %B\n (not a)
  ;;

  print_logic true false;;


Peng

On Monday 04 August 2008 02:32:36 pm Ben Aurel wrote:
 hi
 yeah - the question is low, but I-m struggling on different frontiers

 /// print_logic.ml ///
 
 1 let print_logic a b =
 2 Printf.printf a and b is %B\n (a  b);
 3 Printf.printf a or b is %B\n (a || b);
 4 Printf.printf not a is %B\n (not a)(* Q1 *)
 5
 6 print_logic(true, false);; (* Q2 *)

 ```

 Problem: the code doesn't compile and I don't find any help on the web.

 Questions:
  (* Q1 *): Somehow I don't get the concept with ; and ;;. On line
 4 do I need to end the statement with semicolon double-semicolon or
 nothing?

  (* Q2 *): How can I pass those parameters?


 Maybe there is something that's else wrong.

 thanks
 ben

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFImFUBfIRcEFL/JewRAuRvAJ4yXnpbBE6wQzBlg66hClZomYWBPACfUabY
rHz86mdOg5FIaSk/bi5O9aE=
=L61/
-END PGP SIGNATURE-

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; '

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Tuesday 05 August 2008 08:11:40 am Richard Jones wrote:
 On Sun, Aug 03, 2008 at 08:46:32PM -0400, Ben Aurel wrote:
  print_int fac(6);;

 Read this: http://www.ocaml-tutorial.org/the_basics

 Rich.


Second that.  You really should take a look at that.  Also, this is a great 
resource as well:

  http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf

You can read that online or print out chapters for offline reading.


Peng
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFImFXJfIRcEFL/JewRApGmAKDQtoGMfsFjSvvWuXblp/wRVEBOMgCgtsD2
gIoUYouoTrXnTTrUTBSWyxA=
=HtfJ
-END PGP SIGNATURE-

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Private and type constraints

2008-08-05 Thread Dario Teixeira
Hi,

With 'private', you can make sure that users of a module can only use
constructors to create values, while at the same type maintaining the
ability to pattern-match (which abstracting the type makes impossible).
With 3.10, this can also be done with polymorphic variants:

module Foobar:
sig
type foo_t = [ `A ]
type bar_t = [ `B ]
type foobar_t = [ foo_t | bar_t ]
type t = private [ foobar_t ]

val make_a: unit - t
val make_b: unit - t
end =
struct
type foo_t = [ `A ]
type bar_t = [ `B ]
type foobar_t = [ foo_t | bar_t ]
type t = foobar_t

let make_a () = `A
let make_b () = `B
end


# open Foobar;;
# let ola = make_a ();;
val ola : Foobar.t = `A
# match ola with `A - true | `B - false;;
- : bool = true
# let ola2 : Foobar.t = `A;;
Characters 22-24:
  let ola2 : Foobar.t = `A;;
^^
Error: This expression has type [ `A ] but is here used with type Foobar.t
   Types for tag `A are incompatible


Now, I want to do the same for a type 't' that is declared using a type 
constraint.
There are however two problems: first, the code below is accepted by the 
toplevel,
but not by the ocamlc/ocamlopt compilers (I'm running version 3.11+dev15); 
second,
while as expected it prevents the creation of Foobar2.t values without using the
constructor functions, pattern-matching is unfortunately also disallowed.

module Foobar2:
sig
type foo_t = [ `A ]
type bar_t = [ `B ]
type foobar_t = [ foo_t | bar_t ]
type 'a t = private 'a constraint 'a = [ foobar_t ]

val make_a: unit - foo_t t
val make_b: unit - bar_t t
end =
struct
type foo_t = [ `A ]
type bar_t = [ `B ]
type foobar_t = [ foo_t | bar_t ]
type 'a t = 'a constraint 'a = [ foobar_t ]

let make_a () = `A
let make_b () = `B
end


# open Foobar2;;
# let ola = make_a ();;
val ola : Foobar2.foo_t Foobar2.t = `A
# match ola with `A - true;;
Characters 15-17:
  match ola with `A - true;;
 ^^
Error: This pattern matches values of type [ `A ]
   but is here used to match values of type Foobar2.foo_t Foobar2.t
# let ola2 : Foobar2.foo_t Foobar2.t = `A;;
Characters 37-39:
  let ola2 : Foobar2.foo_t Foobar2.t = `A;;
   ^^
Error: This expression has type [ `A ] but is here used with type
 Foobar2.foo_t Foobar2.t


This is the error produced by the compiler:

Error: The implementation constraint.ml
   does not match the interface (inferred signature):
   Modules do not match:
 sig
   type foo_t = [ `A ]
   type bar_t = [ `B ]
   type foobar_t = [ `A | `B ]
   type 'a t = 'a Foobar2.t constraint 'a = [ foobar_t ]
   val make_a : unit - foo_t t
   val make_b : unit - bar_t t
 end
   is not included in
 sig
   type foo_t = [ `A ]
   type bar_t = [ `B ]
   type foobar_t = [ `A | `B ]
   type 'a t = private 'a constraint 'a = [ foobar_t ]
   val make_a : unit - foo_t t
   val make_b : unit - bar_t t
 end
   Type declarations do not match:
 type 'a t = 'a Foobar2.t constraint 'a = [ foobar_t ]
   is not included in
 type 'a t = private 'a constraint 'a = [ foobar_t ]


Any idea on what is going on?  Also, is it at all possible to achieve
the 'private' semantics I am looking for with types declared using
a constraint?  I know I can do it by boxing the type inside a dummy
union or a record, but I would like to avoid that hassle if possible.

Thanks for your time + best regards,
Dario Teixeira



  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.html

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] [camlp4] expr_of_string, string_of_expr functions exist?

2008-08-05 Thread Richard Jones

Maybe a simple question, but does camlp4 have functions to turn
expr and patt AST structures to and from strings?

Rich.

-- 
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] parameter passing optimizations

2008-08-05 Thread Warren Harris
I've been wondering whether the ocaml compiler does any sort of  
parameter passing optimizations for data structures, e.g. stack  
allocating, or destructuring them when it can determine their scope  
does not escape the call. My first conclusion is that it does for  
tuples only, but I wanted to see what others might know.


I wrote a number of simple test programs that each pass 6 arguments  
through 2 levels of functions by a number of means (main calls foo 1M  
times, foo calls bar once). For 1M iterations, the times I saw  
(optimized) are posted below.


It looks like the case of passing parameters in a tuple doesn't  
allocate (since the number of minor words is the same as the  
positional parameters case). However, it still seems to run more than  
an order of magnitude slower so perhaps it loses the benefits of  
register allocation (?).


Warren


let bar a b c d e f =
  a + b + c + d + e + f

minor_words: 7950
promoted_words: 2251
major_words: 2266
minor_collections: 1
major_collections: 0
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 2266
live_blocks: 354
free_words: 59174
free_blocks: 1
largest_free: 59174
fragments: 0
compactions: 0

real0m0.860s
user0m0.835s
sys 0m0.017s


let bar (a, b, c, d, e, f) =
  a + b + c + d + e + f

minor_words: 7950
promoted_words: 2251
major_words: 2266
minor_collections: 1
major_collections: 0
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 2266
live_blocks: 354
free_words: 59174
free_blocks: 1
largest_free: 59174
fragments: 0
compactions: 0

real0m11.067s
user0m10.942s
sys 0m0.037s


let bar (Foo(a, b, c, d, e, f)) =
  a + b + c + d + e + f

minor_words: 7000224061
promoted_words: 2251
major_words: 2266
minor_collections: 213629
major_collections: 0
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 2266
live_blocks: 354
free_words: 59174
free_blocks: 1
largest_free: 59174
fragments: 0
compactions: 0

real0m17.443s
user0m17.176s
sys 0m0.089s


let bar {a=a; b=b; c=c; d=d; e=e; f=f} =
  a + b + c + d + e + f

minor_words: 7000223886
promoted_words: 2251
major_words: 2266
minor_collections: 213629
major_collections: 0
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 2266
live_blocks: 354
free_words: 59174
free_blocks: 1
largest_free: 59174
fragments: 0
compactions: 0

real0m16.314s
user0m16.167s
sys 0m0.059s


let bar ?(a=0) ?(b=0) ?(c=0) ?(d=0) ?(e=0) ?(f=0) () =
  a + b + c + d + e + f

minor_words: 12002946309
promoted_words: 2251
major_words: 2266
minor_collections: 366300
major_collections: 0
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 2266
live_blocks: 354
free_words: 59174
free_blocks: 1
largest_free: 59174
fragments: 0
compactions: 0

real0m33.036s
user0m32.648s
sys 0m0.156s



smime.p7s
Description: S/MIME cryptographic signature
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Your email requires verification verify#lDvFUUSYGhpbQzAEYXZQlsBnwYh9u8d6

2008-08-05 Thread club
The message you sent requires that you verify that you 
are a real live human being and not a spam source.

To complete this verification, simply reply to this message and leave
the subject line intact.

The headers of the message sent from your address are shown below:

From |[EMAIL PROTECTED] Tue Aug 05 20:57:02 2008
Received: from [190.172.56.223] (helo=sol)
 by server5.servera.info with esmtp (Exim 4.69)
 (envelope-from |[EMAIL PROTECTED])
 id 1KQPq4-iy-5Q; Tue, 05 Aug 2008 20:56:50 +0400
Received: from [190.172.56.223] by mail1-smtp-roc.national.inria.fr; Tue, 5 Aug 
2008 13:56:47 -0300
Message-ID: 01c8f703$19ceb980$df38acbe@|caml-list
From: =?koi8-r?B?+8HNyMHMIPDF1NLP1w==?= |[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: =?koi8-r?B?8sHT09nMy8kgLSDT1dDF0iDTy8nEy8k=?=
Date: Tue, 5 Aug 2008 13:56:47 -0300
MIME-Version: 1.0
Content-Type: text/plain;
  charset=koi8-r
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] parameter passing optimizations

2008-08-05 Thread Stéphane Glondu
Warren Harris wrote:
 I've been wondering whether the ocaml compiler does any sort of
 parameter passing optimizations for data structures, e.g. stack
 allocating, or destructuring them when it can determine their scope does
 not escape the call. My first conclusion is that it does for tuples
 only, but I wanted to see what others might know.

Maybe you can check it out yourself with the -dinstr option of ocamlc,
or the -S option of ocamlopt.


Cheers,

-- 
Stéphane


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] [camlp4] expr_of_string, string_of_expr functions exist?

2008-08-05 Thread Yitzhak Mandelbaum
I don't know about the new camlp4, but in the old one the code looked  
something like this (where my AST is a list of str_item-s):


open Pcaml

let ast_to_strings ast =
  List.map (function str_item - string_of pr_str_item str_item) ast

--Yitzhak

On Aug 5, 2008, at 12:04 PM, Richard Jones wrote:



Maybe a simple question, but does camlp4 have functions to turn
expr and patt AST structures to and from strings?

Rich.

--
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


-
Yitzhak Mandelbaum



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] [camlp4] expr_of_string, string_of_expr functions exist?

2008-08-05 Thread Christophe TROESTLER
On Tue, 5 Aug 2008 17:04:26 +0100, Richard Jones wrote:
 
 Maybe a simple question, but does camlp4 have functions to turn
 expr and patt AST structures to and from strings?

Parsing:

  open Camlp4.PreCast
  
  let loc = Loc.ghost;;
  
  Syntax.AntiquotSyntax.parse_expr loc x = 1;;
  
  Syntax.AntiquotSyntax.parse_patt loc Failure _;;

Printing:  I do not know a way to print to a string, only to a file.
I guess this asymmetry is due to the fact that a string output was
never needed... (but it would be useful to me too!)  Moreover, you can
only print str_item's, so you have to wrap your expr and patt.  E.g.

  let e = :expr 1 + 1 ;;
  
  Printers.OCaml.print_implem ~output_file:/tmp/o.ml :str_item $exp: e$ ;;
  (* will print
  let _ = 1 + 1;;
  *)
  
  Printers.OCaml.print_implem ~output_file:/tmp/o.ml
(let _loc = Ast.loc_of_expr e in Ast.StExp(_loc, e));;
  (* will print
  1 + 1;;
  (but I do not know whether this is a feature!) *)
  
Hope it helps,
ChriS

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Chris Kauffman
I'm curious what sort of scenario calls for retrieving any single
element of a hash table (which is potentially empty?). It seems most
of the cases I deal with involve simply storing or iterating over all
the elements.

Cheers,
Chris

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs