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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:07:48+00:00 2026-05-24T00:07:48+00:00

I have a seq of seqs in FSharp . I want to join a

  • 0

I have a seq of seqs in FSharp. I want to join a seq to the previous one if a predicate returns to true for it.

Sample:

let items = seq [seq[2;3;4];seq[1;5;6;7;1;9];seq[2;3;5;7]]

I want to join a seq to the previos one, if the seq starts by 1, so the result should be in this case:

seq [seq[2;3;4;1;5;6;7;1;9];seq[2;3;5;7]]

Is there any nice functional way to do it?

I am just started to translate my long computation processes from C# to F# and very impressed by the performance improvement I could achieve after even a very few hours of work and my beginner level knowledge of FSharp.

I have bought a book from Amazon entitled ‘Beginning F#’. It is really great, but I mainly should work with seqs, lists, maps, collections now and this topic isn’t explained as detailed as I need. Would anyone be so kind to advise me a good resource about ths topics?

Thx in advance!

  • 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-24T00:07:50+00:00Added an answer on May 24, 2026 at 12:07 am
    let joinBy f input =
      let i = ref 0
      input 
      |> Seq.groupBy (fun x ->
        if not (f x) then incr i
        !i)
      |> Seq.map (snd >> Seq.concat)
    
    joinBy (Seq.head >> ((=) 1)) items
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let I have an array like a <- seq(1, 100, 1) and I want
Let's say I have the following tables tableA seq datea 1 2010-01-01 2 2010-02-01
I want to have class that can be instantiated with list, array, seq, set,
For example, I have Seq(1,2,3) and I want to get Seq(1,0,2,0,3) The first thing
I have a Seq of Tuple3 elements. I want a resulting collection (probably a
I have a seq<'A> . I want to map this to a seq<(int, 'A)>
Seq.max finds the max number. I'd like to have something like Seq.findIndex Seq.maxIndex returns
I have tables, seq, triggers, sp, types, oracle queues etc. I want to know
Let's say I have an increasing sequence of integers: seq = [1, 1, 1,
Let's say I have the following data frame: > df = data.frame(seq(0, 150, length.out=11),

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.