caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Miles Egan <miles@caddr.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] printable digest strings
Date: Fri, 4 May 2001 07:00:14 -0700	[thread overview]
Message-ID: <20010504070014.A35277@caddr.com> (raw)
In-Reply-To: <20010504113727.A9728@pauillac.inria.fr>; from Xavier.Leroy@inria.fr on Fri, May 04, 2001 at 11:37:27AM +0200

On Fri, May 04, 2001 at 11:37:27AM +0200, Xavier Leroy wrote:
> let string_map f s =            
>   let rec map_aux res idx =
>     if idx < 0 then res else map_aux (f s.[idx] :: res) (idx - 1)  
>   in map_aux [] (String.length s - 1)
> 
> let hexstring s =
>   String.concat "" 
>     (string_map (fun c -> Printf.sprintf "%02x" (Char.code c)) s)

I knew there had to be a better way.  Thanks.

This actually brings me to my next question.  There doesn't seem to be a
String.map or String.iter function in the standard library, although I can
imagine they might also be handy.  Am I looking in the wrong place?

-- 
miles
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  reply	other threads:[~2001-05-04 14:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-03 22:32 Miles Egan
2001-05-04  9:15 ` Hendrik Tews
2001-05-04  9:37 ` Xavier Leroy
2001-05-04 14:00   ` Miles Egan [this message]
2001-05-04 14:50     ` Brian Rogoff
2001-05-04 20:27   ` Chris Hecker
2001-05-04 22:54     ` Miles Egan
2001-05-06 18:56     ` [Caml-list] Wserver: Values of global variables lost Mattias Waldau
2001-05-07  8:58       ` Daniel de Rauglaudre
2001-05-07 17:00       ` Mattias Waldau
2001-05-07 18:16         ` Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010504070014.A35277@caddr.com \
    --to=miles@caddr.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).