2025/12/03

Newest at the top

2025-12-03 16:22:30 +0100st_aldini(~Thunderbi@2605:a601:a07c:7400:6e26:f360:f11d:472c) (Quit: st_aldini)
2025-12-03 16:21:12 +0100aljazmc(~aljazmc@user/aljazmc) aljazmc
2025-12-03 16:16:54 +0100 <lucabtz> yep
2025-12-03 16:16:46 +0100 <lambdabot> [2,4,6,8,10,6,7,8,9,10]
2025-12-03 16:16:43 +0100 <kuribas`> > let (xs, ys) = break (> 5) [1..10] in map (*2) xs ++ ys
2025-12-03 16:16:26 +0100bitdex_(~bitdex@gateway/tor-sasl/bitdex) (Quit: = "")
2025-12-03 16:15:59 +0100 <kuribas`> sure
2025-12-03 16:15:40 +0100 <lucabtz> or span
2025-12-03 16:15:27 +0100sord937(~sord937@gateway/tor-sasl/sord937) sord937
2025-12-03 16:15:15 +0100 <kuribas`> break?
2025-12-03 16:15:02 +0100 <lucabtz> kuribas` if there is no state can't you just use break
2025-12-03 16:14:07 +0100califax_califax
2025-12-03 16:14:06 +0100sord937(~sord937@gateway/tor-sasl/sord937) (Ping timeout: 272 seconds)
2025-12-03 16:14:06 +0100califax(~califax@user/califx) (Ping timeout: 272 seconds)
2025-12-03 16:14:06 +0100chexum(~quassel@gateway/tor-sasl/chexum) (Ping timeout: 272 seconds)
2025-12-03 16:13:49 +0100chexum_(~quassel@gateway/tor-sasl/chexum) chexum
2025-12-03 16:12:22 +0100califax_(~califax@user/califx) califx
2025-12-03 16:11:00 +0100 <lambdabot> [2,4,6,8,5,6,7,8,9,10]
2025-12-03 16:11:00 +0100 <__monty__> But the idea works.
2025-12-03 16:10:56 +0100 <kuribas`> > foldr (\(x:xs) cont s -> if (s > 7) then (x:xs) else (x*2) : cont (s+x)) (const []) (tails [1..10]) 0
2025-12-03 16:10:56 +0100spew(~spew@user/spew) spew
2025-12-03 16:10:44 +0100 <__monty__> This is the missing case analysis I was referring to.
2025-12-03 16:10:39 +0100spew(~spew@user/spew) (Quit: nyaa~)
2025-12-03 16:10:30 +0100 <lambdabot> [2,4,6,8,10,12,14,16,18,20*Exception: <interactive>:3:8-59: Non-exhaustive p...
2025-12-03 16:10:27 +0100 <__monty__> > foldr (\(x:xs) xs2 -> if False then (x:xs) else (x*2) : xs2) [] (tails [1..10])
2025-12-03 16:10:08 +0100gawen(~gawen@user/gawen) gawen
2025-12-03 16:09:40 +0100wbooze(~inline@cgn-195-14-221-120.nc.de) (Quit: Leaving)
2025-12-03 16:09:08 +0100 <kuribas`> You can use the continuation if you need to pass some state.
2025-12-03 16:08:44 +0100 <lambdabot> [2,4,6,8,10,6,7,8,9,10]
2025-12-03 16:08:41 +0100 <kuribas`> > foldr (\(x:xs) xs2 -> if (x > 5) then (x:xs) else (x*2) : xs2) [] (tails [1..10])
2025-12-03 16:08:38 +0100 <kuribas`> Actually, this doesn't use the continuation ...
2025-12-03 16:07:41 +0100 <__monty__> Hmm, no the span/break would need to carry state forward.
2025-12-03 16:07:06 +0100 <__monty__> Feels a lot like span/break and folding the fst.
2025-12-03 16:05:52 +0100 <__monty__> Only shortcoming is if the condition is never fulfilled, needs more case analysis.
2025-12-03 16:05:29 +0100lucabtz(~lucabtz@user/lucabtz) lucabtz
2025-12-03 16:04:45 +0100amadaluzia(~amadaluzi@user/amadaluzia) amadaluzia
2025-12-03 16:04:39 +0100 <kuribas`> --proof that it doesn't visit the tail :)
2025-12-03 16:04:26 +0100 <lambdabot> [2,4,6,8,10,6,7,8,9,10]
2025-12-03 16:04:23 +0100 <kuribas`> > take 10 $ foldr (\(x:xs) cont -> \xs2 -> if (x > 5) then (x:xs) else (x*2) : cont xs) id (tails [1..]) []
2025-12-03 16:03:03 +0100spew(~spew@user/spew) spew
2025-12-03 16:02:40 +0100lucabtz(~lucabtz@user/lucabtz) (Remote host closed the connection)
2025-12-03 16:01:59 +0100ttybitnik(~ttybitnik@user/wolper) (Quit: Fading out...)
2025-12-03 16:01:28 +0100divlamir(~divlamir@user/divlamir) (Ping timeout: 244 seconds)
2025-12-03 16:00:45 +0100spew(~spew@user/spew) (Ping timeout: 245 seconds)
2025-12-03 16:00:00 +0100 <kuribas`> obviously needs some lambdacase.
2025-12-03 15:59:41 +0100 <kuribas`> ^ __monty__
2025-12-03 15:59:36 +0100 <lambdabot> [2,4,6,8,10,6,7,8,9,10]
2025-12-03 15:59:30 +0100 <kuribas`> > foldr (\(x:xs) cont -> \xs2 -> if (x > 5) then (x:xs) else (x*2) : cont xs) id (tails [1..10]) []
2025-12-03 15:51:23 +0100wbooze(~inline@cgn-195-14-221-120.nc.de) Inline
2025-12-03 15:47:39 +0100Guest6657(~inline@cgn-195-14-221-120.nc.de) (Quit: Leaving)