2024/11/01

Newest at the top

2024-11-01 12:30:05 +0100 <Hecate> sprotte24: don't hesitate to use play.haskell.org !
2024-11-01 12:29:05 +0100 <sprotte24> I show it, one moment please
2024-11-01 12:28:49 +0100 <sprotte24> I had a solution, but that solution used 2 parameters n and k.
2024-11-01 12:28:06 +0100 <sprotte24> In my recursive loop I have to Test an to increment the Power index.
2024-11-01 12:27:34 +0100morb(~morb@pool-108-41-100-120.nycmny.fios.verizon.net) (Ping timeout: 260 seconds)
2024-11-01 12:26:55 +0100 <mauke> any "loop variable" that changes in the loop is going to become a function parameter
2024-11-01 12:26:33 +0100lortabac(~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Ping timeout: 265 seconds)
2024-11-01 12:26:32 +0100 <mauke> (or a data structure like a list, but you're not allowed to do that, apparently)
2024-11-01 12:26:15 +0100 <mauke> yeah, if you want to emulate a loop in functional code, it's always going to be a recursive function
2024-11-01 12:25:44 +0100 <sprotte24> I plan to build an recursive solution?
2024-11-01 12:24:51 +0100 <sprotte24> I suppose I need a local variaable for k?
2024-11-01 12:24:42 +0100 <mauke> where are you stuck?
2024-11-01 12:24:30 +0100weary-traveler(~user@user/user363627) user363627
2024-11-01 12:24:24 +0100 <mauke> ah, the slow way
2024-11-01 12:24:01 +0100 <sprotte24> One Problem: my input parameter is n and I have to increment k until the condition is satisfied
2024-11-01 12:23:36 +0100misterfish(~misterfis@31-161-39-137.biz.kpn.net) misterfish
2024-11-01 12:22:41 +0100 <sprotte24> I have to test whether nearestPowerOfTwo n >= 2^k
2024-11-01 12:22:40 +0100morb(~morb@pool-108-41-100-120.nycmny.fios.verizon.net)
2024-11-01 12:21:45 +0100 <Rembane> Hecate: Sure thing! :D
2024-11-01 12:21:33 +0100 <Hecate> Rembane: lovely. :) Say hi to Andreas Abel from me if you meet him
2024-11-01 12:21:21 +0100 <sprotte24> I am not allowed to use a list
2024-11-01 12:20:29 +0100 <Rembane> Hecate: Still at Chalmers! I'll be done any day now. :D
2024-11-01 12:20:21 +0100 <lambdabot> (Ord c, ?n::c, Num c) => c
2024-11-01 12:20:20 +0100 <mauke> :t head . dropWhile (< ?n) . iterate (2 *) $ 1
2024-11-01 12:20:15 +0100 <sprotte24> ok. if I use binary number, the Powers of 2 have the format 1, 10 100 1000 and so on
2024-11-01 12:19:23 +0100 <Hecate> Rembane: I'm not doing too bad! Still at Chalmers?
2024-11-01 12:18:46 +0100 <Hecate> damnit I was about to suggest that hahahaha
2024-11-01 12:18:38 +0100 <mauke> like bit shifts?
2024-11-01 12:18:33 +0100 <mauke> define "using binary"
2024-11-01 12:18:23 +0100 <sprotte24> The restriction: using binary is forbidden.
2024-11-01 12:18:22 +0100 <Rembane> Hecate: Suuuuuuuuuuuuuuuuuup! :D
2024-11-01 12:18:15 +0100 <mauke> yeah, that actually makes things easier
2024-11-01 12:18:03 +0100 <Hecate> mauke: maybe they have to round to the highest power of 2
2024-11-01 12:17:41 +0100 <sprotte24> Yes. kome work
2024-11-01 12:17:35 +0100 <mauke> I'd say it's 8
2024-11-01 12:17:21 +0100 <sprotte24> n= 9 nearest Power is 16
2024-11-01 12:16:42 +0100 <mauke> oh, is this homework?
2024-11-01 12:16:37 +0100 <sprotte24> Example:
2024-11-01 12:16:34 +0100 <Hecate> sprotte24: nice
2024-11-01 12:16:28 +0100 <sprotte24> The Haskell programm has to compute the nearest Power of two for a given n.
2024-11-01 12:16:25 +0100 <Hecate> what's uuuuup
2024-11-01 12:16:19 +0100 <Hecate> rembaaaaaaane
2024-11-01 12:15:51 +0100 <mauke> what's it do?
2024-11-01 12:15:47 +0100 <sprotte24> Hi, Rembane
2024-11-01 12:15:35 +0100 <sprotte24> I want to write a Haskell program
2024-11-01 12:15:21 +0100 <Rembane> Hi sprotte24 !
2024-11-01 12:15:11 +0100 <sprotte24> Hi
2024-11-01 12:12:28 +0100sprotte24(~sprotte24@p200300d16f13bb00e9ebafc1049584f7.dip0.t-ipconnect.de)
2024-11-01 12:01:23 +0100ash3en(~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en)
2024-11-01 11:56:29 +0100k_hachig_(~k_hachig@2607:fea8:351d:ef0:901a:fefb:e87f:78b3) (Ping timeout: 260 seconds)