00:00:00 --- log: started forth/06.12.06 00:09:23 --- join: Quartus_ (n=Quartus_@209.167.5.1) joined #forth 00:09:23 --- mode: ChanServ set +o Quartus_ 00:10:01 hey 00:14:53 --- join: ecraven (n=nex@eutyche.swe.uni-linz.ac.at) joined #forth 00:16:12 howdy. 01:34:07 --- join: Cheery (n=Cheery@a81-197-54-146.elisa-laajakaista.fi) joined #forth 02:01:35 --- join: glass (n=glass@cpc1-bolt6-0-0-cust18.manc.cable.ntl.com) joined #forth 02:05:24 * glass should have used 2swap yesterday instead of 2over and 2drop 02:06:26 --- part: Cheery left #forth 02:06:55 --- join: Cheery (n=Cheery@a81-197-54-146.elisa-laajakaista.fi) joined #forth 02:10:03 rot >r rot r> 02:11:12 >r -rot r> -rot 02:11:42 there's an anti-rot... nice :) 02:13:48 gforth's 2swap coded in assembly 02:14:22 (on my x86 box) 02:51:11 --- join: zpg (n=user@user-514d7663.l2.c2.dsl.pol.co.uk) joined #forth 03:13:28 good morning. 03:32:51 hi 03:37:43 --- quit: ecraven ("bbl") 03:37:56 hi JasonWoof 03:38:21 how's it hangin'? 03:38:30 what are you most passionate about? 03:38:30 Not bad thanks, I'm taking another stab at PARTITION. 03:38:39 passionate? for real? 03:39:54 yeah, what engages you 03:41:02 eg legos, sex, saving the world, hiking, etc 03:42:56 why do you ask? 03:43:30 I'm going to sleep in 20 minutes. thought I could make this interesting :) 03:43:35 what's PARTITION? 03:43:53 I like to know what people are into 03:44:45 start by sharing your own passions. 03:44:50 better than just knowing what programming project people have and what they like to bitch about 03:45:09 Contact Improv is my big one right now 03:45:16 Dramatic? 03:45:46 eh? 03:46:29 it's a dance form that's all about experiencing it 03:46:33 not what it looks like 03:47:13 it can be silly, intimate, roudy, soft, fluid and/or acrobatic 03:48:03 and there's a host of other things I like doing 03:49:37 like mountain biking, computer programming, other dance forms (contra, lindy hop, free style, breakdancing, capoeira), hiking, talking, kissing, playing music with people, swimming, video games, reading, eating... 03:50:18 board games, card games, volleyball, laughing 03:50:42 * glass likes pootling about on the guitar 03:50:53 nice :) 03:51:00 rhythm -- I'm not cut out for lead :) 03:51:01 glass: good word :) 03:51:18 wow, there's a nice sunrise developing here that I can see through the frost 03:51:27 17F here 03:51:29 brrrrr 03:51:54 hmmm... you should have gone to bed earlier, shouldn't you've? ;) 03:52:03 that's -8.3C 03:52:26 glass: yep. think I mentioned that 03:52:39 10 minutes. think I'll start brushing the old teeth 03:52:55 since I don't see any young ones coming any time soon 03:53:34 Hmm, partition's nearly working but I haven't got the correct break condition. 03:54:27 nothing moving at breakneck speed -- but one thing I've working on is figuring the furniture that I need for my room... 03:54:29 zpg: what's partition? 03:55:06 JasonWoof: zpg's working on a quicksort implementation 03:55:51 oh, that sounds like fun 03:55:55 I've never done a sorter 03:56:09 yeah, partition for quicksort 03:56:31 i took Quartus' advice and altered the implementation. it looks quite clean and close to working, but i seem to have gotten myself entrenched in an infinite loop. 03:56:32 d'oh 04:02:08 ok boys 04:02:11 bedtime for bonzy 04:02:14 bonzo 04:02:23 * JasonWoof waves 04:02:34 --- quit: JasonWoof ("off to bed") 04:02:40 * glass waves back 04:02:47 --- join: JasonWoof (n=jason@c-71-192-26-248.hsd1.ma.comcast.net) joined #forth 04:02:47 --- quit: JasonWoof (Client Quit) 04:03:11 Hmm, one away from having this operational. The middle values don't seem to get exchanged. 04:14:36 middle values? 04:15:49 oh, the values right in the middle of the array were being mis-swapped. corrected now. 04:15:53 just polishing up. 04:16:47 The pivot itself is relocated in a partitioning operation, and is part of neither sub-list. 04:17:09 * zpg nods 04:17:12 well, often relocated, anyway. 04:17:34 at the moment, my begin/while/repeat loop exits with a high value of L and R1 04:17:37 if that makes sense 04:17:56 the TOS is the end of the first partition. L has been increased upon each loop. 04:18:15 the code /does/ work, but i'm trying to polish it up to give the required stack result. 04:18:26 so presumable you can calculate the other endpoints. 04:18:44 well, R2 is calculatable, i'm using that as the pivot. 04:18:45 -bly 04:18:52 L1 will be R2 cell+ 04:19:05 so it's just L1 that needs calculating 04:19:09 (or storing) 04:19:15 perhaps I should pop that on the return stack? 04:19:55 I don't know, I'd have to see it. 04:20:02 okay let me give this a go first. 04:20:12 sure. 04:24:59 hmm okay, my loop finishes with L2 R1 04:25:05 time to amend that. 04:25:28 so retain the original L and R at the top of the loop. 04:25:45 good plan! that saves too much crunching after the loop. 04:26:51 that works 04:26:57 my pivot is still at R2 though. 04:27:05 so I ought to do an exchange. 04:27:48 fixed. 04:27:50 so i now get 04:27:51 ##( 'b' 'a' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'f' 'g' ) 04:27:51 to 04:27:56 ##( 'b' 'a' 'f' 'd' 'c' 'g' 't' 'p' 'k' 'y' 'h' ) 04:28:00 with the correct stack result 04:28:28 this word is quite long though. 04:28:29 using the middle element as a pivot? 04:28:37 i used the right element as pivot. 04:28:56 which seems to be a widely used method. 04:29:03 care to see the code? 04:29:11 ok. 04:30:14 doesn't that give you worst-case behaviour if the array is sorted/mostly-sorted? 04:30:17 what are the two sub-lists from that partitioning? 04:30:41 http://forth.pastebin.ca/269243 04:30:47 yes, I think the right element as pivot will give you considerable grief on large datasets. 04:32:59 looks like your pivot winds up inside one of the sublists. 04:33:07 it does 04:33:12 i just added that now 04:33:20 it shouldn't. 04:33:23 i could have simply shorted R2 by one and ignored the pivot entirely 04:33:23 okay 04:33:25 doing that now 04:34:06 I mean to say, the original pivot location may be in one of the sublists, but the relocated pivot shouldn't. 04:34:40 http://forth.pastebin.ca/269247 04:36:12 OR: ought i exchange, then increase L2 ? 04:36:23 that would mean the pivot is now central but L2 begins after the pivot 04:37:00 whichever one works :) display your resulting sublists. The left list should end before the new pivot, the right list should begin after it. 04:37:08 yeah ok 04:37:13 so i ought to write an amalgam of the two 04:38:13 After partitioning, the pivot is in the correct, sorted position, so it need be sorted no further. 04:39:22 I recommend sorting yourself out so you have one comparison function instead of two. 04:39:55 ##( 'b' 'a' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'f' 'g' ) 04:39:55 ##( 'b' 'a' 'f' 'd' 'c' 'g' 't' 'p' 'k' 'y' 'h' ) 04:39:55 R2 => 'h' L2 => 't' R1 ==> 'c' L1 ==> 'b' 04:39:55 04:40:15 (note the pivot is in the correct position) 04:42:11 ok. Does it work when one of the sub-lists is empty? 04:42:40 let's see 04:43:15 ahem 04:43:21 if i were to say no ... :) 04:43:32 keep at it :) 04:44:11 :) 04:46:08 You only need str> and can eliminate str<=. 04:46:30 i see. 04:46:42 well, left is overshooting the array bounds 04:46:47 just reverse the operands. 04:47:10 overshooting is bad. :) 04:47:15 heh 04:48:32 test also against different pivots -- left, and middle. 04:49:08 yeah 04:49:13 i'm trying to keep it simple for now 04:49:20 does the code look hyper-ugly or okay as a starting point? 04:50:26 the overall shape is ok, right number of substructures in the approximately correct order, just needs to work in all cases now. 04:54:03 good stuff 04:54:22 prep-car-compare can clearly go inside str> 04:54:38 of course 04:54:53 i started using str< so prepared the addresses prior to using a builtin 04:55:00 Horrible name btw :) 04:55:07 i know i know :) 04:58:59 this looks uglier now :) 04:59:06 e.g. 04:59:06 begin 2dup > if dup r@ prep-car-compare str<= else 0 then while cell+ repeat 04:59:51 I think you're banging out the dent from the wrong side of the car. 05:00:03 heh 05:00:21 ah hang on 05:02:01 --- quit: cmeme ("Client terminated by server") 05:02:43 --- join: cmeme (n=cmeme@boa.b9.com) joined #forth 05:07:32 --- join: tathi (n=josh@pdpc/supporter/bronze/tathi) joined #forth 05:07:32 --- mode: ChanServ set +o tathi 05:08:31 consider that it's ok for the pointer to overshoot, so long you don't dereference. You want to confirm that the two pointers have not crossed before performing an exchange. 05:09:20 ah ok 05:09:31 i've already shortened this down dramatically, looks far cleaner now 05:09:50 the problem is actually in the prep-car-compare side of things 05:09:53 not exchange itself 05:14:22 Good morning. Leaving for work. Y'all talk amongst yourrselves till I get back, k? :) 05:14:55 :) 05:15:27 looking slightly less ugly --> http://forth.pastebin.ca/269280 05:15:40 the problem is these begin/while tests. 05:15:54 do you reckon i can conflate both tests into one loop? 05:17:54 ooh hang on 05:17:59 No, I think they have to be two. 05:18:05 k 05:18:18 They travel in different directions and for different distances. 05:18:23 yep 05:20:37 btw, ( L R L2 R1 -- L R1 L2 R ) is swap rot 05:21:29 -rot swap 05:21:36 no. 05:21:56 er, would that also work? Guess so. 05:22:05 --- quit: ellisway (Read error: 131 (Connection reset by peer)) 05:22:42 I'd avoid it, as -rot may well be rot rot. 05:23:04 the second time today that I've replaced ROT with -ROT and a permutation in stack words :-) 05:23:27 rot is also standard, whereas -rot is common-usage. 05:26:44 --- quit: Quartus_ (Read error: 104 (Connection reset by peer)) 05:28:40 that's now incorporated 05:28:44 r> drop ( L2 R1 ) 05:28:44 2r> 2swap ( L R L2 R1 ) 05:28:44 swap rot ( L R1 L2 R ) 05:28:44 swap 2dup exchange cell+ swap ; 05:29:17 why 2r> 2swap? Why are you keeping those on the return stack? 05:29:43 i thought we'd established that i could keep the initial L and R on the return stack 05:29:51 you could. Do you need to? 05:30:00 good point 05:30:17 especially as you need them underneath L2 R1. 05:30:21 yep 05:30:41 neat, thanks for the pointer. 05:30:48 it's really nice to see incremental cleanup. 05:31:58 so, here's how it stands 05:32:54 http://forth.pastebin.ca/269288 05:33:29 if i'm to retain the two begin/while/repeat's, then i can't see an alternative to checking the bounds in each loop 05:34:00 You needn't so do. 05:34:48 hmm 05:35:10 I believe you have the parameter order swapped for the two tests. 05:35:38 Chasing the left pointer up the array should terminate at the pivot. 05:36:43 I'm not running your actual code, mind you, just eyeballing it. 05:36:56 i could utilise a do loop with the two addresses (left and right) on the stack 05:37:02 then leave if the str> condition is met 05:37:10 no, that would be a disaster, you'd lose access to the return-stack item. 05:37:15 yes was about to say 05:37:33 that's why i avoided DO 05:38:04 try swapping the 'r@ over' and the 'dup r@' 05:39:38 What's that stray cell- at the top? 05:39:49 last element is being used as the pivot 05:39:55 so moving R back one 05:40:12 Which is why you have to do a final exchange. Remove that. 05:41:12 that breaks it. 05:41:22 You have to also remove the final exchange. 05:41:32 i did 05:41:40 let's have a look at it now. 05:41:41 i removed the final line and the cell- 05:41:49 two seconds 05:45:05 --- join: timlarson_ (n=timlarso@65.116.199.19) joined #forth 05:45:36 http://forth.pastebin.ca/269295 05:50:05 http://forth.pastebin.ca/269298 05:50:47 Moved the condition to the bottom, as you won't call partition if the condition isn't valid at least initially. 05:51:05 Changed the test to <= instead of <. Updated the pointers past the exchanged values after the exchange. 05:51:40 intriguing 05:51:42 swapped the 'dup r@' and 'r@ over' 05:51:55 I think that's where the largest segment of the bug was. 05:52:01 where? 05:52:07 swapped the 'dup r@' and 'r@ over' 05:52:32 how was that bugged? 05:52:44 Changed the nature of the test from > to >= and vice versa 05:53:08 Try that, anyway. 05:53:17 hmm okay 05:53:46 I can't crib directly from my version, as I actually used R L as the stack order, turns out to be neater elsewhere. 05:54:07 your version gives this: 05:54:07 ##( 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'l' ) 05:54:07 ##( 'l' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'a' ) 05:54:42 that makes my brain hurt trying to figure out the before and after, and where the pivot is. 05:54:44 mine, problematically, has L2 R2 as 'j' 05:54:54 well the pivot is J, the last element 05:54:56 your L and R, what do they point to? 05:55:01 erm, L 05:55:23 so in that paste, the pivot is 'l', but 'l' ends up first and 'a' last, which is clearly not wanted. 05:55:46 point to? addresses for cons cells 05:55:59 that ##( ... ) printout is the car of each pointer 05:56:03 in fact that's because of the direction of the comparison routine. Please try it with a different initial set, make the last element 'h' for instance. 05:56:40 try it with a mixed set so you can see more elements move. 05:56:45 ##( 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'l' 'h' ) 05:56:45 ##( 'h' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'l' 'a' ) 05:56:51 and with a mixed set 05:57:13 ##( 'b' 'a' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'f' 'g' ) 05:57:13 ##( 'g' 'f' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'a' 'b' ) 05:57:13 L1 ==> 'g' R1 ==> 'k' 05:57:13 L2 ==> 'a' R2 ==> 'b' 05:57:17 whereas mine gives this: 05:57:35 ##( 'b' 'a' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'f' 'g' ) 05:57:35 ##( 'b' 'a' 'f' 'd' 'c' 'g' 't' 'p' 'k' 'y' 'h' ) 05:57:35 L1 ==> 'b' R1 ==> 'g' 05:57:35 L2 ==> 't' R2 ==> 'h' 05:57:55 hmm that R1 pointer is incorrect. 05:58:33 I'm not getting that here, but then I'm not working with your list comparator -- recall I suggested working without the lists until you get it working, one reason is so that others can run your code :) 05:58:46 this is on an array 05:58:55 the array just contains cons cells which are being compared using normal string comparison,. 05:59:08 it is using your string comparison routine, and I can't incorporate that in my tests. 05:59:16 true. 05:59:36 it'd be delightful if we could be working from a simple version that sorted an array. Let me do one up. 06:00:16 --- join: Ray_work (n=Raystm2@199.227.227.26) joined #forth 06:02:35 Good morning, my homies! 06:11:11 --- quit: glass (Read error: 110 (Connection timed out)) 06:12:50 hi 06:13:07 Ok, I've taken that partition routine and bashed it into a working example harness. 06:13:16 --- quit: segher (Nick collision from services.) 06:13:27 --- join: segher (n=segher@dslb-084-056-199-159.pools.arcor-ip.net) joined #forth 06:14:09 So it does work. Would you like to see it, or carry on? 06:14:39 carry on for a bit i think. 06:14:44 ok. 06:27:13 i think it's time to give up again (for now) 06:27:19 getting a sore back :) coffee beckons 06:27:25 ok :) 06:38:55 well, my modified PARTITION seems to have no affect whatever on a numerical array. hoorah 06:39:04 impressive :) 06:41:39 yes, i thought so 06:41:57 i've stripped all the code out into a separate file though 06:42:51 yeah, that without a doubt doesn't work at all. 06:52:20 hmm 06:57:51 ah ok, this does work 06:58:03 but again, i still haven't fixed the boundary conditions 06:58:09 but i'll paste the full thing 06:58:52 http://forth.pastebin.ca/269361 06:59:32 which yields 06:59:33 numbers array. #( 6 8 11 2 12 23 45 ) ok 06:59:33 .s <4> 2242636 2242648 2242656 2242660 ok 06:59:33 inspect-partition L1 ==> 6 R1 ==> 2 06:59:38 L2 ==> 23 R2 ==> 45 ok 07:02:10 Yes, that seems to work. Haven't tested the corner cases though. 07:03:17 they'll fudge when begin/while over-runs due to cell- or cell+ 07:03:28 since there are no tests to check boundary overuns 07:03:39 there shouldn't be any overruns, as you're stopping at the pivot. 07:04:15 ? 07:04:16 begin dup @ r@ > while cell- repeat swap 07:04:38 compare the TOS with the pivot value, and while the TOS is greater, go back a cell. 07:04:43 this doesn't check for the pivot at all. 07:04:55 it would keep going if cells happened to be less than the pivot 07:05:13 until it hits the pivot. With your scheme, you start to the left of the pivot, so you can't use it for a sentinel. 07:05:28 oh i see.... 07:05:43 so if i leave the pivot in place, i can avoid overruns 07:06:01 Even if the pivot moves, you avoid them. 07:06:07 ok 07:06:37 But you must step past the cells you exchange. 07:07:18 ah ok 07:07:32 http://forth.pastebin.ca/269366 07:08:30 oh it works fine now 07:09:08 and i can shed the cell- now, presumably. 07:09:20 see my paste. 07:10:44 yeah i'm going through this myself too. 07:10:47 but this results in an error 07:11:07 numbers array. #( 6 8 12 11 2 45 23 ) <--- note that 11 falls after the pivot when we remove the 'cell-' scheme 07:11:17 I don't follow. 07:11:45 I've plugged that partition routine directly into a quicksort, and it does the job. 07:11:48 well, the pivot ends up preceding 11 and 2 07:12:18 #( 6 8 23 45 2 11 12 ) ==> #( 6 8 12 11 2 45 23 ) 07:12:26 12 being the pivot 07:12:38 And what code are you working with at this point? 07:13:42 http://forth.pastebin.ca/269367 07:15:02 My test gives #( 6 8 12 11 8 45 23 ) 07:15:18 indeed 07:15:25 oh 07:15:32 where's the 2 ? 07:15:54 oh sorry. I modified the test code earlier to test against duplicates. 07:15:58 Ate the 2. :) 07:16:09 heh 07:16:39 okay, so the pivot is falling before numbers less than it. surely we don't want that. 07:16:59 Let me see what is awry. 07:18:11 thanks 07:18:31 interestingly, i think our latest posts are identical. 07:19:54 do we want to be testing the pivot against itself? 07:20:00 no harm in that. 07:20:03 k 07:22:06 12 and 23 are being swapped 07:22:51 and once there i think the left address has been increased such that 12 remains there. 07:24:27 Try this then: http://forth.pastebin.ca/269375 07:25:15 Trouble being, the two sub-lists overlap on the pivot. 07:25:26 yeah 07:26:00 well i remodified mine to do the same thing 07:26:06 keeping begin 2dup < while 07:26:10 i've had this permutation before 07:26:17 let's check with 120 instead of 12 as pivot 07:26:29 nice, all seems to work. 07:27:15 What did you change? 07:27:25 include part.forth 07:27:25 #( 6 8 23 45 2 11 12 ) 07:27:25 #( 6 8 12 45 2 11 23 ) 07:27:25 #( 6 8 11 45 2 12 23 ) 07:27:29 #( 6 8 11 12 2 45 23 ) 07:27:32 #( 6 8 11 2 12 45 23 ) 07:27:35 #( 6 8 11 2 12 45 23 ) 07:27:38 L1 ==> 6 R1 ==> 12 07:27:42 L2 ==> 12 R2 ==> 23 ok 07:27:43 gah, stop. I have no idea what each step is doing. 07:27:44 note the R1 and L2 being the pivot, might have to modify that.... 07:27:49 i know 07:27:53 hang 1 07:28:22 yes, you have to modify that, or the sort will never terminate. 07:28:27 http://forth.pastebin.ca/269383 07:28:35 full part.forth code in there 07:28:50 note that i'm printing the full array on each toplevel partition iteration just to see what's happening 07:29:37 Ok, I have a fix for your code. Hang on, I'll paste it. 07:30:17 k 07:30:19 well i've done this 07:30:29 repeat 07:30:29 r> drop ( L R L2 R1 ) 07:30:29 cell- 07:30:29 swap cell+ rot ( L R1 L2 R ) ; 07:30:32 at the end of partition 07:30:39 but that's buggy if the pivot is 120, say. 07:30:40 try my paste. 07:30:59 okay, awaiting. 07:31:06 http://forth.pastebin.ca/269385 07:31:07 thanks for the help btw, this is intriguing stuff. 07:31:19 Yes, it's a finicky tiny little piece of code. 07:31:26 one line change, right? 07:31:30 line 8 added 07:31:48 Right. Works here both for partitioning, and for the full qsort. 07:31:56 not here 07:32:00 Morning ray. 07:32:02 that's identical to the one i just pasted. 07:32:14 try with this numerical array 07:32:17 create numbers 7 , 6 , 8 , 23 , 45 , 2 , 11 , 120 , 07:32:22 and use my inspect-partition code 07:32:38 i get this: 07:32:39 #( 6 8 23 45 2 11 120 ) 07:32:39 #( 6 8 23 45 2 11 120 ) 07:32:39 L1 ==> 6 R1 ==> 11 07:32:41 L2 ==> 2242608 R2 ==> 120 ok 07:32:45 07:32:49 note L2 is screwed up. 07:34:02 I don't have your bug; here it's #( 120 8 23 45 2 11 6 ) 07:34:20 curious 07:34:21 L1 ==> 120 R1 ==> 7 07:34:21 L2 ==> 8 R2 ==> 6 07:34:44 R1 shouldn't be 7. 07:35:19 you have a different bug? 07:35:44 7 is the first cell of the array i think, length. 07:35:52 --- nick: Raystm2 -> nanstm 07:35:55 Right. 07:36:06 this is a bit of a headache. 07:39:01 .. 07:40:39 ok, wind me back one step. What was broken about this? http://forth.pastebin.ca/269392 07:41:15 --- join: virl (n=virl@chello062178085149.1.12.vie.surfer.at) joined #forth 07:41:31 I think we're chasing a non-bug, and I blame the lack of coffee on my side. :) 07:41:37 can I ask a question? 07:41:45 tathi, you just did, man. :) 07:42:05 this 07:42:06 #( 6 8 23 45 2 11 120 ) 07:42:06 L1 ==> 120 R1 ==> 120 07:42:06 L2 ==> 8 R2 ==> 6 ok 07:42:54 so this is a partition algorithm, using the last element of the array as the pivot? 07:43:00 hugh? what's that? 07:43:01 yes 07:43:26 where'd the algorithm come from, and what's wrong with the one wikipedia gives for quicksort? 07:44:04 The Wikipedia one only runs with the Pseudo compiler, which I don't have installed. 07:44:58 :) ok. 07:45:40 I tried doing it in forth from that, and it looked simpler than what you're doing, so I was curious. 07:46:15 zpg, I'm not sure where the bug is hiding in your code. In my own implementation I'm getting happy results. 07:46:32 tathi, be interested to see your approach. 07:48:25 yes 07:48:32 i've just modified the code to use the median of the group of numbers 07:48:34 seems to work nicely 07:48:47 zpg, let me paste my other implementation. 07:48:51 hang on a sec. 07:48:57 this one's nearly right 07:49:08 the only problem is that the pivot is still in the final LR pairs 07:49:34 paste away, i'll do the same. 07:49:39 perhaps this can be patched with minimal code. 07:49:47 http://forth.pastebin.ca/269397 07:50:13 http://forth.pastebin.ca/269398 07:50:40 partitionQ is yours, Quartus 07:51:13 http://forth.pastebin.ca/269400 07:51:23 That's your earlier code, when I said I'd step away and write a harness. 07:51:39 heh i see. 07:51:44 perhaps we can patch mine up? 07:52:00 could you try the one i pasted, it's self contained. 07:52:04 try it as is. 07:52:09 then modify 12 , to 120 , 07:52:17 hang on, looking at tathi's partition 07:52:22 k 07:53:02 --- join: snowrichard (n=richard@12.18.108.162) joined #forth 07:53:24 I was just having partition return a pointer to the element after the repositioned pivot 07:53:30 and doing the calculations in quicksort 07:53:57 but the parameters make more sense this way (how you're doing it) 07:54:13 tathi, have you tested that? It's not running here. 07:54:15 wait, this doesn't work so well. 07:54:35 I thought I did... 07:54:46 my pivot is still the last element, hmm. 07:54:50 maybe pilot-error, let me bang away at it 07:54:56 zpg, try the code I pasted; it runs as shown. 07:55:39 k 07:55:41 good mornign 07:55:42 tathi, I'm trying your code with the right-hand element as pivot, which shouldn't matter, but perhaps it does. 07:55:44 try mine but replace median with 07:55:45 : median ( x y -- z ) 07:55:45 over - 2/ + ; 07:56:11 A partitioning algorithm should run no matter where the pivot is, just with varying efficiency depending on the sortedness of the data. 07:56:14 this seems to work okay, i just need to ensure the pivot isn't in either sublist. 07:56:52 http://forth.pastebin.ca/269406 07:57:32 zpg, you've changed your pivot, and so you may simply be masking the earlier error. 07:57:41 Quartus: huh. thought I tested partition with the middle and both ends as the pivot. 07:57:52 I'll check it again 07:57:56 Quartus: oh i agree, but i think the problem is more visible this way. 07:58:03 I thought you said it worked. 07:58:07 with max=120 in the list, i get 07:58:13 #( 6 8 23 11 2 45 120 ) 07:58:13 L1 ==> 6 R1 ==> 45 07:58:13 L2 ==> 45 R2 ==> 120 ok 07:58:17 and with max=12 i get 07:58:22 #( 6 8 23 12 2 11 45 ) 07:58:22 L1 ==> 6 R1 ==> 45 07:58:24 L2 ==> 45 R2 ==> 45 ok 07:58:36 the pivot is 45 in both cases 07:58:50 Ok, so the first one is broken -- 45 shouldn't be in the second sub-list. 07:59:01 exactly 07:59:15 and the second is problematic -- how do i deal with L2 R2 when there's nothing in it? 07:59:24 deal with? 08:00:06 well i should have two sublists, the total being one less than the original list, right? 08:01:01 It's fine to have L2 R2 pointing at the same place, your shouldn't be calling partition with a list of length 0 or 1 anyway. 08:02:41 tathi, I've got your code running by itself as pasted, just to clarify -- it's transplanting your partition into my code that I'm working on. 08:03:03 oh, I see. 08:03:29 sorry, I failed to mention that I made it work, wanted to interject that in case I'd sent you off on a testing spiral :) 08:03:35 in mine, 'last' is a pointer to the actual last element, not one past it as usual, maybe that's it? 08:03:43 eh. good for me to write all the test cases :) 08:03:45 no, same here. 08:03:53 hrmph 08:04:07 this seems to work now 08:04:18 changed to read 08:04:18 2dup <= if 2dup exchange cell- swap cell+ swap then 08:04:42 oh I see the thing, tathi. Your pivot is an address, not a value. 08:05:23 oh, yeah. 08:05:35 so you re-fetch it on each compare. 08:06:13 ah, it doesn't :) 08:06:33 yeah, it seemed more general-purpose that way 08:06:47 and on modern hardware there shouldn't be much of a speed difference, if any. 08:07:09 I don't know about that, but I'd prefer fetching it once. 08:07:16 : foo-next ( a1 a2 -- a1' a2' ) cell- cell under+ ; 08:07:23 i still end up with "Pivot is: 720896", ah. 08:07:36 zpg, did you give my paste a whirl? 08:10:37 works well 08:10:47 i tried incorporating some of yours into mine, but in vain. 08:11:04 yes, I'm not sure where the bug is lurking in yours, I had little luck grafting between them myself. 08:11:23 :) 08:11:24 ah well 08:11:28 time to call it a day on partitioning 08:11:33 --- quit: snowrichard ("Leaving") 08:11:35 since i've spent the best part of it writing bad code 08:12:51 gonna stretch the ol' legs, be back in 15 or so 08:12:56 ok 08:13:09 thanks for all the input! 08:15:14 no problem! 08:15:57 tathi, toodling around with yours. Sometimes the left-hand pointer is below the array. 08:17:37 That's one of the problems I encountered with the simplest implementations -- you need to stop the pointers from a-wandering. Hoare, in his original Quicksort article, suggested sentinels on either end of the array that were higher and lower than any value in the array, but that's not all that practical. 08:19:37 btw, one important optimization is to recurse only on the shorter of the two sublists -- tail-recurse (loop) on the longer ones. Cuts stack utilization down appreciably. 08:19:39 --- join: snowrichard (n=richard@12.18.108.162) joined #forth 08:21:37 oops 08:22:56 --- join: marble (n=glass@cpc1-bolt6-0-0-cust18.manc.cable.ntl.com) joined #forth 08:23:17 hrm. I don't understand how that happens. 08:23:28 I can illustrate it if that helps. 08:23:37 the only place I can see that I decrease a pointer, it's a right-hand pointer. 08:23:42 yeah, that'd be great 08:24:55 http://forth.pastebin.ca/269439 08:24:59 displays 5 4 0 1 08:25:04 the 0 is the warning sign. 08:25:27 could be something else, depending on the contents of memory. In fact it's not the left-hand pointer, sorry -- it is the right. 08:26:42 hmm, I thought the comparison in quicksort would avoid problems if the right-hand pointer was too low. 08:26:47 guess I didn't think it through carefully enough 08:27:30 well, I don't know. I'd have to puzzle it out. I had an early implementation I quite liked, but indeed the pointers went off the page, so I re-thunked it. Maybe the comparison does prevent the issue. 08:28:29 oh, I see, you're playing with partition. 08:28:41 Yes, to reveal the pointer going off the page. 08:28:45 yeah, the first right-hand pointer that it returns can be invalid 08:28:55 but the others should all be valid 08:29:07 and quicksort checks to make sure the right is greater than the left 08:29:20 so it never actually uses that address 08:29:30 I didn't think it was a problem 08:29:34 ok. I'll throw in some assertions and test. 08:37:59 Looks good so far. 08:38:38 I'm flailing at it with random numbers. :) 08:39:03 :) 08:39:19 --- quit: snowrichard ("Leaving") 08:39:54 yeah, anytime the pivot ends up at the beginning, you'll get intervals (L, L-1) and (L+1, R) 08:40:24 the first should probably be (L, L), but since qsort checks, I didn't bother putting a check in partition 08:40:34 Makes sense. 08:40:51 --- join: neceve (n=claudiu@unaffiliated/neceve) joined #forth 08:42:39 --- quit: virl ("Verlassend") 08:43:08 back 08:45:49 oh, bother. it doesn't handle an empty interval properly. 08:46:16 how do you mean? 08:46:25 oh, it won't get passed one of those either. 08:46:34 a dup partition 08:46:48 right. Nothing with less than one element makes it in. 08:48:56 ok, so now to remove items and make it so it doesn't constantly fetch the pivot 08:50:17 hi zpg 09:08:13 tathi, I've been staring at it, but I can't see any clean way to avoid the repeated fetch, and still be able to use the pivot address as the sentinel to terminate the loop. 09:08:26 I'll come back to it later. :) 09:08:47 http://forth.pastebin.ca/269501 09:09:00 yeah, I just left the value on the stack 09:09:03 not great, but it works 09:09:57 yes, I was searching for an alternate terminator for the loop. 09:10:34 >r cell+ r> gives me the heebies. :) 09:10:42 likewise :) 09:11:13 I retooled that begin/while/repeat into a begin/until, I think it should work as well. 09:11:30 oh, right. 09:11:52 Since there's no chance the pointer is ahead of the pivot on entry. 09:11:55 I was thinking it needed the check at the beginning 09:11:57 yeah 09:13:35 ok, back to working on SHA-1 then :) 09:13:41 fun 09:25:24 --- quit: Zarutian (Read error: 110 (Connection timed out)) 09:33:07 --- quit: neceve (Remote closed the connection) 09:38:32 Morning Quartus : saw your "mornin ray" way up there. I'm catching up now. 09:38:53 much of it was chasing an invisible bug. 09:41:12 * Ray_work wishing zpg wouldn't timebomb his pastes :) 09:41:27 mine aren't, so you can track the progress. 09:49:37 Caught up. I have a sales newbie to train today, so i'm not omnipresant. :) 09:51:24 --- join: Quartus_ (n=Quartus_@209.167.5.2) joined #forth 09:51:24 --- mode: ChanServ set +o Quartus_ 10:00:45 hey, back for a bit. oh sorry Ray_work, didn't realise anyone really checked out the old stuff. 10:01:35 today's hacking was a mixture of compelling and depressing -- some interesting factoring, but unfortunately bugs lingered. i'll probably start from scratch next time i attack the problem, hopefully a fresh approach will prove fruitful. 10:03:36 Ray_work: how're your projects coming along? 10:14:19 zpg, be curious to see if you can ferret out the mystery bug in your version, I couldn't spot it. 10:40:38 zpg: project progress = slow to none this last week. I goal to do more, but this month is full of things like wedding anniversary, wifes b-day, and Chrismas. 10:42:42 I spent a lot of time this last week trying to justify/rationalize my interest in colorForth. 10:43:33 heh 10:43:46 erider is working on the irc client for my chess game. 10:43:52 good stuff 10:44:00 i take it his forth is coming along then. 10:44:04 How about yourself? looks like your comming right along here. 10:44:04 Quartus_: yeah, that's a fair point. 10:44:20 Ray_work: ah, not so sure about that. hadn't touched forth for a while, but this is a nice functional experiment. 10:44:54 it does have an application, i'm aiming to check whether two lists are equivalent, and a clean way of doing so is sorting both first. 10:45:43 absolutely. 10:45:59 I'm following with interest. I've not done any sorting yet. 10:46:20 Quartus_: i need to clarify what L1 R1 L2 R2 have to look like in terms of the pivot. I take it neither should include pivot information? 10:46:50 Ray_work: any conclusions on the colorForth front? the lack of < and > i found quite surprising. is all comparison done with flags? 10:47:09 Infact, the only time i've compared to a list, I only had one distinct item to find in the list so I just tested it against the entire list and toggle a varible if found. 10:47:28 which list code were you using? 10:48:12 I wasn't using a real list. I cheated and just used the data stack, being I only need one compare per item I just burned thru the stack. 10:49:29 --- join: crest_ (n=crest@p548958A4.dip.t-dialin.net) joined #forth 10:49:42 hmm. 10:49:50 so how was this list being used in the rest of the programme? 10:50:46 It's the list of wall locations in ChuckBots world. Used to generate the walls in there positions and used to compare that ChuckBot can't pass thru the wall. The cheat is I test every wall every move. 10:51:22 Very inefficiant, but doesn't bog down the program so... 10:51:47 this is colorForth? 10:52:12 Yes, colorForth, Glypher, and now QuartusForth. 10:52:23 Possible Retroforth next. 10:52:42 what's Glypher? 10:53:02 don't you find multiple dialects confusing? 10:53:39 I did, to be sure. Not so bad now. 10:55:14 Glypher is another colorForth by Roger Levy. It's built atop a combination of RetroForth 7 and 8. It has a colorForth like environment but with many of the "Quartus-doesn't-like" ( for want of a real adjective ) taken out of it. 10:57:17 url? 10:58:28 I'm maintaining Glypher now as Roger has moved on to invent a GameCube forth. It's hosted at crc's Retroforth page ... link to follow. 10:59:25 --- quit: Crest (Read error: 110 (Connection timed out)) 10:59:53 roger = rabbitwhite? 11:00:14 http://retroforth.org/glypher/ 11:00:17 yes 11:00:26 lokking now 11:02:14 intriguing. any screenshots of Glypher in action? 11:02:44 infact yes. getting url ... 11:03:04 neat, thanks. 11:05:32 http://ray.rx-core.org/old_site/GlypherBOXER.htm 11:05:51 Thats the 3 blocks of a program I use to find box positons in colorforths 11:06:37 boxes are used as backgrounds for simulating windows of information. 11:08:49 That progy features crc's word LATER shortly after he unvailed it to me. 11:09:06 LATER makes for nice continuations. 11:15:14 I find it a confusing name. 11:15:40 http://ray.rx-core.org/old_site/glyph366.png and http://ray.rx-core.org/old_site/glyph368.png the two blocks of a text editor based on P'' ( P-prime-prime ). 11:15:45 --- join: madwork (n=foo@204.138.110.15) joined #forth 11:16:22 the last screenshot looks most confusing. 11:16:37 Yes. Quartus, Glyper was originally supposed to be a picto-graphic language. 11:16:43 it doesn't do anything later, it transfers control to a coroutine right now. 11:17:11 --- quit: Snoopy42 (Read error: 145 (Connection timed out)) 11:17:15 and control gets transferred back at the end of the line 11:17:26 oh, I'm talking about LATER, not the thing with the coloured blocks. 11:17:27 zpg the key to the last block is the line FKEY.... 11:17:43 I recall someone having trouble with LATER because of that (maybe virl, with the irc client)? 11:17:53 Quartus: I'm sure the problem is my usage of the term. 11:18:17 I have used the technique, but as co and co-exit. 11:18:38 Cool. :) 11:18:44 I think it's neat. 11:18:53 and more usefully with another stack, and a backtracking mechanism. 11:20:22 the idea is fine, albeit non-portable. The 'later' name is my issue. 11:22:47 The technique does make for some confusing code. I found with backtracking it became sensible again. 11:25:42 --- nick: crest_ -> Crest 11:26:32 can anybody tell me what package compress/uncompress/zcat might be in? 11:29:59 ncompress on debian 11:30:18 compress is in ncompress 11:30:24 uncompress and zcat are in gzip 11:31:22 this is the wrong channel for that, isn't it? :P 11:32:09 yes 11:32:14 but thanks 11:32:52 bz customer... 11:33:42 --- join: Quartus___ (n=Quartus_@209.167.5.1) joined #forth 11:39:36 with much manual fiddling with the results of my latest PARTITION, i do get "numbers array. #( 1 2 6 8 11 12 23 )" 11:39:52 i think qsort is within reach 11:45:24 heh, now my qsort gets to "numbers array. #( 2 1 6 8 11 12 23 ) ok" before barfing 11:45:41 --- quit: Quartus_ (Read error: 104 (Connection reset by peer)) 11:45:53 you want to avoid the barfing :) 11:46:02 indeed i do. 11:46:05 care to see the latest? 11:46:12 As you like. 11:47:37 http://forth.pastebin.ca/269723 11:49:26 Think you might have too many 2drops in your qsort. Try : qsort ( L R -- ) begin 2dup < while partition recurse repeat 2drop ; 11:50:04 hoorah!! 11:50:35 we got there in the end! 11:50:59 In fact, you can add 'shorter-segment' in front of recurse. 'shorter-segment' brings the shorter of the two partitioned segments to the top of the stack. This is a very good idea. 11:51:19 for stack depth purposes? 11:51:37 Yes, it makes the recursion happen on the shorter segments, tail-recursion on the longer. Saves mondo stack space. 11:51:44 k 11:52:02 pretty cathartic to see the list actually /sorted/ :) 11:52:06 heh 11:54:49 tathi, of interest -- benched your approach for number of exchanges -- 36 vs 13 for this approach. 11:55:52 :) 11:56:12 Interesting there's such a difference. Let me make sure I'm doing apples-apples. 11:56:15 well, wikipedia *did* say that wasn't the standard formulation, just the one they thought was easiest to understand 11:56:59 yup, apples-apples. 3 times as many exchanges. 11:57:07 sure, not flinging mud at you, just saying. :) 11:58:08 I find this other approach pretty understandable -- go left, go right, to find a pair that needs swapping. Swap'em. Repeat. 11:58:38 yeah 11:58:52 mess up implementation for 8 hours. sigh. 11:58:54 repeat :) 11:59:03 it's called learning :) 11:59:23 did I already give a 'shorter-segment' definition? That one's kind of neat. 12:00:35 it's in some of the pastes from playing with mine 12:00:41 dunno if zpg has seen it 12:00:56 : shorter-segment ( ... ) 2over 2over - + > if 2swap then ; 12:01:41 so... 9 12 1 5 shorter-segment .s -> 12:01:57 <4> 1 5 9 12 12:03:18 very Forthy 12:05:28 and now ... 12:05:29 ##( 'b' 'a' 'y' 'p' 'c' 'h' 't' 'd' 'k' 'f' 'g' ) 12:05:29 ##( 'a' 'b' 'c' 'd' 'f' 'g' 'h' 'k' 'p' 't' 'y' ) ok 12:05:33 wooohoo! 12:05:42 Is that all you needed? I could have done that for you by hand. :) 12:05:52 i never learnt my alphabet 12:06:17 Quartus: nice. 12:09:02 just need to write array>list 12:12:57 More than 3x average higher number of exchanges in the tathi version, ratio holds as you increase the number of elements. 12:19:19 though oddly enough, it only seems to run about 2x as fast 12:19:32 which one? 12:20:00 is yours faster desipte the number of exchanges? 12:20:20 I was planning to bench it later. It would surprise me somewhat if true. 12:21:07 no, same direction 12:21:32 well, not too shocked by that. It's not all exchanges, there's the walking of the array to consider. 12:22:04 operational! 12:22:05 [ 'this' 'is' 'not' 'exactly' 'what' 'we' 'anticipated' 'in' '2006,' 'but' 'i' 'guess' 'it'll' 'do.' ] 12:22:05 [ '2006,' 'anticipated' 'but' 'do.' 'exactly' 'guess' 'i' 'in' 'is' 'it'll' 'not' 'this' 'we' 'what' ] ok 12:22:14 cool :) 12:22:28 yeah, I guess I thought the exchanging would be more of the cost 12:22:33 my god, strings in Forth! And they said it couldn't be done. 12:23:41 http://forth.pastebin.ca/269767 (i) 12:23:50 http://forth.pastebin.ca/269765 (ii) 12:24:27 * zpg sighs in relief 12:24:35 Quartus: heh, very true :) 12:24:40 so did you find the mysterious bug, or did it just go away? 12:24:47 next, we get Ray to sort his Huffman strings in colorForth 12:25:07 Quartus: I re-examined the algorithm, and wrote PARTITION from scratch along almost identical lines 12:25:19 no, I'm sure between us in ten minutes or so we can come up with something equally as awkward as Huffman coding. 12:25:30 :) 12:25:46 the only really ugly word in all this is my array>list which can of course be factored neatly 12:25:55 That, alone, makes me think cf is actually an April Fools' joke, like INTERCAL outputting only Roman numbers. 12:26:15 I can't believe people claim strings aren't important for modern languages. Total absurdity. 12:26:29 Did Ray mention how one does 1 2 < if ... then in cf? 12:26:41 strings are a useful data structure, but they're not as funky as people think they are. As you've seen, they're easy. 12:26:54 cf has a word 'less' 12:27:20 True, true. They ought to be abstracted to a fairly flexible level. They're nice data structures, and obviously very human readable, whatever the implementation (character array/vector, etc.) 12:28:28 tathi: so, 'less', 'more', '2dup less -rot = or', that sort of thing? 12:29:06 I assume it doesn't leave anything on the stack 12:29:20 but '1 2 < if' presumably works as normal 12:29:30 there's no < 12:29:31 well, < isn't in cf 12:29:34 i'm just wondering about <= 12:29:39 There's no < 12:29:54 oops, sorry. '1 2 less if' 12:30:00 "2dup less -rot = or" --> x y x y --> x y Flag -> Flag Flag OR 12:30:24 and I just checked, apparently less is non-destructive -- it leaves the 1 and 2 on the stack, just sets the flags. 12:30:25 go Huffman code that and don't come back till you're done, young man 12:30:56 what color would you like that in, sir? 12:31:00 I don't get the advantage of colouring either. 12:31:11 Seems abstruse in spite of the rhetoric. 12:31:17 Chartreuse constants, yellow moons, green clovers, blue diamonds. 12:31:26 from what I've read, colours allow you to do away with the state variable 12:31:37 By adding a multitude of new ones, each associated with a colour. 12:31:39 I'd rather see a state variable. 12:32:10 Is cf using flags in a 1:1 mapping to hardware? 12:32:14 less global state that way 12:32:27 yes, just using the x86's flags 12:32:28 (well, one less variable, anyway ;) 12:32:42 now every character in the source carries state. 12:32:47 ouch 12:32:50 it's not state 12:33:04 it is state 12:33:07 it's a mark, sure -- but it's not global state 12:33:10 though it's every word, not every character 12:33:37 sure, a word split in two colours would be an odd beast. Probably coming in version 2. 12:34:03 I haven't done colourforth (and I still haven't read the forth standard), but 12:34:17 marble: the thing is though, that it doesn't reduce global state 12:34:28 because he has that weird thing that when you switch from yellow to green, it implies a literal 12:34:34 I imagine that instead of specifying whether a word is immediate or not when defining a word 12:34:35 STATE is only global in the broadest sense; it's actually local to the interactive compiler. You can't nest definitions in Standard Forth, so the globality of it is irrelevant. 12:34:37 so he has to track the current color anyway 12:34:47 the colours allow you pick when the word happens 12:35:02 yeah, but you can do that anyway 12:35:12 using [ and ], right ? 12:35:18 and postpone 12:35:23 and immediate. Yes. 12:35:38 the color doesn't add any extra options 12:35:56 it's not about extra options :P 12:36:01 it just moves them from being "punctuation" to being color 12:36:05 (both are turing complete, yadda yadda :) 12:36:07 It's about doing the same damned thing in a much more confusing way. 12:36:23 --- join: vatic (n=chatzill@pool-162-84-178-20.ny5030.east.verizon.net) joined #forth 12:36:31 hey vatic 12:36:48 hi vatic 12:37:07 I dunno -- it definitely sounds interesting to me -- I like the idea of doing away with STATE 12:37:16 Quartus, zpg, hey! 12:37:18 as tathi said, this doesn't do away with it. 12:37:23 (as I have to forth background, I'm not wedded to STATE, etc) 12:37:43 there is no state variable that can be queried 12:38:41 which is an unfortunate lack of reflection, as the state still has to be tracked internally. 12:39:04 only whilst compiling 12:39:13 (I think) 12:39:19 Which is the only time STATE is relevant. 12:39:29 in a regular Forth, that is. 12:39:30 kinda like the was IF THEN is handled 12:40:13 which is annoying because you can't do compound conditions 12:40:24 eh? 12:40:49 vatic: what's new? 12:41:01 you can't do two comparisons and then AND/OR them together 12:41:35 because any time you do a new comparison (or perform any arithmetic operation) it nukes the old flags 12:41:37 zpg: been sick with a cold since last week... 12:41:43 vatic, stop that at once. 12:42:20 Quartus: I was instructed to gargle with vinegar yesterday... 12:42:29 Not by a friend, I assume. 12:42:45 assembly has the same problem, and they're managed to solve it 12:42:55 Quartus: by the woman that sells bus tickets at the GW Bridge bus station. 12:43:07 vatic, she's mad. Stay well clear. 12:43:19 marble: yes, but forth is generally supposed to be easier to use than assembly language :) 12:43:28 Quartus: we have a bunch of fun conversing... 12:43:31 tathi, not anymore, now that we have colorForth. :) 12:43:42 assembly isn't all that hard :) 12:43:47 vatic, I recommend not gargling with acid, but hey, I'm no doctor. :) 12:44:16 a word to convert a flag to an item on the stack is one blunt approach, I suppose 12:44:31 'blunt' he says. 12:44:41 tathi: not to make a judgement, but the new Propeller chip has flag "effects" and conditional execution for almost every ASM instruction... 12:44:52 I suppose one has to learn how to manipulate flags, in a similar to newbi forth programming learning how to manupilate the stack 12:45:14 vatic: yeah, that seems to be a trend 12:45:25 ARM has conditional execution on all kinds of instructions also, I believe. 12:45:26 i'd rather not spend my time flag juggling. 12:45:29 tathi, it does 12:45:44 zpg: you're happy with stack juggling... ;) 12:45:56 anyway, I'm interested in the colours... :) 12:46:13 the whole flag thing, I haven't thought about at all 12:46:15 tathi: I was shocked by the idea that you could set the flags, execute an arbitrary number of instructions, and then start conditionally executing based on the preserved flags. Pretty weird. 12:46:20 marble: so find or create a good syntax highlighting mode for your favorite editor :) 12:46:22 marble, you're just getting started in Forth; all we can do is suggest you don't go off into the weeds. If you're hell-bent on doing that, then try not to remember our warning, you'll just be annoyed. :) 12:46:41 vatic: that's been around for a while. PPC does it, MIPS might also. 12:46:51 vatic: it's not useful very often, but it is fun :) 12:47:23 that makes for some fragile assembly, if you go and carelessly introduce a new instruction that alters flags. 12:47:27 PPC has eight separate sets of flags in its condition register :) 12:47:27 Ask me how I know. :) 12:47:39 yeah, been there, done that. :) 12:47:50 so...how do you know? 12:47:56 mumble mutter 12:48:08 And now, you can have that fragility in your Forth, too! And in COLOUR! 12:48:18 Quartus: like I said, I intend to read the standard, then I expect to play with forth until I have some kind of ability, then I want to see this colorforth thing and understand the design decisions -- if there's nothing of interest in it, then 'oh well' 12:48:45 ok. I recommend wood alcohol and an inner-ear imbalance. 12:49:12 *whoosh* 12:49:22 Or you'll never truly understand the design decisions. :) 12:50:11 * marble nods at tathi 12:50:45 Is this page still state-of-the-art for "Hello World" in colorForth? http://quartus.net/cgi-bin/twiki/view/Main/ColorForthHelloWorld 12:52:14 I see Ray's at the bottom. It's in two different but almost identical shades of green. 12:54:46 probably 12:55:27 It is actually somewhat less difficult to code Hello World in INTERCAL. 12:55:34 Note that INTERCAL is a joke language. 12:56:11 there is a word unpack in the kernel which unpacks a huffman encoded character, but it's not exposed 12:56:20 in Brainfuck, Hello World is ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. 12:56:29 the sensible thing would be to expose that and then you could do it fairly easily. 12:56:44 but of course colorforthers never do anything the easy way :) 12:56:49 cripes. 13:01:22 --- join: jackokring (n=jackokri@static-195-248-105-144.adsl.hotchilli.net) joined #forth 13:04:01 Wait, I think I can do it... 13:04:02 4hw 9show blue screen text 230 350 at red 3 2a 10 c 1 3 3f 0 2e 3 c c 4 44 9 13 for 2emit next ; 8hw 13:04:35 That made blood come out of my ear. 13:05:00 he could have just used decimals instead of hexadecimals 13:05:19 Hey, why not base 36? 13:05:29 Quartus: why base 36? 13:05:36 You get A-Z. 13:06:17 capitals, space, punctuation, etc 13:06:25 trivialities. 13:06:36 then be my guest 13:07:02 perhaps you can have a 36% green for it, or something ;) 13:07:48 hmmm, how about 14.12% green? :D 13:08:01 Of course, it's just as hard in GForth: 13:08:03 : hw 33 100 108 114 111 87 32 44 111 108 108 101 72 13 0 do emit loop ; 13:08:06 oh, wait, no it isn't. 13:08:28 : hw ." Hello, World!" ; 13:08:28 --- join: Snoopy42 (i=snoopy_1@dslb-084-058-112-155.pools.arcor-ip.net) joined #forth 13:11:45 I guess he didn't need to do a lot of that then 13:12:12 And if you're very lucky, neither will you. 13:12:26 why is that? 13:12:33 if need the words, I'll build the word set 13:12:34 Because it's so bleeding difficult. 13:12:37 isn't that the forth way? 13:13:02 more likely, I'll just grab a lib from somewhere 13:13:47 The Forth way is not, generally speaking, to lock yourself into a cabinet and then chew your way back out. 13:14:59 nor is it to simply keep on piling on the layers 13:15:44 If you can convince yourself that a lack of human-readable strings is somehow a positive feature, you'll be well on your way. I'm afraid I'm not up to the task. 13:15:45 from a maintenance point of view, I don't particularly like any of those hello world examples 13:16:02 Quartus: try harder! I'm sure it's not completely beyond you ;) 13:16:09 Trust me. 13:16:49 Oy. 13:17:32 : hw ." Hello, World!" ; seems unmaintainable to you? Too many lines of code? Too dense? Not enough comments? 13:17:48 I meant the colorforth examples, sorry 13:17:55 Poor choice of name? I'd agree with that, actually. 13:18:00 I re-used Ray's name. 13:18:40 tathi, can colorForth parse? Could one write a S" for it? 13:18:53 no, it doesn't parse. 13:19:10 hmmm 13:19:24 Ach mein Gott! 13:19:31 like I said, if you exposed 'unpack' you could pretty easily write something that would display huffman-encoded words 13:19:32 * zpg chuckles miserably 13:19:54 can you even embed a huffman encoded string, if you can't forward parse? 13:19:58 so you could have something that would display a "string" in that 48-character set. 13:19:59 local labels, a la assembler? 13:20:18 you could embed a string by simply putting it in the comment color 13:20:31 and then get at it retroactively? 13:20:36 but the words that you would need to decode it, while they exist, are not exposed 13:20:37 jmp start... meow: db 'meow meow meow' start: CODE_GOES_HERE_AND_REFERS_TO_MEOW 13:20:49 so no, you'd basically have to write it yourself 13:21:14 marble, that resembles assembler, which is a high-level language by comparison. 13:21:58 has Moore stated why he selected Huffman encoding? 13:22:00 So I guess you'd have to put your strings in comment colour in a block on their own, and read and unpack them out of there? 13:22:08 sure 13:22:13 I'd prefer something like s" 13:22:29 I'd prefer Forth. Even a crummy one. 13:22:31 i.e. you'd follow it by the string in comment colour, and it would display them 13:22:48 then continue with more code 13:22:48 that would entail parsing, or something very like it. 13:22:55 yeah 13:23:07 as usual with colorforth, it wouldn't be hard to add, but nobody has bothered doing it. 13:23:18 Too busy writing great apps 13:23:24 rofl 13:23:27 that must be it 13:23:28 oh my brain 13:23:52 zpg: the huffman encoding is basically a tokenization method 13:24:26 could you expand on that? 13:24:31 yes, you can. :) 13:24:38 hehe 13:24:44 hee hee 13:25:01 * zpg dies 13:25:48 "6675 636b 2069 7420 6475 6465 was his epitaph" 13:25:56 ok, how about we stop torturing Quartus and take this over to #c4th? :) 13:26:19 I didn't know about that channel 13:26:29 ? 13:32:22 --- quit: jackokring (Read error: 104 (Connection reset by peer)) 13:32:33 Not only is the emperor unclad, he's funny looking. 13:32:35 well, now I'm enlightened in all things Huffman. 13:33:04 colorForth seems to be the Michael Jackson of languages, just doesn't know when to stop. 13:33:35 --- quit: timlarson_ ("Leaving") 13:34:05 I can see Moore tooling it up for his own ends; he's mad for minimalism, and he had a specific project in mind. He also fancies limited-key keyboards, and big colourful displays. But why does anybody else care about this thing? 13:34:25 Because he's Chuck Moore. 13:35:02 Then spend some time working through the things he's done that have proven, lasting value, before leaping at something like this right off the blocks. 13:35:09 If Alan Kay or McCarthy retooled ST-80 or Lisp in a major way, language fans would check it out. 13:35:30 Kay and McCarthy have both undertaken projects that died on the vine, despite their passion for them. 13:35:38 ST-80 ? 13:35:39 Obviously, when I first looked at Forth, it seemed reasonable to check out what its inventor was doing these days. 13:36:08 Well, Kay's still using a Smalltalk-80 base. To paraphrase, he can't find anything that's better for rapid development. 13:36:18 ah 13:36:35 And no surprise, as it's his 35-year-old personal toolset. 13:36:42 Even so, I'm most interested in ANS, not too fussed about other dialects. 13:36:56 Quartus: indeed. 13:37:32 Coffee-time! 13:38:12 --- join: jackokring (n=jackokri@static-195-248-105-144.adsl.hotchilli.net) joined #forth 13:51:34 --- join: ellisway (n=ellis@host-87-74-241-174.bulldogdsl.com) joined #forth 13:53:46 Quartus: what're you up to at the moment? more work on the book? 13:54:11 Toy-making and the book, split between. 13:55:18 A few other projects along the way. 13:55:48 neat stuff. 13:55:51 Mods to Quartus Forth, support for customers' projects, etc. 13:56:00 i can take another look at book code at some point if you like. 13:56:09 ah yes, is there a new QF release in the pipeline? 13:56:28 Yes, at some juncture; I'm keeping an ear to the ground as regards the new Palm OS. 13:56:36 * zpg nods 13:56:37 makes sense. 13:56:44 Have you chewed on the pattern-matching library sufficiently? 13:56:58 need to take another look. with any luck, it'll click more readily this time. 13:57:01 learning curve and all that. 13:57:08 shall take another look later tonight or tomorrow if you like. 13:57:14 at your convenience! 13:57:36 sure thing. 14:05:57 --- quit: Cheery ("Download Gaim: http://gaim.sourceforge.net/") 14:07:13 --- join: JasonWoof (n=jason@c-71-192-26-248.hsd1.ma.comcast.net) joined #forth 14:07:13 --- mode: ChanServ set +o JasonWoof 14:25:44 --- nick: nanstm -> tiff 14:40:06 --- quit: jackokring (Read error: 110 (Connection timed out)) 14:41:11 zpg: huffman turns out very easy to compare and sort as the entire word is encoded into a 28bitWord with a 4 bit tag at the end and that tag might signal that the next words is an extention. Yes I'm about 2 hours behind in this conversation. 14:41:58 and in the wrong channel :) 14:43:14 And thank goodness for it, because that whole O(1) hashed dictionary-lookup thing was just so slow. 14:44:18 --- join: Amanita_Virosa (n=jenni@adsl-70-248-239-251.dsl.hstntx.sbcglobal.net) joined #forth 14:45:04 good evening 14:45:09 Hi crc 14:47:04 Hi crc 14:47:56 i have written soooo much code recently. 14:48:01 nasty, evil, math code. 14:48:05 shame it's not in forth. 14:55:32 heh. 14:56:01 Ray_work, Quartus: I still can't understand this hugely overblown 'efficiency' and 'minimalist' vibe being espoused. 14:56:22 really? 14:56:24 Obfuscation compromises minimality anyway. 14:56:49 From what I can see, Moore has become increasingly minimalist over the years. 14:56:58 Chuck is obsessive about minimalism; he coded in machine code for a while. :) 14:57:24 I don't know that he's efficiency-mad, there's some indication that he's not. But minimalist in terms of the things he considers worth minimizing. 14:57:27 And certainly in terms of this Huffman search and word-length limit, flexibility of the language seems to be compromised by the Big Idea of Minimalism. It seems to me you have to be clear about what you're aiming for with a minimal system. 14:57:54 I also have no problem with Moore designing whatever he fancies; I just don't get the appeal of a hyper-specialised 'general purpose' system. Seems mad. 14:57:58 "... It's in two different but almost identical shades of green" hey now, that's your wiki and those are your colors :) 14:58:03 i like minimalism. 14:58:05 Ray_work, that's your image. :) 14:58:37 You can type with one finger, but few would advocate deliberately cutting off the other nine. 14:58:51 zpg: well, Forth attracts a lot of kooks. :P 14:58:57 Quartus: Heh, quite. 14:59:08 tathi: perhaps, perhaps. 14:59:31 I doubt that Ray_work is a 'kook', I just don't get the appeal of cf as a usable language. 14:59:44 But I don't want to labour the point, this is just followup. 14:59:47 I sincerely think it's Emperor's New Clothes syndrome. 15:00:05 someone has written a s". I point to Howerd Oakford's cfdos4. 15:01:10 --- quit: Amanita_Virosa ("Woops, gotta bail.") 15:01:42 my observation has been that the colorforth crowd is mostly people who haven't done much (if any) coding before 15:02:02 who see some of Chuck or Jeff's rhetoric saying how bloated everything is and how much better it could be 15:02:10 and get excited about the concept. 15:02:14 Heaven help the poor bastards. 15:03:17 zpg; there are a couple reasons for Chuffman ( not really Huffman but close). One reason is it's a way to make words fit into 32 bits. Another is that they can be compared easily for find. There are others that escape me. Oh Program size. Slightly smaller using the encryption if you take as a sample your entire code and then arrange the letters by frequency. 15:04:12 There was a computer being tossed out yesterday in my building --there's about one every couple of weeks. Laptop. 512 MB RAM, 20 GB HD. 15:04:50 Working condition, no less. 15:05:06 nice 15:06:07 Yes, nice -- but I mention it in reference to the notion that we should go to extreme lengths to slightly compress source code on a Pentium-class machine. 15:06:21 yeah, I figured that's where you were going 15:07:07 I gave that one to my father to use for a specific purpose; these things are just about ubiquitous. I have a machine I use only for writing. We don't need to slightly compress our source code. 15:07:11 when I was playing around with writing bootable programs, I pretty much wasted space all over the place, but still never managed to come close to filling up a 1.2 GB drive 15:07:13 Quartus: it's not an image it's hand coded into your wiki. 15:07:20 I'm nearly caught up here ;) 15:07:30 Ray_work, it's an image, maybe not a bitmap, but it's still all you, man. :) 15:08:25 Hell, we don't need to heavily compress our source code, particularly not Forth source. It's not big. 15:08:54 this is true. 15:08:58 Agreed 100% 15:09:01 We don't need to cut any corners in the name of speeding up dictionary lookup, either. I've never heard anyone complain about the compilation speed of any Forth. 15:09:03 When did it become an image? 15:09:10 Ray_work, it didn't. It's a visual work. 15:09:15 * Ray_work checks this out when he gets home. 15:09:47 AH okay. not technically a picture but an image all the same. 15:09:56 Right. Poor choice of word on my part I guess. 15:10:07 No, you are absolutely right. 15:10:42 If i hand code it, or if I upload a PNG, still an image. 15:10:55 A rectangle with colour in it. 15:11:07 heh 15:11:12 hang it on the wall. 15:11:37 That way, you can point to it and say, "See, TexanForth" :) 15:12:06 HOME homies! :) 15:12:10 Certainly it's a big Hello World, even though it's the smallest one there. Must be Texas, making things big again. 15:12:13 Incidentally, lest I be misunderstood: I like the idea of simplicity, efficiency, clarity. I simply think there's a scale and Moore hasn't traded his in since 1981 15:12:27 hehe. 15:12:35 There's totally a better way. 15:12:40 bye :) 15:12:44 --- quit: Ray_work (Read error: 104 (Connection reset by peer)) 15:13:08 You scared him off with all this talk of pictures and hellos. 15:13:19 :) 15:14:09 zpg, maybe it works for him. Maybe it is an elaborate joke, thumbing his nose at the Forth community. 15:14:32 Who knows. Whatever he wants to do. I'm appreciative of his work on Forth in the 1970s. 15:15:40 yes, Forth continues to be an excellent idea. 15:18:48 hell, just watched the latest Rocky trailer. 15:19:00 yes, thank goodness, that's a story that needed a new chapter, eh? :) 15:19:00 That has clearly ceased to be an excellent idea. 15:19:21 Though that would imply excellent to start with. ahem. 15:19:37 Still, I have a soft spot for Stalone. Comic stuff. 15:20:18 He has a few soft spots of his own. 15:22:15 --- join: virl (n=virl@chello062178085149.1.12.vie.surfer.at) joined #forth 15:25:35 Heh 15:33:31 --- join: nighty_ (n=nighty@sushi.rural-networks.com) joined #forth 15:40:54 --- part: marble left #forth 15:46:36 --- quit: Quartus___ ("used jmIrc") 15:46:52 --- join: Quartus_ (n=Quartus_@209.167.5.1) joined #forth 15:46:52 --- mode: ChanServ set +o Quartus_ 15:47:29 did I miss anything exciting? :) 15:59:55 that much, eh? :) 16:09:49 Wreck on 30 at Camp Bowie. Other than that... 16:09:55 --- nick: tiff -> Raystm2 16:10:01 --- quit: ellisway (Read error: 104 (Connection reset by peer)) 16:48:37 --- join: erider (n=erider@unaffiliated/erider) joined #forth 16:53:52 --- join: Zarutian (n=Zarutian@194-144-84-110.du.xdsl.is) joined #forth 16:54:43 Dang it, I keep forgetting to add to my side of the argument that colorForth has always shipped with an ascii-colorForth converter, usually on block 48. 17:05:49 For converting what storage format to what? 17:12:38 ya, you feed it either and it spits out the other. The icon number is tabled to the ascii representation and vice versa. 17:12:49 one char at a time. 17:12:53 oh. So an interactive helper tool. 17:13:01 :) 17:13:34 I assume you could as easily look them up in a table? 17:13:48 you can use it to feed 0 terminated strings or what have you to a far block and then transfer that into the other os' file system. 17:14:52 The more I reflect on it, the more it really does seem like an elaborate joke at the expense of Forth developers. 17:15:22 :) I can appreciate that. It has weight, your thougth. 17:15:25 thought 17:15:38 I wouldn't put it passed. 17:16:06 well, maybe it actually is just that. Moore is the guy who wrote an angry poem about Forth once, and he's been heard more than once to denounce the Forth community and its efforts. 17:16:30 Franky, the site boils down to "I vomited this shit, lets see what sticks cuz I quit and I aint helping from here on out". 17:17:19 ITS EVEN MICROSOFT GREEN! 17:18:48 To further go on to have things like a change from one specific colour to another denote literals, for instance, is a considerably amusing continuation, in that light. Kind of a modern Aristophanes. 17:19:14 It's a cool toy, still, but like you say, there are better, more powerfull toys out there and then they are super ceeded by the things you should really be interested in. 17:19:29 Few have the intelligence and staying power to go for the really long-duration and complex humour. 17:19:57 Yet here we are. :) 17:20:41 Yes. 17:24:21 you know, buack to the literal thing... 17:24:30 it has a bit of a caveat, as well. 17:25:00 Go on. 17:27:12 yikes the example escapes me, sorry, have patience for an old mind. 17:28:04 it has to do with only being convenient in some situations. 17:28:45 http://en.wikipedia.org/wiki/Fizzbin 17:29:02 * Raystm2 thumbing thru blocks of code. 17:29:23 :) 17:30:58 if a king had been dealt, the player would get another card, except when it's dark, in which case he'd have to give it back. 17:32:21 I love it! :) 17:32:22 lol 17:32:36 I remember those episodes of those shows. 17:32:50 You see the similarity. 17:32:51 Well StarTrek and the Monkeys anyway. 17:33:18 That's why i'm jumping around in laughter here. ;) 17:35:48 That's one way to knock down the competition; waste their time futzing about with a tar baby. 17:36:38 :) sticky gooey. 17:42:43 --- quit: tathi ("leaving") 18:07:52 --- join: ellisway (n=ellis@host-87-74-241-174.bulldogdsl.com) joined #forth 18:12:21 reShalom. 18:12:27 hey. 18:13:00 what's new? 18:13:04 any developments? 18:15:48 I have come to the conclusion that colorForth is a long-running and complex joke. 18:18:01 --- join: geometry (n=gschuett@4.38.41.141) joined #forth 18:18:05 hello 18:18:08 Hi. 18:18:16 I heard forth is free on linux 18:18:17 Oh, it's you. 18:18:23 --- mode: Quartus set +b *!*@4.38.41.141 18:18:26 --- kick: geometry was kicked by Quartus (Quartus) 18:18:58 That, btw, was Gavin W. Schuette, and I'll be happy to provide a small mountain of reasons why kicking him is exactly the right thing to do, if anybody doubts it. :) 18:21:14 Heh, again? 18:21:26 Again. What a pest. 18:22:31 A freaking scourge. Anyway. Have you looked at Tathi's quicksort code? 18:23:25 --- mode: Quartus set -b *!*@4.38.41.141 18:24:07 No, not yet. 18:24:23 Does it use partition, or is a single quicksort routine? 18:24:29 *is it 18:24:46 It's a different approach to the partitioning operation, less efficient and in my opinion harder to follow, but interesting nonetheless. 18:25:06 It makes about 3 times as many exchanges as does the approach we were working on. 18:25:11 Intriguing. I tried to follow the algorithm specs on various sites, including Wikipedia 18:25:31 I'm not sure on the division of labour between us, you probably wrote most of my code :) 18:25:50 You had the idea down yourself early. 18:26:05 * zpg smiles 18:26:50 While quicksort was an obvious choice of sort, and while I need(ed) a sort operation for a bit of code I'm tinkering with, today's exercise suggests I ought to undertake more 'common algorithms' in Forth to try and better my coding style. 18:26:55 Hopefully I'm making progress. 18:27:27 There's still a buffer between reading a spec, or constructing one, and mapping that onto a stack-based language (i.e., thinking "if I had named parameters this would be a hell of a lot easier") 18:27:33 It's good exercise. 18:27:46 Well, you could start with named parameters and then convert that to stack operations. Not sure if that would help, but it's there. 18:28:01 I don't want to over-inflate exchange, but I really liked the simplicity. I also see a parallel with the functional paradigm in Forth, albeit on an analgous level. Not sure if you follow. 18:28:09 for instance, : exchange { a b } a @ b @ a ! b ! ; 18:28:15 * zpg nods 18:29:18 Good factoring, good naming, feels good. 18:29:24 Indeed. 18:29:45 it's all shiny and pretty and stuff, you could just look at it all day. Hyuck hyuck. :) 18:29:54 Heh! 18:31:38 Finally getting qsort working then mapping it onto the list code was a nice affair too. 18:32:04 Yes, it's also nice when it works. And when it's well factored, and you know the ins and outs of every component, and that each is sound and tested independently, it's very satisfying. 18:32:33 You can get a level of confidence about Forth code that's hard to achieve with other languages. 18:32:52 Yep. 18:33:16 Hopefully I can make a bit more progress. It'll be nice if/when Forth seems like the most comfortable choice. (Akin to Lisp, say) 18:33:29 Keep at it. 18:33:40 I believe you'll find it considerably superior to Lisp, but time will tell. 18:33:47 For example, Lisp's builtin list and sort routines encourage, at first glance, just implementing into it whereas Forth seems a little bit of a hassle. 18:33:54 Ah, neat. 18:33:56 Why superior? 18:34:09 A better fit to both mind and machine. 18:34:24 Intriguing. 18:34:43 I used to tinker in Common Lisp, never Scheme. But I write a fair amount of elisp using emacs as I do. 18:34:50 You saw the ezil site I guess. 18:34:56 I did. 18:35:01 5k+ lines of elisp. 18:35:24 Really liked it. Some conveniences such as pretty nice string-based calls, as you'd expect. Regexp for example. 18:35:37 Would be nice to write a small Forth module that uses RE ffi. 18:35:40 Might do that shortly. 18:35:48 Should be quite straightforward. 18:35:52 Once done, you can just use the abstraction via a 'needs' I guess. 18:36:23 Right. You'll use a set of words, how those words do what they do is secondary. Could be Forth, could be ffi. 18:36:39 Very much so. 18:37:17 Still, we have Common Use words, but a Common Library would be handy... can always rewrite dependencies but prototyping benefits from a general toolbelt. What do you reckon? 18:37:46 Imagine sitting down at the terminal and the client has said 'we need this, quick' -- you'd rather not write tonnes of low-level code from scratch, right? 18:38:02 (Although I'm of course being highly generic here) 18:38:13 Well, I'm of two minds about it. Yes, it's very handy to have toolkits, but on the other hand, ones tools in Forth are often custom-fit. So it would depend on what libraries you're talking about. 18:38:20 I think something like quicksort is a good library module. 18:38:46 Agreed. 18:39:07 I have a series of random-number generators that I've made interchangeable with a small wrapper. 18:39:34 Things like that. 18:39:36 Do you have (m)any http/socket Forth programmes? 18:39:54 Nothing that interfaces to the hardware -- just cgi stuff. 18:40:09 And how did you implement sockets? FFI? 18:40:27 I didn't. CGI needs environment variables, stdin, and stdout. 18:40:34 Ah, of course. 18:41:03 some work on the Palm, but that's using the available libraries. 18:41:04 Before I learnt any Forth, I came across FICL. Embedding the Forth in C is quite nice too. 18:41:05 ffi. 18:41:34 ah yes, John Sadler. Nice fellow. 18:43:22 Oh, you've chatted to him? 18:43:30 Corresponded some years ago. 18:44:45 Good stuff. 18:44:52 FICL seems frozen from what I can tell. 18:45:07 Not surprising. It's a pretty neat bit of code. 18:45:14 Yep. 18:45:48 I like the idea of augmenting an existing C programme with a chunk of Forth and linking to FICL 18:46:19 While I remember, I'll download a RE C library. 18:46:24 I find C remarkably arcane when I'm obliged to return to it nowadays. 18:46:27 Are there any you'd recommend. 18:46:48 It's been awhile since I looked a regexp libraries, I'm sure the state of the art has progressed. 18:46:50 I'm not surprised. I am suprised that Plan9 is still all C. They used a different system language initially I think. 18:47:02 Okay, it's a job for google. 18:47:31 I remember turning one up in short order a few years ago; I don't expect it'll be hard to find one. 18:48:18 http://www.regular-expressions.info/pcre.html 18:48:31 or rather, http://www.pcre.org/ 18:49:34 configure && making now 18:50:38 z" ..." is the common way to do zero terminated, C-like strings, right? 18:50:44 Right. 18:50:57 Not defined in gforth. So there's the first step. 18:51:13 Storage is just ( c-addr )? 18:52:24 It is. 18:52:28 Good stuff. 18:52:54 With z" (or zliteral) and strlen you can do pretty much everything you need. 19:01:57 right, zliteral and ztype are written. 19:02:21 ztype is strlen type so I hope you didn't spend too long on it. :) 19:02:46 well, dup strlen type. 19:03:21 ZCOUNT TYPE or DUP STRLEN TYPE ,I'd hope. 19:03:37 As I said. 19:03:47 and strlen 19:04:39 well i wrote ztype first 19:04:42 but now strlen is written 19:04:47 i could rewrite ztype 19:04:51 do that. 19:04:59 zcount is not a name I'd use. 19:05:02 Factor, factor, factor. 19:05:38 if you didn't use EMIT in ztype , this should be a trivial change. 19:06:46 waiting for pastebin 19:07:16 unless... 19:07:19 : zliteral ( c-addr1 u -- c-addr2 ) 19:07:19 here >r dup >r 19:07:19 here swap move 19:07:19 r> r> tuck swap chars + 0 swap c! ; 19:07:25 : strlen ( c-addr ) 19:07:25 0 swap 19:07:29 begin dup c@ while char+ swap 1+ swap repeat drop ; 19:07:31 : ztype ( c-addr ) 19:07:33 dup strlen type ; 19:07:37 yielding: 19:07:41 s" hi there" zliteral ztype 19:07:46 (pastebin unresponsive) 19:07:57 zliteral I'd build around save-mem, think it can be a lot smaller that way. 19:07:58 zliteral is a little messy, but i blame the beer. 19:08:00 there are more than a few pastebins. 19:08:20 there's a shorter strlen, too. 19:08:28 you can do strlen in a much nicer way. 19:08:44 and zliteral, I'd make it work like sliteral. Immediate word. 19:08:49 Then build z" around that. 19:09:00 yeah, i originally wrote a flakey z" that had a state @ call 19:09:09 incremental stuff, this took 2 mins so 19:09:48 PCRE is unfortunately not building 19:10:35 you can replace r> r> tuck swap with: r@ r> r> 19:11:33 * zpg nods 19:11:36 i wrote it in one parse 19:11:41 hence the ugliness 19:11:59 you don't have to keep excusing yourself. 19:14:15 have you been to Britain? 19:15:11 me? No. 19:15:31 there you go then. 19:15:36 we have to apologise for everything. 19:15:39 cf. Blair and slavery. 19:15:53 ridiculously shallow posturing if you ask me, but hey. that's labour for you. 19:17:17 --- quit: vatic (Read error: 110 (Connection timed out)) 19:17:49 if this behavior comes from a British bug and not a perception that we're attacking you, I suppose it's fine. 19:19:42 we? 19:19:45 attacking? 19:20:57 sorry, I don't know how to answer those questions. 19:22:17 --- join: vatic (n=chatzill@pool-162-84-178-20.ny5030.east.verizon.net) joined #forth 19:22:41 --- quit: vatic (Remote closed the connection) 19:25:04 Looks like two calls to the pcre will get you started. 19:25:22 one compiles a regexp into a dfa, the other executes it. 19:25:52 This is all as I recall it. There's a handful of other functions for doing fancier things with the results. 19:27:38 indeed 19:27:44 fink has succeeded, so i now have pcre 19:27:53 i also have guests who are glaring at me rambling about regular expressions. 19:27:57 best head off for a bit. 19:28:01 ok. 19:28:04 :) 19:28:13 seems like tea and a game of chess are on the immediate agenda. 19:28:48 enjoy! 19:28:54 thanks :) 19:53:16 --- quit: Razor-X (Remote closed the connection) 19:54:13 --- join: Razor-X (n=user@user-11faadf.dsl.mindspring.com) joined #forth 19:54:22 got the pcre working under windows. 20:21:19 what language are you using pcre from ? 20:22:37 Forth. 20:22:53 GForth. I ffi'd to the two key functions. 20:27:55 z" a.*e" regexp constant pattern 20:27:55 z" all access" pattern match .s 20:27:57 -> 1 20:29:02 -1 would be no match. 20:29:28 cool 20:29:31 ffi is handy 20:29:42 I was suprised how easy it was to do mysql from gforth 20:30:19 It's pretty slick. According to Anton I'm using some undocumented inadequate version of ffi, but it works fine. 20:30:41 who's that? 20:30:56 Ertl. 20:31:22 you have an old version of ffcall or something? 20:32:23 Current, as far as I know, but it's not officially documented, apparently. Reasons unknown to me. 20:53:15 what os? 20:53:40 W2K. But what I've read says ffi isn't fully documented, thus unofficial as of yet. 20:53:53 As I say, I may be using some backwater version, but it ticks along just fine. :) 20:54:04 I've only found one page on documentation on it in my cursory WWW searches. 20:54:11 Unofficial, of course. 20:54:49 ahh, I run linux 20:54:52 --- quit: zpg (Read error: 104 (Connection reset by peer)) 20:54:55 ffcall is a seperate install 20:54:58 unofficial there too, as far as I know 20:55:01 thus has a known version 20:55:02 It is. 20:55:08 --- join: zpg (n=user@user-514d7663.l2.c2.dsl.pol.co.uk) joined #forth 20:55:11 But there's little/no documentation in using it. 20:55:14 I know the version I'm using, but it's unofficial. 20:55:17 No matter the OS. 20:55:32 It's pretty simple, though. 20:55:37 Yeah. 20:55:39 library pcre pcre3.dll 20:55:39 5 (int) pcre pcre_compile pcre_compile 20:55:39 8 (int) pcre pcre_exec pcre_exec 20:56:03 Works fine, even though pcre_compile actually returns a pointer. 20:58:38 yeah, I think (pointer) and (int) are the same 20:58:56 since those data types are passed in the same way 20:59:13 Right. 20:59:23 hi 20:59:37 Hey zpg. Just playing with pcre. Got it flying under windows. 21:02:12 Good stuff. I've been afk. Just re-wrote those three zliteral words. 21:02:20 : zliteral ( c-addr1 u -- c-addr2 ) 21:02:20 1+ save-mem over 0 2swap chars + ! ; 21:02:20 : strlen ( c-addr ) 21:02:20 dup begin dup c@ while char+ repeat swap - char/ ; 21:02:24 : ztype ( c-addr ) 21:02:26 dup strlen type ; 21:02:34 Your zliteral still does not mirror sliteral in function. 21:02:53 oops, well that's really just a s->z so far 21:03:10 plus, you're storing your 0 further along than you should 21:03:19 --- join: zxcv_ (i=geoff@S01060040f4a589b9.vs.shawcable.net) joined #forth 21:03:23 and you're using ! instead of c! 21:03:44 yes, just correct the c! 21:03:49 how is 0 being stored too far along? 21:04:59 a string of length 0 is stored with save-mem with a length of 1 chars, which it dutifully returns; you're then adding the 1 chars to the original address, and putting the zero there, instead of at position 0 where it belongs. 21:05:39 Extrapolate -- a string of length 5 is stored as 6 chars, etc. 21:05:51 sure, aren't we going for 21:05:54 'hello\0' 21:05:58 i.e., 6 chars 21:06:12 yes, and in hello\0 the \0 is stored at offset 5, not offset 6 21:06:35 oh i see, my offset for c! is wrong 21:06:49 hence, your 0 is being stored too far along 21:07:35 This would, of course, have been revealed when you TESTED these words, right? :) 21:07:38 : not-really-zliteral ( c-addr1 u -- c-addr2 ) 21:07:38 1+ save-mem 1- over 0 2swap chars + c! ; 21:07:53 i did test the, and 'hi there' was printed as expected. 21:07:57 *these 21:08:16 hence the oversight 21:08:26 almost there on the not-really-zliteral. chars 1+ save-mem 1 chars - over + 0 swap c! 21:08:57 if you want to make the chars explicit for readability, or intent, or portability. 21:09:08 You did elsewhere, so I'm assuming. 21:09:47 yes. 21:10:53 I've got it running like this: 21:10:54 z" c.*s.*f$" regexp constant pattern 21:10:54 z" all controls off" pattern match 21:11:11 (returns a 1, with match offsets in a predefined array) 21:11:17 nice! 21:11:49 incidentally, if this is zliteral, do i need to have a state @ if postpone literal then ; immediate ? 21:12:25 I factor that as : ?literal state @ if postpone literal then ; so my zliteral is yours, plus ?literal, and then the whole word is immediate. 21:12:50 nice, so i'm on the right track. 21:13:11 Sure. Then z" is just 21:13:12 : z" ( "...<">" -- c-addr ) [char] " parse postpone zliteral ; immediate 21:14:13 very neat, thanks for those additions. 21:14:48 this comment convention is a little odd --> "...<">" 21:15:17 <> are delimiters for the delimiter character " 21:15:57 so the "..." bit is just 'a string from the input buffer', and <"> is 'parse until "' ? 21:16:35 Right. The standard would say "ccc" 21:16:41 ah. 21:16:43 thanks. 21:17:19 I've changed mine to "..." 21:18:32 good stuff. 21:19:09 Otherwise I cribbed from pcredemo.c, and then wrote wrappers. 21:19:43 I probably won't do the other functions unless I need them at some juncture. 21:20:21 --- quit: zxcv_ ("I love you all!") 21:21:28 i might keep my ffi stuff simple at first before i get onto multi-argument calls. 21:21:28 hmm, is there actually gforth documentation for FFI? i can't see it in the texinfo manual 21:21:46 no, you're flying by the seat of your pants. There's a few examples in c.l.f 21:22:04 In the scrollback you can see what's required for the windows ffi. 21:23:23 Ah, so I see. 21:23:29 okay, simple test time. 21:23:32 yeah, I think I just googled and found an example 21:23:38 seems pretty simple 21:23:56 there is a more complex alternate method to the one I used, I've seen it but can't quote it offhand. 21:24:13 Looks all grown-up and complicated and stuff. :) 21:24:18 I found one bug, but it's easy to work around 21:25:13 I just did this: 21:25:14 require fflib.fs 21:25:23 library libmysql libmysqlclient.so 21:25:23 libmysql mysql-version (int) mysql_get_client_info 21:25:23 libmysql mysql-init ptr (ptr) mysql_init 21:25:24 etc 21:26:31 The windows version in lib.fs is a bit different. Why, only the gods of GForth know for sure. 21:26:39 Or Ertl's hairdresser. 21:27:07 heh 21:31:51 neat stuff -- printf and strlen successively called on osx. 21:32:16 I somehow doubt ffi to strlen will be a win. 21:32:23 of course not. 21:32:36 i'm just testing the interface with painfully simple calls. 21:32:40 it's 0530 after all :) 21:32:51 how come this is ill documented? 21:32:54 I think my first test was abs(). 21:33:07 the rest of gforth seems pretty comprehensive on the doc side. 21:33:16 zpg, don't know. Apparently it's not as magnificent as it needs to be, so they're holding out. 21:33:29 is there a 0.6.3 in the works? 21:33:34 Or some number. 21:33:42 exactly, a +.+.+ 21:34:05 is Paysan still developing GForth or is he spending all his time on bigForth? 21:34:31 I'll buy you a Magic 8-Ball for Christmas, so you can ask these questions and get more useful answers than I can give. :) 21:34:44 In fact, I wrote one. Download Oracle for your Palm. :) 21:34:48 Ah no worries, read an implicit 'have you come across any info on...' 21:34:51 heh :) 21:35:02 REPLY HAZY, TRY AGAIN LATER 21:35:08 :P 21:35:29 JasonWoof: any more work on Herk? 21:37:15 --- quit: madwork (Read error: 110 (Connection timed out)) 21:46:21 --- quit: nighty_ (Remote closed the connection) 21:48:01 best head to bed, night all. thanks for the help chaps. 21:53:34 --- quit: ayrnieu (Read error: 110 (Connection timed out)) 21:57:33 ciao! 22:08:04 --- quit: zpg (Read error: 113 (No route to host)) 23:09:06 --- join: ayrnieu (n=julian@pdpc/supporter/sustaining/ayrnieu) joined #forth 23:12:13 zpg - test the interface by writing an IRC client. That's usually pretty fun :-) 23:59:59 --- log: ended forth/06.12.06