From 7a08726226cdbd461bf259ff89be556381fcfd0e Mon Sep 17 00:00:00 2001 From: Lars Hummelgren Date: Thu, 9 Nov 2023 15:24:55 +0100 Subject: [PATCH] Fix reversed order of toRope --- stdlib/seq.mc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/seq.mc b/stdlib/seq.mc index 4c0f26ab6..a0ccfd814 100644 --- a/stdlib/seq.mc +++ b/stdlib/seq.mc @@ -44,10 +44,10 @@ let toRope = lam seq. in if isRope seq then seq else let s = work [] seq in - -- NOTE(larshum, 2023-10-24): The below line ensures the rope is collapsed to - -- yield constant-time random accesses. - map (lam. ()) s; - s + -- NOTE(larshum, 2023-10-24): The below line ensures the elements of the rope + -- are in the right order, and it also collapses the rope (to ensure + -- constant-time random access). + reverse s let toList = lam seq. createList (length seq) (lam i. get seq i)