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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:46:17+00:00 2026-06-12T05:46:17+00:00

a simple example of what I would like to do is Array.tryFind (fun elem

  • 0

a simple example of what I would like to do is

 Array.tryFind (fun elem index -> elem + index = 42) array1  //not valid

Since there is no break or continue, i find it hard to do it manually even in a for loop

  • 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-06-12T05:46:18+00:00Added an answer on June 12, 2026 at 5:46 am

    Similar with @gradbot’s answer, you could define a module function along the line of mapi, iteri which works on arrays, lists and sequences.

    module Seq =
        let tryFindi fn seq =
            seq |> Seq.mapi (fun i x -> i, x)
                |> Seq.tryFind (fun (i, x) -> fn i x)
                |> Option.map snd
    
    // Usage
    let res = [|1;1;40;4;2|] |> Seq.tryFindi (fun i el -> i + el = 42)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i would like a simple help... i have a url like this: example.com/profile.php?id= &
I wrote a simple example that I expected would do it. The relevant code
A simple example of what I'd like to achieve: <body> <div style=float:left;> Hey, look
Basically, I would like a simple, easy, one-file way to parse an INI file
I am creating a wizard from the Drupal example file and would like to
I have an array of 16 squares and I would like to auto complete
I have an array of elements that I would like to apply a mapping
I have an array of objects in JavaScript. I would like to sort them
Sounds simple enough, but its not working. In this example, I want to set
I would like to bring access to an internal array with a Property, 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.