I’m getting the above error while trying to solve Binary Search in F# in the online editor.
Is it possible to give the editor an upgrade?
Not sure what’s so .NET 8 about my code…
let find (input: int array) value =
let rec searchLoop target left right =
if left > right then
None
else
let middle = (left + right) / 2
if input[middle] = target then
Some middle
elif input[middle] < target then
searchLoop target (middle + 1) right
else
searchLoop target left (middle - 1)
searchLoop value 0 (input.Length - 1)
fsharp/exercises/practice/binary-search/BinarySearch.fsproj at main · exercism/fsharp · GitHub does targets .NET 8. Are you perhaps revisiting an exercise you started a while ago? You might need to update the exercise to get the latest files. There should be a banner on the exercise page referencing that.
I’ve copy-pasted your code in the online editor and it works well for me. Could you check to see if Binary Search in F# on Exercism prompt you to upgrade the exercise to the latest version?
Thank you both for your suggestions. I have seen that prompt to update an exercise on another exercise before but I started this one yesterday. I tried some different paths to get to the editor to maybe trigger the prompt but that never happened.
I finally logged out of Exercism and back in again and then it just accepted the code without issues, maybe the very long logged in session I had running was to blame? I also had C# and F# running side-by-side in different tabs, maybe that’s another factor…
Anyway, all good now!
1 Like