Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 205 206 207 208 209 210 211 212 213 214 215 .. 5022
502,152 events total
2020-09-25 17:28:21 <dsal> You can define different expressions for functions based on the value of their arguments, for example.
2020-09-25 17:28:32 <ski> @src length
2020-09-25 17:28:32 <lambdabot> Source not found. Where did you learn to type?
2020-09-25 17:28:41 <ski> hmpf
2020-09-25 17:28:48 <ski> length :: [a] -> Int
2020-09-25 17:28:52 <ski> length [ ] = 0
2020-09-25 17:29:00 <ski> length (x:xs) = 1 + length xs
2020-09-25 17:29:10 × cosimone quits (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) (Quit: Quit.)
2020-09-25 17:29:24 <ski> is the traditional way to define the length of a (single-linked) list
2020-09-25 17:29:47 <ski> `x:xs' there is like a "dotted pair/cons", in the Lisp world. and `[]' is the empty list
2020-09-25 17:30:04 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2020-09-25 17:30:21 <fluturel> ah, i see, so it's recursion
2020-09-25 17:30:24 <ski> so, `length' is defined via "two definitions" (two defining equations), each handling one of the two possible cases (empty vs. non-empty list)
2020-09-25 17:30:32 <ski> yes
2020-09-25 17:30:35 <dsal> recursion isn't the interesting part of that example, though.
2020-09-25 17:30:38 <fluturel> xs is the remainder of the list and evaluates till xs is empty list
2020-09-25 17:30:52 <fluturel> yeah, no, i got that
2020-09-25 17:31:07 <monochrom> The point is we don't write like "length list = if null list then 0 else 1 + tail list"
2020-09-25 17:31:14 <ski> but you can use this style of definition as well, for your own, user-defined, data types
2020-09-25 17:31:22 <fluturel> And what you said about destructuring-bind being close to this, it does make a lot of sense
2020-09-25 17:31:24 <dsal> > let isThree 3 = True; isThree _ = False in map isThree [1..5]
2020-09-25 17:31:28 <lambdabot> [False,False,True,False,False]
2020-09-25 17:31:44 <ski> s/tail list/length (tail list)/
2020-09-25 17:31:50 <dsal> I have two different definitions of isThree that do different things depending on the value of the argument.
2020-09-25 17:31:56 <albestro[m]> fluturel: I'm studying in parallel both CIS194 2013 and LYAH...for CIS194 I found useful from time to time to compare my solution with the one from the students who attended the course. you can find few of them on github
2020-09-25 17:32:58 <fluturel> albestro[m]: thank you for the suggestion
2020-09-25 17:33:29 Saten-san joins (~Saten-san@ip-62-235-73-121.dsl.scarlet.be)
2020-09-25 17:33:31 <fluturel> albestro[m]: how long have you been studying for?
2020-09-25 17:34:16 <albestro[m]> fluturel: I started during holidays (1 week of spare time) and in the last weeks I had few time to dedicate...but let's say 1 month on the calendar
2020-09-25 17:34:34 <cohn> albestro[m]: beware, some of LYAH is out of date. For example no coverage of Semigroups
2020-09-25 17:34:42 <cohn> other than that, great resource
2020-09-25 17:35:02 <albestro[m]> cohn: thanks! it's absolutely worth knowing.
2020-09-25 17:35:47 <albestro[m]> also about CIS194, I preferred the 2013 version because it feels like it is more dedicated to the "low-level'
2020-09-25 17:36:12 <albestro[m]> compared to the newer one that it seems like they are trying to be "more interesting" with visual things
2020-09-25 17:36:26 cohn shrugs
2020-09-25 17:36:43 <cohn> I don't know enough to have an opinion either way. : )
2020-09-25 17:37:05 <sm[m]> fluturel, also good:
2020-09-25 17:37:05 <sm[m]> @where HTAC
2020-09-25 17:37:05 <lambdabot> "Haskell Tutorial and Cookbook" by Mark Watson in 2017-09-04 at <https://leanpub.com/haskell-cookbook>
2020-09-25 17:37:12 ski grins
2020-09-25 17:37:23 × mu quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-25 17:37:42 <sm[m]> ski, you saw that coming ? :)
2020-09-25 17:37:53 mu joins (~mu@unaffiliated/mu)
2020-09-25 17:37:55 <ski> was briefly thinking about it
2020-09-25 17:38:10 <fluturel> sm[m]: i found it during my searches, but thank you, will be in my priority list
2020-09-25 17:38:37 <ski> fluturel : at some point, you may find yourself wanting a textbook
2020-09-25 17:38:55 <fluturel> i should have taken haskell up while in lockdown..
2020-09-25 17:39:20 <sm[m]> that guy is not paying me, I promise. I just think it's among the best for many folk, and still mysteriously unknown, so I am duty bound to mention it
2020-09-25 17:40:54 <dsal> fluturel: Everything I've ever learned felt like I learned it too late.
2020-09-25 17:41:27 brandstifter joins (~brandstif@62-46-52-151.adsl.highway.telekom.at)
2020-09-25 17:42:02 <fluturel> dsal: I know exactly what you mean. If only i learned more when i had loads of free time..
2020-09-25 17:43:28 <sm[m]> no time like the present
2020-09-25 17:44:26 <fluturel> i have another question: what can you do with haskell these days? Is it just a niche programming language?
2020-09-25 17:44:43 <dsal> fluturel: Here's a project I did recently: http://dustin.sallings.org/2020/04/29/gopro-plus.html
2020-09-25 17:44:50 <dsal> I fail to write up most of the things I do. *sigh*
2020-09-25 17:44:53 <sm[m]> ha, leading question there
2020-09-25 17:46:21 × bitmagie quits (~Thunderbi@200116b8065d560030e19c72082b8700.dip.versatel-1u1.de) (Quit: bitmagie)
2020-09-25 17:46:22 DTZUZU joins (~DTZUZU@S0106bcd165662a4d.vs.shawcable.net)
2020-09-25 17:46:24 <fluturel> sm[m]: sorry if it is, should have phrased it a little bit differently
2020-09-25 17:46:36 <dsal> I sat down to do some "hard" work on that project a couple of nights ago -- resuming partial uploads that failed exactly at the wrong moment where all the bits have been updated but the media wasn't marked completed on GoPro's side. Turns out, it was just a couple lines of code to cover that case. :(
2020-09-25 17:46:40 snakemasterflex joins (~snakemast@213.100.206.23)
2020-09-25 17:46:55 <monochrom> It would be easier to enumerate just the handful of things Haskell is impractical for.
2020-09-25 17:47:01 × DTZUZU_ quits (~DTZUZU@205.ip-149-56-132.net) (Ping timeout: 264 seconds)
2020-09-25 17:47:14 <dsal> fluturel: Nah, Haskell has a reputation of being a weird experimental language for academics. In practice, it's the easiest language I use and the first thing I reach for when I'm doing general computering.
2020-09-25 17:47:16 <sm[m]> fluturel: anything that doesn't require zero GC pauses, or cheap developers, or running on mobile
2020-09-25 17:47:34 × mu quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-25 17:47:54 mu joins (~mu@unaffiliated/mu)
2020-09-25 17:47:58 <dsal> "running on mobile" is a little unfortunate. Some of my programs are running on tiny ARM computers.
2020-09-25 17:48:13 × brandstifter quits (~brandstif@62-46-52-151.adsl.highway.telekom.at) ()
2020-09-25 17:48:23 <sm[m]> cool, I should say "running on phones" maybe
2020-09-25 17:48:26 <nshepperd> haskell is a programming language so easy, even academics can use it!
2020-09-25 17:48:29 <monochrom> And even those divide into fundamentally impractical vs for-now impractical.
2020-09-25 17:49:13 × DataComputist quits (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net) (Remote host closed the connection)
2020-09-25 17:49:48 <dsal> Yeah, it's more about outward requirements. If something has to be written using particular APIs that aren't accessible, then it's not exactly a "Haskell" problem as much as "you're not using the exact language allowed to work with this platform" problem.
2020-09-25 17:50:06 <fluturel> i thought i read something a few years ago about a company that was making games in haskell for mobile. Can't remember the name though
2020-09-25 17:50:16 <sm[m]> Keera, they stopped
2020-09-25 17:50:45 <sm[m]> as far as I know, at least
2020-09-25 17:51:24 <sm[m]> so yes it is possible to run haskell somehow on phones, but I'd say it's impractical except for the very highly motivated
2020-09-25 17:51:32 × crobbins quits (~crobbins@2601:2c1:380:ec40:2d4a:f96c:b859:c0ae) (Remote host closed the connection)
2020-09-25 17:51:34 <sm[m]> for now
2020-09-25 17:52:00 <dsal> fluturel: A better way to think about this is to think about the types of programs you're interested in writing and whether it'll help you with that.
2020-09-25 17:52:09 crobbins joins (~crobbins@2601:2c1:380:ec40:cf6:f95e:2b94:e5c5)
2020-09-25 17:52:22 <geekosaur> and it's not so much that Haskell doesn't work well, as GHC doesn't work well — but for now at least GHC is the only real option
2020-09-25 17:52:28 <geekosaur> (I miss jhc still)
2020-09-25 17:52:35 <fluturel> i was thinking about trying to do a back-end or something in haskell
2020-09-25 17:52:57 <dsal> Most of my programs are IoT or general commandline utilities or monitoring, stats, etc... And my GoPro junk. And various data processing things. All of that stuff is easy.
2020-09-25 17:53:25 <dolio> I don't know. Nothing ever worked as well as GHC anyway for most stuff.
2020-09-25 17:53:48 <dsal> Damn you GHC. Stop making everything else look bad.
2020-09-25 17:54:19 <monochrom> @quote monochrom downloaded.GHC
2020-09-25 17:54:20 <lambdabot> monochrom says: I was trying to design a sensible language... then I downloaded ghc.
2020-09-25 17:54:25 × dhouthoo quits (~dhouthoo@ptr-eiv6509pb4ifhdr9lsd.18120a2.ip6.access.telenet.be) (Quit: WeeChat 2.8)
2020-09-25 17:54:25 <geekosaur> hugs worked pretty well back in the day. but ghc has been alone for so long that other implementations now have to catch up to it as well as implementing standard Haskell :(
2020-09-25 17:54:37 <sm[m]> but of course GHC makes a lot of other stuff look really good
2020-09-25 17:54:39 <dsal> The GHC language is kind of big.
2020-09-25 17:54:57 <dsal> Heh, yeah. I didn't mean to imply GHC is great at all the things. It's a frustrating part of some of mydays.
2020-09-25 17:54:57 <dolio> Hugs worked, but the stuff people used it for wasn't building applications that GHC is unsuitable for.
2020-09-25 17:55:04 <dolio> To my knowledge.
2020-09-25 17:55:21 <monochrom> Actually I think I started with hugs back then, and added GHC later.
2020-09-25 17:55:22 × oisdk quits (~oisdk@2001:bb6:3329:d100:fd58:7633:8b1d:97) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-09-25 17:55:43 <geekosaur> people have at least tried to resuscitate it for use on limited memory platforms iirc

All times are in UTC.