From d83b5a01558a64c51fcbec0a92fa5ac06a71949d Mon Sep 17 00:00:00 2001 From: Tuomas Hietanen Date: Sun, 7 Jul 2024 22:25:21 +0100 Subject: [PATCH] yield needs to be this way for tail-recursion --- src/FSharpAux.Core/String.fs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/FSharpAux.Core/String.fs b/src/FSharpAux.Core/String.fs index 1d33d4f..d8c987c 100644 --- a/src/FSharpAux.Core/String.fs +++ b/src/FSharpAux.Core/String.fs @@ -121,11 +121,9 @@ module String = | Lower _ when not takeUpper -> consume from takeUpper (i + 1) | Upper _ when takeUpper -> consume from takeUpper (i + 1) | _ -> - let r1 = struct (from, i) - let r2 = restart i seq { - yield r1 - yield! r2 } + yield struct (from, i) + yield! restart i } // Split string into segments and turn them to PascalCase seq { for i1, i2 in restart 0 do