caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Pattern matching and strings
@ 2002-10-02 14:12 Alessandro Baretta
  2002-10-02 15:02 ` Luc Maranget
                   ` (2 more replies)
  0 siblings, 3 replies; 44+ messages in thread
From: Alessandro Baretta @ 2002-10-02 14:12 UTC (permalink / raw)
  To: Ocaml

I have to do a little bit of pattern matching on strings. My 
first instict was to write something like the following.

let foo x = ...
let bar x = ...
... = function
| "foo" ^ rest -> foo rest
| "bar" ^ rest -> bar rest
| _ -> raise Unrecognized

Of course, this is not possible because (^) is an operator 
rather than a constructor. Since I believe that the above 
code is much more natural and idiomatic than code based on 
regexps, I wonder how much compiler magic it would take to 
make it work. Probably all it takes is some syntax-magic 
since the above can be mapped onto the following:

open Scanf

... = function x -> begin
   try sscanf x "foo%[^]" foo with Scan_failure _ ->
   try sscanf x "bar%[^]" bar with Scan_failure _ ->
     raise Unrecognized
end

An equivalent mapping could be done with the Str library or 
any other regexp library.

However, the former is much cleaner. If it could be had, I'd 
appreciate it.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: [Caml-list] Threats on future of Camlp4
@ 2002-10-06 23:54 Markus Mottl
  2002-10-11 11:34 ` Kontra, Gergely
  0 siblings, 1 reply; 44+ messages in thread
From: Markus Mottl @ 2002-10-06 23:54 UTC (permalink / raw)
  To: Daniel de Rauglaudre; +Cc: caml-list

On Sun, 06 Oct 2002, Daniel de Rauglaudre wrote:
> On Sun, Oct 06, 2002 at 03:29:59PM -0400, Oleg wrote:
> It would be good, indeed, that Camlp4 be separated from OCaml, but
> the direction of the OCaml team refuses that energically. However
> it was a good compromise.

I want to make my contribution to this flamewar short:

  * Camlp4 is useful.

  * Camlp4 should be part of the main distribution, because a not
    insignificant number of people uses it, be it for streams or
    different syntax.

  * Development and stable versions are absolutely common in software
    development. I don't see any reason why there shouldn't be
    corresponding branches in the CVS, which keeps good track of the
    differences. No need to separate Camlp4 from the rest of the project:
    just agree on release dates and that's it.

  * Concerning the point that somebody says "X is a waste of time". My
    PhD-supervisor thinks that OCaml is a waste of time. So what? I
    don't like Prolog...

Otherwise, please resolve personal issues over a beer in a bar or in a
fight outside, whichever you prefer. As long as all of you stay healthy
for further development, OCaml-users will be happy... ;-)

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 44+ messages in thread
* [Caml-list] Future of Camlp4
@ 2003-02-06 12:28 Daniel de Rauglaudre
  2003-02-06 12:55 ` Jérôme Marant
                   ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Daniel de Rauglaudre @ 2003-02-06 12:28 UTC (permalink / raw)
  To: caml-list

Hi everybody,

I don't refuse to develop Camlp4, I would be happy to continue improving
it, fixing bugs and helping users. I just say that, for internal political
reasons, I want that Camlp4 is distributed separately from OCaml.

If this condition is accepted, you are going to have the better Camlp4
I can do, and all requests from users are welcome. If it is not, I
stop developping it and you are going to get a Camlp4 loosing its
qualities little by little, because nobody knows Camlp4 like me.

Therefore, if you want that Camlp4 be good and better, ask Michel
Mauny from the Cristal Project of INRIA, to accept the separation.
Camlp4 was developped separately the years before and everything
went well.

-- 
Daniel de RAUGLAUDRE
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2003-02-06 19:59 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 14:12 [Caml-list] Pattern matching and strings Alessandro Baretta
2002-10-02 15:02 ` Luc Maranget
2002-10-02 16:21   ` [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) Alessandro Baretta
2002-10-02 17:15     ` Luc Maranget
2002-10-02 18:30       ` Alessandro Baretta
2002-10-02 18:32         ` Benjamin C. Pierce
2002-10-04 13:01       ` Florian Douetteau
2002-10-04  9:07     ` Pierre Weis
2002-10-04  9:31       ` Alessandro Baretta
2002-10-04 10:03         ` Pierre Weis
2002-10-04 10:23           ` Alessandro Baretta
2002-10-04 12:11             ` Remi VANICAT
2002-10-04 12:40               ` [Caml-list] Ocaml 3.06 Win2K OCAML/C link problem Ward Wheeler
2002-10-04 13:12               ` [Caml-list] Pattern matching and strings (and a mini-bug inScanf) Frederic van der Plancke
2002-10-04 19:31               ` [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) Alessandro Baretta
2002-10-07  7:17                 ` Pierre Weis
2002-10-02 20:59 ` [Caml-list] views for strings (was: Pattern matching and strings) Chris Hecker
2002-10-02 23:09   ` [Caml-list] " Alessandro Baretta
2002-10-03  8:31 ` [Caml-list] Pattern matching and strings Sven Luther
2002-10-04 12:00   ` Andreas Rossberg
2002-10-04 14:21     ` Kontra, Gergely
2002-10-04 15:14     ` Luc Maranget
2002-10-04 19:38       ` Alessandro Baretta
2002-10-05  6:34         ` [Caml-list] Camlp4 (Was: Pattern matching and strings) Daniel de Rauglaudre
2002-10-05 12:47           ` Sven LUTHER
2002-10-05 12:42             ` Daniel de Rauglaudre
2002-10-05 13:41               ` Michel Mauny
2002-10-05 13:47                 ` Daniel de Rauglaudre
2002-10-05 14:09                   ` Michel Mauny
2002-10-05 18:13                     ` Alessandro Baretta
2002-10-05 20:30                       ` [Caml-list] Future of Camlp4 Daniel de Rauglaudre
2002-10-04 19:13     ` [Caml-list] Pattern matching and strings Sven LUTHER
2002-10-06 23:54 [Caml-list] Threats on future of Camlp4 Markus Mottl
2002-10-11 11:34 ` Kontra, Gergely
2002-10-11 13:15   ` [Caml-list] Future " Daniel de Rauglaudre
2002-10-12 21:45     ` Oleg
2002-10-13  9:02       ` Daniel de Rauglaudre
2003-02-06 12:28 Daniel de Rauglaudre
2003-02-06 12:55 ` Jérôme Marant
2003-02-06 13:01 ` Sven Luther
2003-02-06 13:23   ` Daniel de Rauglaudre
2003-02-06 13:59 ` Mattias Waldau
2003-02-06 14:20 ` Xavier Leroy
2003-02-06 15:59   ` Sven Luther
2003-02-06 16:30     ` Xavier Leroy
2003-02-06 16:10   ` Georges Mariano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).