caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Cannasse" <warplayer@free.fr>
To: "Christian Schaller" <Christian.Schaller@siemens.com>,
	<caml-list@inria.fr>
Subject: Re: [Caml-list] Doing the transition from imperative to functional (and some other Q)
Date: Wed, 4 Feb 2004 18:48:07 +0100	[thread overview]
Message-ID: <013201c3eb47$0e20ecb0$ef01a8c0@warp> (raw)
In-Reply-To: <A1364BC6814D92479D4EED572D6F6FD8069587@uranus.certw2k.net>

> Now comes the funny part.  Actually, right now I'm not sure how to
> represent the buffer variable internally.  As you can see, in the first
> part I chose string, because of the .[] operator.  However, I cannot use
> string, because this data type doesn't have any fold function.  Right
> now I do not want to make a decision about the data type used, except
> that I know that it must be a sequence of characters.
>
> Though I am a strong believer in static typing, above versions
> disappoint me heavily because of type restrictions.  Is there any way to
> write above version on arbitrary sequences like Arrays, Lists, Strings?
>
> Actually, I would have preferred the buffer data type because I can use
> that one for fast reading of a file.  However, I cannot fold over a
> buffer :(
>
> Any enlightening hints?

You should have a look at ExtLib Enum module that enable you to apply fold's
and others functionals operations on any underlying data structure (string,
array, list, .... ).

http://ocaml-lib.sf.net

Regards,
Nicolas Cannasse

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


      parent reply	other threads:[~2004-02-04 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-04 16:09 Christian Schaller
2004-02-04 17:36 ` Yamagata Yoriyuki
2004-02-04 17:48 ` Nicolas Cannasse [this message]

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='013201c3eb47$0e20ecb0$ef01a8c0@warp' \
    --to=warplayer@free.fr \
    --cc=Christian.Schaller@siemens.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).