Skip to content

Mutual recursion sample for F# record types. #14399

Closed

Description

@davidn-sytelco

The example code for creating mutually recursive record types, does not actually feature any mutual recursion.


Document details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. cartermp commented on Sep 12, 2019

    @cartermp
    Contributor

    @davidn-sytelco The example is indeed a mutually recursive type declaration. Mutual recursion isn't a term limited to just functions.

  2. davidn-sytelco commented on Sep 12, 2019

    @davidn-sytelco
    Author

    Sorry, I should have pointed out why and given a corrected sample.

    The 'and' is not required for the current example data structure, just moving the Address type to be defined first obviates the need for it.

    This version is mutually recursive and cannot be defined without the 'and' as now both types refer to each other.

    // Create a Person type and use the Address type that is not defined
    type Person =
    { Name: string
    Age: int
    Address: Address }
    // Define the Address type which is used in the Person record
    and Address =
    { Line1: string
    Line2: string
    PostCode: string
    ReturnTo: Person option }

  3. added a commit that references this issue on Sep 15, 2019
    a5afb0d
  4. cartermp commented on Sep 15, 2019

    @cartermp
    Contributor

    Thanks @davidn-sytelco, I updated the sample.

  5. added a commit that references this issue on Sep 15, 2019
    c4211c1
  6. added this to the September 2019 milestone on Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions