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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:51:04+00:00 2026-05-15T15:51:04+00:00

Here’s code that works fine: let f x y z = x + y

  • 0

Here’s code that works fine:

let f x y z = x + y + z

let g x y = f x y
let h x z = z |> f x

So I can write expression “h 1”, and FSI displays:

val it : (int -> int -> int) = <fun:it@110-3>

If I call “h 1 2 3”, the arguments are applied in the right order.
But if the last argument has a different type, things get different:

let ff x y (z : string) = x + y

let gg x y = ff x y
let hh x (z : string) = z |> ff x

Now the last function hh causes an error message:

Script.fsx(119,10): error FS0001: Type mismatch. Expecting a string -> 'a
but given a int -> string -> int. The type string does not match the type int

I understand why this happens – “z” is appended to “ff x” making it a second argument. But then I’d expect in the first example expression “h 1 2 3” not to work properly (being executed as “f 1 3 2”). But it works just fine.

  • 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-15T15:51:05+00:00Added an answer on May 15, 2026 at 3:51 pm

    The functions ff and gg in your example are the same – the pipelining operator provides value for a first argument of a function on the right-hand side. In your example, the function on the right hand side is ff x and by using the pipelining operator, you specify the value for argument y:

    let ff x y (z : string) = 
      printfn "%s" z
      x + y
    
    // These two functions are the same:
    let gg x y = ff x y
    let hh x y = y |> ff x
    

    There is no stnadard syntax for specifying other than first parameters when using partial function application. However, you can write a higher-order function or a custom operator to do that. For example:

    // Takes a function 'f' of type 'b -> 'a -> 'c
    // and a value 'v' of type 'a and creates a function
    // that takes the first argument ('b -> 'c)
    let (|*>) v f = (fun mid -> f mid v);;
    
    let gg x y = ff x y     // Specifies arguments x and y
    let hh x z = z |*> ff x // Specifies arguments x and z
    

    I named the operator |*> to denote that it skips one argument. You could define operators that specify value of other arguments similarly (e.g. |**> to skip the first two arguments).

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

Sidebar

Related Questions

Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is my code sample, let me know if it can be further improved?
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a coding problem for those that like this kind of thing. Let's see
Here is an example: I write html code inside of textarea, then I swap
Here is my code (Say we have a single button on the page that
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is my code, which takes two version identifiers in the form 1, 5,
Here is the scenario: I'm writing an app that will watch for any changes

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.