00:00:00 --- log: started forth/18.06.20 00:11:18 --- join: mtsd (~mtsd@77.110.61.100) joined #forth 00:19:50 --- join: dys (~dys@tmo-112-108.customers.d1-online.com) joined #forth 00:26:24 --- quit: ThirtyOne32nds (Ping timeout: 245 seconds) 00:28:41 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 00:48:26 --- join: ncv (~neceve@2a02:c7d:c5c9:a900:c1c7:50c:8461:8572) joined #forth 00:48:26 --- quit: ncv (Changing host) 00:48:26 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 01:09:40 I find it so strange that AI is back in fashion, and instead of using Prolog or Forth or Lisp, people are contorting C++ and Python to fit the problem space 02:27:18 oh i think i got a DOES> working! 02:31:16 hello, im trying to modify this word to also print the result : factorial recursive dup 1 > if dup 1- factorial * then ; 02:31:43 is it against philosophy, and i should use another definition which calls factorial ? 02:32:39 like : factorials factorial . ; 02:33:51 --- join: ThirtyOne32nds (~rtmanpage@84.sub-174-204-17.myvzw.com) joined #forth 02:35:42 --- quit: nighty- (Quit: Disappears in a puff of smoke) 03:13:21 --- quit: ncv (Ping timeout: 256 seconds) 03:16:43 --- quit: ThirtyOne32nds (Ping timeout: 240 seconds) 03:19:07 Personally I prefer the recursive form 03:19:21 that doesn't print the result 03:19:46 because if you want it printed later you can just type . 03:21:22 re 03:23:30 So along with >R, R>, and R@, I decided to implement R! as well. Symmetry seemed to call for it. Saves a *copy* of TOS to return stack, without giving it up from the data stack. 03:23:50 Eliminates all ">R R@" idioms. 03:24:32 KipIngram: http://termbin.com/bds1 http://termbin.com/9iwt rename to: bds1.c 9iwt.S and gcc bds1.c 9iwt.S 03:29:34 --- join: ncv (~neceve@90.218.62.205) joined #forth 03:29:34 --- quit: ncv (Changing host) 03:29:34 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 03:32:09 okay, back to dave9 03:36:08 re 03:43:02 --- quit: dys (Ping timeout: 276 seconds) 03:55:31 --- quit: pierpal (Read error: Connection reset by peer) 03:57:34 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 04:08:06 --- join: nighty- (~nighty@s229123.ppp.asahi-net.or.jp) joined #forth 05:03:37 --- quit: pierpal (Quit: Poof) 05:03:54 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 05:04:13 --- mode: ChanServ set +v crc 05:04:25 --- mode: ChanServ set +o crc 05:06:19 --- join: dys (~dys@tmo-102-136.customers.d1-online.com) joined #forth 05:14:59 KipIngram, I arrived at the same conclusion. my forth also has r!, as well as 2r@ and 2r!, and turns out I've used them quite a bit 05:16:00 I just noticed recently that x4 also has a dup>r. I'm thinking of adding that, but I really don't want my core to become overwhelmingly big so I haven't committed to it yet 05:16:37 plus if I add that then would I also add dupr! ? 05:16:52 probably not, but still. idk 05:24:04 --- join: ThirtyOne32nds (~rtmanpage@14.sub-174-204-38.myvzw.com) joined #forth 05:25:29 Oh good - nice to get some validation. 05:25:45 I haven't had a chance to use it much, but I certainly remember doing a fair bit of >R R@ in the past. 05:26:01 Isn't dup>r the same thing? 05:26:07 as r! that is? 05:26:53 A friend suggested the name dup>r for the new word, but I preferred r! for symmetry with r@ and for brevity. 05:48:55 --- quit: pierpal (Ping timeout: 248 seconds) 06:23:44 --- quit: mtsd (Quit: Leaving) 06:23:46 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 06:31:13 --- quit: pierpal (Quit: Poof) 06:31:32 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 06:32:40 it's bedtime.. nite 06:33:04 --- quit: dave9 (Quit: one love) 06:35:04 oh, my r! actually pops something from the stack 06:35:13 it's like >r but it doesn't move rp 06:49:21 Why does `1 cell` put `8` on the stack? 06:50:51 because a cell is 8 bytes 06:51:09 "2 cells" would push 16, and so on 06:52:23 --- quit: dys (Ping timeout: 248 seconds) 07:11:07 ah ok 07:11:16 why 8 bytes? 07:16:05 That's just the word size of the underlying computer. 07:16:14 Those things don't have to match, but they usually do. 07:16:34 Well, I'd think for things like ALLOT you'd want them to. 07:17:03 I'm using 32-bit pointers in a number of places in my system, but I'd probably still think in terms of 64-bit cells most of the time, since I'd be thinking about storing data. 07:18:55 lf94: The words CELL an CELLS exist so that you can write code thta's portable across systems with different word sizes. 07:19:28 If you used 8 instead, then your code might not work on a 32-bit machine. 07:19:42 What if I used 32 07:19:47 allot would fail? 07:20:06 Well, we're talking number of bytes here, not number of bits. 07:21:14 Some code hard-written for a 32-bit machine might still run on a 64 - you might just waste space. 07:21:56 Or I may have it backwards. Anyway, if you needed 8 bytes to store a number and you only sized things to provide 4, it wouldn't work. The other way might work - it would depend on the case. 07:23:27 How big can numbers be in forth 07:23:35 impl dependent? 07:23:56 Yes, it depends. Some Forths support "double precision" integers, which gives you two cells to use. 07:24:02 So on a 64-bit system that would be 128 bits. 07:29:01 How does + know to use 2 cells? 07:29:09 again, impl dependent? 07:41:11 Well, + uses two cells in the sense that it adds two numbers, and it presumes each is in one cell. 07:41:26 If you mean adding two double-precision numbers that's a different word. D+ or something. 07:41:39 I've never bothered much with double precision words, so my name memory may be off. 07:42:03 But + can only do the one thing - it adds two one-cell numbers, and the other one also does only one thing - it adds two 2-cell numbers. 07:51:12 ah ok, cool 07:51:18 I was just wondering how it knew 07:51:29 turns out, it doesnt :D you need to know about the underlying data 08:21:45 --- quit: pierpal (Quit: Poof) 08:22:03 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 08:29:05 Yes - it's up to you to use the words that manipulate the data the way you want it manipulated. 08:40:57 lol interesting... 9.9 9.9 + 08:41:02 returns 99 08:41:31 + is probably integer addition 08:42:37 remember forth is untyped - operators aren't polymorphic, and there's no coercion 08:43:37 lf94: 9.9 9.9 places either 9 0 9 0 or 0 9 0 9 on the stack. 08:43:50 Then + adds the top 2, which are 0 and 9 either way, so you get 9. 08:44:16 When you include a decimal point in a numeric string it ignores it for calculating the value, but stores it as two cells instead of one. 08:44:29 Type this: 08:44:33 9.9 9.9 . . . . 08:44:33 interesting 08:44:44 You should get either 9 0 9 0 or 0 9 0 9 08:44:59 0 99 0 99 08:45:03 (gforth) 08:45:06 are you sure? I suspect that whatever forth he's using put a cell-sized float on his stack, and then he added them together as though they were integers 08:45:08 Oh, I'm sorry. 08:45:10 oh, so they were doubles 08:45:26 99 is correct - not 9. 08:45:34 D+ is double addition? 08:45:47 Try it. 08:46:04 don't do it, it'll cause your computer to catch fire and burn down your house 08:46:05 result: 0 08:46:05 Also note that there is no difference between 9.9 and 99. 08:46:15 next on the stack: 198 08:46:24 How did you print the result? 08:46:27 Use D. 08:46:32 99. 99. D+ D. 08:46:39 . only prints one cell. 08:46:41 How do I clear the stack 08:46:48 rp0 @ rp! 08:46:52 sorry - sp 08:46:56 sp0 @ sp! 08:47:17 198 08:47:38 Where'd the decimal go 08:47:40 :P 08:47:56 The decimal point does nothing except tell the system to use two cells. 08:48:01 It still treats the digits as digits of an integer. 08:48:09 So you shouldn't even type 9.9 - it's meaningless. 08:48:17 It's 99. no matter where you put the decimal. 08:49:10 that's wack 08:51:56 lol 08:52:07 so . is ignored like you said...gotchya 08:52:12 so...so what's the point 08:52:17 Why not just 99 99 + 09:01:27 I would guess the intention is for double-precision fixed-point arithmetic, but as I've just demonstrated I actually have no idea 09:50:59 --- join: Labu (~Labu@labu.pck.nerim.net) joined #forth 10:03:27 --- quit: pierpal (Ping timeout: 240 seconds) 10:26:21 Yes, it's just to provide you with a "handy" way to engage double-bit-count integers. The scaling is up to you to keep up with, for whatever application you're coding. 10:27:07 99 99 + only uses single-precision and can only carry half as many significant figures. 10:30:35 --- quit: impomatic (Ping timeout: 276 seconds) 10:36:25 --- join: dys (~dys@tmo-080-124.customers.d1-online.com) joined #forth 10:46:20 I'm confused still. How do I do for example, 1.5 + 0.5 ? 10:50:00 1.5 0.5 D+ 1 >> . . 10:50:06 er, sorry, no shift 10:50:07 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 10:50:11 1.5 0.5 D+ . . 10:55:04 It says 20 10:55:20 it's like...fixed point math... 10:55:41 yes, it is 10:56:50 --- quit: pierpal (Quit: Poof) 10:57:36 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 10:57:52 --- quit: ncv (Remote host closed the connection) 10:59:11 --- join: ncv (~neceve@2a02:c7d:c5c9:a900:14fa:fcbb:861b:b7e6) joined #forth 10:59:11 --- quit: ncv (Changing host) 10:59:11 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 11:00:01 --- quit: ncv (Remote host closed the connection) 11:00:25 --- join: ncv (~neceve@2a02:c7d:c5c9:a900:14fa:fcbb:861b:b7e6) joined #forth 11:00:25 --- quit: ncv (Changing host) 11:00:25 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 11:00:57 lf94: if you were wanting floating point, see section 12 of http://forthworks.com/forth/standards/DPANS/DPANS.txt 11:01:27 zy]x[yz, ok! Why did you just say so! :D hehe 11:01:40 I can live with fixed point 11:02:23 IIRC, it'd be something like 1.5E 0.5E F+ 11:08:57 --- quit: jedb (Ping timeout: 240 seconds) 11:14:20 cool, that works too 11:14:51 1.5e 0.5e F+ F. \ 2. ok 11:23:51 lp94: I thought the phrase "double precision *integers* conveyed that it wasn't floating point. 11:26:00 I had no idea what that meant 11:26:07 double precision integer is not a term I've ever come across 11:26:24 and I've done all types of programming 11:26:53 `if` is a compile-only word. `if` `then` . 11:27:03 ^ what does compile time mean in gforth's contexit? 11:27:06 context 11:27:39 That means that if executes while the word you use it in is being compiled. 11:28:03 It causes some compilation actions and affects the content of the definition being made, but you don't wind up with a distinct word "if" that runs when you run your compiled word. 11:28:17 Specifically, if compiles a conditional jump, to an unknown forward location. 11:28:33 THEN also runs at compile time, and it comes back and back-patches the address of that jump. 11:28:54 IF ELSE THEN WHILE REPEAT BEGIN AGAIN are all examples of such words. 11:29:11 It also means you can't use an IF ... THEN outside of a definition - you can't just type it at the interpreter. 11:30:01 The interpreter executes words one at a time, and once it's done with one that word is gone. There's no way to loop back, or jump forward over any words, because "forward" doesn't exist yet. 11:30:09 Except in the unprocessed input stream. 11:30:30 I ran across a Forth once that did interpretation by taking the whole line you type and compiling a "temporary definition" and then executed it. 11:30:44 That one would let you use if then in an interpreted line, because it was secretly compiling it. 11:31:11 But it had some interesting quirks itself - things that were difficult that are easy in a traditional system. 11:32:52 http://christophe.lavarenne.free.fr/ff/ is a compile only forth 11:35:32 Hmmm. I don't think that's the one I saw, but it may be, because I remember encountering it in connection with fasm. 11:39:06 --- quit: pierpal (Quit: Poof) 11:39:24 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 12:36:03 --- quit: ncv (Ping timeout: 256 seconds) 15:00:15 --- join: dave9 (~dave@207.213.dsl.syd.iprimus.net.au) joined #forth 15:01:00 hi 15:02:41 --- join: TCZ (~Johnny@ip-91.246.66.248.skyware.pl) joined #forth 15:12:22 --- quit: TCZ (Quit: Leaving) 15:47:16 --- quit: pierpal (Quit: Poof) 15:47:35 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 16:04:55 --- join: pierpa (4f2c3a2d@gateway/web/freenode/ip.79.44.58.45) joined #forth 17:04:37 --- quit: dys (Ping timeout: 260 seconds) 17:36:27 --- quit: FatalNIX (Changing host) 17:36:27 --- join: FatalNIX (~FatalNIX@unaffiliated/fatalnix) joined #forth 17:44:38 --- quit: dddddd (Remote host closed the connection) 18:09:31 --- join: nighty-- (~nighty@kyotolabs.asahinet.com) joined #forth 18:50:57 brb 18:52:02 oh okay let me know when you get back 18:53:01 zy]x[yz: not yet 18:53:11 alright I'll keep waiting 18:54:23 ok, now! 18:54:31 afk 18:54:39 nite zy]x[yz 19:04:59 --- quit: Keshl (Quit: Konversation terminated!) 19:23:47 --- join: Keshl (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 19:58:00 So I'm finding "grandparent returns" to be quite powerful. I've long had a word ;, which compiles a return but doesn't end the definition, so I can have returns other than at the end of a word. 19:58:17 But I'm finding returning to my caller's caller under certain conditions to be very valuable. 19:58:41 I do those with ;;, and ;; depending on whether I just want to compile it or also want to end the definition. 19:58:55 ;;, is essentially r> drop ;, 19:59:34 I run it as a primitive - it's one line of assembly language tacked on just before dosem that I labeled do2sem. Just moves the return stack pointer down a notch. 20:01:11 I used r> drop once in mine I think 20:01:21 somewhere in my implementation of ( 20:01:30 --- quit: pierpa (Quit: Page closed) 20:01:41 I thought it was clever but it seemed like the kind of thing that would be easy to lose track of, so I decided not to make a habit of it 20:01:45 The situation it helps with is when you have a number of actions to take and any one of them could "get the job done." 20:01:53 So you say : A B C D E ; 20:02:11 And whichever one of A, B, C, D, E "gets the work finished" just does a doublt-return. 20:02:19 Neatly bypassing the rest of the calls. 20:02:32 Without that you'd be faced with a nasty structure of nested conditionals. 20:02:40 Well, or a bunch of conditional returns. 20:02:48 makes sense 20:03:12 I found it really handy in my number conversion code, which I wrote today. 20:03:27 maybe it just gave me uplevel ptsd flashbacks to tcl 20:04:14 --- join: jedb_ (~jedb@199.66.90.113) joined #forth 20:04:26 --- nick: jedb_ -> jedb 20:43:44 --- quit: dave9 (Quit: one love) 20:52:29 Why is this wrong? : ?> (a b -- n) > ; 20:52:34 I'm just aliasing the word basically 20:52:41 ?> is equivalent to > 21:06:45 --- quit: pierpal (Quit: Poof) 21:07:04 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 21:29:19 --- quit: koisoke (Ping timeout: 245 seconds) 21:41:49 --- quit: ThirtyOne32nds (Ping timeout: 240 seconds) 21:44:48 --- join: dave9 (~dave@207.213.dsl.syd.iprimus.net.au) joined #forth 21:45:05 re 22:31:35 --- join: dys (~dys@tmo-122-158.customers.d1-online.com) joined #forth 22:35:57 --- join: koisoke (xef4@epilogue.org) joined #forth 23:48:24 --- join: ThirtyOne32nds (~rtmanpage@88.sub-174-204-37.myvzw.com) joined #forth 23:55:24 --- join: dave69 (~dave@207.213.dsl.syd.iprimus.net.au) joined #forth 23:58:34 --- quit: dave9 (Ping timeout: 256 seconds) 23:59:59 --- log: ended forth/18.06.20