<    March 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 31
00:07 flounders joined
00:09 cschneid_ joined
00:10 unmanbearpig joined
00:13 MotherFlojo joined
00:13 hphuoc25 joined
00:15 fhoffmeyer joined
00:20 eacameron joined
00:26 eacameron joined
00:27 kini joined
00:31 dni- joined
00:36 louispan joined
00:37 argent0_ joined
00:44 eacameron joined
00:48 Squarism joined
00:53 taksuyu joined
01:03 Koterpillar joined
01:03 mcspud joined
01:07 samiratwork[m] joined
01:07 na9da[m] joined
01:07 rodoa96[m] joined
01:10 corintho[m] joined
01:10 tom7942 joined
01:10 unmanbearpig joined
01:11 curry[m] joined
01:11 cmos joined
01:11 <cmos> is there a function that returns all infixes of a list (as defined by `isInfixOf`)?
01:12 <cmos> ie `infixes 2 [1,2,3,4]` would return [[1,2],[2,3],[3,4]]
01:14 <cmos> (as in a library function)
01:14 dyce[m] joined
01:14 hphuoc25 joined
01:16 prose[m] joined
01:16 fhoffmeyer joined
01:16 unclechu joined
01:16 sudoreboot[m] joined
01:16 M-wamaral joined
01:17 Gurkenglas joined
01:23 contiver joined
01:27 GlobalAtom joined
01:30 <MarcelineVQ> not sure I understanfd, do you have another example?
01:31 <MarcelineVQ> ^ cmos
01:32 Rodya_ joined
01:32 <cmos> given a list `x` and a number `n`, it would ideally return all lists `y` such that `y `isInfixOf` x && length y == n`
01:34 Youmu joined
01:36 <MarcelineVQ> > (zipWith (\x y -> [x,y]) <*> tail) [1..4] -- the common one for length 2 is to use tail
01:37 <lambdabot> [[1,2],[2,3],[3,4]]
01:37 <MarcelineVQ> for longer there's a couple ways, not sure what's best, hmm
01:41 <cmos> right, I'm wondering whether there's a library function to do that
01:42 cschneid_ joined
01:42 pie_ joined
01:43 pie_ joined
01:44 <MarcelineVQ> hmm, divvy from the split package would do it
01:44 <MarcelineVQ> > (\x -> divvy x x) 3 [1..10]
01:44 <lambdabot> [[1,2,3],[4,5,6],[7,8,9]]
01:44 <MarcelineVQ> oops :>
01:45 <MarcelineVQ> > (\x -> divvy x 1) 3 [1..10]
01:45 <lambdabot> [[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9],[8,9,10]]
01:45 ego joined
02:03 <cmos> neat, I like that
02:03 <cmos> > take 5 $ flip divvy 1 3 [0..]
02:03 <lambdabot> [[0,1,2],[1,2,3],[2,3,4],[3,4,5],[4,5,6]]
02:04 <cmos> sweet, thanks
02:04 takle joined
02:06 <qu1j0t3> that question is an FAQ by now, it came up a few months ago in here as well
02:11 unmanbearpig joined
02:13 hexagoxel joined
02:15 hphuoc25 joined
02:17 fhoffmeyer joined
02:19 conal joined
02:20 dni- joined
02:27 Koterpillar left
02:29 tom7942 joined
02:33 MotherFlojo joined
02:34 conal joined
02:34 Rodya_ joined
02:40 \Mike joined
02:41 mac10688 joined
02:45 hexagoxel joined
02:58 vadimich joined
02:59 louispan joined
03:11 tom7942 joined
03:12 unmanbearpig joined
03:13 harfangk joined
03:14 systemfault joined
03:16 hphuoc25 joined
03:19 fhoffmeyer joined
03:23 <glguy> > let stuff n = map (take n) . (zipWith const `ap` drop n) . tails in (stuff 2 [1..4], stuff 3 [1..4])
03:23 <lambdabot> ([[1,2],[2,3],[3,4]],[[1,2,3],[2,3,4]])
03:24 yfeldblum joined
03:25 uglyfigurine joined
03:25 mjs2600 joined
03:29 <MarcelineVQ> nice, I couldn't figure out how to use tails cleanly for the problem even though it seemed like an obvious fit
03:33 AndiK joined
03:33 aarvar joined
03:34 MotherFlojo joined
03:36 hexagoxel joined
03:39 cschneid_ joined
03:42 eacameron joined
03:50 MotherFlojo joined
04:03 exferenceBot joined
04:06 alasi joined
04:07 hexagoxel joined
04:07 lspitzner joined
04:09 dni- joined
04:12 ali_bush joined
04:13 unmanbearpig joined
04:17 hphuoc25 joined
04:20 fhoffmeyer joined
04:20 louispan joined
04:41 eacameron joined
04:41 hphuoc25 joined
04:48 fhoffmeyer joined
05:04 Nezteb joined
05:04 _Nezteb joined
05:05 tom7942 joined
05:11 conal joined
05:13 unmanbearpig joined
05:15 Nezteb_ joined
05:33 hugo_dc joined
05:34 MotherFlojo joined
05:49 hphuoc25 joined
05:49 fhoffmeyer joined
05:51 dni- joined
05:53 takle joined
06:02 Sose joined
06:04 takle joined
06:13 takle joined
06:25 eacameron joined
06:31 takle joined
06:32 blissdev joined
06:32 hphuoc25 joined
06:41 takle joined
06:45 Cale joined
06:47 Pupnik joined
06:47 ThomasLocke joined
06:47 ThomasLocke joined
06:49 takle joined
06:50 fhoffmeyer joined
06:56 aarvar joined
06:59 takle joined
07:02 hexagoxel joined
07:13 takle joined
07:17 begriffs joined
07:21 takle joined
07:23 suls joined
07:29 unmanbearpig joined
07:33 takle joined
07:36 zero_byte joined
07:41 takle joined
07:50 takle joined
07:51 fhoffmeyer joined
07:53 louispan joined
07:59 hexagoxel joined
08:00 uglyfigurine joined
08:01 uglyfigurine joined
08:03 Gurkenglas joined
08:05 uglyfigu_ joined
08:06 Durz0 joined
08:07 mattyw joined
08:08 takle joined
08:10 mengu joined
08:17 shayan_ joined
08:27 corintho[m] joined
08:28 hdeshev joined
08:29 takle joined
08:32 louispan joined
08:34 nek0 joined
08:37 takle joined
08:45 takle joined
08:53 fhoffmeyer joined
08:53 takle joined
08:54 Miroboru joined
08:57 MotherFlojo joined
09:01 takle joined
09:04 mengu joined
09:04 thc202 joined
09:05 heath joined
09:06 abhiroop joined
09:10 na9da[m] joined
09:10 rodoa96[m] joined
09:10 M-wamaral joined
09:10 prose[m] joined
09:10 dyce[m] joined
09:10 unclechu joined
09:10 sudoreboot[m] joined
09:10 curry[m] joined
09:10 samiratwork[m] joined
09:18 louispan joined
09:21 takle joined
09:27 takle joined
09:28 louispan joined
09:31 nacon joined
09:31 nacon joined
09:32 ljc joined
09:40 takle joined
09:51 cur8or joined
09:53 hexagoxel joined
09:54 fhoffmeyer joined
09:59 Rizy joined
10:00 jarshwah joined
10:01 takle joined
10:08 takle joined
10:16 exferenceBot joined
10:24 prophile joined
10:31 mattyw joined
10:35 takle joined
10:40 louispan joined
10:44 uglyfigurine joined
10:44 mattyw joined
10:49 takle joined
10:55 Nik05 joined
10:55 fhoffmeyer joined
10:56 hphuoc25 joined
10:57 takle joined
10:57 MotherFlojo joined
11:15 contiver joined
11:17 gregman_ joined
11:17 takle joined
11:29 netheranthem joined
11:48 vmeson joined
11:57 fhoffmeyer joined
11:57 hphuoc25 joined
12:08 pie_ joined
12:08 hexagoxel joined
12:09 hphuoc25 joined
12:12 hphuoc25 joined
12:16 hphuoc25 joined
12:31 jmg8766 joined
12:58 fhoffmeyer joined
12:58 MotherFlojo joined
13:05 Rizy joined
13:13 eacameron joined
13:18 hphuoc25 joined
13:20 vadimich joined
13:21 vadimich joined
13:30 shayan_ joined
13:37 netheranthem joined
13:37 snowcrshd joined
13:38 mjs2600 joined
13:50 exferenceBot joined
13:52 pie_ joined
13:59 fhoffmeyer joined
14:00 hphuoc25 joined
14:00 MattWest joined
14:02 pbrant joined
14:05 eacameron joined
14:09 pbrant joined
14:15 slomo joined
14:15 slomo joined
14:15 Gurkenglas joined
14:22 chlong__ joined
14:23 Rizy joined
14:24 uglyfigurine joined
14:25 Gloomy joined
14:29 e14 joined
14:31 vaibhavsagar joined
14:33 chrissl joined
14:35 mizu_no_oto_work joined
14:42 animated joined
14:48 ThomasLocke joined
14:50 e14 joined
14:50 Siloow joined
14:51 <Siloow> Hello
14:53 argent0 joined
14:59 Rizy joined
14:59 MotherFlojo joined
15:00 carlomagno joined
15:00 <nitrix> Hi.
15:00 fhoffmeyer joined
15:08 jmg8766 joined
15:08 <argent0> nitrix: Hello
15:10 <jmg8766> not sure if my message was posted because of a disconnection, sorry if this is a repost
15:10 <jmg8766> I'm supposed to read a paper on a functional programming topic and then implement haskell code related to it over the next few months, does anyone have any interesting suggestions?
15:14 <PiDelport> jmg8766: What kind of level?
15:15 <PiDelport> jmg8766: You could search for the "Functional Pearls" papers; a lot of them are nice and bite-sized, and implementable.
15:15 <PiDelport> jmg8766: https://wiki.haskell.org/Research_papers/Functional_pearls
15:16 <jmg8766> really low level, we aren't really expected to know any haskell coming into this course
15:17 <jmg8766> okay I'll look at these
15:23 suls joined
15:23 <jmg8766> looking at these, makes me realize where a lot of class topics are probably coming from
15:34 conal joined
15:36 fbergmann joined
15:40 mjs2600 joined
15:46 deeiinu joined
15:50 kaidokuuppa joined
15:54 eacameron joined
15:57 GlobalAtom joined
16:00 lithie joined
16:01 mjs2600 joined
16:01 cschneid_ joined
16:02 fhoffmeyer joined
16:04 animated joined
16:13 wedens joined
16:18 mjs2600 joined
16:19 mjs2600 joined
16:28 ljc joined
16:44 mjs2600 joined
16:48 jathan joined
16:49 GlobalAtom joined
16:58 animated joined
17:00 MotherFlojo joined
17:00 jmg8766 joined
17:02 <jmg8766> I can barely understand most of these papers, not sure how I'm gonna come up with an idea for something to implement :(
17:02 <nitrix> The assignment seems vere vague.
17:02 fProgrammer joined
17:03 <nitrix> Maybe you could implement a brainfuck interpreter using a monad.
17:03 <nitrix> And point to the monad paper (but then you'd surely have to learn enough Haskell to at least use monads).
17:03 fhoffmeyer joined
17:03 <nitrix> It might impress or it might not, but you said low-level earlier.
17:04 <jmg8766> we will be learning modals soon in class, but I need to propose a paper and project today
17:07 <fProgrammer> quick question: I've a created a datatype using record syntax. What is the most efficient way to convert it to a map, where the accessor functions are key and the values are Map Values. For ex: http://lpaste.net/353181
17:09 <nitrix> fProgrammer: Are you interested in new libraries?
17:10 <fProgrammer> nitrix: you mean additional dependencies? sure, no probs. I was expecting a Data.Map kinda typeclass where I can perhaps define instance for my datatype?
17:10 <nitrix> fProgrammer: You can have a description of the record like this [("name", name), ("age", age)]
17:11 <nitrix> Then you `map` a reverse application.
17:11 <nitrix> @let data Person = Person { name :: Text , age :: Int } deriving Show
17:11 <glguy> fProgrammer: You can't make a Map with both a Text and Int as values
17:11 <lambdabot> .L.hs:162:30: error: Not in scope: type constructor or class ‘Text’
17:11 <nitrix> @let data Person = Person { name :: String, age :: Int } deriving Show
17:11 <lambdabot> Defined.
17:12 <fProgrammer> glguy: Got it, homogeneous list.
17:12 <nitrix> @let personRepresentation = [("name", name), ("age", age)]
17:12 <lambdabot> .L.hs:164:49: error:
17:12 <lambdabot> • Couldn't match type ‘Int’ with ‘[Char]’
17:12 <lambdabot> Expected type: Person -> String
17:12 <nitrix> Oh crap. I forgot about that :P
17:13 <nitrix> I was going for a homogenous list and then `fmap ($ person) personRepresentation`
17:13 <nitrix> Or is it `fmap (fmap ($ person))` ?
17:14 <nitrix> Seems a little noisy. That's probably why we have libraries like lens :P
17:14 <fProgrammer> nitrix: Haha, me too. One way I thought was using Data.Aeson. Create a ToJSON Instance, and then let decode it to a (Maybe Map k v) value. But seems convoluted way of doing things.
17:15 <nitrix> fProgrammer: It's a terribly bad way. Aeson does serialization before doing the encoding to JSON.
17:15 <nitrix> err NOT a terribly bad way
17:16 <nitrix> I can't english, forgive me.
17:16 <fProgrammer> nitrix: no problemoe. I'll look up Lens package. Thanks!
17:16 <nitrix> fProgrammer: I think you'd be interested in just the serialization part. It should be easily doable if you don't plan on writing your own little serialization mechanism :P
17:16 <nitrix> Let me see if I can think of a clean lens way of doing it...
17:17 <glguy> lens isn't going to help you make the list of field names and values for your record
17:17 <nitrix> I thought lens had a way to obtain the record name in its TH extension?
17:18 <glguy> Sure, it looks up the field names to generate lenses; that's not going to help you produce this list
17:18 <glguy> We'll need to figure out a valid goal before worrying about how to achieve that goal
17:18 eacameron joined
17:18 <glguy> What type of things are we making now?
17:19 hphuoc25 joined
17:19 <nitrix> 12:07:51 fProgrammer | quick question: I've a created a datatype using record syntax. What is the most efficient way to convert it to a map, where the accessor functions are key and the values are Map Values. For ex: http://lpaste.net/353181
17:19 <nitrix> glguy: ^
17:19 <glguy> someRecord -> [(String, Data.Aeson.Value)]?
17:19 <glguy> the original question suffered from a type error
17:19 <nitrix> Ah for the type of the value? Yeah.
17:20 <nitrix> Maybe Aeson does have all the facilities you're interested in afterall.
17:20 <fProgrammer> nitrix: Maybe I can just write a function where I create a Map singleton, sounds easier :P
17:21 <nitrix> Sure. I'm withdrawing. I've done enough harm in the past hour x]
17:21 <nitrix> You're in good hands with glguy :]
17:22 <fProgrammer> something like: createMapValue p = Map.singleton [( "name", name p), ("age", age p)]
17:22 snowcrshd joined
17:29 boris_rh joined
17:29 vaibhavsagar joined
17:30 wildlander joined
17:35 owiecc joined
17:37 AlainODea_ joined
17:38 staffehn_ joined
17:38 feepo_ joined
17:38 asante10111 joined
17:39 Kongaloosh_ joined
17:39 brassel joined
17:40 mathu_ joined
17:40 l_coal- joined
17:40 hxegon joined
17:40 zerokarm1left joined
17:40 Deaddy_ joined
17:42 emily1 joined
17:42 karce- joined
17:42 ajcoppa_ joined
17:42 aminb_ joined
17:42 Majoo joined
17:42 gpo- joined
17:43 chin-tasti_ joined
17:43 dibblego joined
17:43 dibblego joined
17:43 rembo10 joined
17:44 lukky513 joined
17:45 asm89 joined
17:50 mcspud joined
17:51 lithie joined
17:54 lspitzner joined
17:56 mjs2600 joined
17:56 conal joined
17:58 tsmish joined
17:58 MotherFlojo joined
18:01 gpo joined
18:05 fhoffmeyer joined
18:06 delexi joined
18:08 unmanbearpig joined
18:10 xacktm joined
18:19 hphuoc25 joined
18:20 louispan joined
18:20 chlong__ joined
18:21 blissdev joined
18:22 takle joined
18:24 pilne joined
18:34 flounders joined
18:35 mjs2600 joined
18:44 nadirs joined
18:44 nadir_ joined
18:45 acarrico joined
18:45 saylu joined
18:47 jmg8766 joined
18:52 vaibhavsagar joined
18:53 flounders joined
19:02 emmanuel_erc joined
19:04 shayan_ joined
19:06 fhoffmeyer joined
19:10 Miroboru joined
19:12 AndreasK joined
19:13 MotherFlojo joined
19:17 malaclyps joined
19:22 mjs2600 joined
19:29 deeiinu joined
19:29 uglyfigurine joined
19:32 amatecha joined
19:46 uglyfigurine joined
19:54 jmg8766 joined
19:58 hoffmeyer joined
20:04 wedens joined
20:07 nomotif joined
20:07 fhoffmeyer joined
20:10 chlong__ joined
20:12 <jmg8766> is haskell context-free?
20:12 <qu1j0t3> your question sure is!
20:12 <* qu1j0t3> runz
20:13 <jmg8766> ha!
20:14 <jmg8766> is there a context free grammar for it? that I could use to build a parser?
20:16 <monochrom> Yes. See the Haskell 2010 Report.
20:16 <monochrom> But layout is going to hurt you. (It hurts every parser writer.)
20:16 Deide joined
20:17 <jmg8766> not sure what you mean by layout but i'll check that out
20:19 <tapirus> first result from googling this gives me http://trevorjim.com/haskell-is-not-context-free/
20:19 <monochrom> It means you write "f x = y" on one line, then " where y = z" next line, then " z = x" next line, and it all magically work.
20:21 <monochrom> And you're supposed to note that there are 4 leading spaces on the 2nd line, 4+6 leading spaces on the 3rd line,
20:21 <monochrom> and deduce that I mean "f x = y where {y = z; z = x}"
20:21 <monochrom> And only after that will your CFG mindset be relevant.
20:22 <monochrom> (There is an exception. It does get a bit complicated and circular.)
20:23 <jmg8766> oh ok
20:24 pie_ joined
20:24 <monochrom> I am against making a big fuss about "not context-free because layout".
20:25 <monochrom> After desugaring layout, you still don't get a context-free language, strictly speaking.
20:26 <monochrom> A piece of code that makes CFG sense but not type sense is still not legal Haskell code.
20:26 <monochrom> And the type part is not going to be CFG-definable.
20:27 albertus1 joined
20:27 peterbecich joined
20:27 <monochrom> But my point is that every programmer who asks for "a CFG for Haskell" already understands it. They mean they ask for the CFG part of the language rules. This is a reasonable quest, and I am glad to answer as such, as opposed to lecturing on how no programming language is context-free ever.
20:28 vadimich joined
20:29 <monochrom> Similarly, there is a difference reason why Algol, Pascal, etc, are not context-free. See my http://www.vex.net/~trebla/weblog/declare-before-use.xhtml
20:29 <monochrom> But it is counterproductive to harp on that all the time.
20:29 <nitrix> monochrom: How about Forth?
20:29 <jmg8766> ok thankyou, I think I'm gonna try to implement a couple different parsing algorithms for haskell in haskell for that project I was talking about earlier
20:29 <monochrom> I don't actually know Forth.
20:31 <nitrix> monochrom: You have a stack which is part of the language's semantic, it acts like continuation passing. You essentially only use words that are all unary to manipulate said implict stack.
20:31 <nitrix> monochrom: `f g h` reads as `h . g . f`
20:32 uglyfigurine joined
20:32 owiecc joined
20:34 <monochrom> It probably contains a rule "if you mention a name, it has to be either a built-in name or it has be be user-defined somewhere"
20:35 <monochrom> In the case you happen to never use built-in names, but you define and use several user-defined names, and you have to define them before or after the use sites, you are again in something similar to the declare-before-use case, and therefore not context-free.
20:37 <monochrom> Also I think that Trevor Jim's argument is broken.
20:38 <monochrom> He/She is better off going back to applying Ogden's lemma on the character stream.
20:40 <monochrom> I mean, "if the lexer stage has a stack, then lexer+parser is not CFG"?!
20:41 ljc joined
20:41 eacameron joined
20:41 <monochrom> Has he proved it? Has anyone proved it? I call it bluff.
20:42 vaibhavsagar joined
20:43 argent0 joined
20:51 NoCreativity joined
20:51 Gloomy joined
20:59 binaryplease joined
21:01 mjs2600 joined
21:03 aarvar joined
21:06 MotherFlojo joined
21:06 malaclyps joined
21:08 fhoffmeyer joined
21:12 MotherFlojo joined
21:21 pie__ joined
21:21 mathu joined
21:22 hphuoc25 joined
21:29 mengu joined
21:31 initiumdoeslinux joined
21:36 conal joined
21:38 louispan joined
21:45 binaryplease1 joined
21:47 uglyfigurine joined
21:52 hiratara joined
21:53 fhoffmeyer joined
22:02 Gurkenglas joined
22:25 MotherFlojo joined
22:31 asante joined
22:33 hiratara joined
22:41 wedens joined
22:43 GlobalAtom joined
22:45 malaclyps joined
22:55 nek0 joined
22:56 contiver joined
23:01 shayan_ joined
23:02 Rizy joined
23:21 MotherFlojo joined
23:25 hphuoc25 joined
23:26 andrei_chiffa_ joined
23:28 zero_byte joined
23:50 systemfault joined
23:57 aarvar joined