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 7508803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:44:31+00:00 2026-05-29T22:44:31+00:00

Is there some Haskell function that can take a list, say of doubles, like

  • 0

Is there some Haskell function that can take a list, say of doubles, like this:

[0.5, 0.6, 0.1, 0.7]

and return a list of integers, which represent indices of the items in order. In the above case it would be:

[2, 0, 1, 3]

NOTE: What I am trying to achieve is some function (let’s call it consistent) that can compare two lists of doubles, and tell the user if the lists’s relative ordering is consistent:

> consistent [1.0, 2.0, 3.0] [2.1 3.5 4.6]
True
> consistent [1.0, 2.0, 3.0] [3.0, 2.0, 1.0]
False
  • 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. Editorial Team
    Editorial Team
    2026-05-29T22:44:32+00:00Added an answer on May 29, 2026 at 10:44 pm

    You can zip the list with [0..] to pair each item with its index. Then you can sort that list and use map to get the second element of every pair (the index).

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

Sidebar

Related Questions

Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in
recently I'm writing some functions that I take from Haskell and translate into Java.
I've written a haskell function which splits a list xs into (init xs, last
Is there some Haskell extension that enables the creation of more complex data constructors
Is there some means of querying the system tables to establish which tables are
Is there some rare language construct I haven't encountered (like the few I've learned
Is there some way I can define String[int] to avoid using String.CharAt(int) ?
I think I may have asked this on Haskell-Cafe at some point, but damned
I am converting some functioning Haskell code that uses Parsec to instead use Attoparsec
Reading Real world Haskell i found some intresting question about data types: This pattern

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.