caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois BERENGER <francois.c.berenger@vanderbilt.edu>
To: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Create Array of floats from string
Date: Wed, 26 Apr 2017 08:36:59 -0500	[thread overview]
Message-ID: <685ed94e-e3fa-ce0c-d3c3-5040fa7c2985@vanderbilt.edu> (raw)
In-Reply-To: <20170426110226.GJ32215@ccellier.booking.pcln.com>

On 04/26/2017 06:02 AM, rixed@happyleptic.org wrote:
> If speed is more important than readability I would avoid creating the
> intermediary list of strings and go with Str.search_forward, then extract that
> string and convert it to float.
>
> If the separator is as simple as a space I'd expect String.index_from to be
> slightly faster. Also consider BatString.find_all that returns an enum (of
> starting positions - unfortunately we do not have BatString.split variant
> returning an enum of substrings directly).

Could be welcome into batteries.

> If that's not enough you'd have to use another library to parse the string, one
> that would implement something like `float_of_string_from` so that you do not
> have to build all those useless substrings.

This one too, BatFloat.of_string_from
but we need a little bit more specification to know what's the expected 
behavior (especially, when does the float part of the string ends?).

You can go there for any feature request:
https://github.com/ocaml-batteries-team/batteries-included/issues

Regards,
F.

  reply	other threads:[~2017-04-26 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 10:48 Jon Kleiser
2017-04-26 11:02 ` rixed
2017-04-26 13:36   ` Francois BERENGER [this message]
     [not found] ` <CAPFanBGh0q2AaF7ROWJJF81o=8+79sn-q4-CxqCKGQ__Oa5SEw@mail.gmail.com>
2017-04-26 14:05   ` Jon Kleiser
2017-04-26 15:26     ` Gabriel Scherer
2017-04-27 14:00       ` [Caml-list] Create Array of floats from string, surprise Jon Kleiser
2017-04-26 15:27 ` [Caml-list] Create Array of floats from string Alain Frisch
2017-04-27  8:36   ` Jon Kleiser
2017-04-27  9:15   ` Jon Kleiser
2017-04-28 12:19     ` Jon Kleiser

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=685ed94e-e3fa-ce0c-d3c3-5040fa7c2985@vanderbilt.edu \
    --to=francois.c.berenger@vanderbilt.edu \
    --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).