Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* String.from_list
@ 1999-07-13 14:16 Francois-Rene Rideau
  0 siblings, 0 replies; only message in thread
From: Francois-Rene Rideau @ 1999-07-13 14:16 UTC (permalink / raw)
  To: caml-list

Chers camelots,

David Madore me suggère de vous envoyer les fonctions suivantes
pour inclusion dans string.ml, avec l'espoir qu'elles satisferont notamment
les habitués de Scheme (ou ceux qui traduisent des programmes écrit dans
ce langage) et qui cherchent de telles fonctions en standard.

let from_list l =
  let s = make (List.length l) '\042' in
  let rec f i l =
          match l with
            []   -> s
          | c::r -> unsafe_set s i c ; f (i+1) r
        in f 0 l ;;

let to_list s =
  let rec t i l =
     if i = 0 then l else
       let j = i-1 in f j ((unsafe_get s j)::l)
  in t (length s) [] ;;


Sinon, je n'ai jamais compris si les
[an error occurred while processing this directive]
présents un peu partout sur le site de CAML.inria.fr
étaient intentionnels ou involontaires.
Dans le premier un cas,
un <!--commentaire--> adéquat détromperait le lecteur avisé.
En tout cas, j'ai trouvé ça drôle,
et me suis permis de reprendre la blague à mon compte...

NB: je ne suis pas sur la liste.

Amicamlement,

[ "Faré" | VN: Уng-Vû Bân | Join the TUNES project!   http://www.tunes.org/  ]
[ FR: François-René Rideau | TUNES is a Useful, Nevertheless Expedient System ]
[ Reflection&Cybernethics  | Project for  a Free Reflective  Computing System ]
Keep things as simple as you can, but no simpler.
	-- Albert Einstein
s/things/explanation/ ; s/A.*Einstein/Occam/




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-07-13 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-13 14:16 String.from_list Francois-Rene Rideau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox