00:08:02 trying to come up with an idea........................................ 00:23:04 It's a slow day 00:27:46 "human imagination can always outstrip the capabilities of machines."? 00:35:43 -!- Corun has joined. 00:35:52 marshmallows: that's called "AI scares me" theory 00:36:00 hehe 00:36:13 maybe I should do something AI-ish 00:38:51 marshmallows: the suicide rate over there is quite high 00:38:59 i reccomend against doing anything ;) 00:39:23 ehird you should give me ideas for a logic lang ~_~ 00:45:37 cool stuff http://www.cs.ru.nl/~freek/comparison/comparison.pdf 00:47:50 marshmallows: make it have just amb and some other primitive stuffaelr 00:47:55 then implement the rest in the language 00:47:59 (make the syntax extensible) 00:48:12 the base of the self-hosted lib should ideally look like crazy stuff 00:48:23 err 00:48:24 arb 00:48:36 err 00:48:36 amb 00:52:54 oh 00:53:09 amb is implemented with call-with-current-continuation 00:53:26 and call-with-current-continuation is a specific case of the J operator? 01:03:35 wuz J? 01:03:41 post-composes a lambda expression 01:03:46 what does that, like, mea 01:03:47 n 01:08:39 marshmallows: amb is just a backtracking operator 01:09:02 amb(a,b,c...) means 'pick one argument from the ones i give you and return it' 01:09:08 you can't write amb without call-with-current-continuation 01:09:14 in scheme.. anyway.. 01:09:27 amb() means 'backtrack and try another argument to a previous amb. if we've tried everything on all of the ambs, yell about it and fail' 01:09:32 so e.g.: 01:09:50 foo = amb(1,2,3); if (foo < 3) then amb() 01:09:54 foo will end up being 3 01:10:09 since amb will backtrack until it doesn't get called with no arguments (or is out of arguments) 01:10:13 can you write amb in C with longjmp? 01:10:15 note that it will try every amb in scope 01:10:19 marshmallows: no. 01:10:23 why not? 01:10:29 it needs to call the continuation multiple times 01:24:02 marshmallows: hmm, my amb in scheme isn't working 01:24:02 very odd 01:24:30 show me? 01:24:43 marshmallows: only after you look at this: http://homepage.mac.com/sigfpe/Computing/continuations.html 01:24:45 continuations in C 01:24:46 very simple 01:24:46 I wrote a (stream based) Prolog in scheme the other day 01:25:14 * ehird writes amb with it 01:25:26 for integers ;) 01:25:31 hm wait 01:25:36 any type 01:25:36 :D 01:25:46 using a tagged union? 01:26:04 marshmallows: no, using a typedef 01:26:04 :p 01:26:08 hmm 01:26:11 heh ok 01:26:13 variadic functions in c must be at least one argument 01:26:35 how unfortunate, still, simple solution 01:26:41 define _amb and make amb a macro 01:26:45 a variadic macro, though, so c99 01:26:53 :( 01:27:00 #define amb(...) _amb(amb_dummy, __VA_ARGS__) 01:27:00 -!- timotiis has quit ("leaving"). 01:27:16 why not just call it amb(...) and fail(); 01:27:35 the main reason 0 arg amb is good is because of apply 01:27:36 marshmallows: because it's va_start(ap, last_param) 01:28:08 ah wait 01:28:10 first arg == arg count 01:29:06 marshmallows: but you're right 01:29:07 ok then 01:29:35 thats cool 01:29:38 the page you linked 01:29:41 yes 01:30:37 this is actually what goto is for though 01:32:04 goto <3 01:32:36 marshmallows: can't do this with goto 01:32:44 this jumps across stack frames, and is just like scheme's call/cc 01:32:49 recallable too 01:32:49 etc 01:32:58 you could implement scheme using the c-stack then use that to provide call/cc 01:33:21 so: very impressive, and practically useful too: schemes that go into c, into scheme, into c etc with their ffis generally only provide limited continuiations 01:33:24 with this you can provide full continuations 01:34:06 i = 2; 01:34:06 redo0: j = 2; i++; 01:34:07 redo1: j++; if(j > i) goto redo0; 01:34:07 if(i*j != 483) goto redo1; 01:34:18 marshmallows: that can't jump across stack frames. 01:34:23 ergo: no amb 01:34:24 it doesn't need to 01:35:04 I didn't mean goto is for implementing call-with-current-continuation 01:35:19 I meant that goto is useful for nondeterminism 01:39:21 marshmallows: i am modernizing the code in that article 01:39:23 :D 01:42:19 marshmallows: mmrhh, i hate handling malloc errors 01:42:29 i'm tempted to just make people define CONT_MALLOC_FAILURE 01:42:29 :( 01:42:36 huh? 01:42:40 or make them provide a procedure to call on malloc fail 01:42:40 ;) 01:46:03 marshmallows: heh, look at the exit(1) in that code 01:46:09 a true example of 'offensive programming' 01:46:53 I am considering replacing it with: printf("You SUCK! Go to HELL!\n"); exit(666); 01:47:01 lol 01:47:31 is that an else { /* this is impossible */ } ? 01:48:06 that's an else { /* the programmer told us to restore the last continuation without making one in the first place. i hope his corpse is eaten by maggots. he is so stupid. */ } 01:50:33 % ./amb 01:50:33 You SUCK! Go to HELL! 01:50:35 well jeez. 01:53:35 marshmallows: take a look at my code? 01:53:54 ok 01:54:01 http://rafb.net/p/Ry3AsE59.txt cont.h 01:54:19 http://rafb.net/p/D3uMKQ39.txt cont.c 01:54:32 http://rafb.net/p/beqVCL71.txt amb.c 01:54:35 compile like: 01:54:38 cc amb.c cont.c -o amb 01:56:54 :( 01:57:03 1*4 != 8 01:57:03 You SUCK! Go to HELL! 01:57:05 marshmallows: yep 01:57:09 no idea why that's happening 01:57:14 * marshmallows cries 01:57:22 as far as I can tell, the FAIL; in (argc == 0) should make it backtrack to the TRY 01:57:26 which pops an argument from arb's list 01:57:33 ah wait 01:57:35 need to argc-- 01:57:46 before the TRY 01:57:48 still happens though 01:59:25 get_context is returning NULL sometimes 01:59:31 marshmallows: yes 01:59:33 obviously 01:59:43 no, wait 01:59:44 cont_t *c = malloc(sizeof(cont_t)); 01:59:44 long tos; 01:59:44 if (!setjmp(c->registers)) { 01:59:45 it's gcont that's the problem 01:59:47 is suspect 01:59:49 gcont is sometimes NULL 02:00:01 gcont = get_context() 02:00:02 when we do our FAIL 02:00:07 which causes it to yell at us 02:00:40 marshmallows: this kind of code is almost impossible to reason about because it copies data to the actual stack 02:00:49 i don't think even gdb could handle it 02:00:58 hm 02:00:59 typedef struct _cont { 02:00:59 jmp_buf registers; 02:01:07 marshmallows: most of that shizz is from the article 02:01:09 i just cleaned up the code 02:01:10 oh sorry nevermind 02:02:07 pbos[-i] ? :S 02:02:19 I should read the whole thing .. 02:02:25 any single part of it looks wrong :p 02:02:29 marshmallows: the stack grows downwards 02:02:32 so that's 02:02:34 *(pbos - i) 02:08:34 marshmallows: on a plus note, the example code he gives works with my version 02:09:35 marshmallows: have you noticed that his example resembles a generator? 02:09:41 indeed, TRY is pretty much yield 02:09:47 I don't know what a generator is 02:10:07 marshmallows: google it 02:10:14 basically it's a function that can return multiple times 02:10:16 python example 02:10:30 def all_ints(): i = 0; while True: yield i; i += 1 02:10:43 foo = all_ints(); foo.next() => 1; foo.next() = 2; ...etc... 02:12:02 http://rafb.net/p/EBPm5B37.txt 02:12:30 why did I write != o O_o 02:13:13 marshmallows: i'll try that 02:14:22 marshmallows: yours works! yay! 02:14:41 declarative C is totally awesome 02:15:04 yes :D 02:15:04 marshmallows: interestingly when i make his integer(m,n) function just integer() and unbounded (from 0) the factor program crashes 02:15:08 well, not crashes 02:15:09 but infiniloops 02:15:12 yes 02:15:18 * ehird tries to fix 02:15:32 marshmallows: what is needed is a robust stack smashing library 02:15:34 it's like [(x,y,z) | x <- [0..], y <- [0..], x*y = z] 02:15:42 loads of different archs, a comprehensive test suite 02:15:43 etc 02:15:51 infinite loops because it's dfs 02:15:59 [(x,y,z) | x <- [0..], y <- [0..x], x*y = z] -- problem solved 02:16:00 then you can build stuff like this on top of it without worrying about fragile stack smashing 02:16:01 :) 02:16:11 why about the CLISP stuff Bruno wrote? 02:16:23 maybe you can use that, although it doesn't build on mac last time I tried 02:16:41 oh wait that's only the FFI part (not the other stuff) 02:19:00 eek. my factor program jiust ate the worlds memory 02:19:15 marshmallows: for ffi we have libffi 02:19:16 I prefer #define TRY(i) { amb_t e = i; if (!save_context()) { return e; } } 02:19:26 marshmallows: and that's less generic 02:19:32 then you can just go while (argc--) TRY(va_arg(ap, amb_t)); 02:19:32 my cont.h/cont.c are not tailored towards amb 02:19:50 take a type with it then 02:19:57 marshmallows: no. name clashes. 02:20:33 it works 02:20:41 #define TRY(type, i) { type e = i; if (!save_context()) { return e; } } 02:20:53 marshmallows: not if i do TRY(type, e) it doesn't 02:21:50 marshmallows: yay, i got my factor program working 02:23:19 marshmallows: http://rafb.net/p/FoIwsu63.html 02:23:35 i might make it use gmp sometime, that would be cool 02:24:18 marshmallows: oh, wait, that only factors into two numbers 02:24:23 looks like this will be more in-depth than i thought 02:24:23 hey 02:24:24 :) 02:24:32 ehird, I wanna post amb to rosettacode 02:24:42 marshmallows: uh, go ahead, but that continuation lib is biiig 02:24:49 do i have to license it under anything? 02:24:53 the continuation code ain't mine 02:24:55 but the amb code is 02:27:12 marshmallows: give me a cool thing to program using backtracking 02:28:00 generate magic squares in this way http://muaddibspace.blogspot.com/2008/01/generate-test-and-intertwine-aim-here.html 02:28:51 too much code ;) 02:29:04 bah 02:29:09 It's easy 02:31:05 marshmallows: http://en.wikipedia.org/wiki/Continuation i'm trying to implement 'test' here 02:33:29 marshmallows: it's hard 02:33:35 in C? 02:33:43 marshmallows: yes, using the cont.h funcions 02:44:05 marshmallows: http://rafb.net/p/U9bYdU35.html fibonacci generator using cont.h 02:44:07 going for today, bye :) 02:44:14 bye 02:46:20 -!- ehird has quit ("This computer has gone to sleep"). 03:13:16 -!- jix has quit ("CommandQ"). 03:31:20 -!- adu has joined. 03:42:17 -!- Corun has quit ("This computer has gone to sleep"). 03:59:11 grr 03:59:18 there's a bug in that amb in C thing 03:59:32 Solution : Destroy all humans 05:57:52 -!- cherez has joined. 06:47:54 -!- shinkuzin has quit (Connection timed out). 07:04:52 -!- cherez has quit ("Leaving."). 07:39:35 -!- adu has quit (Remote closed the connection). 07:45:46 -!- oerjan has joined. 07:59:59 -!- clog has quit (ended). 08:00:00 -!- clog has joined. 11:23:19 -!- oerjan has quit ("leaving"). 13:26:50 -!- timotiis has joined. 13:42:49 -!- Corun has joined. 13:49:36 -!- Corun has quit ("This computer has gone to sleep"). 14:43:18 -!- marshmallows has quit ("Leaving"). 14:53:12 -!- Corun has joined. 15:58:29 -!- Corun has quit ("This computer has gone to sleep"). 16:04:17 -!- Corun has joined. 16:29:38 -!- cherez has joined. 16:37:27 -!- p3k has joined. 16:38:21 -!- p3k has quit (Client Quit). 16:38:29 -!- p3k has joined. 16:48:29 -!- jix has joined. 17:18:42 -!- Judofyr has quit. 17:24:36 -!- Corun has quit ("This computer has gone to sleep"). 17:26:15 -!- p3k has quit. 17:27:00 -!- Corun has joined. 18:11:35 -!- cherez has quit ("Leaving."). 18:15:14 -!- Judofyr has joined. 18:24:01 -!- jix has quit ("CommandQ"). 18:51:51 -!- Judofyr_ has joined. 19:07:14 -!- Judofyr has quit (Read error: 110 (Connection timed out)). 19:11:11 -!- Slereah has quit (Read error: 104 (Connection reset by peer)). 19:11:31 -!- Slereah has joined. 19:22:28 -!- RodgerTheGreat has joined. 19:25:15 -!- atsampson has quit (Read error: 104 (Connection reset by peer)). 19:27:31 -!- atsampson has joined. 19:48:51 From the Latin wikipedia : 19:48:52 printf("Salve, munde!\n"); 19:48:53 :D 19:49:17 that is so goign to be what I use for hello world programs now 19:51:53 Ludus Vitae est ludus mathematicus ab Anglico mathematico Iohanne Conway inventus. 19:51:56 Heh. 19:51:57 Cute. 19:57:30 -!- Corun has quit ("This computer has gone to sleep"). 20:14:26 -!- SimonRC_ has joined. 20:15:43 -!- SimonRC has quit (Read error: 111 (Connection refused)). 20:29:02 -!- Judofyr_ has changed nick to Judofyr. 20:42:31 -!- Corun has joined. 20:48:14 -!- jix has joined. 21:04:47 -!- Corun has quit ("This computer has gone to sleep"). 21:18:32 -!- timotiis has quit ("leaving"). 21:36:52 -!- Judofyr has quit. 21:55:57 Iota Jot and Zot makes me think of Rice Crispies. 21:57:31 http://kuvaton.com/kuvei/sparta2.jpg wow i found a movie reference joke funny 21:57:44 slightly 21:57:55 hmm 21:58:12 -!- Corun has joined. 21:58:59 Slereah: that would make a great cereal 22:00:40 -!- calamari has joined. 22:01:43 The three combinator elves. 22:05:01 "During World War II they posed patriotically in military clothing, urging consumers to "Save Time, Save Fuel, Save Work"." 22:05:12 Delicious propaganda. 22:57:34 -!- Judofyr has joined. 23:00:54 -!- timotiis has joined. 23:50:59 -!- Corun has quit ("This computer has gone to sleep"). 23:54:25 -!- Judofyr has quit.