<    April 2017    >
Su Mo Tu We Th Fr Sa  
                   1  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
30
00:00 <Cale> (i.e. the type of the result of (.))
00:01 <Cale> Personally, I wouldn't usually think so hard about how the type of (.) unifies with stuff, because I would think of (fmap . fmap) as being equivalent to (\x -> fmap (fmap x))
00:01 <Cale> and then just notice that if x :: a -> b, then the one fmap is going to make it f a -> f b, and then the second fmap will make it f1 (f a) -> f1 (f b)
00:03 <Cale> :t fmap fmap fmap -- we can also make use of the fact that (.) is fmap for f t = e -> t
00:03 <lambdabot> (Functor f, Functor f1) => (a -> b) -> f1 (f a) -> f1 (f b)
00:09 shayan_ joined
00:10 binaryplease joined
00:11 rstefanic joined
00:16 <monochrom> I lost my lpaste in which I inferred the type of (.) (.) (.)
00:21 <NoCreativity> Cale: Thank you very much for the explanation!
00:21 <NoCreativity> Cale: it was really helpful!
00:24 <Cale> monochrom: Perhaps ironically, I think it's easier to figure out fmap . fmap and then notice that you can pick the appropriate Functor instances to get (.) . (.)
00:27 <monochrom> Would fmap fmap fmap be even easier? :)
00:28 <monochrom> The other day #haskell.tw asked about fmap fix return and I solved it. This time I bookmarked it: http://lpaste.net/91519
00:29 <monochrom> > fmap fix return "hello"
00:29 <lambdabot> "hello"
00:32 <Cale> monochrom: Well, that's slightly harder because you have to realise which Functor is in use for the first fmap
00:48 <Gurkenglas> monochrom, is unifying the types enough? After all, the resulting (a -> a) could be bottom
00:48 eacameron joined
00:48 <monochrom> This is why I had to test it. :)
00:54 eacameron joined
00:58 eacameron joined
01:03 eacameron joined
01:07 Pupnik joined
01:07 eacamero_ joined
01:10 eacameron joined
01:13 DrMentats left
01:19 eacameron joined
01:21 rstefanic joined
01:21 takle joined
01:25 eacameron joined
01:27 vmeson joined
01:27 peterbec` joined
01:29 Geekingfrog joined
01:30 eacameron joined
01:35 Gurkenglas joined
01:36 eacameron joined
01:39 takle joined
01:40 eacamero_ joined
01:48 eacameron joined
01:52 eacamero_ joined
01:53 shayan_ joined
01:57 rstefanic joined
01:59 takle joined
02:04 eacameron joined
02:05 exferenceBot joined
02:11 hexagoxel joined
02:15 eacameron joined
02:19 eacameron joined
02:20 takle joined
02:25 eacameron joined
02:32 takle joined
02:33 eacameron joined
02:36 eacamero_ joined
02:44 Rodya_ joined
02:47 eacameron joined
02:48 takle joined
02:50 eacameron joined
02:53 geekosaur joined
02:55 eacamero_ joined
02:56 meandi_2 joined
03:01 eacameron joined
03:03 exferenceBot joined
03:06 harfangk joined
03:07 vclaud joined
03:07 vclaud left
03:08 DataComputist joined
03:10 hexagoxel joined
03:12 eacameron joined
03:19 systemfault joined
03:21 systemfault joined
03:23 emmanuel_erc joined
03:24 eacameron joined
03:30 Pupnik_ joined
03:32 eacameron joined
03:36 takle joined
03:39 eacameron joined
03:43 User12313 joined
03:45 takle joined
03:53 rstefanic joined
03:58 takle_ joined
04:06 takle joined
04:36 haskelleksah joined
04:39 haskelleksah joined
04:42 azahi joined
04:46 Rodya_ joined
04:48 systemfault joined
04:49 systemfault joined
05:01 mengu joined
05:10 haskelleksah joined
05:12 takle joined
05:19 takle joined
05:27 galderz joined
05:27 monochrom joined
06:09 eatman_ joined
06:10 haskelleksah joined
06:13 Lokathor_ joined
06:15 takle joined
06:16 Pupnik joined
06:18 yellowj joined
06:22 takle joined
06:28 Sose joined
06:34 eacameron joined
06:44 changsen111 joined
06:45 eacameron joined
06:49 Rodya_ joined
06:50 eacamero_ joined
06:52 zero_byte joined
06:53 mengu joined
06:57 eacameron joined
07:02 thc202 joined
07:04 eacameron joined
07:04 t0by joined
07:07 merijn joined
07:09 shayan_ joined
07:12 slomo joined
07:12 slomo joined
07:12 eacameron joined
07:19 eacameron joined
07:28 cur8or joined
07:30 eacameron joined
07:38 lithie joined
07:40 govg joined
07:46 eacameron joined
07:50 Rodya_ joined
07:53 eacameron joined
07:57 gregman_ joined
07:57 xificurC joined
07:58 takle joined
08:02 eacameron joined
08:09 eacameron joined
08:11 grdryn joined
08:14 colt44 joined
08:15 eacameron joined
08:17 delexi joined
08:21 eacameron joined
08:25 eacamero_ joined
08:26 mattyw joined
08:28 nick_h joined
08:37 Pupnik_ joined
08:40 <xificurC> coming from a lisp background I've read and used tail recursion and saw the usual tricks of making tail recursion "work" by putting 1 or more accumulator arguments to a function to get tail-recursive. Are similar "tricks" necessary in haskell? Does lazy evaluation solve this?
08:41 <merijn> xificurC: Not really necessary in (GHC) Haskell
08:42 <xificurC> from my perspective when rewriting things in lisp to conform to this optimization it puts the burden on me - I have to watch for these cases to avoid stacking and rewrite working solutions so that they get fast
08:42 <merijn> xificurC: The entire point of tail-recursion and tail-call optimisation is to avoid growing the function call stack, right?
08:43 <xificurC> merijn: I guess so, and the code can be optimized to something like an imperative for loop
08:43 <xificurC> (by the (JIT) compiler)
08:43 <merijn> xificurC: Here's the mind-blowing epiphany: (GHC) Haskell doesn't *have* a function call stack :)
08:44 <merijn> xificurC: Depending on your point of view, either no function call is tail-recursive, or all of them are.
08:44 <xificurC> merijn: that's tough to imagine
08:44 <merijn> xificurC: Are you familiar with CPS (Continuation Passing Style)?
08:45 <adarqui> u don't have to worry about tail recursion to protect against stack limit overflows and such, but you still have to worry about the 'perforance of your recursion' .. ie using an accumulator argument and such
08:45 <xificurC> merijn: not really, unless they have something to do with continuations as used in scheme
08:45 <xificurC> adarqui: is there a performance or memory difference?
08:46 <merijn> xificurC: CPS is the idea that every function gets an extra argument which is "the continuation (function) to call after computing the current value"
08:46 <xificurC> s/memory/memory consumption/
08:46 dni- joined
08:46 <xificurC> merijn: ok
08:47 <merijn> xificurC: So, suppose we have "incrementBy1 :: Int -> Int" the CPS version of that would be more like "incrementBy1 :: Int -> (Int -> r) -> r" (so take the number to increment and the function to call with the incremented number)
08:47 <merijn> xificurC: In this style you never "return" to the calling function, you always just call the "next" continuation
08:47 <merijn> xificurC: And if you never return, there's no longer a need for a call stack to remember where to return to :)
08:48 <xificurC> merijn: is this a common low-level optimization? Is it actually faster than the function call stack equivalent?
08:49 <merijn> xificurC: If you have a (basic) familiarity with C or assembly and are curious about this sorta thing, there's an excellent paper on (a way to) compile Haskell to "imperative" CPUs, it doesn't require much Haskell knowledge (just function calls, lambda and pattern matching)
08:49 <merijn> xificurC: It's not really an abstraction, more a "different way to think about evaluation"
08:50 <merijn> https://pdfs.semanticscholar.org/5c70/ed80977204a5b84f1f02764d6c3b5d9b8185.pdf
08:50 <merijn> ^^ that one
08:50 <merijn> gotta run for a meeting now
08:50 <adarqui> i've never even seen that, and i've "seen" (not read/understood) many haskell papers
08:50 <adarqui> how did i miss that
08:50 <adarqui> thanks merijn
08:51 Rodya_ joined
08:51 <xificurC> merijn: thanks
08:53 <xificurC> wish I had time and patience to understand papers like that :)
08:53 <adarqui> i have the time/patience. wish i had the brain power. that paper looks decent though, i think i can understand that one.
08:54 <adarqui> with the extra mathy papers, I get destroy
08:54 <adarqui> with the extra mathy papers, I get destroyed
08:54 <merijn> adarqui: To be fair, most people get destroyed by those :p
08:55 <merijn> The difference between academics and "regular people" is academics are used to perpetual confusion
08:55 <merijn> Also, there is a LARGE number of very readable papers that very useful, but people just assume aren't readable
08:55 <merijn> xificurC: I would recommend having a go with that paper anyway, it's really pretty readable :)
08:56 <Iceland_jack> Most papers by Simon Peyton Jones are a nice read
08:57 <merijn> adarqui: If you want "mathy, but not so much that my brain blows up", there's a neat paper called "A Tutorial on the Universality and Expressiveness of Fold" which shows that *any* recursive function can be rewritten as fold + simple helper
08:57 <adarqui> nice merijn , checking
08:58 <adarqui> merijn: ya i wanted to get really good with category theory and all that stuff, so i can get on that next level.. but it was too stressful. now i'm just trying to code and have fun, and absorb more slowly. ;d
08:59 <adarqui> merijn: http://www.cs.nott.ac.uk/~pszgmh/fold.pdf (just for reference in irc logs)
09:00 <xificurC> merijn: I'll try :)
09:01 <xificurC> coming back to my initial question and expanding on it a bit:
09:01 <Geekingfrog> merijn: does the paper address early termination?
09:01 <xificurC> this is the code where I started thinking : http://lpaste.net/354549
09:02 <xificurC> in e.g. common lisp I'd go and rewrite hailstoneSeq to be tail recursive. The better question - is there any performance or memory benefit to doing the same in haskell?
09:04 merijn joined
09:13 gregman_ left
09:14 takle joined
09:31 eacameron joined
09:37 eacameron joined
09:47 eacameron joined
09:51 Rodya_ joined
09:58 mixandgo joined
10:02 Gurkenglas joined
10:16 binaryplease joined
10:19 shayan_ joined
10:35 dni- joined
10:36 Pupnik joined
10:37 galderz joined
10:37 netheranthem joined
10:39 Gloomy joined
10:49 mengu joined
10:51 galderz joined
11:04 Iceland_jack joined
11:23 pbrant joined
11:41 cur8or joined
11:52 Boarders joined
11:53 andrewhn joined
11:54 eacameron joined
11:56 acarrico joined
12:00 eacameron joined
12:05 Gloomy joined
12:15 eacameron joined
12:16 ederign joined
12:17 marvin3 joined
12:22 eacameron joined
12:24 dni- joined
12:28 GreySunshine joined
12:45 madjestic joined
12:51 merijn joined
12:53 Rodya_ joined
12:58 GreySunshine joined
13:04 azahi joined
13:05 takle joined
13:08 dni- joined
13:12 iAmerikan joined
13:17 GreySunshine joined
13:23 mattyw joined
13:31 bunicuEnCeruri joined
13:31 <bunicuEnCeruri> hi
13:33 <bunicuEnCeruri> guys, how do we call a function who is parameter to a data constructor? smth like `Just id` or `Just (+)`
13:33 <GreySunshine> Hello! I am trying to generate my blog with Hakyll and I'm trying to create a template by substituting values into another template. My code is here (http://lpaste.net/354556), my template is here (http://lpaste.net/354554) and this is the error that I get (http://lpaste.net/354555). What am I doing wrong?
13:34 <merijn> bunicuEnCeruri: I don't think that has a name?
13:34 <bunicuEnCeruri> i mean i know `Just id` isnt `id`
13:35 delexi joined
13:36 chlong joined
13:37 mizu_no_oto_work joined
13:37 <hexagoxel> bunicuEnCeruri: the data constructor is Applicative or at least Functor, right?
13:38 <merijn> bunicuEnCeruri: "Just id" is "just" (ha!) "Maybe with a function inside
13:39 <hexagoxel> "call" is ambiguous in the question :D
13:39 <bunicuEnCeruri> is there any reason why pure method is named 'pure'?
13:40 <Ferdirand> because it constructs an applicative-wrapped value from a pure value, maybe ?
13:41 mattyw joined
13:45 RoyalNightGuard joined
13:46 eacameron joined
13:50 <bunicuEnCeruri> thanks, guys
13:52 mattyw joined
13:54 Rodya_ joined
13:57 mengu joined
14:00 circ-user-YJwe5 joined
14:10 ederign_ joined
14:13 harfangk joined
14:22 delexi1 joined
14:27 eatman joined
14:38 mojjo joined
14:47 mattyw joined
14:54 martingale joined
14:54 govg joined
14:55 Rodya_ joined
15:03 kipd_ joined
15:03 seanparsons_ joined
15:04 staffehn_ joined
15:04 isacloud_ joined
15:04 w4and0er96__ joined
15:04 stux|RC joined
15:05 ajmccluskey_ joined
15:06 chindy_ joined
15:06 sistvan_ joined
15:06 tuturto_ joined
15:06 adarqui_ joined
15:06 c0smo joined
15:07 nkpart_ joined
15:09 ajcoppa joined
15:09 sns joined
15:09 lukky513_ joined
15:09 mimi_vx_ joined
15:09 Sornaensis_ joined
15:09 benzrf_ joined
15:09 Jello_Raptor_ joined
15:10 machuga_ joined
15:11 gothos joined
15:11 Elsi joined
15:12 marmalod1 joined
15:12 CARAM__ joined
15:14 circ-user-YJwe5 joined
15:14 merijn joined
15:15 contiver joined
15:19 zgrepc joined
15:20 nacon joined
15:20 nacon joined
15:22 RoyalNightGuard joined
15:22 Gurkenglas joined
15:23 RoyalNightGuard joined
15:28 abhiroop joined
15:28 <abhiroop> Anybody has experience working with text formatting libraries?
15:29 Uniaika joined
15:30 exferenceBot joined
15:31 <bitemyapp> abhiroop: don't ask for a person, ask a question.
15:31 <abhiroop> Sorry
15:32 <abhiroop> Looking for something simple like "Hello %d %s" 1 "World"
15:32 <abhiroop> I was looking at https://hackage.haskell.org/package/text-format
15:32 <abhiroop> Didn't find any examples
15:33 <glguy> > printf "Hello %d %s" 1 "World" :: String
15:33 <lambdabot> "Hello 1 World"
15:33 LiaoTao joined
15:34 <abhiroop> Does printf work with Text?
15:35 <abhiroop> lokking for Data.Text formatting
15:38 <Iceland_jack> abhiroop: If you want Text and a type-safe formatter you can use "formatting"
15:38 <glguy> ?hackage formatting
15:38 <lambdabot> http://hackage.haskell.org/package/formatting
15:39 <GreySunshine> Guys, here is a dog picture (https://i.redd.it/1a4vjeg90cry.jpg), please tell me what I should be doing. If its seems very obvious please tell me because I a little new to Haskell.
15:42 <bitemyapp> is...that a coyote-dog?
15:43 <bitemyapp> GreySunshine: I do not use runghc when using Hakyll.
15:43 <bitemyapp> let me link my thing
15:43 <bitemyapp> https://github.com/bitemyapp/teef/blob/master/Makefile
15:46 <GreySunshine> bitemyapp: I don't use runghc either, here is my Makefile(https://gitlab.com/vasanthaganeshk/hustlr-in/blob/master/Makefile). I was trying to produce a minimal example of where my code was failing.
15:46 <bitemyapp> GreySunshine: use my Makefile as a guideline
15:48 Rodya_ joined
15:58 jmiven joined
15:59 jmiven joined
16:00 circ-user-YJwe5 joined
16:01 grdryn joined
16:04 Myrl-saki joined
16:05 <Myrl-saki> mathu: You're here omg
16:07 math493 joined
16:07 <math493> Hi :)
16:07 <Myrl-saki> Yoh
16:07 <Myrl-saki> So
16:08 <math493> [18:02] <+Myrl-saki> math493: f [1,2,3,4,5] [5,4,3,2,1] = [3]
16:08 <math493> This is where we came from :)
16:09 <Myrl-saki> http://ideone.com/JFYmE9
16:10 <Myrl-saki> math493: This is actually very minor.
16:10 <Myrl-saki> math493: I'm just talking about how using x or y doesn't matter.
16:10 <Myrl-saki> math493: but it's fairly standard to use the first-defined rather than the second.
16:11 <math493> Myrl-saki: Yeah, makes sense.
16:11 <math493> What's the line keepDuplicates _ _ = [] for, if I may ask?
16:11 <Myrl-saki> math493: _ _ means "we don't care about the argument"
16:11 <Myrl-saki> math493: And interestingly, if the first 2 lines don't match, turns out that we have to return []
16:12 <Myrl-saki> math493: There are 2 (or 3) cases where that is true
16:12 <Myrl-saki> math493: That is `keepDuplicates xs []`, `keepDuplicates [] ys` and `keepDuplicates [] []`, the 3rd is captured by others.
16:13 <math493> Hm, now I just used the console rather than loading the file, but should that matter? I'm wondering why it returns [] in the console.
16:13 <math493> Just removed line break.
16:13 <math493> keepDuplicates (x:xs) (y:ys) | x == y = x : keepDuplicates xs ys | otherwise = keepDuplicates xs ys
16:13 <math493> No errors.
16:13 <math493> Just returning [], not [3]
16:13 <Myrl-saki> math493: Screenshot?
16:13 <Myrl-saki> Oh
16:13 <Myrl-saki> math493: No need
16:14 <math493> Myrl-saki: OK :)
16:14 <Myrl-saki> math493: You also inserted `keepDuplicates _ _ = []`
16:14 <math493> Yes?
16:14 <math493> Shouldn't I?
16:14 <Myrl-saki> math493: You redefined keepDuplicates to always return []
16:14 <math493> Oh. And I don't do that, if I load it into a file?
16:14 <math493> *load it from a file
16:14 <Myrl-saki> math493: In this case, you have to do `keepDuplicates (x:xs) (y:ys) | x == y = x : keepDuplicates xs ys | otherwise = keepDuplicates xs y; keepDuplicates _ _ = []`
16:14 <Myrl-saki> math493: And yeah.
16:15 <math493> Oh :)
16:15 <math493> Eh, that gives me error, but maybe I'll just need to load from a file then :D
16:15 <Myrl-saki> math493: keepDuplicates xs ys*
16:15 <math493> Oh :D
16:15 <Myrl-saki> I accidentally removed the s before the ;
16:15 <math493> That's why
16:16 <math493> Then it works
16:16 <Myrl-saki> :D
16:16 <math493> But there could be cases, which are not matched by the first two lines?
16:17 Rodya_ joined
16:17 <Myrl-saki> math493: Yeah, `keepDuplicates xs []`, `keepDuplicates [] ys` and `keepDuplicates [] []`, the 3rd is matched by the first 2 though.
16:18 <math493> Ah, I see :)
16:18 <marvin3> -fwarn-incomplete-patterns is useful to catch if your pattern matching missed something
16:18 <math493> :)
16:18 <math493> Myrl-saki: Is this some kind of recursion again?
16:19 <Myrl-saki> math493: Yep.
16:19 <Myrl-saki> math493: We're calling keepDuplicates again.
16:19 <math493> So in the first line, the equality case...
16:19 <math493> We have x : keepDuplicates xs ys
16:19 <math493> Where keepDuplicates is a recursive call.
16:19 <Myrl-saki> Mhm
16:19 <math493> Basically meaning "doing the same again"
16:20 <math493> For the remaining elements.
16:20 <math493> In both.
16:20 <math493> xs and ys are the arguments provided.
16:20 <math493> To keepDuplicates?
16:20 <Myrl-saki> Yep
16:20 <math493> And otherwise, if they are different, we don't add the element :D
16:21 <math493> To the result.
16:21 <Myrl-saki> Mhm.
16:21 <math493> Very nice example!
16:21 <math493> Now, if we go back to http://ideone.com/cQpY9s
16:22 <Myrl-saki> Okay.
16:22 <math493> What was the magic thing in the equality case then? Is this related?
16:22 mattyw joined
16:23 <Myrl-saki> math493: Ish. I just wanted to emphasize that x could be substituted for y there.
16:23 <Myrl-saki> math493: Because x == y
16:23 <math493> Myrl-saki: Sure :)
16:23 <math493> I see.
16:23 <math493> But we are using ys rather than yss, right?
16:23 <Myrl-saki> Mhm.
16:24 <Myrl-saki> ys is yss without the y.
16:24 <math493> And yss is "everything"?
16:24 <Myrl-saki> math493: Everything that is passed to it.
16:26 <math493> Myrl-saki: Would it be easy to go through this with some numbers? If we consider a specific input and "run it by hand"?
16:26 <Myrl-saki> math493: Sure.
16:26 Deide joined
16:27 <math493> I think that would make me understand it better :)
16:27 <Myrl-saki> math493: Let's start with [1,3] +++ [2,4]
16:27 <Myrl-saki> math493: Please note that pyon's definition is incomplete, and I'll fill it up as we go.
16:27 <Myrl-saki> (and by extension, mine is incomplete, since it's a direct translation.)
16:27 <math493> pyon's definition of what? :)
16:27 <Myrl-saki> math493: +++
16:27 <math493> OK :)
16:28 <Myrl-saki> definition -> his code
16:28 <math493> Yeah.
16:28 <Myrl-saki> math493: [1,3] +++ [2,4]
16:28 <math493> Yes.
16:28 <Myrl-saki> in this case, 1 is less than 2.
16:28 <Myrl-saki> Errr
16:28 <Myrl-saki> Let me change it.
16:28 <math493> :D
16:28 <Myrl-saki> [1,2,3] +++ [2,4]
16:28 <Myrl-saki> 1 is less than 2.
16:28 dni-_ joined
16:29 <Myrl-saki> So we take the first choice
16:29 <math493> Yes, case 1 :)
16:29 <Myrl-saki> And we get `1 : [2, 3] ++ [2, 4]` correct?
16:29 <math493> Yes :)
16:29 <Myrl-saki> Next
16:29 <Myrl-saki> 2 == 2
16:29 <Myrl-saki> Sooo?
16:29 <math493> Case 2 :D
16:29 <math493> So...
16:30 sujeet` joined
16:30 <Myrl-saki> 1 : 2 : [3] +++ [4]
16:30 <math493> I see :)
16:30 <Myrl-saki> We then get 1 : 2 : 3 : [] +++ [4]
16:30 <Myrl-saki> And now, this is where our definition is incomplete.
16:30 <Myrl-saki> We have nothing to compare [4] with.
16:31 <Myrl-saki> This is where adding a `_ +++ ys = ys` would be useful.
16:31 adjesticm joined
16:31 Youmu_ joined
16:31 ajmccluskey_ joined
16:31 <Myrl-saki> Or rather, `[] +++ ys = ys`
16:31 staffehn joined
16:31 isacloud_ joined
16:31 <math493> Myrl-saki: Where would we add this? :)
16:31 vin-ivar_ joined
16:31 saidinwot1 joined
16:31 <Myrl-saki> math493: When you use _, it should be strictly after the past defintions.
16:32 <Myrl-saki> math493: When you use [], it can be anywhere around the past definitions.
16:32 m1dnight_ joined
16:32 kori_ joined
16:32 zero_byte joined
16:32 <math493> Myrl-saki: I see, that's clever :)
16:32 bydo joined
16:32 CuriousErnestBro joined
16:32 <math493> So it could be added in... line 4?
16:33 <Myrl-saki> Mhm.
16:33 <Myrl-saki> math493: So we have `1 : 2 : 3 : [4]` as a final thing.
16:33 <Myrl-saki> math493: And pretty-print that, we get [1,2,3,4]
16:33 blissdev joined
16:33 <math493> Yeah, : is just binding them together, right?
16:34 <Myrl-saki> Mhm.
16:34 Geekingfrog joined
16:35 abhiroop joined
16:35 <math493> Hm, shouldn't I be able to run [1, 2] +++ [2, 4] in the console after defining it? I didn't yet extend the definition, so I chose an example with the same length for both.
16:36 <math493> [1,2Prelude> *** Exception: <interactive>:101:1-113: Non-exhaustive patterns in function +++
16:36 <Myrl-saki> math493: You get a `[] ++ [4]`
16:36 <Myrl-saki> +++ *
16:37 <math493> Oh... so I'll try to extend it as you suggested.
16:37 <Myrl-saki> math493: Mhm.
16:37 <Myrl-saki> math493: For completion
16:37 lithie joined
16:37 <Myrl-saki> math493: `[] +++ ys = ys` and `xs +++ [] = xs` both have to be added.
16:38 <math493> Myrl-saki: Can I do it in the console or do I need to load it from a file? I'm not sure if I will get the same problem as before?
16:38 <math493> Like overwriting the definition?
16:39 <Myrl-saki> math493: If you want to do it from the console, you'll have to use the semicolon.
16:39 kipd joined
16:39 <math493> Oh, then it works :)
16:40 <math493> Prelude> [1, 2] +++ [2, 4]
16:40 <math493> [1,2,4]
16:40 <Myrl-saki> :D
16:41 malaclyps joined
16:41 baweaver left
16:41 <math493> That's nice! :)
16:42 <math493> Maybe I can come up with an example going into all three cases, which I can try to run by hand again...
16:43 <Myrl-saki> math493: A little note. The lists have to be sorted from the start.
16:43 <math493> Myrl-saki: Oh, that's a requirement? Otherwise it won't work?
16:43 <Myrl-saki> mhm
16:43 <math493> What makes sure it's sorted in the Hamming program?
16:44 <Myrl-saki> math493: 3*x is a number bigger than x.
16:44 <math493> Myrl-saki: Oh, I see :)
16:45 <math493> A good example would probably be [2, 3, 4] and [1, 3, 5], right?
16:45 <math493> Here we come into all three cases.
16:46 <Myrl-saki> math493: Yep.
16:46 <math493> 2 > 1, 3 = 3, 4 < 5
16:47 <math493> So... first case 3.
16:47 <math493> y : xxs +++ ys
16:47 <math493> That would be...
16:47 mwilly joined
16:48 <math493> 1 : [2, 3, 4] +++ [3, 4]
16:48 <math493> Right?
16:48 <math493> Sorry.
16:48 <math493> [3, 5]
16:48 <Myrl-saki> Hmm
16:48 <math493> Well... no.
16:48 <Myrl-saki> That's correct.
16:49 <math493> Oh :D
16:49 <math493> Yeah.
16:49 <math493> I just confused myself.
16:49 <math493> 1 : [2, 3, 4] +++ [3, 5]
16:49 <math493> That must be OK.
16:49 <math493> Then case 2.
16:49 <math493> x : xs +++ ys
16:49 <math493> That would be...
16:50 <math493> Hm, did I update my lists now?
16:51 <math493> Are the new inputs [1, 2, 3, 4] and [3, 5]?
16:52 <math493> If so, it would be 1 : [2, 3, 4] +++ 5?
16:52 <Myrl-saki> So
16:52 <Myrl-saki> Nope
16:52 <math493> Ah, too bad - haha.
16:52 <Myrl-saki> Hmm
16:52 <Myrl-saki> Think of it as
16:52 <Myrl-saki> 1 : ([2,3,4] +++ [3,5])
16:53 <Myrl-saki> We don't care about the 1: anymore
16:53 <Myrl-saki> We're calculating something else now.
16:53 <math493> Oh, so the new inputs are [2, 3, 4] and [3, 5]
16:53 <Myrl-saki> Now, compare 2 and 3. That's case 1, right?
16:53 <math493> Yes.
16:53 <math493> x : xs +++ yys
16:53 <Myrl-saki> So we have `1 : (2 : ([3,4] ++ [3,5]))` continue.
16:53 <math493> So 2 : [3, 4] +++ [3, 5]
16:54 <Myrl-saki> Mhm.
16:54 <math493> I see :)
16:54 <math493> Now we do [3,4] ++ [3,5]. And we have equality.
16:54 <math493> So case 2.
16:54 haskelleksah joined
16:54 <math493> x : xs +++ ys
16:54 <math493> 3 : 4 +++ 5?
16:55 <Myrl-saki> [4] +++ [5]
16:55 <math493> 1 : (2 : (3 : 4 +++ 5))
16:55 <math493> Right?
16:55 <math493> Maybe I should add brackets :)
16:55 <Myrl-saki> 1 : (2 : (3 : ([4] ++ [5])))
16:55 <math493> 1 : (2 : (3 : ([4] +++ [5])))
16:55 <math493> Yeah.
16:55 <Myrl-saki> Mhm.
16:56 <math493> And then we have case 1 again?
16:56 <Myrl-saki> Yep.
16:56 <math493> x : xs +++ yys
16:56 <math493> 4 : [5] +++ []?
16:56 <math493> I guess?
16:56 <Myrl-saki> Why did [5] move locations? :P
16:57 <math493> Sorry :D
16:57 <math493> 4 : [] +++ [5]?
16:57 <Myrl-saki> Mhm.
16:57 <math493> And [] +++ [5] is just [5]?
16:57 <Myrl-saki> Yep.
16:58 <math493> So I had
16:58 <math493> 1 : (2 : (3 : (4 +++ ([] +++ [5]))))
16:58 <math493> And now obtain
16:58 <math493> 1 : (2 : (3 : (4 : [5])))
16:58 <math493> Correct?
16:58 <math493> Or... perhaps without the bracket.
16:59 <math493> And pretty print would be [1, 2, 3, 4, 5]
16:59 <Myrl-saki> With the bracket.
16:59 <Myrl-saki> And yep.
16:59 <math493> :D
16:59 <Myrl-saki> > 1 : (2 : (3 : (4 : [5])))
16:59 <lambdabot> [1,2,3,4,5]
16:59 <math493> That's also what Haskell returned! Success!
17:00 <math493> Oh, there is even a Haskell bot? :D
17:00 <math493> Hi lambdabot - lol
17:00 <Myrl-saki> Mhm. :P
17:00 <math493> > 2 + 2
17:00 <lambdabot> 4
17:00 <Myrl-saki> Ah. It's already 1, and we have to go home from our trip. Night night~
17:00 <math493> :D
17:00 <math493> Night, and thanks a lot, Myrl-saki :D
17:00 <math493> I learned a lot.
17:00 runeks joined
17:00 <Sornaensis> :t 2
17:00 <lambdabot> Num t => t
17:00 sa1_ joined
17:00 <Myrl-saki> math493: No problem. As long as more people go into Hell, I mean Haskell. :D
17:01 <math493> Hahaha :D
17:01 <Sornaensis> :t 2.0
17:01 <lambdabot> Fractional t => t
17:01 <Sornaensis> :t 1e5
17:01 <lambdabot> Fractional t => t
17:01 <Sornaensis> interesting
17:02 amatecha joined
17:05 RoyalNightGuard joined
17:06 <Sornaensis> :t (# #)
17:06 <lambdabot> (# #)
17:07 <Sornaensis> :t #4
17:07 <lambdabot> <no location info>: error: not an expression: ‘#4’
17:07 <Sornaensis> :t INt#
17:07 <lambdabot> error: Data constructor not in scope: INt#
17:08 <geekosaur> :t 4#
17:08 <lambdabot> GHC.Prim.Int#
17:08 <Sornaensis> O:
17:13 abhiroop joined
17:14 iAmerikan joined
17:20 dedgrant joined
17:21 circ-user-YJwe5 joined
17:21 seanparsons joined
17:23 LiaoTao joined
17:26 peterbec` joined
17:35 delexi joined
17:35 RoyalNightGuard_ joined
17:43 yellowj joined
17:58 haskelleksah joined
17:59 simendsjo joined
18:02 circ-user-YJwe5 joined
18:05 nullcone joined
18:14 <mathu> Myrl-saki: i've been in this channelf for like a year lol
18:15 myrkraverk_ joined
18:21 sigmundv_ joined
18:22 Glooomy joined
18:23 uglyfigurine joined
18:24 banseljaj joined
18:28 wildlander joined
18:36 Boarders joined
18:42 ederign_ joined
18:49 chlong joined
18:52 pilne joined
18:55 m3tti joined
18:55 ederign joined
19:01 RoyalNightGuard joined
19:06 takle joined
19:07 takle joined
19:08 malaclyps joined
19:14 ederign joined
19:19 Deide joined
19:19 haskelleksah joined
19:21 mattyw joined
19:33 mbrcknl joined
19:37 feepo joined
19:39 merijn joined
19:41 MarcelineVQ joined
19:53 madjestic joined
19:58 <_ikke_> I don
19:58 <_ikke_> don't think that's necessary
20:07 circ-user-YJwe5 joined
20:13 shayan_ joined
20:15 Rodya_ joined
20:16 <circ-user-YJwe5> chapter 5 pg 203 ? not getting head around this any suggestions? http://lpaste.net/354563
20:18 <merijn> circ-user-YJwe5: What's the problem?
20:19 <circ-user-YJwe5> are f and x args to an undefined function?
20:19 <circ-user-YJwe5> not seeing how line 14 is produced
20:20 <merijn> f is a function (the fact that it happens to be undefined, i.e. a crash, doesn't change that
20:20 <merijn> circ-user-YJwe5: There's only 13 lines? :P
20:20 <merijn> circ-user-YJwe5: 'x' is a Char which happens to have value undefined to
20:20 <circ-user-YJwe5> oops 13
20:21 <merijn> circ-user-YJwe5: Well, what's the type of 'f'?
20:21 <circ-user-YJwe5> some type a
20:21 <merijn> No :)
20:23 <merijn> circ-user-YJwe5: Next guess?
20:24 <circ-user-YJwe5> haha... ;) that is exactly what it would be
20:25 <circ-user-YJwe5> λ> :t f f :: a -> a -> a -> a says what?
20:26 <merijn> circ-user-YJwe5: That 'f' is a function that takes 3 a's and returns an 'a'
20:26 <merijn> for all types 'a'
20:26 <merijn> circ-user-YJwe5: But those 'a' are type variables, so they must all be the same type
20:26 iAmerikan joined
20:27 <circ-user-YJwe5> ok got that
20:27 <merijn> Since 'x :: Char' if you apply 'f :: a -> a -> a -> a' you basically say "the first argument has 'a = Char'"
20:27 <merijn> So f loses one input (it's been applied) and you update the type with the fact that you know 'a = Char'
20:27 <merijn> Thus 'f x :: Char -> Char -> Char'
20:28 <circ-user-YJwe5> so the x in f x would be a function also?
20:29 <merijn> yes
20:29 <merijn> circ-user-YJwe5: Note that "a -> a -> a -> a" is the same as "a -> (a -> (a -> a)))
20:30 <circ-user-YJwe5> yes nested correct?
20:31 takle joined
20:32 <merijn> So instead of 'f' being a function that takes 3 arguments you could also (more correctly) see 'f' as a function that takes 1 argument and returns a function 'a -> (a -> a)' as result
20:34 mengu joined
20:36 <circ-user-YJwe5> merijn: thanks i'll get back to it.
20:37 MrRicecake joined
20:59 RonnieHolm joined
21:01 RonnieHo` joined
21:01 RonnieHo` left
21:02 RonnieHolm left
21:02 haskelleksah joined
21:03 eacameron joined
21:04 ronnie joined
21:04 vaibhavsagar joined
21:09 RonnieHolm joined
21:12 albertus1 joined
21:13 mojjo joined
21:18 chlong joined
21:26 chindy joined
21:26 Rodya_ joined
21:31 govg joined
21:35 circ-user-YJwe5 joined
21:39 binaryplease joined
21:41 govg joined
21:45 colt44 joined
21:54 hiratara joined
22:08 andrewhn joined
22:26 suds13_ joined
22:26 uglyfigurine joined
22:27 Rodya_ joined
22:39 hiratara joined
22:41 <lpaste> suds pasted “Tic Tac Toe AI COode” at http://lpaste.net/354566
22:42 <suds13_> Hi everyone, I am writing a tictactoe ai which uses a profit function to calculate the score of a particular game state (board) and then uses minimax algorithm to calculate the max possible score from a particular game state by all possible future moves, and thus making that move for the ai. The problem is that it doesn't win., in most cases. Please have a
22:42 <suds13_> look at my code : http://lpaste.net/354566
22:45 <suds13_> I think that my minimax implementation is wrong(?) I have tried changing my depth with no change in the predicted moves!
22:47 RoyalNightGuard joined
23:02 thebored joined
23:10 mizu_no_oto_work joined
23:14 uglyfigurine joined
23:18 circ-user-YJwe5 joined
23:19 eacameron joined
23:29 Rodya_ joined
23:34 zero_byte joined
23:49 mengu joined