Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] newbie questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: [Caml-list] newbie questions
>>>>> "Ruediger" == Dr Ruediger M Flaig <flaig@hablas.com> writes:

    Ruediger> Good morning to all you bedouins out there :-) , as I am
    Ruediger> a neophyte to CAML, forgive me if my questions have been
    Ruediger> asked (and answered) a hundred times before...

You might have checked in the mailing list archive before asking...

    Ruediger> 1.: Is there any means of doing list-type pattern
    Ruediger> matching (style "| h::t -> ...") for recursion on
    Ruediger> strings? [...]

unfortunately no. You cannot have pattern matching on strings.
But the Str module might help (it provides regular expressions).

See also recent postings on this issue:
http://caml.inria.fr/archives/200303/msg00289.html
http://caml.inria.fr/archives/200303/msg00399.html

    Ruediger> 2.: A question on language design: why do recursive
    Ruediger> functions have to be marked explicitly as such?  [...]

Any (syntactically non-recursive) *expression* can appear on the right
hand side of let bindings, but this is not true for let rec bindings
which are restriced (syntactically) to functions and constant
constructors

see http://caml.inria.fr/ocaml/htmlman/manual015.html for more

(Historical note; many other languages require syntactic marking of
recursions: Scheme, Fortran90, PL1, ...)


-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

-------------------
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