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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:39:20+00:00 2026-05-18T08:39:20+00:00

Total F# n00b question. How do I sort a LIST data structure? Edit: Sorry,

  • 0

Total F# n00b question.
How do I sort a LIST data structure?

Edit: Sorry, my data structure is actually a LIST.

maybe i should add my code since just using “.sort” hasn’t worked:

let getDataFromDb (db: MyDB) Id =
Query.query <@ seq { 
    big honking database/FLinq query
    yield  (sec, pm, sr, trade, tradeRec, i, pm_firm, files, lt)
} @> |> List.ofSeq

when I change the last line of code to this:
} @> |> List.ofSeq.sortBy fst
I get the following:

Error 1 The field, constructor or member ‘sortBy’ is not defined

ugh, what a pain. I’m trying this now:

|> List.ofSeq |> List.sortBy

But I’m getting this:

Error 1 Type mismatch. Expecting a (Security * RoleContributor * RoleContributor * SuggestedTrade * SuggestedTradeRecommendation * Idea * RoleContributor * SupportingUploadedFile * LargeText) list -> ‘a but given a (‘b -> ‘c) -> ‘b list -> ‘b list The type ‘(Security * RoleContributor * RoleContributor * SuggestedTrade * SuggestedTradeRecommendation * Idea * RoleContributor * SupportingUploadedFile * LargeText) list’ does not match the type ”a -> ‘b’

  • 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-18T08:39:20+00:00Added an answer on May 18, 2026 at 8:39 am

    Seq.sortBy would do that.

    However sorting implies you know the key values of the full sequence at the time of sorting, so by definition you cannot use this on infinite sequences.

    Edit:
    The equivalent for lists has the same name:
    List.sortBy

    MSDN example:

    let sortedList2 = List.sortBy (fun elem -> abs elem) [1; 4; 8; -2; 5]
    printfn "%A" sortedList2
    

    Edit 2:

    From your new example it seems like you have a list of tuples. Now it depends on what item in the tuple you want to search by.

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

Sidebar

Related Questions

I realize this is a total n00b question, but I'm curious and I thought
i am not sure if its a total n00b question but here goes. i
I'm a total C n00b trying to teach myself C off K&R. My question
Total Novice here. I have some list items. I need to add a class
Total n00b question here. I am using pgAdmin to attempt to administer a remote
I need some help ... I'm a bit (read total) n00b when it comes
Total newbie question but this is driving me mad! I'm trying this: myInt =
I am a total Groovy newbie. I saw the following code here . def
Total n00b to C# and events although I have been programming for a while.
I feel like a total n00b for not understanding what I'm doing wrong, but

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.