Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 470 471 472 473 474 475 476 477 478 479 480 .. 18002
1,800,105 events total
2021-06-15 09:40:15 <Rembane> Interesting
2021-06-15 09:40:21 <nitrix> I think I would write a recursive function and pattern match it at this point. It's not very general :/
2021-06-15 09:40:40 <Rembane> +1
2021-06-15 09:44:42 × dixie_ quits (~dixie@real.wilbury.sk) (Ping timeout: 272 seconds)
2021-06-15 09:45:06 ddellacosta joins (~ddellacos@86.106.143.151)
2021-06-15 09:45:13 × fishfinger quits (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net) (Ping timeout: 244 seconds)
2021-06-15 09:46:06 × n0db quits (~n0db@HSI-KBW-091-089-090-070.hsi2.kabelbw.de) (Quit: Client closed)
2021-06-15 09:46:39 × BosonCollider quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Ping timeout: 272 seconds)
2021-06-15 09:46:47 <nitrix> The nasty for loop needs to be a fold I think.
2021-06-15 09:47:32 fishfinger joins (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net)
2021-06-15 09:48:20 <Rembane> nitrix: Isn't it a filter of some sort?
2021-06-15 09:50:01 × ddellacosta quits (~ddellacos@86.106.143.151) (Ping timeout: 272 seconds)
2021-06-15 09:50:09 jakzale joins (uid499518@id-499518.charlton.irccloud.com)
2021-06-15 09:50:24 × mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Quit: mikoto-chan)
2021-06-15 09:50:27 <nitrix> Mhhh, a filter with a default.
2021-06-15 09:51:02 × nsilv1 quits (~nsilv@host-82-50-119-12.retail.telecomitalia.it) (Ping timeout: 272 seconds)
2021-06-15 09:51:08 <Rembane> fromMaybe is good with defaults
2021-06-15 09:57:10 <cheater> <nitrix> That'll be like the first version I posted. He wants the first element from the second list that matches the current element from the first list (the matching is case insensitive, but the result needs to be sensitive). < nope. if the second list doesn't contain a matching element, then we use the element from the first list.
2021-06-15 09:58:03 × azeem quits (~azeem@176.200.200.250) (Ping timeout: 272 seconds)
2021-06-15 09:59:22 azeem joins (~azeem@176.200.200.250)
2021-06-15 09:59:41 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 244 seconds)
2021-06-15 10:00:40 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-15 10:01:08 <nitrix> I'm playing with the getFirst monoid.
2021-06-15 10:01:22 <teaSlurper> @haskell let x = 2
2021-06-15 10:01:23 <lambdabot> https://www.haskellers.com/
2021-06-15 10:01:40 <teaSlurper> can you write haskell in this chat ?
2021-06-15 10:01:54 <teaSlurper> is there like an intrepreter?
2021-06-15 10:02:07 ph88 joins (~ph88@ip5f5af6fd.dynamic.kabel-deutschland.de)
2021-06-15 10:02:14 <teaSlurper> @haskell 1 + 2
2021-06-15 10:02:15 <lambdabot> https://www.haskellers.com/
2021-06-15 10:02:23 <Rembane> > 1 + 2
2021-06-15 10:02:25 <lambdabot> 3
2021-06-15 10:02:31 <teaSlurper> > 1 + 1
2021-06-15 10:02:33 <lambdabot> 2
2021-06-15 10:02:37 <teaSlurper> thx
2021-06-15 10:02:50 <sshine> % "this one also"
2021-06-15 10:02:50 <yahb> sshine: "this one also"
2021-06-15 10:02:55 <teaSlurper> > 1 : 2
2021-06-15 10:02:57 <lambdabot> [1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2...
2021-06-15 10:03:11 <teaSlurper> that's not right is it?
2021-06-15 10:03:13 <sshine> % 1 : 2
2021-06-15 10:03:13 <yahb> sshine: ; <interactive>:83:1: error:; * No instance for (Num [Integer]) arising from a use of `it'; * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it
2021-06-15 10:03:30 <sshine> I'm not sure why lambdabot does that.
2021-06-15 10:03:54 × pe200012 quits (~pe200012@183.63.73.36) (Ping timeout: 264 seconds)
2021-06-15 10:03:57 pe200012_ joins (~pe200012@120.236.161.38)
2021-06-15 10:04:17 <teaSlurper> % 1 : 2
2021-06-15 10:04:17 <yahb> teaSlurper: ; <interactive>:86:1: error:; * No instance for (Num [Integer]) arising from a use of `it'; * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it
2021-06-15 10:04:26 <teaSlurper> % 1 : [2]
2021-06-15 10:04:26 <yahb> teaSlurper: [1,2]
2021-06-15 10:04:30 <sshine> % subsequences "wat"
2021-06-15 10:04:30 <yahb> sshine: ["","w","a","wa","t","wt","at","wat"]
2021-06-15 10:04:45 <teaSlurper> i have a question
2021-06-15 10:04:57 <teaSlurper> why does this little function work...
2021-06-15 10:05:17 <teaSlurper> % let f x = x : f x in f 1
2021-06-15 10:05:23 <yahb> teaSlurper: [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
2021-06-15 10:05:39 <teaSlurper> and this doesn't
2021-06-15 10:05:40 <teaSlurper> :
2021-06-15 10:05:47 <teaSlurper> % 1 : 1
2021-06-15 10:05:48 <yahb> teaSlurper: ; <interactive>:1:1: error:; * No instance for (Num [Integer]) arising from a use of `it'; * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it
2021-06-15 10:05:53 <sshine> :t (:)
2021-06-15 10:05:54 <lambdabot> a -> [a] -> [a]
2021-06-15 10:06:09 <sshine> the (:) constructor expects the right-hand side to be a list. in '1 : 1', the second 1 is not a list.
2021-06-15 10:06:27 <teaSlurper> my function shouldn't work though right?
2021-06-15 10:06:34 <sshine> in 'let f x = x : f x in f 1', the right-hand side of ':' is 'f x' which is a list.
2021-06-15 10:06:54 <sshine> it happens to be an infinite list, but those are okay in Haskell.
2021-06-15 10:07:11 <sshine> % let xs = [1,2..] in take 10 xs
2021-06-15 10:07:11 <yahb> sshine: [1,2,3,4,5,6,7,8,9,10]
2021-06-15 10:07:20 <Rembane> :t let f x = x : f x in f 1
2021-06-15 10:07:21 <lambdabot> Num t => [t]
2021-06-15 10:07:46 <teaSlurper> there's no part of my function that has a list in it?
2021-06-15 10:08:03 <sshine> teaSlurper, yes there is. 'x : f x' is a list
2021-06-15 10:08:18 <sshine> teaSlurper, also, because 'x : f x' is a list, so is 'f x', because of recursion.
2021-06-15 10:08:34 <teaSlurper> 1 : 1 : 1
2021-06-15 10:08:37 Guest5851 joins (~Guest58@ti0182q160-6494.bb.online.no)
2021-06-15 10:08:40 <teaSlurper> % 1 : 1 : 1
2021-06-15 10:08:40 <yahb> teaSlurper: ; <interactive>:3:1: error:; * No instance for (Num [Integer]) arising from a use of `it'; * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it
2021-06-15 10:08:41 <sshine> % 1 : 1 : 1 : []
2021-06-15 10:08:42 <yahb> sshine: [1,1,1]
2021-06-15 10:08:58 <teaSlurper> but at no point do i specify []?
2021-06-15 10:09:12 <sshine> the right-hand side of (:) needs to be a list. I recommend you read the chapter of LYAH on lists: http://learnyouahaskell.com/starting-out#an-intro-to-lists
2021-06-15 10:09:40 <sshine> teaSlurper, that's right, lists can be infinite, and [] would mark the ending of a list. so not all lists have a [] at the far right.
2021-06-15 10:09:49 fizbin joins (~fizbin@2601:8a:4080:1280:8c7e:5b3f:79d6:ec26)
2021-06-15 10:09:54 <sshine> teaSlurper, also. not all lists contain a ':' either.
2021-06-15 10:10:53 <sshine> teaSlurper, also, #haskell-beginners :) (not to dissuade you from asking questions here, but this channel is also active.)
2021-06-15 10:11:15 yd502 joins (~yd502@180.168.212.6)
2021-06-15 10:11:21 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds)
2021-06-15 10:11:27 <dminuoso> teaSlurper: the key to realize is that `1 : 1 : 1 ..` associates as 1 : (1 : (...))
2021-06-15 10:11:47 <sshine> Ó_ò
2021-06-15 10:12:13 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-15 10:13:52 <dminuoso> Compare that to the peano construction of natural numbers
2021-06-15 10:14:00 <dminuoso> % data Nat = Succ Nat | Nil
2021-06-15 10:14:00 <yahb> dminuoso:
2021-06-15 10:14:42 × fizbin quits (~fizbin@2601:8a:4080:1280:8c7e:5b3f:79d6:ec26) (Ping timeout: 264 seconds)
2021-06-15 10:16:09 <dminuoso> let x = Succ (Succ (Succ Nil))
2021-06-15 10:16:11 <dminuoso> % let x = Succ (Succ (Succ Nil))
2021-06-15 10:16:11 <yahb> dminuoso:
2021-06-15 10:17:27 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 244 seconds)
2021-06-15 10:17:44 <teaSlurper> thx dminuoso
2021-06-15 10:17:55 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-15 10:18:36 × zaquest quits (~notzaques@5.128.210.178) (Quit: Leaving)

All times are in UTC.