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

  • Home
  • SEARCH
  • 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 6331559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:05:33+00:00 2026-05-24T18:05:33+00:00

all! What is wrong with this code? I cannot understand what I am doing

  • 0

all!

What is wrong with this code? I cannot understand what I am doing wrong with Seq.Map.
Here is the error message: The type ‘unit’ is not compatible with the type ‘seq<‘a>’

let getPathToLibFile value =
    let regex = new Regex("\"(?<data>[^<]*)\"")
    let matches = regex.Match(value)
    matches.Value

let importAllLibs (lines:string[]) =
    lines
    |> Seq.filter isImportLine
    |> Seq.iter (printfn "Libs found: %s")
    |> Seq.map getPathToLibFile // error in this line
    |> Seq.iter (printfn "Path to libs: %s")

Is there any understandable examples on Seq.Map?

PS Example from wiki (it works):

(* Fibonacci Number formula *)
let rec fib n =
    match n with
    | 0 | 1 -> n
    | _ -> fib (n - 1) + fib (n - 2)

(* Print even fibs *)
[1 .. 10]
|> List.map     fib
|> List.filter  (fun n -> (n % 2) = 0)
|> printlist
  • 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-24T18:05:34+00:00Added an answer on May 24, 2026 at 6:05 pm

    I suspect the problem is actually your previous call.

    Seq.iter doesn’t return anything (or rather, returns unit) so you can’t use it in the middle of a pipeline. Try this:

    let importAllLibs (lines:string[]) =
        lines
        |> Seq.filter isImportLine
        |> Seq.map getPathToLibFile
        |> Seq.iter (printfn "Path to libs: %s")
    

    … and then if you really need to print out the “libs found” line, you can add another mapping which performs the printing and just returns the input:

    let reportLib value =
        printfn "Libs found: %s" value
        value
    
    let importAllLibs (lines:string[]) =
        lines
        |> Seq.filter isImportLine
        |> Seq.map reportLib
        |> Seq.map getPathToLibFile
        |> Seq.iter (printfn "Path to libs: %s")
    

    This may well be invalid F#, but I think the aim is right 🙂

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

Sidebar

Related Questions

I'm probably doing this all wrong. I have a text file full of data
I found this code on the internet on how to to display message/pop up
I have the following situation below. This code will throw a compiler error for
I have this code where all objects are created by Entity Framework 4.1: public
I'm getting compile error in this code #include<iostream> #include<cstdio> #include<string> using namespace std; void
I have been looking at this code for a while now, and cannot figure
All throughout an application wherever error messages (or other user messages) are used I
All I want is to update an ListViewItem's text whithout seeing any flickering. This
this code works fine: procedure TForm2.Timer1Timer(Sender: TObject); var Text: string; begin SetLength (Text,555); GetWindowText
I have tried to understand dependency injection and not quite gotten it, except I

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.