00:08:40 foo<-{n->{i->n++i}} 00:08:55 foo<-\n.\i.n++i 00:12:18 Main :: 0 00:12:18 = RNode 4 1 0 00:12:18 = RNode 4 2 0 00:12:18 RNode n t p = RNode 0 n t p 00:12:18 RNode m m t p :: p 00:12:19 RNode n m t p :: #node n t -> RNode n+1 m t p 00:12:23 eight! 00:12:37 ...close in complexity to the hypercube 8| 00:12:58 what a verbose lang, i need those shorthands... 00:15:23 What's ASCII 96? `? 00:15:30 Doesn't appear on my chart. 00:16:32 oklopol! how would you like to help devise a language even more concise than oklotalk 00:16:46 with only one goal: tiny code 00:16:53 well, tiny code that can be written fast :-) 00:18:23 starting on what basis? 00:18:58 oklopol: hm, insanity 00:19:06 or: functions, mainly, i guess 00:19:10 functions and mutations 00:19:33 typing makes things concise because it allows for massive overloading. 00:19:54 ok then 00:19:56 type inference? 00:20:02 or dynamic typing 00:20:19 hmm 00:20:50 well, definately not explicit typing :) 00:21:11 ofc 00:21:16 type inference could be fun 00:21:16 yep 00:21:25 you could build up a huge knowledge base of info about functions 00:21:35 it could know more about how a function behaves than you do :P 00:21:41 but then type inference can get complex 00:21:46 also, less possibility for operator abuse 00:21:59 indeed, never tried implementing it though 00:22:09 so... dynamic typing? 00:22:17 prolly 00:22:21 ok 00:22:30 let's get some sort of grammar 00:22:37 we want prefix, binary, and postfix operators 00:22:42 also N-ary binaries 00:22:44 that is 00:22:46 hehe 00:22:48 ARG op ARG ARG ... 00:22:58 i don't think ARG ARG ... op ARG ARG ..., though 00:23:01 that would be confusing 00:23:22 perhaps. 00:23:33 what usage would that have 00:23:40 asdf i remember i came up with a language some time ago, but i forgot what it was.... 00:23:46 how do you parse arg op arg arg? 00:25:21 dunno 00:25:23 K does it 00:26:50 oklopol: instead of thinking about that 00:27:01 oklopol: let's just say: prefix, postfix, binary 00:27:12 arg op arg arg would be arg op (arg arg), i.e. second arg a list 00:27:16 so 00:27:23 what about the 'function' operator 00:27:35 i think: [] 00:28:05 [_+1] or [x;x+1] 00:28:08 oklopol: good so far? 00:28:36 seems to work. 00:28:50 but that's a given since there's no sidestep from K :P 00:28:57 K does it? huh 00:29:02 i don't think so... 00:29:05 ok, now let's define two functions over lists 00:29:09 specifically, map and fold 00:29:13 \ is fold 00:29:21 / is map 00:29:24 Postfix operators 00:29:37 func\ is a function f 00:29:42 f called with a list does fold over that list with func 00:29:45 same for / but with map 00:29:51 +\1 2 3 -> 6 00:30:03 +/(1 2) (3) -> (3) (3) 00:30:15 that works as long as you can't change the meaning of \ during the program 00:30:25 yes, and? 00:30:26 well, as long as it always is a postfix oper. 00:30:31 it is 00:30:36 x/ and x\ 00:30:42 +\1 2 3 is really: 00:30:44 well, i mean if you want to make your own postfixors. 00:30:46 (+\) 1 2 3 00:31:12 if you can't make them, then the separation into postfix operators is useless and the terminology of K can be used 00:31:19 verbs & proverbs 00:31:21 [_+2]/1 2 3 -> 3 4 5 00:31:22 oklopol: you can 00:31:28 oklopol: you can define all kinds of ops 00:31:40 [x;x+2]/1 2 3 -> 3 4 5 00:31:47 yes, well in that case, those need to be type checked at compile time. 00:31:59 which somewhat rules out dynamic typing 00:31:59 nah 00:32:01 dynamic typing 00:32:02 no? 00:32:16 /, \ use their arg as a func 00:32:25 if it's a number, the interpreter balks out 00:32:30 it will change parsing if you change a postfix operator into a prefix one. 00:32:52 how does k handle this 00:33:11 i don't think proverbs are first class 00:33:19 although i don't *know* 00:33:50 ok, well then parsing can be changed at runtime 00:33:50 :D 00:33:53 *adverbs 00:33:55 not proverbs 00:34:02 compiling will probably be possible with some tricks 00:34:21 like no matter what an op is compiled as prefix,postfix,infix depending on how its used 00:34:26 when multiple choices, both are tried 00:34:31 and it is resolved at runtime 00:35:01 oklopol: should we have pattern matching? 00:35:05 and if so, what syntax 00:35:38 hmmm 00:35:49 uhhh K-tree <3 00:36:08 i *have* to get my hands on a K interp or make one myself... 00:36:10 echo 'define k-tree' | ehirdtalk 00:36:19 heh 00:36:37 upi can get a free K interpreter from Kx 00:36:39 as in beer 00:36:51 what? 00:36:59 *-up, or what's upi? 00:37:08 you 00:37:16 xD 00:37:23 oh, heh 00:38:28 hm 00:38:31 kx.com is confusing 00:38:32 pattern matching can make things more concise, definitely, the problem is the kind of iterative programming K does is much more comcise 00:38:32 no info abotu K 00:38:33 *concise 00:39:17 oh well 00:39:18 http://www.nsl.com/misc/k/kwin.zip 00:39:20 there's your interpreter 00:39:42 i'm actually on ubuntu. 00:40:46 lol thank you xchat, there's no way to copypaste that into my url without the kwin.zip part xD 00:40:51 klin then 00:41:17 now WHERE is my goddamn interpreter for os x 00:43:53 http://www.kx.com/download/download.htm sdfhsdfoijsdfoihsdf no k interpreter 00:44:22 anyway 00:44:25 explain k-trees, oklopol 00:45:34 anyway. fact:[*1|_] 00:45:40 there's a factorial 00:46:12 whellll the k-tree is a tree 00:46:18 which holds the vars 00:46:31 helpful 00:46:45 the point is you can do scopes explicitly in a fun fashion by executing something in a lower branch 00:47:59 so how do i use a k-tree in place of pattern matching 00:48:15 umm... there's no "a k-tree" 00:48:19 there's only one k-tree 00:48:21 ok 00:48:26 how do i use it in place of pattern matching 00:48:34 depends what you mean. 00:48:42 ohhhhh 00:48:56 when i said "k-tree <3", it had nothing to do with pattern matching. 00:50:01 uhhh 00:50:03 k 00:50:03 + 00:50:05 erlang 00:50:06 = 00:50:08 sex. 00:50:31 kinda like pi calculus, but... less calculus'y :-) 00:50:57 something involving a linda-like global tuplespace 00:50:58 so, oklopol... 00:51:04 what? :) 00:51:05 how should we do conditionals/pattern matching/whatever 00:51:24 ah, well, *that* i don't know. 00:51:32 all i know is, k+erlang, maybe? 00:51:33 :)) 00:51:52 i have no idea what that even means, i just know it's awesome. 00:52:22 actually, i should learn linda, since i just know it has the global tuplespace, and that's awesome :P 00:52:38 :/ 00:52:52 sorry for not being helpful, my brain isn't good at anything non-random ideas thinking at this hour. 00:53:09 i'd need longer vacations to get used to the fact i sleep during the day :) 00:53:27 hm the evaluation model of our language is still pretty standard 00:53:38 maybe there's a way to make code more consice, by completely changing it 00:55:14 well, you could make it point-free, and add lots of high-order functions :)) 00:55:24 i'm going to sleep soon 00:55:27 too many smileys. 00:55:28 heh 00:55:33 point-free code isn't consicer though 00:55:46 not really, no 00:55:47 certainly not quicker to write either 00:55:56 certainly not, no 00:55:58 :)) 00:56:54 oklotalk isn't hard to win, since i've let a lot of stuff out i originally had, for lessening obscurity :< 00:57:31 so, the language 00:57:46 if the aim is for conciseness, i'd start with examples 00:58:04 i mean, examples of programs we want to be concise. 00:58:32 it's pretty simple to find a language that would be most concise for doing a certain kind of job 00:58:53 well, ofc not *the most concise one* 00:59:05 but, like, very. 01:00:21 aim is for conciseness and speed to write 01:01:27 well, one way to be concise is to leave more stuff for the interp to figure out 01:01:40 make it a bit more declarative 01:01:53 ok 01:01:57 example? 01:02:10 one way to do this would indeed be the tuple space, i think... although that is only a feeling, since i haven't explored it that rigorously.. 01:02:13 hmm 01:02:32 well, i can give you extreme examples, ones that are fully declarative... 01:03:23 like ![{a for sorting 01:03:41 ![] means "do something that makes this return true" 01:03:52 ooh 01:03:56 let's devise an algorithm for sorting 01:03:57 that is 01:03:58 1. fast 01:04:00 then \2\, here, was a reduce that took 2 at a time 01:04:06 2. extremely concise when expressed declaratively 01:04:09 and the rest is trivial 01:04:43 also, that ![...] stuff 01:04:45 for that 01:04:48 will be uh... 01:04:50 hard for the interp 01:04:53 specifically, near-brute-force 01:05:31 anyway, let's do what i said 01:05:33 indeed. 01:05:51 i said i can only concoct an extreme example in a short time. 01:06:10 you can so something in-between 01:06:23 :-) 01:06:26 hmmmm 01:06:28 hm 01:06:35 what about improving mergesort, then making it declarative 01:06:44 specifically, i'm thinking running the branches concurrently 01:07:13 indeed, a lot of support for cutting and splicing lists, and recursion! 01:08:21 declarative recursion 01:08:24 you figure that one out :-) 01:09:15 wait wait 01:09:19 i'm close to it. 01:11:03 ooh 01:11:06 :-) 01:11:16 i'm having a hard time coming up with a syntax. 01:11:22 did you find something? 01:12:28 rec l\2, zipx .<< 01:12:55 let's say that's a function, l\2 splits a list [1, 2, 3 ,] 01:12:57 eh... 01:13:22 let's say that's a function, l\2 splits a list [1, 2, 3, 4, 5] -> [[1, 3, 5], [2, 4]] 01:13:55 rec is a lower precedence high-order function that applies current function recursively for every item in a list 01:14:02 in this case the two halves of the list 01:15:01 , is a low precedence function that works as a data flow controller, it takes the output of the last thingie and gives it to the next. this could just be done using normal application, but i think the precedences may provide more conciseness with a comma oper. 01:15:48 zipx takes a function and a list of lists, and always zips the value the function gives from all the heads of the lists given to it as a list, and concatenates one at a time 01:16:15 these are all very basic functions, so i think that could be made 8 or 10 chars. 01:16:30 this is not declarative 01:16:46 nope. 01:16:47 just an idea. 01:17:01 the declarative one i had was less concise :P 01:17:11 list splicing is sooooo mucho fun 01:17:27 anyway: [$_\2,!] 01:17:31 hmm 01:17:33 anyway 01:17:36 what is that 01:17:37 is that a sorter 01:17:45 what is what 01:18:51 anyway 01:18:58 here's a quicksort idea: 01:20:02 '\_2,)#<< 01:20:35 hm 01:20:36 wait 01:20:43 tell me the syntax for car and cdr 01:20:46 one-char, prefix 01:21:14 i use . and : usually 01:22:12 ok 01:24:47 qs^naive:[l:r:(). :?_<2[_][p:#_ ?_/2. [:_ oklopol: imperative-style quicksort 01:25:10 you can figure it out. it's not hard 01:25:29 watch out for : being both a 3-arity prefix and a 2-arity infix 01:26:05 qs^naive:[l:r:(). :?_<2[_][p:#_ ?_/2. [:_ missed a . 01:26:18 qs^naive:[l:r:(). :?_<2[_][p:_#?_/2. [:_ made # infix 01:26:26 that's not very concise + i'm not sure i can read it. 01:26:26 oklopol: take a look at that 01:26:35 its not concise cause it's imperative 01:26:38 i'll walk you through it 01:26:39 qs^naive:[l:r:(). :?_<2[_][p:_#?_/2. [:_ x:y is assignment 01:26:48 ah 01:26:53 l:r:() is like l = r = [] 01:27:00 () just being the null expression 01:27:12 since scalars = list 1-order, 01:27:15 null = list 0-order 01:27:17 mine was imperative and 9 characters :) 01:27:23 then we have 3-arity : 01:27:28 but okay 01:27:32 and yes but mine's not relying on bizzare things 01:27:36 ?_<2 01:27:37 neither is mine. 01:27:38 ? is length 01:27:42 ?_ being length of the arg 01:27:45 checking <2 01:27:50 if so, we just return it - [_] 01:27:59 otherwise, pick a pivot from the middle - ary#index 01:28:16 then, run [:_ if _ is less than the pivot, append it to l 01:28:25 ~ is concat 01:28:28 otherwise, append it to r 01:28:34 then, qs l and r and concat them together 01:28:47 so what's your qs? 01:28:53 it's not fully imperative really 01:28:58 thought so 01:29:14 qs is much harder in my lang stub. 01:29:31 '\_2,)#<< 01:29:33 walk me through 01:29:49 i already did, but i'll redo that 01:30:02 wait, it's not qs 01:30:05 it's brute-force sort 01:30:06 :-) 01:30:10 it's mergesort 01:30:33 also, it's a parametrizable mergesort of any amount of splits 01:30:44 it's also slow 01:30:50 turning \ into / will make another mergesort, which runs a bit faster 01:31:00 nope, yours copies the list too. 01:31:33 ok walk me through it 01:31:35 each char 01:31:54 okay, first split by ',' to get the statements 01:32:00 ok 01:32:01 '\_2 01:32:03 and )#<< 01:32:24 "'" there is a special recursion tool that applies recursion to each sublist, unless an empty list, which is simply returned 01:32:28 this is a frequent need. 01:32:35 it's a deep mapping. 01:32:38 basically 01:32:40 ok 01:32:44 and \_2 01:33:13 \ is a prefix splice here, _ is the nameless arg given to the substatement, so it will basically be cut in two halves in the first statement 01:33:26 then, the recursion applies 01:33:26 prefix splice? sounds pretty specific to me 01:33:35 err... 01:33:36 ok, wht's )#<< and why does it have unmatched 01:33:44 cutting a list into pieces is what i based the idea on. 01:33:51 ok 01:33:54 )#<< 01:34:41 yeah, that will take the resulting list, )# is, kinda like ', a special prefix transformer, that takes a list, and concatenates using the function given to decide which one pick at each time. 01:35:05 that's pretty spesific, but there are enough 2-char tokens to have that kind of stuff, especially when you can overload. 01:35:11 << is just a min function 01:35:51 it would be just <, in case of type inference, where < can be min when a non-boolean is expected and normal ordering function int->int->bool when a bool is expected. 01:36:00 how about we define a problem domain to work on 01:36:03 then base the language on that 01:36:17 let's think low-level: what essentially are most algorithmic programs? 01:36:24 Let's take the factorial. 01:36:31 Isn't it a map? 01:36:37 yeah 01:36:39 An infinite map. 01:36:43 yarrrr 01:36:46 So.. 01:36:57 If [] is a mapping, 01:37:03 [x=y. x=y] etc 01:37:11 hmmm 01:37:14 then 01:37:16 [] is a mapping? 01:37:20 errr 01:37:20 we can algorithmically define how to look up a key 01:37:25 what kinda mapping, now? 01:38:03 fact = [_<2 = 1; n = n * fact(n-1)] 01:38:07 do you see? 01:38:13 it's just a dictionary, mapping, hash table, thing 01:38:17 but you can define keys algorithmically 01:38:24 and they are lazily called upon 01:38:29 fact(n-1) is just a table lookup 01:38:36 a function is just a table 01:38:37 well yeah, that's how oklotalk would do it 01:38:41 no 01:38:43 because it's still a function 01:38:48 it's still called and returned from, etc 01:38:54 ? 01:38:59 let's put it this way 01:39:02 there are no functions 01:39:06 _<2 isn't a pattern match as such 01:39:06 oklotalk doesn't differentiate between lists and functions... 01:39:11 it doesn't match on an 'argument' 01:39:24 i see, it's the same thing, essentially, though? 01:39:26 it simply states that in the fact table, lookups < 2 = 1 01:39:30 that is: it's a hash table 01:39:35 yes, a function 01:39:36 you don't 'execute and match' 01:39:40 you 'lookup' 01:39:49 that's exactly how functions do it, pattern match and return. 01:39:50 please understand the philisophical difference 01:39:54 no 01:40:04 how' 01:40:06 please think about it 01:40:15 it's a different way of thinking about it 01:40:19 instead of factorial being an algorithm 01:40:23 it's just a lookup table: 01:40:33 yes, exactly the idea behind pattern matching. 01:40:46 [0 = 1; 1 = 1; 2 = 2; 3 = 6; 4 = 24; ...] 01:40:52 don't think of it as matching 01:40:53 but, oklotalk does exactly what you're thinking there, makes function basically an infinite list. 01:40:57 think of it as all keys are evaluated already 01:40:58 or a hashmap 01:41:05 don't think of fact(n) matching 01:41:05 yes, the oklotalk way. 01:41:08 period. 01:41:11 just think of it looking up an already infinite table 01:41:23 yes, the *exact* idea behind oklotalk's functions. 01:41:33 no, because you don't reason about it like a function 01:41:41 k. 01:41:42 you reason about it like a pre-computed table 01:41:48 like everything is constant 01:41:49 ah, kinda like in oklotalk. 01:41:55 kind of, but not exactly 01:42:05 oklotalk still makes you think about calling and returning, etc 01:42:41 yes, it lets you do that if you want, i'm just saying that's nothing new, pattern matching is equivalent to that... 01:43:09 except for the possible built-in functions that might handle it differently, but you can do that for functions too 01:43:15 yes, the method is equiv 01:43:17 the reasoning isn't 01:43:21 we're thinking about this abstractly 01:43:47 if we think of just looking everything up in tables that have always been constant and calculated, with that stuff just as syntactic sugar, our primitives etc. will be different 01:43:50 and perhaps fruitful 01:44:14 well yeah, that provides for interesting, infinite lazy lists 01:44:24 tables 01:44:25 not lists 01:44:27 but haskell already has those, and you can even use them exactly like lists 01:44:36 fact = [hello = 4] 01:44:40 fact(hello) 01:44:41 4 01:44:42 well 01:44:44 "hello" 01:44:44 with a look-up table like that, with random-access type indexing, it's very hard to be lazy. 01:44:46 and fact("hello") 01:44:49 actually... no 01:45:04 oklopol: the implementation wouldn't be lazy, it'd do it via pattern-matching if needed, but it's a method of thinking 01:45:06 well, tables, hashmaps. 01:45:21 functions 01:45:22 . 01:45:31 Success! 01:45:37 Slereah: good for ya :) 01:45:46 I have made an ASCII-ish code for that BF interpreter. 01:46:08 ehird`_: i'm just saying i'm afraid it's not really a new way of thinking. 01:46:08 Let's try those big BF programs now. 01:46:28 oklopol: but as the only basis for a language 01:46:31 oklopol: and it is slightly 01:46:43 oklopol: but yeah, give me an example program in it... quicksort is a mapping of lists to lists, obviously 01:46:48 at least not to me... done lots of thinking on different ways to specify infinite lists 01:48:03 ehird`_: example program in what? 01:48:12 qs = [[] = []; [x] = [x]; x:[...,p,...] = stuff] 01:48:14 note the mapping thing 01:48:19 have to go in 5 mins 01:48:56 -!- mtve has quit ("Terminated with extreme prejudice - dircproxy 1.0.5"). 01:49:08 * oklopol notes 01:50:00 the question is 01:50:02 what is stuff 01:50:21 looked interesting how you specified the p there 01:53:11 oh well, tomorrow i shall define a concise language :P 01:53:20 specifically, a write-only but productive one 01:53:35 i.e. you can hack on it easily, but you cannot actually take a definition and look at it properly :P 01:53:52 yeah 02:15:35 ehird`_: i think with my current semantics, quicksort would be /2;A B:C,AB,',JnB 02:16:30 it's not very concise, because i haven't yet made that much splitting facilities, but anyhow, just in case you feel like competing :) 02:17:29 now sleep -> 02:19:50 -!- ehird`_ has changed nick to ehiird|sleeep. 02:19:50 -!- ehiird|sleeep has changed nick to ehird|sleeep. 02:19:59 -!- ehird|sleeep has left (?). 02:20:33 -!- ehirdsleep has joined. 02:24:42 Apparently, the full interpreter works okay, but at turtle speed. 02:29:06 Wish I knew how to optimise code. 02:32:41 wish i was more stupid 02:35:41 Let's trade! 02:38:57 bsmntbombdood: why? 02:40:35 dunno 02:41:44 Ah. There's an error in the - instruction. 02:42:15 Let's see if the programs run better! 02:42:49 bsmntbombdood: why? 02:42:53 whoops-. 02:42:54 '/,)# a:B,',\# Yay, the BF quine prints! 02:43:14 /2;A b:C,',JnBquicksort 02:43:25 starting to look a bit like an esolang ;) 02:44:26 oh, actually, bubblesort is ";a:B,',\# so... the sleeps -> 02:52:03 * Slereah tries the Mandelbrot program 02:52:17 Which is pretty stupid, since it's already slow on a normal BF interpreter. 02:52:42 Oooh! I know! Try it on dbfi! 02:53:32 What, an interpreter on an interpreter on an interpreter? 02:53:44 Are you a fan of recursion by any change? 02:53:58 *ce 02:56:06 I'll just leave the Mandelbrot running his night. 02:56:42 If it works, I think I can say that the interpreter works okay. 02:57:12 ... or! 02:57:42 Maybe I should try Lost Kingdom instead, which IIRC execute faster than Mandelbrot on a usual BF interpreter. 02:58:54 Lost Kingdom, for all it's size, is fairly quick usually. 02:59:59 I assume that it's because, unlike Mandelbrot, the text output without a bajillion other steps before. 03:01:12 Yeah. 03:01:55 See? I only had to wait 2 minutes before it asks me if I want to enable long room descriptions! 03:02:13 all factorials in a list: "1::Il,)&*" 03:02:30 to take one specifically is a bit harder ;) 03:02:54 i can't sleep, this language is hunting me :< 03:02:57 retry -> 03:04:19 In your dream? 03:04:35 Is it some sort of BrainFreddy? 03:09:51 Blah. Either the next step is taking forever, or the input has some problem. 03:21:02 Oh bloody hell. 03:21:09 The CH function prints CH now. 03:21:14 Forgot that exception 03:22:16 ROT13 works okay now! 03:33:57 -!- faxathisia has joined. 03:57:47 -!- Slereah has quit (Read error: 110 (Connection timed out)). 03:58:03 -!- Slereah has joined. 04:30:58 -!- slereah_ has joined. 04:36:31 -!- Slereah has quit (Read error: 110 (Connection timed out)). 04:45:46 -!- slereah_ has changed nick to Slereah. 05:15:00 * pikhq goes into a full-on panic 06:11:29 ? 06:11:39 No xkcd. 06:12:00 hrm 07:39:42 what 07:39:43 -!- calamari has quit ("Leaving"). 07:45:09 no xkcd 07:48:05 -!- Sgeo has joined. 07:48:20 Hi all 07:48:30 hi 07:48:46 pikhq, heads up: The "domain installation check" function probably won't accept arguments 07:48:54 I'm probably going to change it 07:49:04 pikhq, how's work on the psox.pebble lib going? 07:50:36 ok, so pikhq's away 07:59:59 -!- clog has quit (ended). 08:00:00 -!- clog has joined. 08:04:29 * Sgeo monologues 08:04:52 * faxathisia wonders if this is a good idea for language design 08:05:12 pick a random algorithm and stick it in a while loop -- add syntax 08:16:19 Hm, it's easy for BF to receive a LBYTES as a STRING and a STRING as an LBYTES, but difficult for the conversion to be performed on the tape.. 08:55:52 Which makes me wonder if I should add a function that just returns whatever was given to it.. 08:55:59 hm, maybe not 08:56:02 G'night all 09:13:12 -!- oerjan has joined. 09:13:29 -!- Sgeo has quit (Read error: 110 (Connection timed out)). 09:32:49 -!- slereah_ has joined. 09:49:32 -!- Slereah has quit (Read error: 110 (Connection timed out)). 10:35:32 -!- johnl_ has joined. 10:37:08 -!- johnl has quit (Read error: 104 (Connection reset by peer)). 10:43:02 -!- johnl_ has quit (Remote closed the connection). 11:25:25 -!- sebbu has joined. 11:30:02 -!- oerjan has quit ("leaving"). 11:37:03 faxathisia: i see you've found the recipe for making perfert esolangs without any effort, we can now bury this chan and go on with our lives :) 11:38:09 also, you weren't here when i did the graphica spec stub, so i'll paste it assuming you don't read the logs. 11:39:34 http://www.vjn.fi/pb/p123363511.txt 11:40:38 not sure if that helps at all, i've been told my bnf sucks ass 11:41:04 In general BNF kind of stucks 11:41:14 well actually i'm wrong 11:41:25 I just personally don't like because it's not execyutable 11:41:36 not executable? 11:42:01 A lot of times I've seen a languages syntax written in BNF.. then had to write a parser 11:42:08 wishing I could just run the BNF instead :/ 11:43:33 i don't think it'd be hard to automatically make a parser just based on a bnf 11:43:49 don't the parser creator do just that? 11:44:04 yacc or whaddyacallit... 11:44:59 -!- sebbu2 has quit (Read error: 110 (Connection timed out)). 11:45:09 would be interesting to have a language where a bnf would correspond to a logic program describing the parser. 11:45:25 :o 11:45:27 but, where semantics might actually be more complicated 11:45:41 maybe you could just define the ::= operator in prolog 11:45:48 :D 11:45:52 that would own 11:45:57 actually... 11:46:20 parsing via bnf is basically just trying a branch and backtracking... 11:46:29 it might actually be simple 11:46:48 i don't actually know prolog that well 11:47:01 now did you read the spec? :-) 11:47:11 no :p 11:47:12 * faxathisia is now 11:51:04 gotta leave soon 11:51:15 in fact, need to shower in exactly 6 minutes. 11:51:41 * faxathisia thinks implicit nested lisp is very cool 11:52:00 (which always signifies a leave of course, since i rarely shower when i'm alone :P) 11:52:13 yeah, i think the expression syntax is great :o 11:53:16 it's not fully nested lisp, since you can still do stuff like 5+(+ 4-2 5*7)*3 11:53:55 i'm not actually sure whether you can just do infix alone with my current implementation... would be kinda sucky if you couldn't :P 11:54:19 although, the way you're supposed to use that, is by using infix for simple expressions, and sexps for the rest. 11:54:27 oh, right, it's not lisp, just sexp. 11:54:37 there's a term for it 12:03:47 okay, wtf... i have *not* written this code... 12:04:02 hehe 12:04:14 i was splitting a list by the last occurrence of an element 12:04:20 so... 12:04:36 l.index(reversed(s)), where s was what was used as the pivot 12:04:39 wtf xD 12:05:03 and l was the list to split 12:05:37 it's kinda sad if you can't do that with the built-ins in python :\ 12:05:51 i don't know of a way, but then again i don't know much built-ins 12:06:38 in general, i don't understand why there's always so little basic operations like this in the language 12:06:54 there's usually just map, reduce and filter, in some form 12:07:04 and a zip 12:08:32 plus, these are things that help you program, immensely in some cases, but they're very high-level, people will just use a less generic solution if something like that isn't supplied 12:08:58 i feel it's the language disegners duty to add more list support 12:09:05 i'm gonna mail the python people -> 12:09:38 * faxathisia doesn't really know python 12:09:49 "we already have that, in a module, idiot" "hey, no one in their right mind is gonna import a module." *no answer* 12:09:51 I just feel that I won't learn anything from getting good at python 12:10:22 well, after doing c++, python was a great relief 12:10:33 I can imagine :p 12:10:42 -!- sebbu has quit (Read error: 113 (No route to host)). 12:10:46 stuff that i actually carefully had to plan and write for days, is trivial in python 12:11:04 stuff that i actually *do* in python, i would never even imagine doing in c++. 12:11:50 you're a haskellor, then? 12:12:00 that might just be a guess 12:12:19 last program I wrote is in haskell 12:12:38 I wouldn't say that though, I still haven't found my language :) 12:12:38 what was that? 12:12:47 implementation of the reversible langauge Janus 12:12:51 ah 12:13:52 haskell gets a bit verbose with side-effectful stuff in my experience 12:13:59 but most likely i just suck. 12:14:41 i should try making something less opengl'y and i might actually learn it 12:15:10 first thing I did in haskell used OpenGL 12:15:40 or something where i actually have some experience with a language i know... i was doing a circuit drawing program 12:16:12 it gets quite complex if you make it good 12:16:16 I'm probably totally wrong so I'll phase this differently, 12:16:32 I just use haskell to write langauges 12:16:37 since it's great for that 12:16:51 (I was going to say that's what it's best for but I couldn't really know that) 12:17:27 i've actually found multiple favorite languages, erlang, K and haskell are probably the languages i'd most like to use daily 12:17:39 i've never even *tried* erlang/K though :P 12:17:43 haha 12:17:58 I think J is a bit like K.. I liked J a lot 12:18:03 yep 12:18:05 never actually looked at K 12:19:01 the funny thing is, i don't even like python really... 12:19:08 K owns 12:19:11 -!- Sgeo has joined. 12:19:17 Me neither ^_^ 12:19:23 and i just love erlang 12:19:32 Hi all 12:19:36 * Sgeo didn't get any sleep 12:19:38 yeah, but i program at least 100 lines of python every day :) 12:19:40 :( 12:19:58 * Sgeo should update some stuff on the PSOX spec 12:20:00 yesterday some 250 12:20:05 Have you read the doc about how erlang was conceived (via Prolog)? 12:20:13 nope 12:20:23 ah.. I'll see if I can find it, this is a great paper 12:20:25 do link, although i'm leaving now -> 12:20:40 Ok, WHY TF is MemoServ looking like it's replying in #haskell ? 12:21:29 http://www.erlang.se/publications/prac_appl_prolog.ps 12:21:59 * Sgeo goes to write an example for reading in a STRING and turning it into an LBYTES 12:29:02 -!- Hiato has joined. 12:29:34 Just stopping by for two things: Firstly, everyone, have a great new year! :D 12:30:13 Secondly: Full0.8tt.org is down (for reasons unknown to me) so use http://full0.freehostia.com 12:30:28 anyway, cheers 12:30:39 and have a good new year (if you haven't already ;) ) 12:30:45 -!- Hiato has quit (Client Quit). 12:35:03 +>,[<.>.,]. 12:35:16 -!- tejeez has joined. 12:35:22 Hi tejeez 12:35:23 +>,[<.>.,]. 12:39:39 And the reverse is: ,[,.,]. 12:40:14 ah I see 12:40:35 +>,[<.>.,].,[,.,]. = ,[.,]. ? 12:40:46 er sorry 12:40:50 of course not.. 12:41:01 I'd need to take the output from one into the other 12:41:16 -!- RedDak has joined. 12:41:28 oh, right, faxathisia: also wanna comment the spec :D 12:41:40 Note that the ",[,.,]." assumes there are no NULs in the body of the LBYTES. If there are, it can't exactly be turned into a STRING, because STRINGs are NUL-terminated 12:42:09 that was a question. 12:43:08 oklopol: It seems fine 12:43:19 good. 12:43:43 i'll add lists and suchas in the spec and make it my first esowiki donation 12:44:18 although it's not *that* esoteric 12:49:01 -!- tesseracter has quit (calvino.freenode.net irc.freenode.net). 12:49:01 -!- faxathisia has quit (calvino.freenode.net irc.freenode.net). 12:49:04 -!- puzzlet has quit (calvino.freenode.net irc.freenode.net). 12:49:05 -!- sekhmet has quit (calvino.freenode.net irc.freenode.net). 12:49:05 -!- Possum has quit (calvino.freenode.net irc.freenode.net). 12:49:05 -!- Sgeo has quit (calvino.freenode.net irc.freenode.net). 12:49:06 -!- oklopol has quit (calvino.freenode.net irc.freenode.net). 12:49:06 -!- bsmntbombdood has quit (calvino.freenode.net irc.freenode.net). 12:49:06 -!- GregorR has quit (calvino.freenode.net irc.freenode.net). 12:49:06 -!- cherez has quit (calvino.freenode.net irc.freenode.net). 12:49:08 -!- Overand has quit (calvino.freenode.net irc.freenode.net). 12:49:09 -!- RedDak has quit (calvino.freenode.net irc.freenode.net). 12:49:11 -!- pikhq has quit (calvino.freenode.net irc.freenode.net). 12:49:13 -!- dbc has quit (calvino.freenode.net irc.freenode.net). 12:49:14 -!- cmeme has quit (calvino.freenode.net irc.freenode.net). 12:49:14 -!- slereah_ has quit (calvino.freenode.net irc.freenode.net). 12:49:16 -!- lifthrasiir has quit (calvino.freenode.net irc.freenode.net). 12:49:16 -!- lament has quit (calvino.freenode.net irc.freenode.net). 12:49:16 -!- weilawei has quit (calvino.freenode.net irc.freenode.net). 12:49:16 -!- SimonRC has quit (calvino.freenode.net irc.freenode.net). 12:50:32 -!- Sgeo has joined. 12:50:32 -!- slereah_ has joined. 12:50:32 -!- faxathisia has joined. 12:50:32 -!- oklopol has joined. 12:50:32 -!- puzzlet has joined. 12:50:32 -!- cherez has joined. 12:50:32 -!- bsmntbombdood has joined. 12:50:32 -!- GregorR has joined. 12:50:32 -!- dbc has joined. 12:50:32 -!- tesseracter has joined. 12:50:32 -!- SimonRC has joined. 12:50:32 -!- weilawei has joined. 12:50:32 -!- cmeme has joined. 12:50:32 -!- sekhmet has joined. 12:50:32 -!- lifthrasiir has joined. 12:50:32 -!- Possum has joined. 12:50:32 -!- Overand has joined. 12:50:32 -!- lament has joined. 12:51:09 -!- RedDak has joined. 12:51:09 -!- pikhq has joined. 12:53:46 re 13:46:14 -!- jix has joined. 13:50:23 Is (.*?)((?<=(?:[^\x00]|\A)(?:\x00\x00\x00)*)\x00)) an expensive regex? 13:50:24 Hi jix 13:50:36 * Sgeo isn't even sure if that regex would work 13:50:42 But it looks expensive :/ 13:58:19 "look-behind requires fixed-width pattern" 14:06:12 * Sgeo comes up with what looks like a much simpler regex 14:06:19 ((?:[^\x00]|\x00{3})*)(\x00.*) 14:07:36 ((?:[^\x00]|\x00{3})*)(\x00.*)? 14:07:59 Nope 14:08:24 ((?:[^\x00]|\x00{2}.)*)(\x00.*)? 14:09:23 Close 14:11:42 ((?:[^\x00]|\x00{2}.?)*)(\x00.*)? 14:11:53 Since the ? after the . is greedy, that should work 14:11:57 * Sgeo hopes so 14:12:03 Tests seem to show that it works 14:18:55 * Sgeo changes it to ((?:[^\x00]|\x00{2}(?:.|\Z))*)(\x00.*)? 14:29:44 Bye all 14:46:23 -!- Slereah has joined. 14:46:51 -!- Sgeo has quit (Read error: 110 (Connection timed out)). 15:03:30 -!- slereah_ has quit (Read error: 110 (Connection timed out)). 15:19:03 -!- jix has quit (Nick collision from services.). 15:19:11 -!- jix has joined. 16:26:44 -!- oerjan has joined. 16:33:22 Oh hell. 16:33:40 One whole night, and the Mandelbrot has barely printed two lines. 16:35:36 Well, they're correct at least. 16:53:44 What do you mean correct? 16:54:16 Well, the first two lines are the same than the one on any BF interpreter. 16:54:35 ahh :D 16:54:55 I thought you were about to have computed the mandelbrot set or something (apprently) impossible like that 16:55:35 (I never read a proof of that which I understood though, so I can only assume the result is true) 16:56:06 Just the mandelbrot.b program. 17:09:32 -!- slereah_ has joined. 17:20:57 -!- RedDak has quit (Remote closed the connection). 17:27:20 -!- Slereah has quit (Read error: 110 (Connection timed out)). 17:50:53 -!- jix has quit ("Guten Rutsch!"). 18:42:11 -!- calamari has joined. 18:49:13 hello 18:49:16 -!- ehirdsleep has changed nick to ehird. 18:55:03 bf question: >*N[<*N...code...>*N]<*N is a common idiom, right? 19:16:48 oerjan: I think i'd be better off if i formally stated BF syntax then worked from that 19:16:53 +-><,. are verbatim 19:17:14 [ parses many, recursively, up to the first ] given to it 19:17:19 everything else is ignored 19:17:33 So. 19:17:44 parse :: String -> [BF] 19:17:53 parseLoop :: String -> [BF] 19:17:56 oerjan: I believe that is correct. 19:18:04 the problem is you were doing the ignoring in the wrong function, basically 19:18:13 oerjan: However, that involves the recursion stuff 19:18:26 where as you are saying the haskelly way is to return (one, whatsleft) instead of [all] 19:19:16 subparsers need to return what's left for the bigger parser to know where to continue 19:20:07 right 19:20:10 so 19:20:18 parse :: String -> [BF] 19:20:28 parseOne :: String -> [(BF, String)] 19:20:33 um no 19:20:40 returning only [] or [(one, rest)] 19:20:41 -> ([BF], String) 19:20:47 no, parse >ONE< 19:20:48 oh wait 19:20:54 and, parseOne "" = [] 19:21:03 so: parseOne :: String -> [(BF, String)] 19:21:13 parseLoop :: String -> [BF] 19:21:15 what about parseOne (']':_) ? >:) 19:21:24 no, wait 19:21:29 wait. i'll write this down 19:21:56 there is an alternative. -> (Maybe BF, String) 19:22:19 You could extract the haskell code from http://d.hatena.ne.jp/ku-ma-me/20070813 19:22:29 oerjan: isn't Maybe for fails? 19:23:33 sure 19:23:56 and that parseOne "" would be a failure 19:24:09 i guess so 19:24:17 but it'd be a failure guaranteed to happen every parse :-) 19:24:24 http://hpaste.org/4733 this is right 19:24:36 hm, should i write it top-down like that? 19:24:40 or should i do it down-up 19:24:41 but the subtle point is not _that_ case, but the case " ]..." 19:24:57 hm yes 19:25:00 since parseLoop will not see it 19:25:11 instead parseOne will and signal an error 19:25:15 that is puzzling, oerjan. 19:25:26 something like let bf '<' = [BFBack] ; bf '>' = ... ; _ = bf _ = [] in concatMap bf 19:25:38 the Maybe version works better then 19:25:56 you can return (Nothing, rest) for failure 19:26:10 i think my brain is being haskellstretched here 19:26:22 BFBack? 19:26:24 oh 19:26:25 i see 19:26:30 and then parseLoop will know that no command was found, but it might still be that it has reached a ] 19:26:53 [19:27:13] concatMap f = foldr ((++) . f) [] 19:26:57 i don't think i get that 19:27:07 concatMap f lst 19:27:08 is 19:27:13 map f lst 19:27:17 joined together with ++ 19:27:19 am i right 19:27:22 concatMap = concat . map 19:27:36 the Prelude definition is just concatMap f l = concat (map f l) 19:27:43 wow, a whole 2 keystrokes saved, faxathisia 19:27:47 (report that is) 19:28:06 =<< saves more 19:28:25 (That is how I'd do it http://rafb.net/p/DnYi0s42.txt ) 19:28:42 (Which is probably horrendously slow or something) 19:28:43 faxathisia: that won't work for loops 19:28:51 I know 19:28:56 I only did +-<> 19:29:59 uhh i can handle non-loops just fine 19:30:27 however, that definition does look quite elegant 19:30:29 so i shall expand on it 19:30:29 ehird: that paste looks fine 19:30:49 and i usually do top-down too 19:30:51 oerjan: Q: is faxathisia's even capable of handling loops? 19:31:05 a concatMap on single characters? no. 19:31:11 ehird: No, I only did +-<> 19:31:30 oerjan: yes good point :p 19:31:32 add to data , BFWhile | BFEnd or something 19:31:39 faxathisia: that's not parsing 19:31:40 that's lexing 19:31:47 if you want BFLoop [BFStmts] 19:31:50 and seperate parsing/lexing is archaic 19:32:06 then I (personally, though it may not be the best way), you would lex and parse seperately 19:32:14 s/you // 19:32:28 what do you mean archaic? I found it to simplify code a lot 19:32:45 it's 70s-style 19:32:52 hehe 19:32:56 Is that bad? 19:33:04 oerjan: http://hpaste.org/4733 parseMany is actually superflous isn't it? 19:33:23 since it would not be useful to parseOne or parseLoop, and parse can replace 'outer' usages it might have 19:33:24 should be identical to parseLoop 19:33:28 no 19:33:30 parseLoop handles ] 19:33:36 I mean you can always go parse = parseLoop . lex 19:33:49 oerjan: parseLoop isn't about haskell loops 19:35:10 i had the idea you could pass a Bool that told if you were inside a loop or not 19:35:15 then you can unify them 19:35:29 and the caller no longer needs to check 19:36:03 oh, passing a boolean 19:36:08 that's what my scheme code does 19:36:09 but.. 19:36:13 it's kind of unhaskelly. 19:36:16 imo. 19:36:18 it just looks ugly. 19:36:19 parse :: String -> [BF] parse "" = [] parse s = p:(parse s') where (p, s') = parseOne s 19:36:24 hmm, pretend that's 3 lines 19:36:43 hm wait, i don't check for Maybe BF there 19:36:54 wait, that's OK 19:36:59 because it'll never occur 19:37:04 so parseOne :: String -> (BF, String) 19:37:10 i think it is easier to have parseMany and parseLoop separate then 19:37:22 parseLoop would call parseMany 19:37:32 wait, it might 19:37:34 I do need Maybe 19:37:38 and itself just do the boundary [ ] checking 19:38:23 note that Maybe is almost the same as my suggestion to parse comment chars into NOPs 19:38:29 oerjan: parseMany would see the ] and say 'HAY UNBALANCKD' 19:38:31 parse :: String -> [BF] parse s = case parseOne s of (Just p, s') -> p:(parse s') _ -> [] 19:38:37 it's just that the NOP is not included in the BF type itself 19:39:34 ehird: the problem with doing that is you duplicate code 19:39:43 instead, let parseMany do no checking 19:39:52 oerjan: so how do i choke on unbalanced ]s 19:39:58 and let the caller check the boundaries 19:40:43 parseLoop calls parseMany and checks that the remainder starts with ] 19:40:55 parse calls parseMany and checks that the remainder is empty 19:41:33 parseOne ( _ :s) = (Nothing, s) 19:41:35 that is right? 19:41:50 um... 19:41:56 just asking. 19:42:01 otherwise comment handling could f up 19:42:17 you could let parseOne skip comments 19:42:27 parseOne ( _ :s) = parseOne s 19:42:38 so, the only time i use Nothing is: 19:42:39 parseOne "" = (Nothing, "") 19:42:51 also for ] 19:42:59 but only those two 19:43:44 ok 19:44:05 parseOne ('[':s) = 19:44:22 btw it may be more efficient for parseMany to collect the commands in reverse, tail recursively. Parsec's many uses this trick to avoid stack blowup 19:45:15 ehird: = parseLoop s, essentially 19:45:50 KRRR! Wrong! 19:45:55 pparseLoop :: String -> ([BF], String) 19:46:00 parseOne :: String -> (Maybe BF, String) 19:46:12 hm right a little wrapping needed 19:46:32 i don't see how i can stuff [BF] into a Maybe BF 19:46:33 :D 19:46:44 ergo: my parser architechture is b0rketh! again! 19:46:58 * oerjan hopes you're joking 19:47:44 = let (bfs, s') = parseLoop s in (Just (Loop bfs), s') 19:49:27 oh 19:49:28 duh 19:49:28 of course 19:49:28 heh 19:50:04 parseOne (']':s) = fail "KRRRRRRRRRRRRRRRRRR!" 19:50:19 er no 19:50:40 s/fail/error 19:50:49 especially not that 19:50:55 what then 19:51:07 = (Nothing, ']:s) 19:51:15 er, = (Nothing, ']':s) 19:51:46 ok, that spirals my current parse into an inf loop 19:51:48 :-) 19:51:50 parse "]" -> ..... 19:52:00 (Nothing, s') -> parse s' 19:52:03 that's why 19:52:13 oerjan: This is where parseMany comes in? 19:52:23 could be 19:52:27 :D 19:52:39 ok, base case: parseMany "" = ([], "") 19:52:52 fine 19:53:19 parseMany s = let (p, s') = parseOne s in p:(parseMany s') 19:53:23 + extra checking 19:53:51 parseMany s = case parseOne s of 19:54:00 (Nothing, ']':_) -> error "KRRRRRRRRRRRRRRR!" 19:54:02 right? 19:54:14 no!!! 19:54:18 :( 19:54:20 parseMany should _never_ check 19:54:50 it is called both by parse and parseLoop. it does not _know_ whether a ] or end-of-file is allowed 19:54:57 only the caller does 19:55:30 -> ([], ']':_) 19:55:48 er, not quite 19:56:02 whatever actually remains 19:56:30 parseMany :: String -> ([BF], String) parseMany "" = ([], "") parseMany s = case parseOne s of (Just p, s') -> let (p', s'') = parseMany s' in (p:p', s'') (Nothing, s') -> ([], s') 19:57:03 yay 19:57:23 i remember when type declarations scared me! :-P 19:57:34 it was the arg -> arg -> ... -> result, i got that when i got that everything was curried in haskell 19:57:44 -!- pikhq has quit (Read error: 110 (Connection timed out)). 19:58:49 oerjan: guess i'd better rework 'parse' for parseMany now 19:58:53 oerjan: confuzzling 20:01:48 parse :: String -> [BF] parse s = case parseMany s of (p, "") -> p ([], ']':_) -> error "KRRRRRRRRRRRRRRRRRRNK!" ([], _) -> error "wtf" 20:01:54 oerjan: i wonder when wtf occurs 20:02:20 hm indeed 20:03:15 oh well, time to write parseLoop i guess 20:03:44 *Main> parse "+]+<" *** Exception: /Users/ehird/Code/Frainbuck/Frainbuck.hs:(33,10)-(36,35): Non-exhaustive patterns in case 20:03:58 that's parse s = case parseMany s of 20:04:14 oh right 20:04:15 *Main> parse "+]+<" *** Exception: wtf ([Add 0 1],"]+<") 20:04:21 ofc 20:04:25 that first [] should just be _ 20:04:28 yep 20:04:43 now to figure out parseLoop 20:04:57 it'll look / a lot/ like parse 20:05:40 -!- pikhq has joined. 20:05:42 oerjan: then i'll use some kind of monad to do lines/columns 20:06:43 as you wish 20:10:13 oerjan: note to future self. functional parsers are not happy fluffy. 20:11:03 Parsec makes functional parsers good! 20:11:10 yes! but i'm not usinkg parsec 20:12:50 oerjan: http://hpaste.org/4734 20:14:04 hm... you don't need the parseMany "" case 20:14:12 correct 20:14:39 ok, now you teach me about the State monad! or whatveer i'm meant to use here 20:14:41 :D 20:15:25 ouch 20:15:36 tee hee 20:15:44 * oerjan wants to shout for Cale 20:16:04 i have you trap'd 20:16:14 There is a great doc a bout monad transformers you might use 20:16:18 although you _could_ still use the explicit Int passing from yesterday 20:16:30 http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.en.html 20:16:55 faxathisia: Optimus isPrime 20:17:09 lol 20:17:25 <_< 20:17:33 oerjan: not as pretty though 20:17:34 :P 20:17:38 you should consider using state transformer instead of state directly though I think 20:17:57 cause then you can use IO or whatever inside the middle if you didn't think you needed to before 20:17:59 StateTransformer Vehicle Robot 20:18:04 ok,. i'll stop with the transformer puns 20:18:59 well as long as you use the overloaded functions changing the monad later is easy 20:19:40 the main work is monadizing the code in the first place... 20:20:32 i'm scared 20:28:35 oerjan: i must know! :P 20:28:36 ehird: http://hpaste.org/4734#a1 20:28:46 just one function 20:28:59 without even looking more it's scary 20:28:59 :P 20:29:11 anyway, i dont' see how i can plug two ints into that 20:29:15 :| 20:29:35 you start by changing to type MM = State (Int,Int) 20:30:13 then your monadic code can use the put/get commands to get the tuple 20:30:28 *to access 20:30:42 what does MM stand for? 20:30:43 and what would an example parseOne look like? 20:30:55 MyMonad :) 20:31:23 groan 20:31:24 :P 20:31:32 well without the line/col handling most of the lines would just add a return 20:31:39 so what would parseOne look like? 20:31:39 i'm betting: ugly 20:31:45 with linecol 20:32:14 i think you would want to add a helper function 20:32:24 oh dear 20:32:24 :P 20:32:37 hm actually... 20:34:56 most of the lines would need to advance the column by 1, so make a helper function for doing that and returning the argument 20:35:27 oerjan: do you think this is cleaner than shoving around l and c? :) 20:36:35 well the alternative is adding a lot of extra parameters 20:36:44 just l and c 20:36:47 that's 2 20:37:52 hm 20:37:56 addOneColAndSucceed 20:37:58 that's an ugly name ;) 20:38:12 yeah a bit long 20:38:28 but anyhow here's how to define it: 20:38:47 oh i meant for my parameter passing 20:38:48 :| 20:38:53 do you think i should use a monad? 20:39:08 addOneColAndSucceed result = do addOneCol; return result 20:39:28 addOneCol = do (l,c) <- get; put (l,c+1) 20:39:48 ok fine! i'll go with monads :P 20:39:57 hmm, LineColumnMonad? 20:40:01 that's a crap name :P 20:40:14 LineColumnMonad for BF? 20:40:25 oerjan: parse is still String -> [BF] right? 20:40:27 faxathisia: for error reporting 20:40:30 actually there's a simpler definition: 20:40:39 addOneCol = modify (second (+1)) 20:40:40 oo 20:40:54 though you need import Control.Arrow for second 20:40:55 faxathisia: this is meant to be the #1 ideal every-optimization multiple-backend brainfuck compiler :-) 20:40:58 * faxathisia is now confused why you aren't using Parsec 20:40:59 we need nice things! 20:41:10 because it would report [abc at EOF not the position of the [ 20:41:22 yeah i imagined parse would be outside the monads 20:41:24 oerjan: how can i import that? 20:41:28 should i just import second? 20:41:30 or just all of it 20:41:39 you can annotate your datatypes wityh the column positions 20:41:41 (with parsec) 20:41:44 import Control.Arrow (second) if you want just that 20:42:29 oerjan: got a better name fort aOCAS? 20:42:53 also, how do i get the monad implicitly passed to addOneCol? 20:42:56 that is, what is their types 20:43:06 addOneCol :: MM () 20:43:20 i see 20:43:21 addOneColAndSucceed :: a -> MM a 20:43:26 so i implicitly grab the caller's monad? 20:43:32 figuratively 20:43:48 well to be completely general: 20:44:43 addOneCol :: (Num b, MonadState (a,b) m) => m () 20:44:45 i think 20:45:03 i uh think i'll stick to my definition 20:45:04 hehehe 20:45:08 what's => 20:45:15 that's the type that would be inferred 20:45:42 => separates class contexts from the type proper 20:45:57 oh-kay 20:46:03 i have learning to do 20:46:04 :-) 20:46:11 it's a good thing a bf compiler will be mostly functional 20:48:19 oerjan: got a bettter addoM-/andsM-/ name? 20:48:48 hm... 20:48:59 shifting? 20:49:28 shiftOneing 20:49:29 :P 20:49:33 don't think so 20:49:42 advancing? 20:50:10 it only advances one though 20:51:47 hm... my idea was that it should be short since you need to add it to all those lines 20:52:09 good point 20:52:14 advancing it is 20:52:33 LineColumnMonad is a bit verbose too 20:52:52 (i wouldn't care but most haskell code i've seen has been very concise [but still readable]) 20:52:58 and plain advance for the places you just pass a [ or so 20:53:13 should you not put spaces in tuple seperators? 20:53:28 er very optional 20:53:38 talking about style here 20:54:08 probably 20:54:20 a bit air never hurts 20:55:02 probably put them in or probably not 20:55:09 'cause ghci prints them -- and lists -- without spaces 20:55:51 hm right the official show definitions don't use them 20:56:45 but neither does it use newlines... 20:56:54 haha, that is a good point 20:57:16 oerjan: i'm goign for LineColumnMonad since i cannot think of something smaller 20:57:31 Plus I have M-/ 20:57:32 :-) 20:57:56 very well 20:58:02 hm... 20:58:04 Parser 20:58:23 not really a parser monad though 20:58:26 it doesn't hold parser stuff 20:58:29 indeed 20:58:48 PosMonad 20:59:59 YAEY 21:00:24 i'm suprised haskell is implementable, actually 21:00:28 let alone compilable 21:00:35 Why? 21:00:46 it's got more 'oh-god-how-can-you-implement-that-sanely' stuff than oklotalk 21:00:49 just really powerful stuff 21:01:10 oh yeah 21:01:16 lazyness keeps freaking me out 21:01:40 isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack) 21:01:41 this is insane 21:02:05 like in any strict language.. that would be ridiculous 21:02:25 I think it's got the same complexity as any dynamic programming version you'd do in a strict language though 21:02:35 laziness at first made me thought they had intelligent gnomes compiling it 21:02:41 'ah, we need to evaluate just this bit!' 21:02:58 in a particle accellerator, which is why its' fast :-) 21:03:08 complete laziness isn't that hard 21:03:14 yeah 21:03:23 but it appears it, before you study it low-level 21:03:36 i.e. continuations are 'WTF' until you just think: 'copy of the call stack' 21:05:52 do advance; return x 21:05:56 is there a nicer way of writing that? 21:05:59 i.e. without the ; :-) 21:06:03 well, without adding a new line 21:06:08 because that just makes it very thin 21:06:17 @undo do advance; return x 21:06:21 advance >> return x 21:06:30 @help 21:06:36 oerjan is a cyborg lambdabot! 21:06:41 I AM NOT LAMBDABOT 21:06:46 that was pure coincidence 21:06:50 lol! 21:06:52 suuuure 21:06:52 CYBORG 21:09:19 oerjan: i never need advance on its own 21:09:25 so i'm refactoring it into advancing 21:09:36 wait, did i just say refactoring when talking abotu haskell 21:09:40 please forgive me 21:09:46 no need 21:09:53 uh haskell is great when you refactor 21:09:56 no need for what 21:10:01 faxathisia: yes, but the terminology :-) 21:10:05 for forgiveness 21:10:15 Haskell is in fact, 100% Enterprise Ready 21:10:19 i think Philippa used it just earlier today 21:10:26 * ehird tries and figures out where 'where' should go to satisfy the compiler's rules 21:10:34 well someone on #haskell did 21:10:38 I usually use 2 spaces but I'm probably weird 21:10:45 well I wrote a brainfuck parser anyway, would you like to see it? 21:10:50 (It's kind of stupid) 21:10:54 Forthers say 'factoring' because forth is so awesome they only ever have to do it once! ;) 21:11:00 faxathisia: maybe. 21:12:13 so, oerjan, how do i retrieve (line, col)? 21:12:18 get 21:12:22 yaey 21:12:27 (line, col) <- get 21:13:39 * oerjan thinks ehird must have used monadic (probably IO) code before, things seem to go easier than he expected 21:14:03 eh, i've used it for the toy read-line-then-print-one stuff in YAHT 21:14:08 so i was familiar with the basic syntax 21:14:15 but i didn't have trouble in the first place :-)_ 21:14:42 i guess that syntax may somehow be the _most_ familiar part of haskell to some 21:14:42 http://hpaste.org/4735 my error message generating code is fugly :) 21:14:57 i should have a reportError function 21:15:00 so i would do: 21:15:05 reportError "Unmatched [" 21:15:08 and it would add that stuff 21:15:48 indeed, so just take that do expression and refactor it :) 21:15:54 say, oerjan, if parseMany returns monad stuff, how do I wrap it out of that in parse? 21:16:27 right. that is Monad specific 21:16:49 in this case, runState or evalState 21:16:58 i'm, uh, excited 21:16:58 which 21:16:58 :P 21:17:17 depends on whether you need the line/col at the end 21:17:24 well you probably shouldn't 21:17:25 nope, not right now 21:17:27 so evalState 21:17:42 evalState (parseMany s) -> tuple? 21:17:53 drop the parens 21:18:05 oh wait no 21:18:14 i mean add the initial (line, col) 21:18:20 hey, i'm using monads now - so i can use 'fail' 21:18:22 right? 21:18:24 in reportError 21:18:25 indeed 21:18:28 although, parse uses fail 21:18:34 Wouldn't use throwError? 21:18:39 can i partly use monads in a function? 21:18:44 and then return an unwrapped value 21:18:51 throwError doesn't take a String 21:18:52 faxathisia: ? why 21:19:03 oh I'm sorry 21:19:04 i mean, it's failure if there are unmatched []s 21:19:08 fail = throwError . strMsg for most error monads 21:19:10 not something you can recover from or anyting 21:20:13 sure some monads can be unwrapped 21:20:18 like State 21:20:22 yaey 21:20:40 so if i have some code with fail calls etc in and then want to unwrap the state and return that, what's my approximate skeleton? 21:21:10 um what do you mean, fail is monadic 21:21:13 yes 21:21:19 what i'm saying is 21:21:26 'parse' ,the top-level parsing function 21:21:33 you said would just return [BF] probably, outside of the monads 21:21:41 if you want it to 21:21:42 but it does the unmatched-] checking 21:21:52 which will use my reportError 21:21:54 which will use fail... 21:22:08 yep so do that checking still inside the monad i guess 21:22:28 so what would my code skeleton look like? 21:22:32 hm... 21:23:14 (to mirror fail, i have reportError :: PosMonad => String -> PosMonad a -- that is right?) 21:23:37 parse s = flip evalState (1,1) $ do (p,s) <- parseMany 21:24:09 oerjan: now THAT is haskell 21:24:22 but where's my 'case' to handle errors 21:24:22 :-) 21:24:28 case s of (_, "") -> return p 21:24:46 argh 21:24:55 case s of "" -> return p 21:25:08 right i get it now 21:25:36 grr, i do hate 80-columns 21:25:40 i just used the flip to avoid putting the whole do in parentheses :) 21:26:07 the worst part of being over 80 columns: 21:26:11 i'm only 1 over 21:26:22 well you can shrink the width 21:26:23 this is the problem with off-side languages :P 21:26:42 ofc why i'm sticking to such an archaic limit nobody knows 21:26:53 the do doesn't need to be on the same line as $ 21:27:09 good point 21:27:17 * faxathisia usually sticks the $ directly under the = 21:27:22 there, that's nice 21:27:26 (actually there are many ways of rearranging it) 21:27:58 The last statement in a 'do' construct must be an expression 21:28:04 blargifarg 21:28:15 that's from 21:28:17 oh 21:28:17 How about, return $ case s of "" -> p 21:28:18 my indentation 21:28:24 off by ONE 21:28:32 faxathisia: he want fail inside the case 21:28:34 faxathisia: can't, need that unwrapping stuff 21:28:36 *wants 21:28:42 WHich fail? 21:28:48 well, syntax 21:28:49 for the other option 21:28:49 err 21:28:52 parseError 21:28:53 :-) 21:28:57 oh I didn't know there wa snothe 21:28:58 whcih uses fail 21:29:24 i didn't finish the function because ehird said he got the rest 21:29:24 now to figure out parseOne ('\n':s) = 21:29:27 oh, that's simple 21:29:44 modify (first (+1)) :-) 21:29:53 er not quite 21:30:00 you also want to reset the column 21:30:10 err, ok 21:30:11 yes 21:30:12 :-) 21:30:17 modify (\(l,_) -> (l+1,1)) 21:30:32 or wait... 21:30:33 wow, er, that's impressive.. i didn't know you could patternmatch lambdas 21:30:39 oklopol: you'd like that! 21:30:49 modify ((+1) *** const 1) 21:30:57 damn 21:30:59 what's *** 21:31:00 if you like the arrow operators :) 21:31:16 another Control.Arrow thing 21:31:21 qwiz: 21:31:28 parseOne ('\n':s) = do modify ((+1) *** const 1); return (parseOne s) 21:31:31 remove the ; 21:31:35 let me try... 21:31:37 f *** g = first f >>> second g by default 21:31:55 parseOne ('\n':s) = modify ((+1) *** const 1) >> parseOne s 21:32:12 er, return (parseOne s) 21:32:13 JACKPOT 21:32:42 Not in scope: type constructor or class `State' 21:32:44 ono 21:32:49 what do i need to import? :P 21:33:15 hm, i wonder if ghc can tell me 21:33:29 eh i'll guess 21:33:31 Control.Monad.State 21:33:40 YOU WIN AGAIN 21:33:43 :D 21:34:15 although lambdabot's @hoogle and @index would also work 21:34:16 Type constructor `PosMonad' used as a class In the type `(PosMonad m) => String -> m a' 21:34:21 i guess i need Monad m, right? 21:34:28 no 21:34:29 (for parseError, i based it on fail's type) 21:34:38 ok maybe 21:34:58 heh 21:35:08 i was just trying to make it PosMonad only 21:35:11 since it retrieves line,col 21:35:27 that would be just String -> PosMonad a 21:35:29 ah 21:35:33 thank you 21:35:33 :P 21:36:11 you also should have the option of using :t to ask what ghc infers as its type 21:36:32 (remove any declaration first) 21:36:59 hm: 21:37:01 _ -> parseError "Unmatched [" 21:37:03 gives me 21:37:04 Parse error in pattern 21:37:12 heh 21:37:22 previous 2 lines: 21:37:25 parseLoop s = do (p, s') <- parseMany s 21:37:25 case s' of ']':s'' -> return (p, s'') 21:37:32 with correct indentation 21:37:32 heh 21:38:09 and _ is directly under ']' ? 21:38:15 (the ' that is) 21:39:01 bastard 21:39:03 one character off 21:39:19 there should be a haskell-blinkenlights-mode 21:39:24 that blinks red things like that 21:40:12 Couldn't match expected type `(Maybe BF, String)' against inferred type `PosMonad (Maybe BF, String)' In the first argument of `return', namely `(parseOne s)' 21:40:18 talking about: 21:40:19 parseOne ('\n':s) = modify ((+1) *** const 1) >> return (parseOne s) 21:40:29 oh. drop the return 21:40:57 i did 21:40:59 parseOne is already monadic 21:41:07 oh 21:41:09 then it gives me 21:41:14 another error ,tjat looks the same 21:41:14 doh :-) 21:41:22 parseOne (_:s) = advancing (parseOne s) 21:41:27 obviously i need some kind of trick here 21:41:47 advancing () >> parseOne s 21:41:57 you needed advance anyhow :) 21:42:33 oerjan: no use of advance there 21:42:42 advance = advancing () 21:42:48 essentially 21:42:52 ah, good point 21:42:53 ok then 21:43:17 Loading package mtl-1.0 ... linking ... done. 21:43:20 WHAT DID IT DO THERE :O 21:43:35 monad transformer library 21:43:41 :O 21:43:43 includes Control.Monad.State 21:43:45 anyway, my parser works brilliantly 21:43:54 yay 21:44:20 a clear, monadic-error-handling, 43 line brainfuck parser in nice-looking haskell 21:44:29 it should be required reading 21:44:29 :P 21:44:35 ah well you've really beaten me 21:44:39 well, this line looks a bit ugly: 21:44:41 Let's see? 21:44:43 fail (x ++ " at line " ++ (show line) ++ ", column " ++ 21:44:44 (show col) ++ ".") 21:44:49 because of the (show col) ... line 21:44:52 ok, faxathisia 21:45:00 i'll jsut paste ll my current code 21:45:05 you don't need the parentheses around (show col) 21:45:26 and you can replace the ones after fail with $ 21:45:50 what about show line 21:45:52 are its parens needed? 21:45:57 no 21:46:22 ok then 21:46:26 http://hpaste.org/4739 21:46:31 note, i didn't count lines before "type PosMonad = ..." 21:46:35 since that's the parser bit 21:49:09 oh wait 21:49:31 it ends early? 21:49:32 parseError "Unmatched [" 21:49:47 nope 21:49:52 that's the whole parser 21:50:14 there are still some errors in the line/col handling 21:50:20 yes oerjan 21:50:25 *Main> parse "]" *** Exception: Unmatched ] at line 1, column 2. 21:50:37 shall I annotate mine? 21:50:37 this is because i advance while still doing ']':s 21:50:42 i just need to replace advancing with return 21:50:45 faxathisia: sure 21:50:52 right that's the first error 21:51:00 the other? 21:51:14 http://hpaste.org/4739#a1 21:51:20 actually... 21:51:33 you are failing to advance on [ where you should 21:51:42 __ = __ -- This entire file is sort of stupid 21:51:45 what the HELL is that, faxathisia 21:51:48 it scares me 21:51:51 i think it's supposed to 21:51:52 lol 21:51:57 also jeez 21:52:05 *Main> :t let __ = __ in __ 21:52:06 let __ = __ in __ :: t 21:52:11 your code looks like what someone who saw yacc output tried to write in a cleaner form in haskell 21:52:26 oh jeez you use parsec 21:52:57 also mine has more optimization slots in the types 21:52:58 :P 21:53:09 Mine doesn't even optimize correctly 21:53:15 It does a half assed job and gives up 21:53:28 mine does no optimization... just is possible to 21:53:33 i'm going to write a backend first, THEN optimize 21:54:07 ehird: in the loop code you don't advance on [ and ]. moreover i think the unmatched error will give the end-of-file position 21:54:08 oerjan: for various section headers of my compiler, should i use {- Optimization -}? 21:54:11 i.e. multiline comment 21:54:22 why not 21:54:30 you are right about the unmatched EOF 21:54:31 :( 21:54:46 parseError needs to take params 21:55:02 actually 21:55:07 how do i remember the position in the first place 21:55:10 :| shit 21:55:23 with get 21:55:34 oh. yes. 21:55:39 i need to do it in parseOne though 21:55:41 otherwise i'd have to -1 21:55:47 hm? 21:55:53 wait, no 21:55:54 you are right 21:56:02 blargh, parseLoop needs to call advance 21:56:21 golly, 'do advance\nstuff' looks ugly :-) 21:56:42 parseLoop s (PosMonad (l, c)) -- right? 21:56:50 called as parseLoop s get 21:57:11 huh? 21:57:35 no 21:58:18 just do the get inside parseLoop i think 21:58:32 oh, right 22:02:37 oerjan: faxathisia: http://hpaste.org/4724#a1 all good 22:02:42 apart from the 'advance' line on its own 22:02:47 doesn't look very good 22:02:47 :P 22:04:19 well you can sneak it before parseMany with >> 22:04:26 assuming you still don't like ;'s 22:04:52 that's actually a good idea 22:05:01 since i am getting the result of an advance-parse 22:05:02 or something 22:05:06 i think you still have one advance too little 22:05:11 for the final ] 22:05:21 yep 22:05:25 *Main> parse "[][" *** Exception: Unmatched [ at line 1, column 2. 22:05:36 fixed 22:06:12 oerjan: http://hpaste.org/4724#a2 tada 22:06:20 i really like that code 22:06:29 it's the cleanest code i've ever written, methinks :P 22:06:33 i like haskell, i think 22:07:55 oerjan: for the backend stuff 22:08:07 i'm going to make a: Target String, type 22:08:11 and write things like 22:08:21 compile (Target "C") p = ... 22:08:30 compile (Target "i386") p = ... 22:08:33 or is that yuck :P 22:09:00 oh not necessarily 22:09:16 some people would even define datatypes for Line and Col 22:09:39 prevents them being mixed up with other kinds of Ints 22:09:47 or each other 22:09:49 yeah, i think that's not very important 22:09:57 i was just thinking about Target only having a string 22:10:01 instead of like 22:10:06 data Target = C | I386 22:10:07 or something 22:10:15 maybe the latter would be preferable 22:10:16 That seems better 22:10:27 you don't have to go compile (Target _) = error 22:11:02 class Target a where ...; instance Target C where... :) 22:11:10 haha, oerjan wins i think 22:11:46 oerjan: is there a haskell command-line option parsing lib? 22:11:52 that allows the code for a given target to be kept together 22:12:00 yes 22:12:08 System.Console.GetOpt, iirc 22:12:23 is it anything like gnu getopt? SAY NO :P 22:12:35 based on.. 22:12:41 faxathisia: aieeeeee 22:12:50 "This library provides facilities for parsing the command-line options in a standalone program. It is essentially a Haskell port of the GNU getopt library." 22:12:51 it seems to work ok though 22:12:58 how cRUEL 22:13:16 oh wow that example is ugly :| 22:13:30 you also have getArgs for doing it your own way :) 22:13:42 oerjan: yes, but option parsing is non-trivial :P 22:13:45 --longarg=x 22:13:47 --longarg x 22:13:51 -s x 22:13:53 -sx 22:13:53 etc 22:14:01 -- --literal 22:14:06 - --also-literal 22:14:40 that sounds like "option parsing is non-trivial if you want to be GNU-compatible, and I hate GNU, so I want that" 22:14:50 haha 22:14:57 well, gnu long options can be useful :| 22:15:03 i just hate gnu getopt's C interface! 22:15:03 it's horrid 22:15:13 admittedly though if i use an option a lot i use its short form 100% 22:15:24 really i'll only have two options 22:15:29 --arch and --output 22:15:31 aka -a and -o 22:15:43 oh well the haskell interface may be different 22:15:55 looked a bit crazy 22:15:55 but OK 22:16:09 hm, damn: i will need to write a mapping of name->class 22:16:23 oerjan: hashtable/map/whatever String->uh...ClassClass 22:16:26 er 22:16:27 InstanceClass 22:16:28 :-) 22:16:30 no wait 22:16:32 String->Target 22:16:33 i think. 22:16:42 what's the shortest syntax to create one? i don't know of any 22:17:05 deriving Read -- I guess 22:17:25 * oerjan points at Data.Map 22:17:37 actually 22:17:40 shouldn't i just do 22:17:46 targetFor "c" = C 22:17:49 Yes 22:17:50 hm oh that may be awkward for classes 22:17:53 targetFor "i386" = I386 22:17:53 but that's not the shortest :p 22:18:00 faxathisia: i can do a case 22:18:07 targetFor n = case n of 22:18:16 what you just wrote is better than a case imo 22:18:44 i guess, but it's not really pattern matching is it? so maybe it's not appropriate(oerjan?) 22:18:53 it is pattern matching 22:18:53 hmm, /me wonders how to downcase a string 22:19:00 targetFor "C" == targetFor "c" :-) 22:19:07 map toLower 22:19:21 (Data.Char) 22:19:26 oerjan: for that i do need a case don't i 22:19:30 i can't do that in a pattern match 22:19:32 without a guard 22:19:33 It's a nested pattern match like Cons 'i' (Cons '3' (Cons '8' (Cons '6' Nil))) 22:20:13 targetFor :: String -> Either String Target -- that's right if i want to return a "Unknown target", yes? 22:20:18 lookup (map toLower t) [("c",C),etc.] 22:20:28 using a list 22:20:30 Unknown String 22:20:33 hm 22:20:35 in your data ? 22:20:36 a case seems nicer to me 22:20:45 faxathisia: huh? 22:21:32 Either is fine 22:21:45 indeed it's a monad, with fail = Left 22:21:57 Hm you know I'll just use 'fail' 22:21:59 much simpler 22:22:00 :P 22:22:05 Hmm 22:22:09 But what monad would that be! 22:22:17 ANd why is a function called targetFor being monadic! 22:22:24 Much better: 22:22:27 Maybe Target 22:22:33 OK so maybe is a monad 22:22:36 :< but hey 22:22:38 Maybe is a monad too, with fail = const Nothing :D 22:22:54 data Target = C | I386 | Unknown String 22:23:02 faxathisia: ew, no 22:23:02 but I would just error .. I mean what else are you going to do ? 22:23:10 targetFor :: String -> Maybe Target 22:23:14 why is that ew but Maybe isn?T 22:23:14 targetFor n = case map toLower n of 22:23:18 "c" -> Just C 22:23:19 _ -> Nothing 22:23:26 faxathisia: eh, because it's not about the type 22:23:27 I would make it targetFor :: String -> Target 22:23:28 it's about the function 22:24:23 Maybe is fine 22:25:29 oerjan: class Target a where 22:25:34 do i put my type declarations in there? 22:29:45 :| 22:29:54 um 22:30:23 no, method declarations 22:30:42 ok, you lost me 22:30:53 i know haskell's class/method/instance isn't real OOP, it just shares the names 22:30:55 so: do explain 22:31:41 class Target a should declare the types of the functions that every instance of Target needs to define 22:31:53 oh, i may have misunderstood you 22:32:19 it's similar to Java interfaces 22:32:41 java, don't say that in front of me 22:32:45 however, i get your point 22:33:06 i don't /quite/ see ow i'm going to distinguish between different target's functions thoiugh 22:33:09 You don't like Java??? 22:33:25 you may use data instead if you like 22:33:48 the difference is how the definitions for each target are grouped 22:33:55 (well, one difference) 22:34:20 with data, each function must be defined together, for all its targets 22:34:48 with class, each target must be defined together, with all its functions 22:35:03 i think perhaps i need an example 22:35:04 :-) 22:35:18 ouch 22:36:02 haha 22:36:04 i am evil 22:36:15 well, like that compile function you had 22:36:34 with data, you would define cases: 22:36:50 compile C prog = ... 22:37:13 compile I386 prog = ... 22:37:17 all together 22:37:32 ys 22:37:33 yes 22:37:39 hm wait 22:37:58 oerjan: ooh, one thing.. 22:38:06 is Char a unicode char? 22:38:09 yes 22:38:29 because the C backend could be outputting unicode C (which is a Good Thing)... but an i386 backend needs binary! 22:38:30 but most I/O functions truncate to 8 bits 22:38:33 So how should I define that in Target? 22:39:09 an encoding method perhaps? 22:40:02 confuzzled 22:40:36 i think maybe data is simpler for a start 22:41:09 aww 22:41:14 but class is nicer looking :P 22:41:32 a backend will always be generating either a tring or a binary string 22:41:39 i just need to encode that in compile's type 22:43:02 encoding :: a -> String -> String 22:43:12 where a is the class parameter 22:43:13 hmm 22:43:14 what does that do 22:43:29 shouldn't it be "compile" 22:43:33 wait, what DOES that do 22:43:35 what is 'encoding' 22:43:59 a final pass that encodes the String if necessary 22:45:03 excuse me, i'll be going out to watch the fireworks 22:45:08 is there a binary string type in haskell? 22:45:09 back in a while 22:45:14 hmm, wait, it should just be [Byte] 22:45:18 assuming haskell has [Byte] 22:45:45 actually Char is used for most simple I/O. for bigger things there is ByteString 22:46:02 which is not actually a list type, and extremely optimized 22:46:13 cu 22:47:38 bye :-) 22:54:42 so, where's this code that isbeing disgust 22:54:47 *discussed 22:54:52 *cussed 22:54:54 ;-) 22:55:21 in an emacs buffer 22:55:23 pointing to a file 22:56:26 right, so HTF are people looking at it? 22:57:17 SimonRC: my various pastes in here and to hpaste 22:58:00 * oerjan decides fireworks are highly overrated anyhow, especially when you've neglected to eat in advance 22:58:42 oerjan: write a haskell/libcaca (Are there bindings?) ascii-art-fireworks program 22:58:45 :P 22:58:55 generate the sounds algorithmically 22:59:12 only thing is by the time you can run it it'll be too late for fireworks... 22:59:17 -!- pikhq_ has joined. 22:59:41 ehird: I think that even foru your program it is worth using Parsec 22:59:56 SimonRC: it's already working 100% perfectly 23:00:02 and parsec would report unmatched [s at EOF 23:00:03 for clarity etc 23:00:06 not at the line/col of the [ 23:00:16 mine is perfectly ok looking :P 23:00:20 actually, you can make it work either way 23:00:26 meh, whatever 23:00:28 * oerjan still thinks you could fool parsec with try ... <|> ... somehow 23:00:28 it's done now. 23:00:46 Question: is there an unwords that instead does newlines? 23:00:59 unlines 23:01:06 strangely enough :D 23:01:16 HAPPY NEW YEAR!!!!!!!!!!!!!!!!!!!!!!! 23:01:34 -!- ehird has left (?). 23:01:42 -!- ehird has joined. 23:01:46 I spy a Scandanavian 23:01:55 where? 23:01:56 -!- pikhq has quit (Nick collision from services.). 23:01:59 -!- pikhq_ has changed nick to pikhq. 23:02:00 you cannot prove it! 23:02:03 oerjan: you, surely? 23:02:07 i could be - south african! 23:02:08 -!- ehird has changed nick to ehird`. 23:02:16 it is just that, 23:02:22 my c header etc 23:02:23 only people from wierd places like Scandanavia use TZ+0100 at this time of year 23:02:28 is multiple lines, and having \ns in one long line 23:02:30 o using ++ 23:02:32 would be ugly :-) 23:02:49 you mean SA is on daylight saving? 23:03:08 what? 23:03:19 we don't have daylight saving here 23:03:20 everyone on the net that is not American is Britsh or Scandanavian 23:03:22 now 23:03:24 there are no others! 23:03:40 :roll: 23:03:50 question 23:03:58 is it possible to 'save myself' from sigsegv in a c program? 23:04:07 i'm considering expanding the tape on segfaults :-) 23:04:15 which should be more efficient than checking every move 23:05:04 -!- pikhq has quit ("leaving"). 23:05:18 i know you can trap sigsegv 23:05:21 oh and btw it's scand-I-navian 23:05:23 but can you break back out of the handler to the program? 23:06:16 -!- pikhq has joined. 23:06:19 hmm 23:07:03 (because if so, that would be FREAKIN' AWESOME) 23:07:08 and the C code should be /really damn fast/ 23:07:17 whcih is the idea! 23:08:12 I am told that gdb can do it 23:08:21 i'm not gdb 23:08:24 :P 23:08:26 hm actually are you guaranteed that the sigsegv happens exactly when you go beyond the array boundary? what if you instead scramble malloc data first? 23:08:30 anyway gdb does crazy asm stuff 23:08:31 maybe grep the gdb sources for "SIGSEGV" 23:08:41 oerjan: hmm, i didn't quite understand 23:08:42 * oerjan has no actual idea 23:09:08 tape[345897345893] when tape is length 2 /should/ cause SIGSEGV 23:09:21 I assume that he is arranging to have an invalid page at the end of the tape 23:09:33 hmm 23:09:33 The library offers a rather nice "free" dynamic memory allocation feature for running brainfuck code. 23:09:33 It works through page protection mechanism and catching of SIGSEGV signals. 23:09:37 http://savannah.nongnu.org/projects/libbf 23:09:39 oh well if you can carefully align things... 23:09:49 SimonRC: as soon as i figure out how to do that. yep! 23:09:53 should just be powers-of-two 23:09:53 * oerjan already mentioned he has no actual idea, right? 23:10:15 this technique reminds me of the Cheney-on-the-MTA Scheme->C compilation stuff 23:10:31 you just let the stack grow and grow, and if you go too high, trash loads of stuff and continue 23:10:49 here, you jsut let the pointer grow and grow, and if you go too high and signal an error, expand the tape and continue 23:10:53 "just in time" 23:12:10 Actually a good way to cope would be to ask the OS to lazily mmap 16 EB of zeros 23:12:42 -!- pikhq has quit ("leaving"). 23:12:50 I think you can just ask linux to mmap /dev/zero for that effect 23:13:13 linux mmaps lazily 23:14:30 i run on os x, which is a bsd variant 23:14:40 bsd is very conservative, so i doubt tricks like that will work 23:14:50 (this is a good thing: i want portable code, to as big as degree as possible) 23:15:07 -!- pikhq has joined. 23:15:44 -!- pikhq has quit (Client Quit). 23:17:18 SimonRC: i'm wondering how i could really assure to as much a degree as possible that i have an invalid page at the end 23:17:22 i'm not sure just one trick will work 23:17:29 -!- pikhq has joined. 23:18:31 maybe you can ask something to be mmapped non-readable 23:18:35 I don't know really 23:19:59 seems so 23:20:01 if you haev int prot = 0 23:20:03 third arg 23:20:24 however, I don't know how to make it occur right at the end of the other thing 23:20:33 unless you can ask for an address 23:20:36 yes 23:20:40 oh dear... 23:20:41 * SimonRC goes 23:20:47 void * 23:20:48 mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset); 23:20:55 * SimonRC goes. 23:20:57 bye. 23:20:58 :) 23:21:10 wait, fuck, it's really almost 2008 23:21:18 2008. the number looks weird. 23:21:29 i might not release anything in 2008, just so i don't get that horrible number tied to it 23:22:00 bsmntbombdood: you know you said no code for libbf? 23:22:07 http://cvs.savannah.nongnu.org/viewvc/libbf/?root=libbf code, bitch. 23:22:59 http://cvs.savannah.nongnu.org/viewvc/libbf/libbf_interpreter_dynalloc.c?root=libbf&view=markup yow, that's some heavy stuff 23:26:19 -!- pikhq has quit (Read error: 104 (Connection reset by peer)). 23:27:26 ? 23:27:30 libbf? 23:27:35 -!- pikhq has joined. 23:27:49 bsmntbombdood: you said about it's dynamic allocation stuff 23:27:53 bsmntbombdood: using sigsegv 23:27:58 and said 'damn no code' 23:28:01 oh 23:28:04 cool 23:28:08 like a year ago :P 23:28:33 * bsmntbombdood orgasmums 23:28:51 holy crap that's a lot of code 23:31:59 1.6 megabytes?! 23:33:29 look at that one file i showed you... 23:33:34 that's the feature you were looking for 23:33:38 fukcing crazy code 23:33:40 i'll never understand it 23:33:46 it's like kernel code 23:33:49 well, more like libc code 23:33:52 like malloc or something 23:35:59 man 23:36:25 f addr is non-zero, it is used as a hint to the system. (As a conve- 23:36:25 nience to the system, the actual address of the region may differ from 23:36:25 the address supplied.) 23:36:29 fucking mmap 23:36:32 i don't want a 'hint' 23:36:35 that doesn't guarantee this will work 23:37:11 i might not be able to understand it 23:37:25 see what i mean :P 23:38:27 [ehird:~/Code/Frainbuck] % ./test 23:38:28 fuck: Operation not supported by device 23:38:33 that's what i get for doing perror("fuck") 23:39:39 bsmntbombdood: any other bright ideas for more speedy reallocation than just checkig all the time? :-) 23:40:13 catching sigv is the only way 23:40:20 *segv 23:41:13 bsmntbombdood: somehow i doubt it's possible to do the catching segv without that mass of crap :P 23:43:08 hm 23:43:11 gnu libc manual 23:43:11 size_t page_size = (size_t) sysconf (_SC_PAGESIZE); 23:43:13 is that portable? 23:43:59 fuck if i know