Logs: freenode/#haskell
| 2021-04-20 20:03:19 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-04-20 20:04:31 | × | ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection) |
| 2021-04-20 20:04:52 | × | jumper149 quits (~jumper149@80.240.31.34) (Quit: WeeChat 3.1) |
| 2021-04-20 20:05:19 | × | petersen quits (~petersen@redhat/juhp) (Ping timeout: 252 seconds) |
| 2021-04-20 20:05:41 | → | ukari joins (~ukari@unaffiliated/ukari) |
| 2021-04-20 20:07:06 | × | wonko7 quits (~wonko7@62.115.229.50) (Ping timeout: 240 seconds) |
| 2021-04-20 20:07:45 | → | petersen joins (~petersen@redhat/juhp) |
| 2021-04-20 20:08:07 | × | DavidEichmann quits (~david@147.136.46.217.dyn.plus.net) (Remote host closed the connection) |
| 2021-04-20 20:09:05 | → | shailangsa joins (~shailangs@host86-185-102-48.range86-185.btcentralplus.com) |
| 2021-04-20 20:10:47 | × | hiroaki_ quits (~hiroaki@2a02:8108:8c40:2bb8:2126:aa80:b49b:4f77) (Ping timeout: 260 seconds) |
| 2021-04-20 20:14:43 | × | LKoen quits (~LKoen@92.163.9.109.rev.sfr.net) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”) |
| 2021-04-20 20:15:24 | → | dsrt^ joins (dsrt@ip98-184-89-2.mc.at.cox.net) |
| 2021-04-20 20:16:29 | → | BG-Haskell joins (49561a19@c-73-86-26-25.hsd1.de.comcast.net) |
| 2021-04-20 20:16:39 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-20 20:17:15 | × | geekosaur quits (930099da@rrcs-147-0-153-218.central.biz.rr.com) (Quit: Connection closed) |
| 2021-04-20 20:17:34 | → | geowiesnot joins (~user@87-89-181-157.abo.bbox.fr) |
| 2021-04-20 20:18:37 | → | geekosaur joins (930099da@rrcs-147-0-153-218.central.biz.rr.com) |
| 2021-04-20 20:20:17 | <BG-Haskell> | Hello All |
| 2021-04-20 20:20:33 | → | pavonia joins (~user@unaffiliated/siracusa) |
| 2021-04-20 20:20:34 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-04-20 20:20:38 | → | hiroaki_ joins (~hiroaki@2a02:8108:8c40:2bb8:9a44:5c99:5f02:ae1) |
| 2021-04-20 20:21:41 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-04-20 20:23:29 | × | MrFantastik quits (~user@rrcs-184-74-43-235.nys.biz.rr.com) (Remote host closed the connection) |
| 2021-04-20 20:25:00 | <geekosaur> | ohai? |
| 2021-04-20 20:25:13 | × | finn_elija quits (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) (Remote host closed the connection) |
| 2021-04-20 20:28:44 | → | finn_elija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) |
| 2021-04-20 20:31:19 | × | xff0x quits (~xff0x@2001:1a81:5214:2600:51f9:992c:5a15:4907) (Ping timeout: 276 seconds) |
| 2021-04-20 20:32:36 | → | xff0x joins (xff0x@gateway/vpn/mullvad/xff0x) |
| 2021-04-20 20:33:56 | × | Guest78317 quits (~laudiacay@67.176.215.84) (Ping timeout: 265 seconds) |
| 2021-04-20 20:34:35 | × | coot quits (~coot@37.30.50.130.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-04-20 20:36:30 | → | usr25 joins (~usr25@unaffiliated/usr25) |
| 2021-04-20 20:38:22 | × | kritzefitz quits (~kritzefit@212.86.56.80) (Remote host closed the connection) |
| 2021-04-20 20:41:01 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2021-04-20 20:42:06 | × | geekosaur quits (930099da@rrcs-147-0-153-218.central.biz.rr.com) (Quit: Connection closed) |
| 2021-04-20 20:42:21 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds) |
| 2021-04-20 20:45:03 | × | ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection) |
| 2021-04-20 20:45:58 | → | ukari joins (~ukari@unaffiliated/ukari) |
| 2021-04-20 20:46:42 | × | BG-Haskell quits (49561a19@c-73-86-26-25.hsd1.de.comcast.net) (Quit: Connection closed) |
| 2021-04-20 20:47:35 | × | ClaudiusMaximus quits (~claude@unaffiliated/claudiusmaximus) (Quit: ->) |
| 2021-04-20 20:47:50 | × | xkapastel quits (uid17782@gateway/web/irccloud.com/x-bawywirjaljqzbpz) (Quit: Connection closed for inactivity) |
| 2021-04-20 20:47:58 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2021-04-20 20:49:08 | × | HannaM quits (~quassel@p54849510.dip0.t-ipconnect.de) (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
| 2021-04-20 20:49:57 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-04-20 20:52:06 | → | geekosaur joins (930099da@rrcs-147-0-153-218.central.biz.rr.com) |
| 2021-04-20 20:53:06 | × | myShoggoth quits (~myShoggot@75.164.11.109) (Ping timeout: 240 seconds) |
| 2021-04-20 20:53:15 | → | tatsumaru joins (~tatsumaru@85.196.189.103) |
| 2021-04-20 20:53:20 | <tatsumaru> | hey guys, |
| 2021-04-20 20:53:52 | <tatsumaru> | why does [3, 4, 2] > [3, 4] return 'True' instead of an error? Isn't the "2" evaluated? |
| 2021-04-20 20:53:59 | → | myShoggoth joins (~myShoggot@75.164.11.109) |
| 2021-04-20 20:54:15 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-20 20:54:28 | → | Sornaensis joins (~Sornaensi@077213200034.dynamic.telenor.dk) |
| 2021-04-20 20:55:16 | <glguy> | tatsumaru: lists use "lexicographic" ordering |
| 2021-04-20 20:55:45 | <glguy> | https://en.wikipedia.org/wiki/Lexicographic_order |
| 2021-04-20 20:55:48 | → | Tario joins (~Tario@201.192.165.173) |
| 2021-04-20 20:56:29 | <tatsumaru> | "One variant applies to sequences of different lengths by comparing the lengths of the sequences before considering their elements. " |
| 2021-04-20 20:56:39 | <tatsumaru> | so basically the 2 isn't considered because the second list is shorter? |
| 2021-04-20 20:57:20 | <monochrom> | But Haskell's Ord for [a] doesn't use the variant. |
| 2021-04-20 20:58:12 | <edwardk> | > "abc" > "ab" |
| 2021-04-20 20:58:14 | <lambdabot> | True |
| 2021-04-20 20:58:18 | <edwardk> | ^- same thing |
| 2021-04-20 20:58:22 | × | Sorny quits (~Sornaensi@85.203.36.21) (Ping timeout: 268 seconds) |
| 2021-04-20 20:58:53 | <tatsumaru> | edwardk not getting how this is helpful |
| 2021-04-20 20:59:04 | × | xff0x quits (xff0x@gateway/vpn/mullvad/xff0x) (Ping timeout: 265 seconds) |
| 2021-04-20 20:59:20 | <edwardk> | this is the same thing that is happening in haskell, it is using lexicographical ordering on lists, the very ordering you use when you find things in a dictionary. |
| 2021-04-20 20:59:26 | <monochrom> | When sorting names we choose "louie" < "louies". The standard library simply extends this from [Char] to [a]. |
| 2021-04-20 20:59:28 | → | justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311) |
| 2021-04-20 21:00:12 | <tatsumaru> | alright, but I still don't understand why the 2 doesn't get evaluated |
| 2021-04-20 21:00:28 | → | xff0x joins (~xff0x@2001:1a81:5214:2600:51f9:992c:5a15:4907) |
| 2021-04-20 21:01:07 | <monochrom> | Does it help if you know "[3,4]" is syntax sugar for "3 : (4 : [])"? |
| 2021-04-20 21:01:17 | <edwardk> | compare (x:xs) (y:ys) = case compare x y of { LT -> LT; EQ -> compare xs ys; GT -> GT }; compare [] [] = EQ; compare [] (_:_) = LT; compare (_:_) [] = GT |
| 2021-04-20 21:01:33 | <monochrom> | and then that. |
| 2021-04-20 21:01:37 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2021-04-20 21:01:59 | <edwardk> | when it starts it compares 3:4:2:[] with 3:4:[]. so we start on the first compare pattern, which then compares 3 with 3, gets EQ and compares the tails |
| 2021-04-20 21:02:10 | <monochrom> | Near the end of the recursive algorithm, it is comparing [] against non-[], done, doesn't even care. |
| 2021-04-20 21:02:26 | × | myShoggoth quits (~myShoggot@75.164.11.109) (Ping timeout: 240 seconds) |
| 2021-04-20 21:02:32 | <edwardk> | we then compare 4:2:[] with 4:[] -- which compares the heads (compare 4 4 yields EQ, which recurses again with 2:[] and [] |
| 2021-04-20 21:02:34 | <monochrom> | > [] < undefined : undefined |
| 2021-04-20 21:02:36 | <lambdabot> | True |
| 2021-04-20 21:02:56 | <edwardk> | now we fall into the last case compare (_:_) [] = GT |
| 2021-04-20 21:03:08 | → | Guest78317 joins (~laudiacay@67.176.215.84) |
| 2021-04-20 21:03:11 | <edwardk> | > [2] > [] |
| 2021-04-20 21:03:13 | <lambdabot> | True |
| 2021-04-20 21:04:00 | <edwardk> | lexicographical comparison is comparing element by element through the two lists until one of the lists runs out and the other doesn't, or until it encounters a difference in the values contained. |
| 2021-04-20 21:04:19 | <edwardk> | so notice how compare (_:_) [] = GT -- didn't care a whit about what you stored in the list. |
| 2021-04-20 21:04:45 | <tatsumaru> | i am not familiar with the (_:_) construction yet |
| 2021-04-20 21:04:49 | <edwardk> | > 'a':'b':(undefined:[]) > "ab" |
| 2021-04-20 21:04:51 | <lambdabot> | True |
| 2021-04-20 21:05:05 | <edwardk> | (_:_) is just a pattern throwing away both the x and the xs in the pattern match |
| 2021-04-20 21:05:26 | <edwardk> | foo (x:xs) = "hello" could be written as foo (_:_) = "hello" -- since the body doesn't need the name x or xs. |
| 2021-04-20 21:05:29 | <monochrom> | The _ is "wildcard pattern" and it matches unconditionally and also doesn't care. |
| 2021-04-20 21:05:36 | <edwardk> | const a _ = a |
| 2021-04-20 21:05:42 | <edwardk> | throws away the second argument |
| 2021-04-20 21:05:59 | <monochrom> | The : you're supposed to know if you use Haskell lists at all. |
| 2021-04-20 21:06:15 | <edwardk> | : is just how you cons onto a list. |
| 2021-04-20 21:06:15 | <tatsumaru> | well IIUC : means append to the beginning of the list |
| 2021-04-20 21:06:20 | <edwardk> | > 1:2:3:[] |
| 2021-04-20 21:06:22 | <lambdabot> | [1,2,3] |
| 2021-04-20 21:06:37 | <edwardk> | > case [1,2,3] of x:xs -> x |
| 2021-04-20 21:06:40 | <lambdabot> | 1 |
| 2021-04-20 21:06:44 | <edwardk> | > case [1,2,3] of x:xs -> xs |
All times are in UTC.