00:00:00 --- log: started forth/09.04.29 00:06:08 --- quit: Quartus (Read error: 104 (Connection reset by peer)) 00:47:43 --- part: X-Scale left #forth 03:46:46 --- join: schme (n=marcus@sxemacs/devel/schme) joined #forth 04:14:55 --- join: benny99 (n=bebenny@p5486DBA9.dip.t-dialin.net) joined #forth 04:23:17 --- quit: benny99 ("Lost terminal") 05:00:50 --- join: schme_ (n=marcus@c83-249-81-1.bredband.comhem.se) joined #forth 05:12:13 --- quit: schme (Read error: 110 (Connection timed out)) 05:16:19 --- quit: proteusguy (Remote closed the connection) 05:17:05 --- join: proteusguy (n=proteusg@61.7.144.97) joined #forth 05:45:34 --- join: proteusguy_ (n=proteusg@61.7.144.97) joined #forth 05:45:57 --- quit: proteusguy (Read error: 110 (Connection timed out)) 06:39:41 --- quit: schme_ (Read error: 60 (Operation timed out)) 06:43:35 --- join: schme (n=marcus@c83-249-81-1.bredband.comhem.se) joined #forth 06:50:14 --- quit: dkcl ("leaving") 06:50:27 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 07:07:37 --- join: GeDaMo (n=gedamo@212.225.108.65) joined #forth 07:39:55 --- quit: proteusguy_ ("Leaving") 07:40:29 --- join: proteusguy (n=proteusg@61.7.144.97) joined #forth 08:28:15 Why do I love Forth so much? I'm supposed to be Lisping. 08:28:31 hahaha. 08:28:45 dkcl: welcome to the dark side ;) 08:48:10 I know. :) 09:14:14 --- join: andrewSC (n=andrew@ipanema.parkpointrit.com) joined #forth 09:14:16 hi all 09:14:17 :) 09:14:22 Moin. 09:19:02 is there anyway to determine if the top value on the stack is an address? 09:19:17 rather than just some arbitrary number? 09:19:43 without using the @ symbol as that would throw an invalid pointer if the value was just some number.. 09:20:10 No 09:20:15 mhmm 09:20:39 Addresses are just arbitrary numbers :P 09:20:48 :P 09:21:16 What is it you're trying to do? 09:21:31 my bet: thermo nuclear war 09:21:49 yes schme 09:21:52 ;) 09:22:21 GeDaMo, i'm just trying to recurse down a tree and add the values of the leaf nodes 09:22:33 however, my null value is zero 09:23:18 Hmmm ... I don't see the problem 09:23:37 andrewSC: maybe test for zero before you access ;) 09:23:37 well, i think my logic is a bit off... 09:23:49 well i do kinda.. 09:23:55 Yeah, what schme said 09:23:56 dup dup 0 = if else drop cell+ @ recurse then + ; 09:24:14 is that far from the correct way to recurse this tree? 09:24:32 assume i've put the root node on the stack 09:25:10 how are your nodes mapped in memory? 09:25:17 using arrays 09:25:36 my root node has a value then pointers to the left and right nodes 09:25:46 so 09:25:56 create root 22333 , lnode , rnode , 09:26:16 and my child nodes are structured the same way. 09:26:49 it looks like it it simpsons time :) 09:27:07 haha what?? 09:27:15 literally or figuratively? 09:28:22 literally. the wife just woke up. 09:28:26 haha 09:34:15 What you want is something like dup left@ over right@ + swap value@ + 09:34:40 --- join: Al2O3 (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 09:34:50 Where left@ gets the value of the left tree 09:36:56 mhmmmm 09:39:34 : sumtree dup 0 = if 0 else dup @ ( value ) swap cell+ dup recurse ( left ) swap cell+ recurse ( right ) + + then ; 09:41:12 Whoops, forgot a drop before else 09:41:22 Drat! I mean a nip :P 09:41:41 Or a drop right after the if 09:57:44 --- join: tgunr (n=davec@cust-66-249-166-11.static.o1.com) joined #forth 10:02:11 hey GeDaMo, my apologies i just got off the phone.. 10:02:18 so regarding the one liner you posted 10:02:35 The one-liner with the three lines of edits? :P 10:02:40 the value, left, and right words are supposed to be nodes? 10:02:42 ;) 10:03:07 i suppose a more precise question would be what is value? 10:03:25 Value is the value at the current node 10:03:33 ok 10:03:42 what do the braces do? 10:04:01 Forth comments 10:04:07 ahhhh that's right 10:04:19 forgot about that form of commenting 10:04:23 tisk tisk.. 10:04:44 so the final line would be 10:04:47 : sumtree dup 0 = if drop else dup @ ( value ) swap cell+ dup recurse ( left ) swap cell+ recurse ( right ) + + then ; 10:05:31 You missed a 0 between drop and else 10:05:52 ahh 10:05:53 ok 10:05:58 That's the value of the tree if it's empty 10:07:15 gotcha 10:08:44 seems to go into an infinite loo 10:08:46 loop 10:09:44 my structure looks like 10:09:54 create root 5 , lnode , rnode , 10:10:09 create lnode 22 , llnode , 0 , 10:10:31 create llnode 2 , 0 , 0 , 10:10:39 create rnode 9 , 0 , 0 , 10:10:47 Presumably you don't do them in that order 10:10:56 right 10:11:12 root is at the bottom of the instructions 10:11:21 etc etc 10:12:00 --- quit: dkcl ("leaving") 10:12:04 I forgot the @s right before each occurence of recurse 10:12:35 So it's not fetching the addresses of the children 10:12:45 ahhhh 10:12:46 yes 10:12:49 i see now 10:13:04 That's what happens when I make stuff up on the fly :P 10:13:07 just recursing on the address not on the value inside the address 10:13:09 hahah 10:13:15 works well 10:13:17 :) 10:13:27 thanks for the help GeDaMo 10:13:54 No problem :) 10:45:12 why is it when i say test cell 10:45:21 i get the address of the first cell 10:45:36 plus the value stored in the third cell? 10:45:41 test being an array 10:45:45 infact 10:45:51 create test 1 , 2 , 4 , 10:45:59 that's the array 10:47:09 apparently you redefined `cell` to do something silly. :) 10:47:43 oh man.. 10:48:02 i Definitely don't think i did.. lol 10:48:18 oh, wait. 10:48:24 `cell` probably gives 4 10:48:29 the size of a cell in bytes 10:48:37 has nothing to do with the third value in your array 10:48:49 ahhh 10:48:50 ok 10:49:02 so it was just a coincidence 11:05:12 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 11:26:38 --- quit: Al2O3 (Connection timed out) 11:26:47 regarding trees and recursion 11:26:55 if i wanted to go left or right depending on a nodes value 11:26:59 how could i do that? 11:27:21 would i need to visit that nodes children before i could make a decision? 11:28:37 You only need the node's value 11:29:50 wouldn't that only apply to BST? 11:30:03 value@ condition? if visit-left else visit-right then 11:30:14 being the left node and it's children are < the root and the right and it's children are > root 11:30:23 mhmmm 11:30:46 let me see what i can do 11:30:47 :) 11:48:30 seems that i'm not doing something right... 11:48:34 dup 0 = if drop 0 else dup dup 3 cells + @ ( height ) > if swap cell+ dup @ recurse ( left ) else swap 2 cells + dup @ recurse ( right ) then + + then ; 11:48:45 i'm getting an underflow exception 11:49:22 on swap 11:49:45 i make two copies of the value 11:49:56 shit one by 3 and compare it's integer value 11:50:07 if it's greater than i traverse left down the three 11:50:18 if it's less than i traverse down the right 11:51:12 Why are you adding three cells? 11:51:34 oh 11:51:44 i forgot to mention i've changed my nodes 11:51:51 \ create node weight , leftnode , rightnode , height , leftstrut , rightstrut , 11:53:02 It might be easier to read if you create field words like height@ 11:53:27 hmmmm 11:54:57 What are the fields in your node for? 11:55:04 a mobile 11:55:08 :) 11:55:56 A mobile what? 11:56:50 http://www.hangingmobilegallery.com/ 11:56:54 basically those.. 11:57:12 it's simple in the sense that it's just a tree that stores it's weight 11:57:25 and the length between the weight and strut 11:57:32 etc etc.. 11:58:28 i think i see the problem 11:58:56 if i grab the height of a particular node the conditional statement will eat that value 11:59:13 however if i dup the value... 11:59:24 i should do a drop swap? 11:59:39 because the conditional will leave a -1 or 0 on the stack 12:00:03 then i end up swapping so it trys to get an address when it's a integer literal 12:00:51 meh that didn't do much.. 12:02:23 What are you testing the height against? 12:03:15 lol nothing apparently... 12:03:17 wow 12:03:18 umm 12:04:45 i'm comparing the left node height to the right node height 12:04:57 or what i'm supposed to be comparing.. 12:06:29 so perhaps after the else i need to recurse then compare the values and add? 12:07:28 I'm still not sure what you're trying to do 12:07:52 haha 12:08:04 let me see if i can explain a little bit better 12:09:00 basically each node has a weight, height, addresses for it's two children, and strut information (irrelevant for now). 12:10:11 starting at the root i need to traverse the tree and when i come to a node (left side or right side) i need to compare that nodes height to it's same-level right node 12:10:28 let me rephrase that last bit 12:11:53 i need to compare that nodes height to the nodes i've seen before it 12:12:16 haha give me second here.. 12:13:22 basically find the largest height value and traverse from that leaf node to the root adding the heights of it's parents as it returns to the root node 12:13:33 does that make sense? 12:13:55 i tried to explain it as best as i could.. :) 12:14:39 Hmmm ... 12:14:51 yes 12:14:57 andrewSC: I'd second that you should make a structure instead of using cell+ 2 cells + etc. 12:15:24 i tried to read about structures in Forth and i came across two examples but no explanations 12:15:32 hmm 12:15:41 one example was too easy so i assumed it was just pseudo code 12:15:54 probably not. :) 12:16:09 the other was way more complicated than cell+ and 2 cells + 12:16:21 so i made a decision 12:16:32 0 field: weight field: leftnode field: rightnode ... constant node-size 12:16:34 but ultimately yes, i completely agree i think structs here would be perfect 12:16:47 hmmmm 12:16:48 then you can do `leftnode @` and so on 12:17:01 was the zero infront of field intentional? 12:17:02 and your code will still work even if you change the structure around 12:17:10 yeah. starting size 12:17:17 what does it do? 12:17:22 oh 12:17:24 lol 12:17:29 i misread excuse me. 12:17:39 i see hmmmm 12:27:29 i think i almost have a struct in forth 12:27:41 basically i've created a word called field 12:27:45 so 12:27:52 : field dup constant ; 12:28:03 in gforth i type 12:28:10 oh, sorry. I was assuming your Forth had `field:` 12:28:18 no worries 12:28:52 oh nevermind it does.. 12:28:52 lol 12:29:00 i am trying to follow this one example 12:29:05 so say i want to set weight 12:29:12 i need to type 12:29:13 ok 12:29:45 5 weight 12:29:45 ? 12:30:08 where is the example? gforth docs? 12:30:17 http://www.figuk.plus.com/articles/jb/struct.htm 12:31:23 ah, ok. 12:31:40 that first bit (dup constant) just gives you the offset 12:31:52 ok 12:32:03 so you would have to do `5 node weight + !` 12:32:57 --- quit: dkcl ("leaving") 12:33:14 what is node in reference to? 12:33:19 the array? 12:33:50 whatever node you're setting the weight on. 12:33:57 mhmm 12:34:18 structure field words just take an address to the whole structure and add the appropriate offset to give you the address of the field 12:35:10 just a named replacement for `2 cells +` or whatever. 12:35:16 right right 12:35:18 hmmm 12:35:32 let me try something.. 12:35:45 so you could even just define them by hand 12:35:47 ok 12:37:37 ok i think i almost have this working 12:37:38 umm 12:38:01 once i set the value how can i access it? 12:38:03 weight@ 12:38:03 ? 12:38:13 or node cell+ @ 12:38:13 ? 12:38:20 ( node ) weight @ 12:38:24 mhmm 12:39:14 hmmmm 12:39:24 something is still off and i have to get going... 12:39:33 will you be in here later tathi ? 12:40:10 hmm...probably not...I have choir tonight. 12:40:20 ahh ok 12:40:27 well thank you very much for the help 12:40:29 Let's see...it's 3:40 now; I might be back on 9ish 12:40:42 just ask. Someone will answer. :) 12:40:45 fair enough 12:41:00 i'll probly here later tonight as well 12:41:09 anyways, thanks again! :) 12:41:12 --- quit: andrewSC ("Leaving") 13:05:36 --- join: Stepan (n=Stepan@opensuse/member/reinauer) joined #forth 13:08:32 so what happened to #forthcafe 13:09:36 he noticed the existence of ##forth and moved there instead 13:11:23 There's a ##forth? 13:11:54 Yeah...freenode changed their naming policy at one point, and (maybe) wanted us to move. 13:12:00 not that i think i should be involved, but we are so few, we should not argue and split up 13:12:18 But we sort of decided that since no one really owns the term "forth" that we would just stay here unless and until they forced a move. 13:14:26 Stepan: yeah...I tried talking to him privately, but couldn't understand what the problems were exactly. 13:14:59 I was hoping there was something we could do to keep him here 13:16:15 Well, obviously the kick he posted on c.l.f. was uncalled for, but it seems to have been an isolated incident AFAICT. 13:16:19 just saw the posting on c.l.f 13:16:37 (which was the reason to come here,.. so it had it's good side) 13:16:50 heh. 13:17:19 I just can't see that people leaving operator status on is a big issue. 13:17:35 Ditto people talking about random unrelated stuff, as long as it's not interfering with actual Forth conversation. 13:17:54 But maybe other folks feel otherwise, I dunno. 13:18:33 these little things can mess with people's mood and reception sometimes 13:19:08 i think everybody should live. and behave *g* 13:19:20 hear hear :) 13:19:33 What are you up to these days? Anything Forth related? 13:19:37 It's not like this channel is particularly busy 13:20:21 tathi: not doing much forth anymore.. OpenBIOS is mostly maintained by the Qemu folks, and I'm not working on any other OFW 13:20:23 --- join: Al2O3 (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 13:20:33 but who knows.. this might change again 13:22:43 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 13:29:20 --- join: Al2O3_ (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 13:42:47 --- quit: Al2O3 (Connection timed out) 14:20:23 stepan: ohai 14:39:57 --- quit: Al2O3_ (Read error: 54 (Connection reset by peer)) 14:40:20 --- join: Al2O3 (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 14:40:43 segher: What ya doin? 14:41:06 http://icanhascheezburger.com/upcoming/?pid=108860 14:41:35 --- quit: Al2O3 (Connection reset by peer) 14:42:09 --- join: Al2O3 (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 14:42:40 stepan: nothing much. well, way too much. but sleeping, in a few minutes :-) 14:43:41 i spend most of today on bringing my mail folders under 5GB 14:43:58 imap _sucks_ 14:44:14 it does? 14:44:19 better than pop3 i suppose 14:44:53 i started doing a libpayload port to ppc today 14:44:57 powerpc even 14:45:13 but all the .S files are empty ;) 14:45:33 heh 14:45:36 No bugs then :P 14:46:03 gedamo: depends on the linker script :-P 14:47:48 Pessimist :P 14:50:29 realist, heh 15:17:56 --- quit: dkcl (Read error: 104 (Connection reset by peer)) 15:21:08 --- quit: qFox ("Time for cookies!") 15:21:50 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 15:32:33 --- quit: GeDaMo ("Leaving.") 15:35:25 --- quit: dkcl ("leaving") 15:39:00 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 16:11:22 --- join: andrewSC (n=andrew@ipanema.parkpointrit.com) joined #forth 16:11:25 hi all 16:11:26 :) 16:44:14 Hello again. 17:04:51 --- join: nighty__ (n=nighty@210.188.173.245) joined #forth 18:04:15 hey all 18:28:05 morning 18:28:38 evening :) 18:37:08 --- quit: dkcl ("leaving") 18:51:17 --- join: snowrichard (n=richard@12.169.182.169) joined #forth 18:52:01 hi 18:55:04 mak 18:55:21 make bigForth failed... 18:57:09 never tried it 18:57:29 o? 18:59:44 --- quit: snowrichard ("Leaving") 19:00:24 ahh so where were we :) 19:00:39 --- quit: Al2O3 () 19:05:27 tathi, i'm still a bit confused as to how i should go about accessing and creating structs 19:05:29 : \ 19:05:46 i've been toying with different setups for a while now and i'm not getting far.. 19:15:54 weight @ 19:15:54 :28: Stack underflow 19:15:54 weight >>>@<<< 19:15:54 Backtrace: 19:15:58 excuse the flood.. 19:16:04 next time i will do a codepad 19:16:15 but i'm getting this error after i type 19:16:20 5 node weight + ! 19:18:01 even when i type the above and type 19:18:05 node weight @ 19:18:14 i get zero even though i've set weight to 5 19:18:39 perhaps i can only access values in an array not modify them? 19:24:17 facinating 19:24:37 with structs i can only access the values not modify them.. 19:24:48 node weight @ ok 19:24:48 .s <1> 9 ok 19:25:07 which is what i set the nodes weight to 19:28:22 er...you're doing two different things there 19:28:31 :) 19:28:41 `node weight` is not the same as `node weight +` 19:29:08 try 5 node weight ! 19:29:31 ah 19:29:34 yes that sets it 19:29:44 and node weight get's it 19:29:45 cool 19:29:54 node weight @ gets it 19:29:59 oh? 19:30:12 oops 19:30:12 at least that's what you just said... 19:30:13 yes it does 19:30:16 i forgot the @ 19:30:26 : \ 19:33:07 do you like grilled cheese tathi? 19:33:16 on occasion 19:33:22 excellent 19:34:28 ok... was there a point to that? :) 19:35:21 oh no 19:35:23 :) 19:56:43 http://codepad.org/3swJOErp 19:56:55 i can't figure out what i'm doing wrong here 19:57:21 did i forget to add syntactic sugar? 19:57:35 :1: Invalid memory address 19:57:39 that's what i'm getting 19:57:51 hmm, let's see. 19:58:34 this is irrelevant, but `dup 0 = if drop 0` seems kind of silly. 19:58:53 "if it's zero, drop it and put a zero there instead"? 19:58:58 yes 19:59:10 the stack actually holds the root node 19:59:13 oh, but you're distinguishing between null and 0 19:59:21 right 20:00:49 you want the dup before leftnode, not after. 20:01:47 you want to duplicate the tree pointer so you can get the rightnode later 20:01:57 instead you're duplicating the address of the leftnode pointer 20:02:08 ahhhh 20:02:14 yes 20:02:17 that fixed it! 20:02:35 :) 20:03:25 actually I'd use over, and add after each recurse 20:03:40 dup weight @ over leftnode @ recurse + swap rightnode @ recurse + 20:04:04 mhmmm 20:06:33 And personally I'd use `dup if ... then` instead of `dup 0 = if drop 0 else ... then` 20:07:41 lol let me see if can clean this up a little 20:07:42 :) 20:11:35 made the changes thanks for the heads up tathi 20:11:35 :) 20:11:39 brb afk 20:11:56 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 20:28:33 --- join: adu (n=ajr@pool-72-83-254-159.washdc.fios.verizon.net) joined #forth 20:29:07 bedtime for me -- goodnight all... 20:29:13 Night! 20:30:02 hi 20:30:11 how are you? 20:30:25 Sleep-deprived. How are you? :) 20:31:00 sleeepy 20:33:26 indeed 20:33:29 nite everyone! 20:33:29 :) 20:33:31 --- quit: andrewSC ("Leaving") 21:05:56 --- quit: adu () 21:14:33 --- join: adu (n=ajr@pool-72-83-254-159.washdc.fios.verizon.net) joined #forth 21:15:01 I like simplicity 21:42:37 --- quit: dkcl ("leaving") 22:49:10 --- quit: foxLaptop (Read error: 104 (Connection reset by peer)) 23:11:04 --- quit: adu () 23:59:59 --- log: ended forth/09.04.29