Logs: liberachat/#haskell
| 2021-08-20 08:03:40 | ubert1 | is now known as ubert |
| 2021-08-20 08:04:02 | × | bebenon quits (~bebenon@5.44.169.233) (Client Quit) |
| 2021-08-20 08:04:15 | <kuribas> | c_wraith: ah right, thanks! |
| 2021-08-20 08:04:16 | × | econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity) |
| 2021-08-20 08:04:28 | → | jumper149 joins (~jumper149@80.240.31.34) |
| 2021-08-20 08:04:37 | <kuribas> | c_wraith: btw, this is Optics... |
| 2021-08-20 08:05:03 | × | tzh quits (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz) |
| 2021-08-20 08:05:07 | <c_wraith> | can't tell by the code you provided, which is the same with either |
| 2021-08-20 08:05:25 | <kuribas> | yeah, it's the same problem |
| 2021-08-20 08:05:36 | → | hendursa1 joins (~weechat@user/hendursaga) |
| 2021-08-20 08:05:49 | <kuribas> | Using two set is probably better anyway, but I wanted to know why it failed. |
| 2021-08-20 08:06:53 | → | trcc joins (~trcc@users-5343.st.net.au.dk) |
| 2021-08-20 08:08:03 | × | hendursaga quits (~weechat@user/hendursaga) (Ping timeout: 244 seconds) |
| 2021-08-20 08:08:04 | × | Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 252 seconds) |
| 2021-08-20 08:08:04 | <kuribas> | It seems rather easy to go from lenses to optics. |
| 2021-08-20 08:08:28 | → | polyphem joins (~polyphem@2a02:810d:640:776c:bd0c:a594:ef4e:c3f3) |
| 2021-08-20 08:08:31 | <kuribas> | Optics seem cleaner, especially when using labels. |
| 2021-08-20 08:08:32 | → | mc47 joins (~mc47@xmonad/TheMC47) |
| 2021-08-20 08:08:42 | → | gentauro_ joins (~gentauro@185.107.12.141) |
| 2021-08-20 08:09:04 | × | gentauro_ quits (~gentauro@185.107.12.141) (Client Quit) |
| 2021-08-20 08:09:24 | → | gentauro_ joins (~gentauro@185.107.12.141) |
| 2021-08-20 08:09:24 | × | gentauro_ quits (~gentauro@185.107.12.141) (Client Quit) |
| 2021-08-20 08:12:09 | × | hnOsmium0001 quits (uid453710@id-453710.stonehaven.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-08-20 08:14:07 | → | vpan joins (~vilius@212.117.1.172) |
| 2021-08-20 08:17:39 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b))) |
| 2021-08-20 08:17:39 | → | allbery_b joins (~geekosaur@xmonad/geekosaur) |
| 2021-08-20 08:17:42 | allbery_b | is now known as geekosaur |
| 2021-08-20 08:22:45 | → | dunj3 joins (~dunj3@2001:16b8:30a8:2000:7c3b:4a4d:e83e:847a) |
| 2021-08-20 08:26:57 | × | aman quits (~aman@user/aman) (Ping timeout: 258 seconds) |
| 2021-08-20 08:26:57 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-08-20 08:27:24 | → | aman joins (aman@user/aman) |
| 2021-08-20 08:27:50 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 2021-08-20 08:27:58 | → | nschoe joins (~quassel@2a01:e0a:8e:a190:1cfd:5590:1382:edd9) |
| 2021-08-20 08:33:45 | → | burnside_ joins (~burnsides@client-8-91.eduroam.oxuni.org.uk) |
| 2021-08-20 08:34:22 | × | burnside_ quits (~burnsides@client-8-91.eduroam.oxuni.org.uk) (Remote host closed the connection) |
| 2021-08-20 08:34:48 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Read error: Connection reset by peer) |
| 2021-08-20 08:35:00 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-20 08:36:46 | × | tput quits (~tim@S0106a84e3fe54613.ed.shawcable.net) (Remote host closed the connection) |
| 2021-08-20 08:37:11 | → | tput joins (~tim@S0106a84e3fe54613.ed.shawcable.net) |
| 2021-08-20 08:38:42 | × | vicfred quits (~vicfred@user/vicfred) (Quit: Leaving) |
| 2021-08-20 08:40:57 | → | Obo joins (~roberto@h-46-59-103-134.a498.priv.bahnhof.se) |
| 2021-08-20 08:50:10 | × | tomboy64 quits (~tomboy64@user/tomboy64) (Ping timeout: 240 seconds) |
| 2021-08-20 08:57:27 | × | zaquest quits (~notzaques@5.128.210.178) (Remote host closed the connection) |
| 2021-08-20 08:59:12 | × | trcc quits (~trcc@users-5343.st.net.au.dk) (Ping timeout: 245 seconds) |
| 2021-08-20 09:02:31 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds) |
| 2021-08-20 09:05:37 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 248 seconds) |
| 2021-08-20 09:06:07 | → | tomboy64 joins (~tomboy64@user/tomboy64) |
| 2021-08-20 09:06:57 | → | Guest610 joins (~Guest6@115.98.232.12) |
| 2021-08-20 09:07:20 | <Guest610> | hi .. I am a newbie to haskell.. just started with LYAH |
| 2021-08-20 09:07:33 | <[exa]> | hi, welcome! |
| 2021-08-20 09:08:25 | <Guest610> | Is this the right forum for a beginner to ask questions on haskell ? |
| 2021-08-20 09:08:35 | <[exa]> | yes |
| 2021-08-20 09:09:30 | <[exa]> | if there's a lot of traffic here with categories thrown all around the place (currently not the case as you see), there is a dedicated beginner channel, but I guess it's always better to ask here |
| 2021-08-20 09:09:44 | <Guest610> | thanks |
| 2021-08-20 09:09:59 | × | betelgeuse quits (~betelgeus@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-08-20 09:10:22 | <Guest610> | I have a list of tuples to which i want to merge a list of integers and create a new list |
| 2021-08-20 09:10:50 | <Guest610> | alist = [("a",1,2), ("b",5,6)] blist = [4,8] newList = zip alist blist.. which gives [(("a",1,2),4),(("b",5,6),8)] which does not get the element inside the tuple. |
| 2021-08-20 09:10:51 | → | betelgeuse joins (~betelgeus@94-225-47-8.access.telenet.be) |
| 2021-08-20 09:11:26 | <[exa]> | yeah, `zip` always constructs 2-tuples |
| 2021-08-20 09:11:52 | <Guest610> | how do i get the output newlist = [("a",1,2,4), ("b",5,6,8)] |
| 2021-08-20 09:11:57 | <[exa]> | there might be a function for "flattening" the tuples, but I think you might be better off just making it manually |
| 2021-08-20 09:12:24 | <Guest610> | well i have reached only chap 5.. |
| 2021-08-20 09:12:35 | <Guest610> | are there some concepts i need to look at |
| 2021-08-20 09:12:39 | <[exa]> | > zipWith (\(a,b,c) d -> (a,b,c,d)) [(1,2,'a'), (2,3,'b')] [5,6] |
| 2021-08-20 09:12:40 | <lambdabot> | [(1,2,'a',5),(2,3,'b',6)] |
| 2021-08-20 09:12:43 | <Guest610> | or is there an in build function |
| 2021-08-20 09:13:35 | <[exa]> | does that ^ look fine or should we improve? :] |
| 2021-08-20 09:14:08 | <Guest610> | I am sorry to labour on this.. is zipWith and in built function or part of anylibrary or you have custom developed it.. |
| 2021-08-20 09:14:17 | <Guest610> | i did not get this on hoogle.. |
| 2021-08-20 09:14:39 | <[exa]> | zipWith is a built-in generalization of zip, yes |
| 2021-08-20 09:15:33 | <Guest610> | great.. thanks.. |
| 2021-08-20 09:15:52 | <[exa]> | if you didn't find it on hoogle...taht would be weird, mine is full of zipWiths |
| 2021-08-20 09:17:16 | <Guest610> | sorry my mistake.. the drop down was set to package: |
| 2021-08-20 09:17:27 | <[exa]> | np :] |
| 2021-08-20 09:17:49 | → | mastarija joins (~mastarija@78-3-210-70.adsl.net.t-com.hr) |
| 2021-08-20 09:20:02 | <[exa]> | Guest610: there might be a way to construct that "merging" function from stuff like uncurry3 and curry4 in Data.Tuple.Extra but that might be a bit mindbending exercise at this stage. :] |
| 2021-08-20 09:21:17 | <Guest610> | will jot it down..should come in handy by the time i finish the book.. thanks for your help.. |
| 2021-08-20 09:22:33 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2021-08-20 09:23:37 | → | Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) |
| 2021-08-20 09:26:04 | → | zer0bitz joins (~zer0bitz@dsl-hkibng31-58c384-213.dhcp.inet.fi) |
| 2021-08-20 09:26:38 | <[exa]> | Guest610: seems like it can be really constructed as such: |
| 2021-08-20 09:26:44 | <[exa]> | uncurry3 (curry4 id) :: (a, b, c) -> d -> (a, b, c, d) |
| 2021-08-20 09:27:08 | <[exa]> | which corresponds to |
| 2021-08-20 09:27:36 | <[exa]> | :t \(a,b,c) d -> (a,b,c,d) |
| 2021-08-20 09:27:38 | <lambdabot> | (a, b, c) -> d -> (a, b, c, d) |
| 2021-08-20 09:27:56 | <[exa]> | </unneeded_exercise> |
| 2021-08-20 09:28:05 | <Guest610> | no .. its useful.. |
| 2021-08-20 09:28:15 | <Guest610> | i just have not reached uncurry .. |
| 2021-08-20 09:30:48 | <[exa]> | ah okay, worry not then. curry/uncurry is a way to transform functions that work on tuples to functions that work on curry-style multiple parameters, which kindof helped here: I took a function that does nothing (id), assumed it works with tuples and curried it to work with normal parameters (curry4), and then converted the first 3 params of that to work on tuples again (uncurry3) |
| 2021-08-20 09:31:12 | <[exa]> | simpler example: |
| 2021-08-20 09:31:33 | <[exa]> | > map (uncurry (+)) [(1,2), (5,6)] |
| 2021-08-20 09:31:35 | <lambdabot> | [3,11] |
| 2021-08-20 09:32:13 | <Guest610> | ok.. |
| 2021-08-20 09:32:24 | <Guest610> | so uncurry has the impact of unpacking elements in tuples ?? |
| 2021-08-20 09:32:56 | <[exa]> | not erally impact, but you can use it to convert functions from tuple-ish to parameter-ish (and back) |
| 2021-08-20 09:33:08 | <[exa]> | :t (+) |
| 2021-08-20 09:33:08 | <Guest610> | ok |
| 2021-08-20 09:33:09 | <lambdabot> | Num a => a -> a -> a |
| 2021-08-20 09:33:16 | <[exa]> | :t uncurry (+) |
| 2021-08-20 09:33:17 | <lambdabot> | Num c => (c, c) -> c |
All times are in UTC.