Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 106361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:35:05+00:00 2026-05-11T01:35:05+00:00

When importing numbers from a csv file, I need to convert them to floats

  • 0

When importing numbers from a csv file, I need to convert them to floats with unit.

Currently I do this with an inline function:

data |> List.map float |> List.map (fun n -> n * 1.0<m>) 

But I’m wondering if there is a more elegant way to do this – or do I have to create my own ‘units’ module with conversion functions?

What would be really nice would be something like this, but I doubt it’s possible…

data |> List.map float |> List.map lift<m> 

This is the opposite of my previous question (How to generically remove F# Units of measure).

UPDATE: For homemade units, I’ve tried this, which works ok:

[<Measure>] type km =      static member lift (v:float) = v * 1.0<km>  data |> List.map float |> List.map km.lift 

or, following the question in this answer

data |> List.map (float >> km.lift) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:35:05+00:00Added an answer on May 11, 2026 at 1:35 am

    It looks like units of measure can’t be type parameters for the moment (no idea if this will change). So the shortest way to write this is:

    data |> List.map float |> List.map ((*) 1.0<m>) 

    EDIT

    See also now FloatWithMeasure here

    http://msdn.microsoft.com/en-us/library/ee806527(VS.100).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 165k
  • Answers 165k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Reflection isn't a problem here; EF won't even be able… May 12, 2026 at 1:10 pm
  • Editorial Team
    Editorial Team added an answer I went through these steps: Sign up for an account… May 12, 2026 at 1:10 pm
  • Editorial Team
    Editorial Team added an answer You can override the exceptionHandler bean using resources.groovy with your… May 12, 2026 at 1:10 pm

Related Questions

In the years that I've been at my place of employment, I've noticed a
Is there any real issue - such as performance - when the hibernate object
I've been using the Microsoft Enterprise Library since before it was labeled as such
I'm collecting some data via a Perl script. The data needs to be reviewed

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.