Logs: freenode/#haskell
| 2020-09-27 01:49:31 | → | falafel joins (~falafel@cpe-104-172-194-249.socal.res.rr.com) |
| 2020-09-27 01:49:39 | × | justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 272 seconds) |
| 2020-09-27 01:50:58 | hackage | tasty-mgolden 0.0.2 - Golden testing provider for tasty with muti-line diff output https://hackage.haskell.org/package/tasty-mgolden-0.0.2 (mbj) |
| 2020-09-27 01:51:27 | × | ryansmccoy quits (~ryansmcco@156.96.151.132) (Ping timeout: 240 seconds) |
| 2020-09-27 01:52:36 | → | ryansmccoy joins (~ryansmcco@193.37.254.27) |
| 2020-09-27 01:55:07 | × | acidjnk_new quits (~acidjnk@p200300d0c723788981cc0ce7da3b2720.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
| 2020-09-27 01:55:26 | × | xff0x_ quits (~fox@2001:1a81:5304:1100:600f:1d33:a4fd:a80e) (Ping timeout: 246 seconds) |
| 2020-09-27 01:57:32 | × | xerox_ quits (~xerox@unaffiliated/xerox) (Ping timeout: 246 seconds) |
| 2020-09-27 01:57:35 | → | xff0x_ joins (~fox@2001:1a81:533e:8e00:b1b8:25fe:117c:c2a0) |
| 2020-09-27 01:58:53 | → | xsperry joins (~as@cpe-188-129-91-153.dynamic.amis.hr) |
| 2020-09-27 01:59:38 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 01:59:47 | × | Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 240 seconds) |
| 2020-09-27 02:02:26 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-09-27 02:03:33 | → | p0a joins (~user@unaffiliated/p0a) |
| 2020-09-27 02:03:44 | <p0a> | hello in [(i,j) | i<-[1..3], j<-[1..3], i < j], am I guaranteed the order in which the tuples are ordered in the resulting list? |
| 2020-09-27 02:05:41 | <ski> | yes |
| 2020-09-27 02:06:23 | <ski> | > [(i,j) | i <- [1 .. 3],j <- [1 .. 3],i < j] |
| 2020-09-27 02:06:26 | <lambdabot> | [(1,2),(1,3),(2,3)] |
| 2020-09-27 02:06:33 | <ski> | > [(i,j) | i <- [1 .. 3],j <- [1 .. j-1]] |
| 2020-09-27 02:06:35 | <lambdabot> | *Exception: not an integer: j - 1 |
| 2020-09-27 02:06:45 | <ski> | ah, right |
| 2020-09-27 02:06:55 | <p0a> | that's a typo |
| 2020-09-27 02:06:57 | <ski> | > [(i,j) | i <- [1 .. 3],j <- [i+1 .. 3]] |
| 2020-09-27 02:06:59 | <lambdabot> | [(1,2),(1,3),(2,3)] |
| 2020-09-27 02:07:13 | <p0a> | I see your point |
| 2020-09-27 02:07:15 | <ski> | > [(i,j) | i <- [1 .. j-1],j <- [1 .. 3]] |
| 2020-09-27 02:07:17 | <lambdabot> | *Exception: not an integer: j - 1 |
| 2020-09-27 02:07:38 | <ski> | hmpf, that error comes from another `j' that is in scope |
| 2020-09-27 02:07:45 | <ski> | > let j = () in [(i,j) | i <- [1 .. j-1],j <- [1 .. 3]] |
| 2020-09-27 02:07:47 | <lambdabot> | error: |
| 2020-09-27 02:07:47 | <lambdabot> | • Could not deduce (Num ()) arising from the literal ‘1’ |
| 2020-09-27 02:07:47 | <lambdabot> | from the context: (Num b, Enum b) |
| 2020-09-27 02:07:58 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds) |
| 2020-09-27 02:07:59 | × | mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer) |
| 2020-09-27 02:08:20 | <ski> | anyway, the `j' from `j <- [1 .. 3]' is not in scope in `i <- [1 .. j-1]', so you can't use `j' there |
| 2020-09-27 02:08:44 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:08:49 | <p0a> | yeah |
| 2020-09-27 02:09:01 | <ski> | but the `i' from `i <- [1 .. 3]' is in scope in the `j <- [1 .. 3],i < j' part (and the initial `(i,j)') part, so you could replace that generator part by `j <- [i+1 .. 3]' |
| 2020-09-27 02:09:52 | <ski> | and the order you get for `[(i,j) | i <- [1 .. 3],j <- [1 .. 3]]' is still the same order. `i' is the "outer loop", `j' is the "inner loop" (whose bounds are allowed to depend on the index `i' of the outer loop) |
| 2020-09-27 02:10:45 | <ski> | or, if you think of this in terms of enumerating cells in a matrix, then `i' is row index, `j' is column index. and different rows are allowed to have different lengths |
| 2020-09-27 02:11:00 | <p0a> | yeah, right |
| 2020-09-27 02:11:25 | <ski> | > [[(i,j) | j <- [i+1 .. 3]] | i <- [1 .. 3]] |
| 2020-09-27 02:11:27 | <lambdabot> | [[(1,2),(1,3)],[(2,3)],[]] |
| 2020-09-27 02:11:33 | <ski> | > concat [[(i,j) | j <- [i+1 .. 3]] | i <- [1 .. 3]] |
| 2020-09-27 02:11:35 | <lambdabot> | [(1,2),(1,3),(2,3)] |
| 2020-09-27 02:11:54 | <ski> | @undo [(i,j) | i <- [1 .. 3],j <- [i+1 .. 3]] |
| 2020-09-27 02:11:55 | <lambdabot> | concatMap (\ i -> concatMap (\ j -> [(i, j)]) [i + 1 .. 3]) [1 .. 3] |
| 2020-09-27 02:11:59 | <p0a> | So that's an implementation I guess, eh |
| 2020-09-27 02:12:03 | <ski> | @undo [(i,j) | i <- [1 .. 3],j <- [i .. 3],i < j] |
| 2020-09-27 02:12:04 | <lambdabot> | concatMap (\ i -> concatMap (\ j -> if i < j then [(i, j)] else []) [i .. 3]) [1 .. 3] |
| 2020-09-27 02:12:23 | <p0a> | okay makes sense |
| 2020-09-27 02:13:25 | <ski> | the `[[(i,j) | j <- [i+1 .. 3]] | i <- [1 .. 3]]' shows what to do, if you wanted a list of lists (each being a row, in the above image), rather than a single list with all pairs in it (the result of `concat' on the list of lists) |
| 2020-09-27 02:14:04 | → | remexre joins (~nathan@207-153-38-50.fttp.usinternet.com) |
| 2020-09-27 02:14:36 | × | rcdilorenzo quits (~rcdiloren@cpe-76-182-87-188.nc.res.rr.com) (Quit: rcdilorenzo) |
| 2020-09-27 02:14:42 | <p0a> | sure |
| 2020-09-27 02:15:02 | <p0a> | well that's not what I want, but I see how that is superior in the sense that concatMap gives you the other one |
| 2020-09-27 02:15:22 | <p0a> | it's a forgetful functor! |
| 2020-09-27 02:15:25 | p0a | runs |
| 2020-09-27 02:15:30 | <ski> | hm |
| 2020-09-27 02:16:00 | <ski> | anyway, earlier generators in a list comprehension vary more slowly than later generators |
| 2020-09-27 02:16:25 | <p0a> | right |
| 2020-09-27 02:17:42 | <p0a> | thank you! |
| 2020-09-27 02:18:01 | <p0a> | One more question, it seems that variable name clashes can happen often in Haskell right? |
| 2020-09-27 02:18:01 | × | mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer) |
| 2020-09-27 02:18:13 | <p0a> | Unless everything is qualified, if an import changes in the future, it may clash |
| 2020-09-27 02:18:26 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:18:55 | → | asan joins (~yan4138@124.78.5.33) |
| 2020-09-27 02:19:19 | <monochrom> | You can use explicit imports "import M(a, b, c)" to limit it. |
| 2020-09-27 02:20:13 | <p0a> | That's a good point, thank you |
| 2020-09-27 02:20:24 | × | mu_ quits (~mu@unaffiliated/mu) (Client Quit) |
| 2020-09-27 02:21:29 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:21:59 | <ski> | p0a : if there's an ambiguity, it'll tell you, so you can qualify the name by the module name (or alias) that you imported the identifier from |
| 2020-09-27 02:24:31 | <ski> | (if the ambiguity is between an imported identifier, and an identifier defined at top-level in the current module, then if you import the identifier qualified, then the plain (unqualified) identifier will refer to the one defined in the current module. and i suppose you don't even need to import qualified, if the identifier is locally bound) |
| 2020-09-27 02:27:05 | × | lagothrix quits (~lagothrix@unaffiliated/lagothrix) (Killed (card.freenode.net (Nickname regained by services))) |
| 2020-09-27 02:27:13 | → | lagothrix joins (~lagothrix@unaffiliated/lagothrix) |
| 2020-09-27 02:27:41 | → | wei2912 joins (~wei2912@unaffiliated/wei2912) |
| 2020-09-27 02:28:39 | × | mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer) |
| 2020-09-27 02:28:47 | × | machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 240 seconds) |
| 2020-09-27 02:28:47 | × | danso quits (~dan@107-190-41-58.cpe.teksavvy.com) (Read error: Connection reset by peer) |
| 2020-09-27 02:28:49 | → | mu__ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:29:51 | → | danso joins (~dan@107-190-41-58.cpe.teksavvy.com) |
| 2020-09-27 02:31:40 | holo1 | is now known as Faye |
| 2020-09-27 02:32:43 | × | cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Quit: leaving) |
| 2020-09-27 02:34:12 | × | nbloomf quits (~nbloomf@2600:1700:83e0:1f40:cc55:612b:5adc:f6f1) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-09-27 02:34:20 | → | xerox_ joins (~xerox@unaffiliated/xerox) |
| 2020-09-27 02:35:15 | → | thir joins (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de) |
| 2020-09-27 02:37:45 | × | elliott_ quits (~elliott@pool-100-36-54-163.washdc.fios.verizon.net) (Ping timeout: 258 seconds) |
| 2020-09-27 02:38:19 | → | elliott_ joins (~elliott_@pool-100-36-54-163.washdc.fios.verizon.net) |
| 2020-09-27 02:38:20 | × | mu__ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer) |
| 2020-09-27 02:38:48 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:40:15 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-09-27 02:40:19 | × | thir quits (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
| 2020-09-27 02:42:11 | × | _xor quits (~xor@74.215.46.133) (Ping timeout: 240 seconds) |
| 2020-09-27 02:42:56 | → | elliott__ joins (~elliott@pool-100-36-54-163.washdc.fios.verizon.net) |
| 2020-09-27 02:44:07 | × | Achylles quits (~Achylles@200-161-190-140.dsl.telesp.net.br) (Ping timeout: 240 seconds) |
| 2020-09-27 02:48:17 | × | mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer) |
| 2020-09-27 02:48:56 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-27 02:49:08 | <p0a> | For example I am trying to use `sum' |
| 2020-09-27 02:49:24 | <p0a> | but it is defined in Numeric.Matrix. But that is a hidden module? |
| 2020-09-27 02:49:57 | hackage | mtsl 0.1.0.0 - Reified monad transformer stacks https://hackage.haskell.org/package/mtsl-0.1.0.0 (sgschlesinger) |
All times are in UTC.