00:00:00 --- log: started forth/09.04.30 00:42:29 --- join: ygrek (i=user@gateway/tor/x-ec0da20e213bc826) joined #forth 00:54:07 --- quit: gogonkt ("leaving") 01:00:13 boing boing 01:50:44 --- join: GeDaMo (n=gedamo@212.225.108.65) joined #forth 02:01:16 --- quit: nighty__ (Client Quit) 03:30:46 --- quit: GeDaMo ("Leaving.") 06:48:49 --- quit: proteusguy (Read error: 110 (Connection timed out)) 06:49:43 --- join: proteusguy (n=proteusg@61.7.144.97) joined #forth 07:26:31 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 08:23:24 --- join: GeDaMo (n=gedamo@212.225.108.65) joined #forth 08:55:47 --- quit: tgunr (Remote closed the connection) 09:06:35 --- join: Al2O3 (n=Al2O3@c-98-245-193-186.hsd1.co.comcast.net) joined #forth 09:22:23 --- quit: Al2O3 () 10:28:02 --- join: andrewSC (n=andrew@ipanema.parkpointrit.com) joined #forth 10:28:05 hi all 10:28:06 :) 10:28:37 Hi :) 10:28:54 Moin. 10:29:37 hi hi 10:30:56 No te veo. :/ 10:31:01 Oops, wrong channel. 10:31:30 What is that? 10:31:33 * schme is curious. 10:31:44 lol 10:31:49 Spanish for "I can't see you". 10:31:50 --- join: paniko (n=chatzill@212.225.231.177) joined #forth 10:31:54 hahah 10:31:55 Oh ok :) 10:33:44 pero puedo ver ti 10:33:47 :) 10:33:51 lol oh man 10:33:53 focus. 10:33:54 Pero yo puedo verte (a ti). * 10:34:00 Sorry, I'm a grammar nazi in every single language I speak. 10:34:14 haha quite alright 10:34:17 Stackars sate :( 10:34:19 hi 10:34:36 Hi :) 10:34:43 i'm not fluent in Spanish and that was from google translate dkcl :) 10:34:56 just thought it amusing 10:34:59 andrewSC: Yeah, I figured. That doesn't mean it should be left incorrect, however. :) 10:35:02 slightly creepy, but amusing 10:35:06 indeed 10:35:09 :) 10:35:29 dkcl: i see you... :-) 10:36:01 andrewSC: did you make any progress with your program? 10:36:06 ohhhh 10:36:16 a fair amount GeDaMo 10:36:24 tathi helped me clean it up 10:36:29 but i'm still having some problems 10:36:38 right now i'm just trying to clean it up a little bit more 10:36:39 :) 10:36:57 i also introduced structs so it's a bit easier to read 10:44:16 --- join: aguai (n=aguai@114-42-212-42.dynamic.hinet.net) joined #forth 10:46:31 --- quit: paniko ("ChatZilla 0.9.84 [Firefox 2.0.0.14/0000000000]") 10:48:22 hmm 10:48:39 to set an initial condition i just need to put that value on the stack right? 10:48:58 then when my function loads i should manipulate the stack to get that initial condition 10:49:50 well 10:49:52 actually 10:49:58 That question is kind of ... vague :P 10:50:18 haha 10:50:40 i'm just trying to think of how to compare the first node height 10:50:50 if that makes sense.. 10:50:54 if i'm given the root 10:51:00 what do i compare it's height to? 10:51:47 I thought you were processing the children before the node value 10:52:08 i'm not sure if that's a good idea.. 10:52:27 also, i can't really wrap my mind around that kind of a structure.. 10:55:06 Can you describe the algorithm again? 10:55:28 sure 10:55:42 your given a tree with n number of nodes 10:56:00 each node has a height, weight, leftnode, and rightnode value 10:56:17 to get the total-height of the tree 10:56:25 you need to find the node with the largest height value 10:56:34 then traverse from that node back to the root 10:57:10 adding the height of each node in the traversals path to the total height 10:57:41 So you're not using the weight? 10:57:57 right 10:58:51 if you did the recursion in the beginning and had the if statement after the two recursive calls.. I don't really understand how the comparison would work. 10:58:57 So it's something like visit-left visit-right select-largest add 10:59:12 basically 10:59:32 but you need to find the largest height value in the entire tree 10:59:39 so you have to compare nodes 10:59:53 That's what the select-largest is for 10:59:54 would you need a variable for that? 11:00:04 ah 11:01:44 : compute-height dup 0= if 0 nip else dup left @ recurse over right @ recurse max swap value @ + then ; 11:01:53 Or something like that 11:02:38 mhmmm 11:03:12 is max a defined word? 11:03:26 Hmmm ... not sure 11:03:42 yeah i'm looking it up now :) 11:03:50 : max 2dup > if drop else nip then ; 11:04:33 hmmmm 11:05:10 I've just realised I don't need the "0 nip" becuase it only gets there if the value on top of the stack is 0 :P 11:05:54 haha 11:05:55 yeah 11:05:59 i changed it to 11:06:09 dup if dup leftnode @ 11:06:10 etc.. 11:11:02 excellent :) 11:11:42 http://codepad.org/ONfMYtRJ 11:11:54 thanks GeDaMo 11:12:04 Does it work? 11:12:12 works well 11:12:30 i've changed some numbers and it calculated properly 11:12:46 :) 11:12:57 Functions over trees generally follow the same pattern 11:13:32 mhm 11:14:34 With a bit of thought you could probably come up with a meta function for it 11:15:34 meta functions? 11:15:44 Like map or fold over lists 11:17:59 mhmm 11:21:14 GeDaMo, how often do you do metaprogramming in a work enviroment? 11:21:26 environment* 11:21:41 Me, personally? Not much - I'm unemployed :P 11:22:23 ahhh ok 11:22:35 do you use forth alot in general? 11:22:43 say more than C/C++? 11:23:22 I played around with Forth a lot a few years back, not so much recently 11:23:46 http://www.forthfreak.net/index.cgi?FunForth 11:24:16 is that your code? 11:24:23 That's something I wrote a few years ago 11:24:29 nice :) 11:27:14 Hmmm ... 2004 11:35:49 --- join: GoNoGo (n=GoNoGo@cro34-3-82-236-93-215.fbx.proxad.net) joined #forth 11:48:30 --- join: JasonPx (n=Jason@ipanema.parkpointrit.com) joined #forth 11:54:39 GeDaMo, what's wrong with this piece of code? 11:54:45 dup if dup weight @ over leftnode @ recurse ( left ) + then ; 11:55:02 i'm simply trying to sum the weights of the left part of the tree 11:55:40 You haven't supplied the value for when the tree is empty 11:55:54 else 0 then 11:56:05 mhmm.. 11:56:34 i mean the code runs, but i don't get the expected output.. 11:56:41 i'll add that in now though.. 11:57:07 Actually, I'm wrong 11:57:12 Ignore me :P 11:57:13 lol 11:58:34 seems that all the addresses that line actually got were zeros 11:58:34 You should replace over with swap but that should affect the result 11:59:17 i thought about that but like you said that shouldn't matter.. 12:01:23 Actually, it will affect the result 12:01:55 oh really? 12:01:56 how so? 12:02:54 that actually fixed it aswell.. 12:02:58 Every level you go down, leaves an extra value on the stack above the weight 12:03:19 because over takes the 2nd value from the top and duplicates it 12:03:25 ahhh ok 12:09:43 when using recursion and the if then statement GeDaMo, will anything after the then statement get executed during recursion? 12:10:00 or only after recursion has finished 12:10:32 It gets executed at every level of recursion 12:10:36 ahh ok 12:10:38 thanks 12:11:20 is there a way to seperate the code that needs recursion from the code that doesn't? 12:19:22 Like what? 12:19:41 A line of dashes? 12:20:15 dup if dup weight @ swap rightnode @ recurse ( right ) + then root rightnode @ rightstrut @ * 12:20:18 after the then 12:20:25 i don't want that code to be recursive 12:20:28 it should only execute once 12:20:44 Put it in a separate word 12:21:01 i tried but that word get's called and still gives the same value 12:21:24 No, I mean put it in a word which calls your recursive word 12:21:29 ohhh 12:21:30 ok 12:24:34 excellent! it works :) 12:24:44 thanks for the help GeDaMo 12:24:51 :) 12:25:00 i'm gonna go now afk.. 12:35:18 --- quit: ygrek (Remote closed the connection) 12:51:53 --- join: Maki (n=Maki@adsl-78-30-145-143.eunet.rs) joined #forth 13:14:37 --- quit: warpzero ("leaving") 13:14:43 --- join: warpzero (n=warpzero@twink.obsoleet.org) joined #forth 13:14:46 --- quit: warpzero (Client Quit) 13:15:52 --- join: warpzero (n=warpzero@twink.obsoleet.org) joined #forth 13:15:57 --- quit: warpzero (Client Quit) 13:16:02 --- join: warpzero (n=warpzero@twink.obsoleet.org) joined #forth 14:01:03 Double-length Variables and Constants just holds more right? 14:02:18 Two cells instead of one 14:14:15 how od i retrieve the pair values? i can only obtain the last one 14:14:38 --- quit: GoNoGo ("ChatZilla 0.9.84 [Firefox 3.0.10/2009042316]") 14:16:48 How are you retrieving? 14:19:30 If you're using 2variable to create the variable, store with 2!, fetch with 2@ 14:19:49 This channel is great for grepping. :) 14:20:10 If you're looking to "split" the value into its two component parts, there's no need: just retrieve the two parts one at a time. There's nothing special that binds the two values together. 14:22:23 gedamo: whoops i just stored wrong 14:23:04 :) 14:48:40 --- quit: Maki ("Leaving") 14:54:15 if my stack contain 1 '+.. how can i append it together to 1+ ? 14:54:23 what will be the appraoch for this? 14:56:57 What's on the stack? A constant and an execution token? 14:58:23 Do you want to create a function or just execute? 15:11:28 JasonPx: this is one way : combine: create swap , , does> dup @ swap cell+ @ execute ; 15:11:45 1 ' + combine: my1+ 5 my1+ . 15:22:05 :) 15:22:35 Hi JasonPx, :) 15:22:43 geDamo: sorry was away. im still trying to understand your code. 15:22:45 hey 15:23:36 i liked your presentation on Wed. :) 15:24:18 It creates a word and stores the constant and xt, the does> part fetches them and executes 15:24:20 thanks, though i think i mess up big time 15:24:24 hahah 15:24:44 gedamo: what does , do? 15:24:50 nah it was rough but i think the professor was like "Yeah his partner dropped" 15:25:05 stores the value on top of the stack into the dictionary 15:25:39 indeed 15:25:41 :) 15:25:49 JasonPx, what are you doing? 15:25:51 mobiles? 15:26:21 the first one. (seems easy to implement but dont know the syntax and forth approach for it) 15:26:30 ahh 15:27:04 JasonPx, check this link out http://www.forth.com/starting-forth/sf1/sf1.html 15:27:12 on the right hand side you'll see links 15:27:19 like different chapters 15:27:20 etc 15:27:27 andrewSC: yea im up to sf10 now 15:27:30 that really helped me with learning the syntax 15:27:33 nice 15:29:12 --- quit: GeDaMo ("Leaving.") 15:47:35 andrewSC: JasonPx: so you guys are both taking the same course at a college somewhere? 15:47:44 tathi, that's correct 15:47:47 :) 15:47:57 and a coincidence that we're in the same irc channel 15:48:02 yeah 15:48:18 Well, this is pretty much it as far as Forth irc channels go :) 15:48:23 hahahahahah 15:48:51 But I dunno how many college students use irc anymore. 15:48:56 haha 15:48:59 indeed 15:49:25 i like irc i used to be an Op for an old channel that did XDCC transfers.. 15:49:27 we're cs majors..so yeah.. 15:49:28 fun stuff 15:49:38 hi 15:49:46 well i mean still JasonPx, i don't think alot of kids in our class would even venture onto IRC 15:49:51 i use to dl alot via irc when i have 56k 15:49:56 unless it's like for a vent server or something.. 15:50:13 haha 15:50:30 hi slava 15:50:32 :) 15:50:38 seems like facebook and twitter and so on are where it's at these days 15:50:40 hey slava 15:50:53 agreed. 15:51:01 tathi: yea those are popular 15:51:16 i think it's because of the lack of brain cells.. or personal preference. 15:51:25 haha 15:52:02 that's like one of my pet peeves man.. Computer illiterate people under the age of 50. 15:52:28 I just don't see how they can't not learn about computers. 15:52:44 They don't need to know how it works, just how to use it. :) 15:52:52 ughh 15:53:38 It *is* kind of annoying sometimes. 15:53:41 http://galileo.phys.virginia.edu/classes/551.jvn.fall01/primer.htm /trying to learn from an example here, search " 53 CONSTANT PRIME".. for some reason.. i get an error for doing this 15:53:50 --- join: juron (i=juorn_ep@xdsl-87-78-161-109.netcologne.de) joined #forth 15:54:07 you make a valid point tathi i suppose that very statement is what keeps computer professionals in business 15:54:08 * search for "53 constant prime" to see what im referring to. 15:54:09 Still, I think it's interesting that the technology is getting transparent enough that people don't feel a need to muck around with it, they just use it. 15:54:19 looking... 15:54:51 hmmmm 15:55:09 so you did `: constant create , does> @ ; 53 constant prime` and you get an error? 15:55:15 what error? 15:56:54 --- join: iano (n=iosgood@168-103-233-36.ptld.qwest.net) joined #forth 15:56:58 it blames "prime" ... undefined word 15:57:44 are you sure you didn't misspell something? It should work 15:57:48 gforth, I assume...? 15:57:52 indeed 15:58:21 --- part: juron left #forth 15:58:28 yea 15:58:34 that's the CREATE .. DOES> example that everybody uses 16:01:18 so it's a gforth problem or ? 16:02:07 i don't think it's gforth JasonPx 16:02:08 maybe restart gforth and try it again? 16:02:14 tathi, do you listen to Bing Crosby? 16:02:17 It really should work. Works in gforth here. 16:02:49 sure 16:03:08 What album would recommend? 16:03:52 or maybe 16:03:59 Oh, I guess I don't *listen* to him -- I've seen him in movies 16:04:04 ahh ok 16:06:20 JasonPx: any luck? 16:06:28 it's fine now :) 16:06:36 this is killing me 16:06:51 ok. maybe you had redefined CREATE or something -- that would be my guess. 16:06:52 seems everyone only likes his Christmas stuff.. 16:07:09 Well, that's what he's best known for, I guess. 16:07:42 haha 16:12:01 brb, have to close up the greenhouses for the night. 16:22:57 brb aswell but for dinner 16:22:58 :) 16:23:31 andrewSC: gah. now I'm going to have Irving Berlin songs stuck in my head 16:29:03 --- quit: dkcl ("leaving") 16:43:53 andrewSC: did you use TIB to do 3 ' + curry-bin-op 3+ \ creates the word 3+ ? 16:46:39 you shouldn't need to 16:47:32 tathi: what operation would i need? 16:48:40 you mean to get the name 3+ ? 16:48:58 use CREATE or : 16:49:19 er, I should have said to *define* the name 16:52:26 CREATE .. DOES> allows you to make a word with data attached and code to do something with the data 16:53:23 : starts a regular definition, then you can use COMPILE, POSTPONE and LITERAL to compile behavior into it. 16:53:34 --- quit: kspaans (hubbard.freenode.net irc.freenode.net) 16:53:34 --- quit: kleinjt (hubbard.freenode.net irc.freenode.net) 16:53:35 --- quit: JasonPx (hubbard.freenode.net irc.freenode.net) 16:53:36 --- quit: iano (hubbard.freenode.net irc.freenode.net) 16:53:36 --- quit: aguai (hubbard.freenode.net irc.freenode.net) 16:54:30 --- join: kleinjt (n=kleinjt@tarsonis.dhcp.rose-hulman.edu) joined #forth 16:54:30 --- join: kspaans (i=kspaans@artificial-flavours.csclub.uwaterloo.ca) joined #forth 16:54:48 --- join: iano (n=iosgood@168-103-233-36.ptld.qwest.net) joined #forth 16:54:48 --- join: aguai (n=aguai@114-42-212-42.dynamic.hinet.net) joined #forth 16:54:58 --- join: JasonPx (n=Jason@ipanema.parkpointrit.com) joined #forth 16:56:52 ok guys my gforth now keep complaining about quota exceed.. what to do? 16:57:00 i try restarting it.. but same problem 16:57:46 hmm. I haven't seen that one. I guess I'll check the source and see what it means... 16:59:05 huh. doesn't seem to be a gforth error 16:59:22 i think it's my hd 16:59:51 that would be my guess, that your OS has limits set somewhere that you're exceeding. 17:02:54 --- quit: iano () 17:03:23 tathi: : boo( a b -- creates the word ab) 17:03:44 first i must concat those element and create it 17:04:10 oh. I thought they gave you the name. 17:04:13 how would i even create ____ / when the blank is from a param 17:04:24 you said `3 ' + curry-bin-op 3+` above 17:04:38 in which case it's easy. 17:04:39 o wait.. lemme double check 17:05:55 what i said is true.. but whhy would they do 3 ' + and 3+ ? 17:06:27 because there isn't any good way to get the names of things which came before 17:08:22 or you might want to give it a name that describes what it's used for, instead of just what it does. 17:10:27 ok i understand now.. damn overthink this.. now i wasted 2 hours :*( 17:11:53 maybe you can get extra credit for doing it both ways. ;) 17:14:05 nah 17:24:27 tathi: so i did the first part.. however the 2nd part http://pastebin.com/da371f22 ... i have to somehow save the early param and then execute it? 17:25:31 yeah. 17:26:50 err exactly how would i do this.. using "variable" will be inefficient as my value will messup if i create multiple words with it.. 17:27:01 hi again 17:27:02 :) 17:27:15 you want to build them into the new word 3+ that you're defining 17:28:37 you could use CREATE .. DOES> like you were looking at before 17:28:54 or you could make a regular colon definition and look at the words for compiling code 17:29:18 that is: COMPILE, (compile-comma) LITERAL POSTPONE 17:32:29 ahah im lost now 17:33:07 im currently using create does> num Op 17:33:17 ok 17:33:31 however num Op must be somehow be unique variables related to that word 17:33:33 * andrewSC smiles 17:34:01 im thinking of using some array.. but... hmm 17:34:26 no... 17:34:46 look back at that example using CREATE .. DOES> to define 'constant'. 17:36:06 The whole point of CREATE .. DOES> is that CREATE gives you a place to store data for each CREATEd word, and DOES> allows you to perform an arbitrary action on it. 17:39:39 or get Stephen Pelc's book Programming Forth from http://www.mpeforth.com/books.htm and read the section on CREATE .. DOES> :) 17:48:03 good golly 17:48:11 i just got isBalanced working properly... 17:48:12 ? 17:48:15 that was a pain lol 17:48:16 nice 17:48:27 nice im still far away 17:48:31 oh man 17:48:37 your gonna be up late lol 17:48:40 I always find recursive stuff annoying 17:48:48 meh 17:49:03 it's only natural to find it annoying like 99% of people think iteratively.. 17:49:08 well, tricky to debug, anyway. 17:49:11 that other 1% idk about.. 17:49:15 lmao 17:49:15 yeah 17:49:16 hehe 17:49:37 danging pointers in C++ is a killer too... 17:49:47 if you have dangling pointers in C++ you're doing it wrong :) 17:49:56 don't code it like C and it will be less of an issue 17:49:57 oh god please don't remind me 17:50:00 lol 17:50:03 tathi: : CONSTANT CREATE , , DOES> @ @ ; / to handle 2 param, however if i throw 10 20 constant prime, calling prime fails 17:50:03 modern idioms are pretty robust 17:50:06 I'll second that 17:50:19 C++ is supposed to be totally different than C 17:50:19 hmmmm 17:50:59 JasonPx: think it through -- after the first @, what does the stack look like? 17:52:37 the previous top will be in the top of the stack 17:52:56 ? 17:53:12 ok, do you know what @ does? 17:53:29 it sends an email right? 17:53:33 like tathi @ gmail.com 17:53:34 no 17:53:42 ding ding ding! we have a winnah! 17:53:47 :) 17:53:54 reads the address and retrieve the contents 17:54:07 its kind of annoying though. the domain name is read from the ipnut stream at compile time, only the recipient can be a parameter at runtime 17:54:10 damn ANS 17:54:16 they ruined email 17:54:38 ANS is the Anti-Forth 17:55:55 JasonPx: right, so CREATE puts an address on the stack, then you call @, leaving the value. Where are you getting the address for the second @? 17:57:03 im not sure now 17:57:38 i guess it doesnt exist ? 17:57:45 bingo 18:01:04 cool i will have to use 2@ i 18:06:57 ok.. so it works.. however ' + will be translated to some numbers instead.. and not the addition operation 18:07:13 how would i step over this problem? 18:08:31 if statements don't consume the -1 do they? 18:10:54 i believe they do 18:13:19 so ' + is stored as some number.. is there a operation to make it to + ? 18:18:10 --- join: nighty__ (n=nighty@210.188.173.245) joined #forth 18:19:50 @ 18:19:51 ? 18:20:03 JasonPx, is the number negative? 18:24:40 hmmm 18:24:47 how do you take the absolute value of something? 18:26:28 do you know off the top of your head tathi? 18:27:42 nvm 18:27:46 it's negate btw 18:35:34 ' + gives an execution token 18:35:53 you can execute it with EXECUTE or compile it with COMPILE, (compile-comma -- the comma is part of the word name). 18:36:27 hmmm 18:37:13 andrewSC: there is also a standard word ABS 18:37:27 or there is U. if you want to display something as an unsigned number 18:37:53 mhmm 18:38:14 yeah it was just a little hack to get around a root node with no children and no struts 18:38:26 ah 18:38:34 i said 18:38:48 if i got all null values, the sum will be zero 18:39:03 otherwise it should be greater than zero 18:39:19 and IF does consume the flag, but I assume you figured that out. 18:39:29 yeah lol i figured that out 18:39:30 ;) 18:39:38 and JasonPx made a hint to it 18:39:46 brb afk 18:39:49 cool 18:43:53 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 18:50:35 --- quit: dkcl (Read error: 104 (Connection reset by peer)) 18:51:23 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 18:59:08 --- quit: dkcl (Read error: 104 (Connection reset by peer)) 19:08:26 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 19:46:54 --- quit: dkcl (Read error: 54 (Connection reset by peer)) 20:03:12 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 20:10:32 so i'm reading about struct. they mention "offset".. what does that mean? 20:44:29 --- quit: andrewSC ("Leaving") 20:57:41 --- quit: dkcl (Read error: 54 (Connection reset by peer)) 21:05:00 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 21:22:03 --- quit: dkcl (Read error: 104 (Connection reset by peer)) 21:22:12 --- join: dkcl (n=dkcl@unaffiliated/dkcl) joined #forth 21:26:39 can someobdy go provide me a useful link of structure in forth? 21:52:23 or can somebody explain how to use compat/struct.fs http://sysinf0.klabs.be/usr/share/gforth/0.6.2/compat/struct.fs?dist=%3Barch= 22:10:44 --- quit: dkcl ("leaving") 22:22:14 --- quit: JasonPx ("Leaving") 22:55:49 --- join: qFox (i=C00K13S@132pc222.sshunet.nl) joined #forth 23:59:59 --- log: ended forth/09.04.30