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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:33:46+00:00 2026-05-30T17:33:46+00:00

I had to write 2 operators : let inline (|/>) (seqinit:seq<‘a*’T>) f = seqinit

  • 0

I had to write 2 operators :

let inline (|/>) (seqinit:seq<'a*'T>) f = seqinit |> Seq.map  (fun (key1 ,seq1) -> (key1, seq1 |> f ))
let inline (||>) (seqinit:seq<'a * seq<'b>>) (f2:seq<'b>->seq<'c*seq<'d>>) = seqinit |>  Seq.map  (fun (key1 ,seq1) -> (key1, seq1 |> f2 ))

In order to have the following operations, the first group transforming Seq’s to Map’s, the second group adding a key to a collection

let toMap  (seqinit:seq<'a*'T>)                 =  seqinit |/> id     |> Map.ofSeq  
let toMap2 (seqinit:seq<'a*seq<'b*'T>>)         =  seqinit |/> toMap  |> toMap
let toMap3 (seqinit:seq<'a*seq<'b*seq<'c*'T>>>) =  seqinit |/> toMap2 |> toMap


let groupBy2 f1 f2 (seqinit:seq<'a>) = 
  seqinit |> Seq.groupBy f1  ||> (Seq.groupBy f2)

let groupBy3 f1 f2 f3 (seqinit:seq<'a>) =
  seqinit |> Seq.groupBy f1  ||> (Seq.groupBy f2) ||> (Seq.groupBy f3)

Are there any special name for those 2 operators |/> and ||> ?

This would help me find other such operators and not reinvent the wheel

EDIT

it is also useful for ungrouping

let ungroup  (seqinit:seq<'a*seq<'b>>)                 = seqinit |> Seq.fold(fun state (key, keyseq) -> Seq.append state keyseq) Seq.empty
let ungroup2 (seqinit:seq<'a*seq<'b*seq<'c>>>)         = seqinit |/> ungroup |> ungroup
let ungroup3 (seqinit:seq<'a*seq<'b*seq<'c*seq<'d>>>>) = seqinit |/> ungroup |/> ungroup |> ungroup
  • 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-30T17:33:47+00:00Added an answer on May 30, 2026 at 5:33 pm

    ||> is already defined in FSharp.Core as 'T1 * 'T2 -> ('T1 -> 'T2 -> 'U) -> 'U. Usage: (arg1, arg2) ||> func. Its compiled name is op_PipeRight2.

    Your definition of |/> seems too customized to be of general use, so my guess is there isn’t a predefined name for it.

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

Sidebar

Related Questions

Have had to write my first proper multithreaded coded recently, and realised just how
I have experience with OCaml. You had to write a stub for every function
I have some code that I had to write to replace a function that
I've just had to write a string reverse function in C# 2.0 (i.e. LINQ
If you had to write code that takes messages from a message queue and
I had a task to write simple game simulating two players picking up 1-3
I had a task to write simple game simulating two players picking up 1-3
My kiddo had a homework assignment to write Blackjack in Java. I helped him
Suppose I only had the regular J2SE http libraries but wanted to write a
I am trying to write a program in PHP which I had already written

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.