00:00:00 --- log: started forth/05.12.15 00:06:40 --- join: I440r (n=none@rrcs-24-242-160-169.sw.biz.rr.com) joined #forth 01:09:08 --- join: Ray_work (n=Raystm2@adsl-68-94-190-17.dsl.rcsntx.swbell.net) joined #forth 01:10:40 --- quit: Ray-work (Read error: 104 (Connection reset by peer)) 03:40:51 --- quit: sw_lters_ (Read error: 104 (Connection reset by peer)) 04:01:15 --- join: sw_lters_ (n=swalters@6532183hfc82.tampabay.res.rr.com) joined #forth 04:37:15 --- join: PoppaVic (n=pete@0-1pool47-101.nas30.chicago4.il.us.da.qwest.net) joined #forth 05:27:22 --- join: segher (n=segher@blueice2n1.de.ibm.com) joined #forth 05:47:54 --- nick: Raystm2 -> nanstm 06:02:39 --- join: madwork (n=foo@derby.metrics.com) joined #forth 07:04:36 --- join: Cheery (n=Henri@a81-197-18-99.elisa-laajakaista.fi) joined #forth 07:28:48 --- quit: PoppaVic ("Pulls the pin...") 07:31:03 --- join: PoppaVic (n=pete@0-2pool236-226.nas22.chicago4.il.us.da.qwest.net) joined #forth 07:50:53 my cousin told me that (a + b) * (a + c) would be less efficient on a stack machine than on a register machine 07:51:28 because you have to duplicate the value of the variable a 08:07:26 That's because registers are magic. 08:25:20 madwork: what do you mean? 08:26:15 Well, how is the value of "a" not being duplicated in the registers? 08:26:53 in C.. it would be thanks to an optimizer honed by experts 08:31:42 That doesn't really describe how it's physically done. 08:32:00 fetch b to r1, fetch a to r2, add r1 to r2, fetch c to r1, add from address of a to r1, multiply r1 by r2. 08:32:08 that is what gcc does on my i386 box 08:35:35 You've essentially duplicated a by fetching from it twice. 08:35:52 on forth i imagine this: 08:36:32 fetch a to register 1, push register 1, fetch b to register 1, pop register 2, add register 2 to register 1, push register 1, fetch a to register 1, push register 1, fetch c to register 1, pop register 2, add register 2 to register 1, pop register 2, multiple register 1 by register 2 08:49:58 Unoptimized high-level Forth on a register-based architecture, sure. Now are you actually talking about Forth here, or CPU architectures? 08:51:06 maybe i am not the best the armchair has to offer.. i am talking about forth versus c on my home computer 08:52:56 OK, because initially you said "register machine" vs. "stack machine". 09:02:23 --- quit: JokeR69 (Read error: 104 (Connection reset by peer)) 09:25:19 --- join: virl (i=core@chello062178085149.1.12.vie.surfer.at) joined #forth 09:46:26 --- quit: PoppaVic ("Pulls the pin...") 10:08:45 SunDragon: not sure it's fair to compare an optomized compiler in one language with an unoptomized compiler for another 10:08:59 SunDragon: and also keep in mind that x86 is very much designed to run C code 10:10:24 most forth implementations don't optomize much, but it can be done, and I don't think it's terribly hard 10:11:56 I've looked into optomizing out the stack juggling (dup drop swap over rot lit etc) 10:12:00 and it can be done quite simply 10:12:09 --- quit: ccfg ("paipai") 10:15:58 --- quit: docl (niven.freenode.net irc.freenode.net) 10:16:40 --- join: docl (n=docl@67-51-244-38.bras01.mcl.id.frontiernet.net) joined #forth 10:30:02 --- quit: docl ("Leaving") 10:40:42 JasonWoof, what are your strategies for optimizing out the stack juggling? 11:05:53 you keep some stack items in registers, and as you assemble, you let the number of stack items in registers vary from 0-4 or so 11:06:00 at compile time 11:06:11 you keep track of where the values are 11:06:33 so you hit SWAP, and just change your variables that say which registers the stack items are in 11:07:01 same with DUP, OVER etc 11:07:10 Ahh, neat. 11:07:22 when you write asm words like + you just have to ask it which registers have TOS and SOS, and then update them after 11:07:49 then before you exit or call a word you have to compile instructions to put the stack back to normal 11:12:21 I haven't actually done it, but it seems pretty easy 11:13:14 What about non-destructive words? 11:23:53 eh? 11:23:58 you mean like 1+ 11:35:50 Well, everything, in theory. 11:35:54 Except DROP. 11:37:03 DROP is non-desturctive; for example, i know how to "repair" 1 DROP 11:37:33 Fine, but functionally, it's destructive. 11:37:56 so by non-destructive you mean things which do not alter the cells already on the stack? 11:38:14 such as DUP 11:40:18 that's a better definition i guess 11:40:50 or perhaps you want to include operations that can return the stack to the original state, by only lookingb at what is left on the stack 11:44:34 --- quit: I440r (Read error: 104 (Connection reset by peer)) 11:49:54 segher: I don't understand what you just said 11:50:36 something like 1+ is repairable by only using info still on hte stack: just do an 1- 12:01:30 ok. does that have something to do with what we were talking about before? 12:04:41 Hey all. 12:12:00 Hi, Q. 12:12:25 JasonWoof, I'm saying for something like IF THEN... where the IF doesn't drop the TOS. Nothing does. 12:35:55 --- join: I440r (n=none@rrcs-24-242-160-169.sw.biz.rr.com) joined #forth 12:37:51 hi Quartus 12:39:11 still have no idea what you guys are talking about. If you could ask a specific question that doesn't rely too much on context I could probably answer it. 12:51:27 1 1 + 12:51:27 [ 1 1 2 ] 12:51:30 instead of 12:51:33 1 1 + 12:51:34 [ 2 ] 12:51:58 Nondestructive + vs. destructive + 12:53:16 --- join: TheBlueWizard (i=TheBlueW@ts001d0248.wdc-dc.xod.concentric.net) joined #forth 12:53:36 madwork: you want to implement that ? 12:54:25 Not necessarily... just curious about the pros and cons... if it would reduce stack juggling or not. 12:55:13 would not reduce stack juggling 12:55:47 : non-dest-+ over over + ; 12:56:23 Er... well it would have to be implemented this way from primitives. 12:56:55 --- quit: Cheery ("Leaving") 13:01:37 * JasonWoof looks around for queston marks 13:02:29 --- quit: segher () 13:02:36 madwork: I doubt something like the + you gave in your example would be much use 13:03:10 you've gotta get rid of the 1 1 underneath one way or another 13:03:16 Yes, you do. 13:03:29 But, there are cases when you don't want to. 13:03:51 2dup + 13:04:01 The DUP and OVER etc. usage may be reduced. 13:04:09 And then you see more DROP and NIP. 13:16:53 None of this is actually an issue in practice, though. 13:22:51 * JasonWoof agrees with Quartus 13:29:15 Over the years, I've seen a number of people express extreme concern over how to eliminate stack juggling; this always comes from people new to Forth who haven't developed enough expertise with the language to understand how to write code that minimizes the juggling in the first place. 13:31:02 Now, if you've got an inlining Forth that can eliminate, say, a 'DUP DROP' sequence, all the better -- though such sequences rarely arise even in such a Forth. 13:42:04 Breathe 13:42:08 Ok back to work. 13:49:45 indeed. 13:49:54 the solution to stack juggling is not tricky new words 13:50:05 or things that help you juggle (such as locals or something) 13:50:36 the solution is to get good at the forth methodologies. write your code so nothing needs juggling. Things just are in the right order to begin with 14:26:28 --- quit: Ray_work (Read error: 104 (Connection reset by peer)) 14:34:15 --- join: snoopy_1711 (i=snoopy_1@dslb-084-058-149-153.pools.arcor-ip.net) joined #forth 14:35:02 --- quit: Snoopy42 (Nick collision from services.) 14:35:29 --- nick: snoopy_1711 -> Snoopy42 15:40:48 * SunDragon laughs 15:41:08 --- quit: SunDragon ("Leaving") 15:42:06 --- join: SunDragon (n=ben@leb-cr1-220-16.peak.org) joined #forth 15:42:35 quartus: so is it incorrect forth to write this way? a @ b @ + a @ c @ + * 15:44:13 a @ dup b @ + swap c @ + * would probably be better, since you only have to get a from memory once 15:45:13 what would swap look like in asm pseudocode for an i386? 15:45:27 erm, i dunno 15:45:41 it swaps the top two stack elements 15:45:52 i don't think there is an i386 instruction for that 15:46:03 * SunDragon is probably wrong 15:46:03 how that looks in asm depends on how the forth is implemented 15:46:48 let's say you are using the i386 stack pointer for the stack, with the top of stack in a register 15:48:09 pop r2, push r1, assign r2 to r1? 15:49:05 * saon is not terribly good at assembler 15:50:15 * SunDragon neither 15:50:30 but i don't think the pseudocode i pasted is superior to a single fetch from memory 15:51:01 SunDragon: you can check it out by see swap :) 15:51:13 see swap 15:51:13 SWAP is primitive defined in 'C' kernel. 15:52:06 of course if you have a stack optomizer thing... the swap would compile to no instructions at all 15:52:16 or, you could just factor it right and you wouldn't need swap 15:52:30 no wait... 15:52:41 looks like gforth loads both items to registers, then pushes both items back to the stack in reverse order 15:52:45 guess you do need something 15:53:28 guess I'd do a @ b @ + a @ c @ + * 15:53:34 it's more readable 15:53:40 the x86 code to swap registers is XCHG reg1,reg2 15:54:26 XCHG reg,mem also works 15:55:06 SunDragon, just tuned in. It's not incorrect Forth, as it'll compile, but it's ugly as sin on a Sunday. :) 15:55:40 quartus: how would you do it? 15:55:51 let's say that we are forced to use variables a b and c 15:55:59 Right there, I'd diverge and use the stack. 15:56:10 It's a stack-based language, after all. 15:56:15 TheBlueWizard: i didn't remember you could xchg with memory 15:56:16 I limit the use of globals. 15:56:56 quartus: how would you do it stack-based? 15:57:50 Is the intended result (a+b)*(a+c)? 15:57:54 yes 15:59:41 Just off the top of my head: : foo ( a b c -- n ) rot dup >r + swap r> + * ; 15:59:57 That assumes ( a b c ) -- it would be cleaner ( b c a ) or similar. 16:00:28 Thought not much. 16:00:33 *though 16:00:51 --- join: segher (n=segher@dslb-084-056-163-063.pools.arcor-ip.net) joined #forth 16:00:58 what is >r? 16:01:06 Moves the top of the data stack to the return stack. 16:01:18 r> is the reverse. 16:01:34 i remember reading about that trick in starting forth 16:01:56 It's not so much a trick as just general practice in Forth, using the return stack as temporary storage. 16:02:30 it looks like it will end up as more instructions than what gcc would emit 16:02:40 That will entirely depend on what Forth you're using. 16:02:52 SunDragon: I checked it using DEBUG on MSDOS and single stepped thru XCHG AX,[200]...it works :) 16:03:05 TheBlueWizard: that is good to hear 16:03:23 Quartus: what forth would it depend on? 16:03:57 SunDragon, different Forth systems will emit different code for that sequence. An optimizing native-code Forth will generate a different sequence than will a non-optimizing one; a threaded Forth will emit a different sequence, and so on. 16:04:01 i mean, what forth produces machine code that is tight compared to gcc? 16:04:25 ah, an optimizing native-code Forth 16:04:30 Off the top of my head, I know Stephen Pelc has an optimizing Forth for the x86 that's well thought of. 16:06:14 too bad it requires NDA 16:06:32 It's a commercial system. 16:06:53 I believe there's an evaluation version, but I haven't had a look at it for awhile, so I may be wrong. 16:10:49 --- nick: nanstm -> Raystm2 16:30:20 --- quit: virl (Remote closed the connection) 16:38:00 Sup my peops? 16:38:20 hiya Raystm2...just chillin' and reading /. 16:38:28 reading? 16:38:36 hi TheBlueWizard :) 16:39:01 yeah..reading /. 16:39:17 Title? Or is it verbotten? 16:42:07 Slashdot 16:42:28 as in / = slash, . = dot 16:43:31 Oh sorry, of course, thought it was a typo. But twice? couldn't be. 16:43:31 :) 16:43:49 Still, shouldn't that be verbotten? :) 16:43:53 hehe. 16:44:00 I don't think i've ever read /. 16:44:10 Programming stuff? 16:44:13 * Raystm2 looks 16:44:28 a popular website (slashdot.org) 16:48:54 oh boy, today's nichtlustig is great 16:49:30 And that is what, a kind of streudel? :) 16:49:41 nichtlustig.de 16:49:45 online cartoon 16:50:32 "not funny" 16:51:47 Well, I appear to be at a creative impass. 16:51:56 the other day i finally got it.. the jupiter ace.. jupiter is the 4th planet 16:52:34 5th 16:52:44 Mars=4 16:52:52 Earth =3 16:53:02 hrm, that's a bad 1 off, even for me 16:53:08 :) 16:53:12 np, long day 16:53:13 hehe 16:53:30 WAIT counting starts with 0. 16:53:33 you are correct 16:53:46 Jupiter = 5 16:54:01 wait now i'm 1 off. 16:54:07 It's catchy. 16:54:30 Mercury is in the 0th position. 16:55:14 how many moons does mars have? 16:55:18 2 16:55:19 so what's the sun's position then... -1st? 16:55:35 Sun = star not a planet. 16:55:54 position = not about substance 16:56:22 in that case shift to include substances not a planet. 16:56:31 if you want to start counting at 0, just makes sense to count the center as 0 16:56:47 concede. 16:56:55 I have conceded. 16:57:01 what do i win :-) 16:57:01 I have agreed. 16:57:04 yes 16:57:07 you win 16:57:19 well thanks! 16:57:29 I am proud to just know you. :) 16:57:50 i am proud to have such faithful disciples 16:57:53 you win the center. 16:58:12 And I am yet still one off. :) 16:58:31 it was mined already. it _always_ has been mine 16:58:41 s/d / / 16:59:07 Moons of Mars? I know one must be Phobos? 16:59:13 or close to that. 16:59:25 Yikes entire internet in front of me and i'm guessing. 17:00:03 phobos && deimos 17:00:15 i haven't named my moons 17:00:36 thanks you just saved an engineer at N.A.S.A from having to respond to a one-off e-mail. 17:00:38 the feminine ones, you mean? 17:00:40 I've heard of big people, but very few actually have satellites. 17:00:54 Quartus: kids? 17:01:00 Do they orbit? 17:01:07 Don't they? 17:01:14 can a sun have moons? 17:01:21 YES! 17:01:25 Mostly they sit right on their duffs until they're kicked out, and then they never call. :) 17:01:28 depends on how much of anti-ad&hd chemicals you slip them 17:01:45 Quartus ;( 17:01:52 that's sad, but true 17:02:14 segher: is that legal? 17:02:51 Our sun has many, many moons. 17:02:57 For many, many moons. 17:03:27 raystm2: dunno 17:03:51 raystm2: i know it's done a lot though. sadly. 17:03:57 Yes. 17:04:14 We fell for it, with wifes first son. 17:04:21 Not for very long tho. 17:04:53 good to hear 17:05:02 most parents did the world a disfavor by producing kids 17:05:03 that last thing 17:05:13 indeed 17:05:25 Getting your children to "fit" socially into the world with drugs is just plain wrong. 17:05:36 --- quit: TheBlueWizard (Connection reset by peer) 17:06:32 Our 'lifestyle' is completely and totally and even all artificial. 17:06:56 they will find their own place no matter what, don't worry 17:07:01 My plastic pet cat doesn't like to hear talk like that, Ray. 17:07:03 yes. 17:07:12 Quartus: what about the robots? 17:07:32 * Raystm2 loves Quartus' replicas 17:07:36 ALSO ARTIFICIAL, YES. :) 17:08:01 I was so filled with joy when I saw your website. 17:08:13 Those darn things are neato-bosso. 17:08:15 That's good! I recommend joy. 17:08:57 personnally, I think i'll stick with colorforth -- pun by RAS. Please come again. 17:09:09 heh 17:09:38 * Raystm2 is slightly saddened by the promotion to warehouse manager. 17:09:53 Now I'm not in front of a terminal as often, and can't chat. 17:10:08 But I did get the warehouse computer online and the display corrected. 17:10:23 most people prob'ly never noticed I had moved. 17:11:14 Hmm, I think i left the chat client off, while fixing the display adapter. I don't see Ray-work here. 17:12:01 * Raystm2 needs to learn how to control this machine from work and the work machine from here. 17:13:09 P'' visualColorStudio is at a creative impass. 17:13:40 Neatest thing about it, it's a heck of a hex editor. 17:14:11 Raystm2, i use ssh for that 17:14:21 for hex editing ? 17:14:29 (controlling work machine from home and viceaversa 17:14:31 no you mean controlling each machine :) 17:14:36 right. 17:14:41 * Raystm2 must learn how to do that. 17:14:45 for a hex editor i use bvi 17:15:02 BUT i'm one onf those idiots who loves to read tech stuff but only learns what people tell me. 17:15:07 you do. 17:15:17 * Raystm2 needs to google bvi. 17:15:53 i've heard of a neat binary editor from simon tatham (the dude who made putty) 17:16:07 I have "HexEdit", but i like the fact that i'm a novice programmer and now have a hexeditor of my own construction, completely bastardizable by me . :) 17:16:38 back in the days of dos, i forgot what i used.. it was a sector editor 17:17:13 cool, edit an entire sector of disk at a time then? 17:17:28 yes 17:17:49 HDD? floppy? both? 17:18:01 any? all? 17:18:12 i seem to remember the one i used worked on hdd as well, but for a good part of my dos life i had no hdd 17:18:23 right, i get that. 17:18:47 * Raystm2 came late to the dance. 17:18:48 on unix i can just use dd and hexdump -C 17:19:19 right. I've used dd but not hexdump. 17:19:31 if i need to twiddle a specific byte, then dd a sector to a file, then dd a byte in the file, then dd the file back to disk 17:19:52 cool. 17:20:19 * Raystm2 really needs to fire up the linux box and learn no less then 1/2 hour everyday. 17:20:42 i think it is worth it to get a toy box that runs free unix 24/7 17:21:03 eliminate that reboot hassle, network it, log in at will, don't be afraid to leave long-running jobs on it while you do other stuff 17:21:31 Well, I have several toy boxen, I can't seem to throw out anything and I collect old machines from friends, neighbors, and co-workers :) 17:21:40 yes. 17:22:09 * Raystm2 would just like to get colorforth networked with another colorCoder. 17:22:25 if i use forth seriously, i will insist on a filesystem 17:22:38 * SunDragon will not use blocks much 17:22:40 I see. Makes sence. 17:23:15 it complicates the bootstrap, but i think it is worth it 17:23:36 I've not had any problems with either blocks or files ( save finding things in either ) so I don't have a developed predjudice yet. 17:23:36 i can see doing without a filesystem on a system with less than 64k memory 17:23:51 but i will want to interact with other systems 17:23:54 ya 17:24:04 that's a good point. 17:24:57 SO, TCP/IP standard is it then? We should point our systems to be compatable thier and then all will be fine. :) 17:25:31 there even? 17:26:03 i won't to tcp/ip 17:26:13 for me a filesystem will be enough 17:26:46 like what a digital camera does 17:30:24 ya. 17:31:33 * Raystm2 wants to boot colorforth from the memorychip in a digital camera. 17:38:04 i would be more interested in a forth that used a standard us keyboard layout, was self-hosting, and worked on monochrome devices 17:40:55 --- join: sproingie (n=chuck@64-121-2-59.c3-0.sfrn-ubr8.sfrn.ca.cable.rcn.com) joined #forth 17:43:13 That would be fun to play with. 17:43:37 brb. 17:49:06 i am a little surprised that i could not find more high level forth code 17:49:20 such as a gzip implementation done in forth 18:23:26 --- join: snowrichard (n=richard@adsl-69-155-177-154.dsl.lgvwtx.swbell.net) joined #forth 18:23:56 hi 18:31:55 --- quit: snowrichard ("Leaving") 20:13:29 I wanna try blocks 20:13:32 they sound so cool 22:51:36 --- quit: sproingie (Remote closed the connection) 23:37:16 --- join: snowrichard (n=richard@adsl-69-155-177-154.dsl.lgvwtx.swbell.net) joined #forth 23:59:59 --- log: ended forth/05.12.15