From fa7e17c5bb04256e344d10f730c44193d5d260e1 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Fri, 24 May 2019 20:06:08 +0200 Subject: [PATCH] fix(tests/playground/rbmap_checkpoint): do something with the list tail --- tests/playground/rbmap_checkpoint.hs | 6 +++--- tests/playground/rbmap_checkpoint.lean | 2 +- tests/playground/rbmap_checkpoint.ml | 2 +- tests/playground/rbmap_checkpoint.sml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/playground/rbmap_checkpoint.hs b/tests/playground/rbmap_checkpoint.hs index 53f878a318..939b71710e 100644 --- a/tests/playground/rbmap_checkpoint.hs +++ b/tests/playground/rbmap_checkpoint.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE ScopedTypeVariables #-} import System.Environment data Color = @@ -67,6 +68,5 @@ mk_Map n freq = mk_Map_aux freq n Leaf [] main = do [n, freq] <- getArgs let mList = mk_Map (read n) (read freq) - (m:_) <- return mList - let v = fold (\_ v r -> if v then r + 1 else r) m 0 - print v + let v :: Int = fold (\_ v r -> if v then r + 1 else r) (head mList) 0 + print (show (length mList) ++ " " ++ show v) diff --git a/tests/playground/rbmap_checkpoint.lean b/tests/playground/rbmap_checkpoint.lean index cb273cc4b1..c06e42a1e0 100644 --- a/tests/playground/rbmap_checkpoint.lean +++ b/tests/playground/rbmap_checkpoint.lean @@ -82,5 +82,5 @@ let freq := freq.toNat, let freq := if freq == 0 then 1 else freq, let mList := mkMap n freq, let v := fold (λ (k : Nat) (v : Bool) (r : Nat), if v then r + 1 else r) mList.head 0, -IO.println (toString v) *> +IO.println (toString mList.length ++ " " ++ toString v) *> pure 0 diff --git a/tests/playground/rbmap_checkpoint.ml b/tests/playground/rbmap_checkpoint.ml index ff12588f81..4f408d8ece 100644 --- a/tests/playground/rbmap_checkpoint.ml +++ b/tests/playground/rbmap_checkpoint.ml @@ -66,7 +66,7 @@ let mk_map n freq = mk_map_aux freq n Leaf [];; let main n freq = let m = mk_map n freq in let v = fold (fun k v r -> if v then r + 1 else r) (List.hd m) 0 in -Printf.printf "%8d\n" v; +Printf.printf "%d %d\n" (List.length m) v; v;; main (int_of_string Sys.argv.(1)) (int_of_string Sys.argv.(2));; diff --git a/tests/playground/rbmap_checkpoint.sml b/tests/playground/rbmap_checkpoint.sml index c70abbfad6..7fe05e0833 100644 --- a/tests/playground/rbmap_checkpoint.sml +++ b/tests/playground/rbmap_checkpoint.sml @@ -68,7 +68,7 @@ fun main n freq = let val m = mk_map n freq val v = fold (fn k => fn v => fn r => if v then r + 1 else r) (List.hd m) 0 in -print (Int.toString v) +print (Int.toString (List.length m) ^ " " ^ Int.toString v) end val l = List.map (valOf o Int.fromString) (CommandLine.arguments ())