Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add back concat and flatten #19

Closed
wants to merge 1 commit into from
Closed

feat: add back concat and flatten #19

wants to merge 1 commit into from

Conversation

favonia
Copy link
Contributor

@favonia favonia commented Oct 17, 2023

Close #18. My hesitation is whether the complex code to make it tail-recursive is worth it:

let concat bs =
  let[@tail_mod_cons] rec go bs =
    function
    | Emp ->
      begin
        match bs with
        | Emp -> Emp
        | Snoc (bs, b) -> (go[@tailcall]) bs b
      end
    | Snoc (xs, x) ->
      Snoc ((go[@tailcall]) bs xs, x)
  in
  go bs Emp

@favonia
Copy link
Contributor Author

favonia commented Oct 17, 2023

Actually, I might found a possibly better way to write my code without using concat. Let me close this PR for now.

@favonia favonia closed this Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding back concat (flatten) and concat_map
1 participant