00:00:00 --- log: started forth/01.01.26 00:01:47 --- quit: aaronl (The name's X. Bitch X.) 00:13:59 --- quit: tgunr () 02:19:53 --- quit: speuler (Ping timeout for speuler[c38038.upc-c.chello.nl]) 02:22:12 --- join: speuler (l@c38038.upc-c.chello.nl) joined #forth 02:32:22 --- part: speuler left #forth 03:52:46 --- join: Fare (fare@ppp64-net1-idf2-bas1.isdnet.net) joined #forth 07:28:58 --- quit: Fare (Connection reset by pear) 10:28:52 --- quit: clog (Ping timeout) 10:28:52 --- log: stopped forth/01.01.26 10:29:15 --- log: started forth/01.01.26 10:29:15 --- join: clog (nef@bespin.org) joined #forth 10:29:15 --- names: list (@clog) 12:46:51 --- join: edrx (edrx@200.240.18.73) joined #forth 13:09:02 --- quit: edrx (Ping timeout for edrx[200.240.18.73]) 13:46:48 --- join: edrx (edrx@200.240.18.101) joined #forth 15:43:11 --- part: edrx left #forth 15:46:49 --- join: Fare (fare@ppp64-net1-idf2-bas1.isdnet.net) joined #forth 15:58:28 --- join: adu (andrew@adsl-63-201-88-118.dsl.snfc21.pacbell.net) joined #forth 16:05:40 --- join: tcn (tcn@207.198.30.85) joined #forth 16:26:31 --- quit: tcn (Client Exiting) 16:30:04 hi Fare 16:30:36 yop, adu 16:54:00 cool 16:54:12 i'm workin' pretty hard on that forth program 16:54:19 which? 16:54:44 ppc isforth 16:55:08 it sounds like what i want to use for my new environment 16:55:57 what's your metacompiler? forth? gas? 16:57:24 gas 16:57:28 i can't use nasm 16:57:36 it hasn't been ported to ppc 16:57:38 gas has 16:57:49 forth, that would be interesting 16:58:02 but then it wouldn't be isforth 16:59:03 then isforth sucks 17:01:12 isforth's prime directive is no C, so if the compiler is written in C, then would that be pushing it? 17:01:23 Fare: you don't know isforth? 17:01:47 its the only project i've ever really helped, so i hope i'll learn something from it 17:02:45 write a compiler in isforth! 17:07:45 good idea 17:09:07 but wouldn't it haveto be made for ppc? 17:09:17 hmm 17:09:26 i see how i could do it 17:09:34 nice... 17:09:37 alright then 17:09:40 :) 17:17:45 --- join: aaronl (aaronl@vitelus.com) joined #forth 17:18:38 hi 17:18:50 i'm going to write isforth in isforth 17:25:30 --- join: tcn (tcn@207.198.30.48) joined #forth 17:32:03 hi tcn 17:32:11 what's up? 17:32:19 tcn: I440r is always looking for you 17:32:47 he's not here now tho obviously 17:33:11 unless he's in invisible mode 17:33:24 is that possible? 17:33:42 isn't there a +i option? 17:34:46 that only hides you from people not in your channels 17:34:58 o 17:35:02 ic 17:35:05 n/m then 17:35:28 he could try email :) 17:35:42 email? 17:35:44 how? 17:35:52 what's that? :) 17:36:07 he could try to be invisible by email? 17:36:41 uhh.. to get hold of me... :) 17:36:51 o 17:37:10 tcn, so are you working on isforth? 17:37:21 --- quit: tcn (Read error to tcn[207.198.30.48]: EOF from client) 17:37:30 --- join: tcn (tcn@207.198.30.48) joined #forth 17:38:07 xchat crashes if u look at the wrong font 17:38:29 --- quit: tcn (Read error to tcn[207.198.30.48]: EOF from client) 17:38:37 --- join: tcn (tcn@207.198.30.48) joined #forth 17:38:46 man! 17:39:12 --- join: tcn_ (tcn@207.198.30.48) joined #forth 17:40:13 hi again 17:40:45 hehe 17:42:49 i'm wondering if i should wait until isforth is done 17:42:54 to make my version 17:43:12 because isforth is supposed to be made in asm 17:43:26 but i see no reason to make it in isforth itself 17:43:43 credit due to Fare 17:44:57 make what..? 17:45:19 my version 17:45:21 ppc 17:45:39 it would be source compatible with isforth 17:45:42 for x86 17:45:49 u might as well start messing around now 17:45:56 i am actually 17:46:21 but i'm distressed that isforth's prime directive is asm, not C 17:47:19 don't be :) 17:47:49 i'm fine, but i think isforth should be like gcc, with different back ends 17:47:59 wouldn't that be better? 17:48:20 or should it only compile for the host CPU? 17:48:27 i need to talk to I440r 17:48:34 ummm 17:48:59 u mean a cross-compiler? 17:49:40 ya 17:49:42 i guess 17:50:09 that can be done 17:50:45 but i think isforth's goals it to use ONLY, and ALL the host CPU 17:50:52 hmm 17:50:56 i did something like that for retro, once 17:51:05 retro? 17:51:22 forth os 17:53:48 the way i see this, isforth has an asm 'core' for each processor, but above that layer it's the same 17:54:27 s/processor/platform/ (OSes make a big difference) 17:54:44 --- quit: tcn_ (Client Exiting) 17:59:13 i'm still here 18:01:36 um, is it tru 18:01:37 that 18:01:53 you can only delete the most recent defined word? 18:03:45 --- join: TheBlueWizard (tbw@ppp-97.u1-h1.dca.fcc.net) joined #forth 18:03:45 --- mode: ChanServ set mode: +o TheBlueWizard 18:03:48 no 18:03:51 hiya all 18:03:54 hey 18:04:27 FORGET xxxx deletes xxxx and everything after it 18:04:59 hiya tcn 18:05:13 hey 18:05:24 hiya adu 18:05:42 tcn: so that was just in chuck's version, right? 18:06:09 is it possible to defragment memory during program execution? 18:06:53 s/defragment/serialize/ ? whats the right word? 18:07:19 take out the gaps by moving the data closer together... 18:07:36 you COULD 18:08:02 normally you just don't have to 18:08:42 o 18:08:48 what if i wanted to? 18:09:03 could that be done in forth? or would it be done in asm.... 18:09:22 you'd have to change any references to what you moved.. 18:09:30 maybe it could be part of the DELETE word...or something i'm not sure what that word is 18:09:35 that's easy w/ forth code 18:10:15 i only know OF, not very good with normal forth 18:10:42 I gather you are talking about deleting a single Forth, right? 18:11:14 and it says Def: [Word, Addr, Text] and that Addr dirrects scanner to interpret char string.... 18:11:21 is scanner a Parser? 18:11:41 well anyways.. you shouldn't _need_ to move code around like you're saying.. 18:11:43 TBW: a single word 18:12:13 ah yes...I forgot to type "word" hehe 18:12:14 tcn: because of big memories nowadays? 18:13:03 in theory you can do that....but in practice you will have to worry about those subsequent words which reference the word that is deleted 18:16:38 in the old days they just allocated separate memory areas for each task 18:16:51 like in unix, etc. 18:18:30 you might say, 'alloc 32k heap for this program' and if you need even more, alloc/free it yourself 18:20:48 what the heck does this mean: 18:20:50 Notice that although FORTH implements a supervisor, compiler and loader these aspects cannot be localized. 18:21:21 "localized"? beats me.... 18:21:26 i know.... 18:21:27 hmm 18:21:37 wierd 18:22:07 that would've been cool for tv on Terminals 18:22:12 sorry 18:22:14 wrong window 18:22:39 hehe 18:22:58 we're talking about the ascii-cam 18:23:05 in the other window 18:23:22 ah...I saw` that on /. really gnarly hack! 18:23:35 hehe ya 18:23:44 * TheBlueWizard quietly munches the stray ` 18:23:45 gnarly... i like that... 18:24:08 * TheBlueWizard smiles...."thanks" 18:24:32 hows the ` taste? 18:24:49 it tastes rather prickly :) 18:25:28 haha 18:26:27 hahaha 18:26:46 i'm trying to figure out how a definition works 18:26:58 can't be localized? means u can't pin them down to specific programs/words 18:27:02 adu: what definition? 18:27:21 the general definition 18:27:26 but the truth is, you can pin them down 18:27:34 like : XXX .... ; ? 18:27:45 ya 18:28:24 ah....you want to know the "inside" mechanism (in threaded interpreter language) on how that is laid out? 18:28:32 ya 18:28:48 i'm wondering how its implemented 18:28:59 i have this: 18:28:59 Definition: declared by : 18:29:00 [Word,Addr,Text] 18:29:00 --text->core 18:29:00 --addr 18:29:10 my notes from reading 18:29:14 ok....let's start with subroutine threaded model first cuz it is easy to visualize 18:29:24 threaded? hmm... ok 18:29:34 hehe, just read Starting Forth 18:29:46 ok 18:29:48 where? 18:30:05 it gets pretty deep for an introductory book 18:30:14 library 18:30:29 amazon.com :) 18:30:42 ok 18:31:09 : XXX ... ; would typically get compiled to: [flag/length] [word XXX itself in ASCII string format] [link-to previous word] [CFA] [ .... ] [] 18:31:47 have fun, tbw :) 18:31:51 * tcn is afk 18:32:04 whats the cfa? 18:32:08 and dosemi? 18:32:11 the ... part is just a series of JSR YYY JSR ZZZ etc.... 18:32:19 o 18:32:23 ic 18:32:45 the CFA part is just nothing (IIRC :) 18:32:56 huh? 18:33:00 whats dosemi? 18:33:42 --- join: CosmicRay (jgoerzen@pi.glockenspiel.complete.org) joined #forth 18:34:11 hi cr 18:34:49 good evening 18:35:02 * CosmicRay is here to sit in on bluewiz's forth explanation 18:35:34 * TheBlueWizard blinks in surprise at CosmicRay 18:35:40 hiya CosmicRay! 18:35:42 hehe 18:36:19 oh i see 18:36:22 I guess since CosmicRay know next to zip about Forth, I shall outline very briefly what Forth is and how it looks like to him first :) 18:36:28 'do semi' 18:36:44 semicolon 18:36:44 * CosmicRay knows exactly nil about Forth, save that its name has 5 letters 18:37:32 ok.. i'll explain the CFA when we get there.. 18:37:33 Forth is a hybrid compiler/interpreter language, and it is typically implemented in what is known as threaded interpreter language (TIL for short)....and there are quite a number of TIL flavors running around 18:37:53 there is no such thing as either compiled or interpreted languages 18:37:54 it can be interactive.... like this: 18:38:05 only c or i'd implementations 18:38:19 3 4 + 6 * . [hit ENTER key here] 42 OK 18:38:28 Fare: Perl is both 18:38:30 that is the traditional Forth behavior 18:38:39 ooo 18:38:40 RPN! 18:38:54 what's the dot do 18:39:05 display 18:39:11 stack 18:39:16 top of 18:39:18 oops 18:39:19 * CosmicRay loves RPN 18:39:21 Forth is stack based language...all meaning are clear except for . which means: pops the top value off the stack and print it to screen in current BASE 18:39:58 cr: rev-pol-not is lisp, i think its different, its pol-not isn't it? 18:40:15 right, Lisp is not RPN 18:40:21 (RPN == postfix) 18:40:22 o really? 18:40:23 CosmicRay: yes, that's exactly right! Forth is RPN....it really revolves around the stack...in fact it has two stacks...one is called a parameter stack and the other is called a return stack 18:40:24 Lisp is prefix 18:40:25 o 18:40:28 ic 18:40:30 n/m 18:40:45 in lisp you'd say (* (+ 3 4) 6) 18:40:51 C is braindeadfix 18:40:51 i know lisp 18:40:59 i didn't know the definition os rpn 18:41:00 ie, * + 3 4 6 in pure prefix (polish) 18:41:07 XML is hardcorepornfix -- does it all the ways at the same time 18:41:14 Lisp is a PN language....it uses prefix, not postfix 18:41:20 right 18:41:33 hahahahahah 18:41:54 actually, original PN had no parentheses -- fixed arity operators only 18:42:04 right 18:42:14 hence my pure prefix rendition :-) 18:42:34 the parens are there because + is technically a lisp function and not a pure binary operator 18:42:46 you could say (* (+ 3 4 5) 6) 18:42:57 in pure prefix you'd say * + + 3 4 5 6 18:43:06 anyway, back to forth :-) 18:43:10 but I digress...anyway, the general syntax (that word is somewhat controversial, but I will let it as is for now) is extremely simple: any sequence of characters delimited by spaces or a CR denote a WORD....that is the Forth notion of function/subroutine/whatever (one exception: numbers are treated a bit differently, but I digress) 18:43:11 * CosmicRay hands to soapbox back to bluewiz 18:43:53 so: XYZ DEF G^%N -@1 ~xR$ are all legal Forth words 18:44:06 ok 18:44:16 * TheBlueWizard doesn't notice the soapbox being inserted under his feet 18:44:22 heh 18:44:36 it is, your royal opness :-) 18:45:00 now...a typical way to write function/subroutine (the distinction is totally irrelevant here) would be: 18:45:08 * TheBlueWizard laughs 18:45:34 : MY-WORD blah blah ..... ; 18:46:07 : defines the new word MY-WORD, and then proceed to compile the blah blah .... up to ; 18:46:23 : blah " hello world" ; 18:46:40 and there you create a new word MY-WORD, which you can then use it right away 18:46:56 adu: um....use ." not " hehe 18:47:08 the hello world pgm would be: 18:47:30 : hello ." Hello world!" CR ; 18:47:47 whats the diff between s" and ." ? 18:48:18 notice the space after ." it is necessary due to the syntax I just explained earlier.... ." is a word...in fact it is actually a little routine itself! 18:48:54 adu: s" leaves the address of the string on the stack and ." prints out the string literal itself 18:49:29 o 18:49:29 --- quit: Fare (3053) 18:49:52 remember I said that the "syntax" is rather controversial? well, it is because that the actual meaning of syntax is actually rather dependent on certain words 18:50:25 ." would scan up to " (" is the delimiter rather than the space here) 18:50:43 ; terminates the definition of the word 18:51:11 ok....let's see how this works out using a bit more "practical" word defining stuff 18:51:18 : square dup * ; 18:51:35 3 square . [hit ENTER] 9 OK 18:52:23 you see, 3 is passed as an argument (since it is on the stack) to SQUARE, which then duplicates it, multiplies together and return with the result on the stack 18:52:33 follow me so far? 18:53:04 --- mode: TheBlueWizard set mode: +o tcn 18:53:11 --- mode: TheBlueWizard set mode: +o aaronl 18:53:16 --- mode: TheBlueWizard set mode: +o adu 18:53:21 --- mode: TheBlueWizard set mode: +o CosmicRay 18:53:31 I tend to op ppl here hehe 18:53:31 wow, 100% ops 18:53:41 omg i'm scared now 18:53:43 heh 18:53:47 anyway, I assume you're following me alright 18:53:52 you can /deop adu if you don't want it :-) 18:53:52 please no one kick me out 18:53:54 hehe 18:54:08 CosmicRay is quite nice guy... 18:54:12 ok 18:54:17 I think only bluewiz and I are awake besides you anyway :-) 18:54:23 o 18:54:27 ok 18:54:48 tbw: how come i never got this kind of informative session the first time i was in here? 18:54:58 um...[thinking] Forth is like Lisp in that it is extensible...you can extend stuff by adding new words....at times things can become rather plastic 18:55:12 adu: you never ask .... ha ha ha 18:55:46 ah...control words....it is weird yet cool in Forth.... 18:55:50 example: 18:56:48 * TheBlueWizard tries to think up of a simple if-then-else example 18:58:16 : can-hold-gerbils 4 > if ." you are holding too many gerbils...you lost out the excess number!" cr then ; 18:58:27 omg 18:58:32 cosmic ray? 18:58:43 how long have you had your name? 18:58:49 in C this would be: if (num_gerbils > 4 ) printf("....."); 18:59:28 the if and then words are actually little programs.... 18:59:58 i will quote from one of chuck's papers 19:00:03 the loop constructs are: begin ... again begin .... while .... repeat begin ... until 19:00:03 void can_hold_gerbils(int num_gerbils) { ... } 19:00:03 "3.14 COSMIC.RAY 19:00:03 are both words." 19:00:27 http://www.ultratechnology.com/f70c4.html 19:00:39 ok...I think I explain enough of how Forth looks like 19:01:18 now on to explaining how Forth is traditionally implemented and executed....I shall use subroutine threading as the easiest one to understand 19:01:44 whats an example of a TIL? 19:01:54 the previous example : square dup * ; would get "compiled" to an intermediate form like this 19:02:13 pascal? basic? 19:03:31 oh, TILs (threaded interpreting languages) are a rather diverse group....it includes subroutine threading, direct threading, indirect threading (most popular), and token threading 19:05:49 [flags/length of the word name] [word SQUARE] [link to next word up in the dictionary] [code field...here, it is just nothing in subroutine threading] [JSR DUP] [JSR STAR] [RET] 19:07:09 the length here would be 6...the flags are for things like whether it is IMMEDIATE or not (IF, THEN etc. are IMMEDIATE words...the compiler would execute them instead of compiling the addresses as it normally does) 19:07:35 tcn: Forth != Pascal and Basic :))) 19:08:06 hehe 19:08:25 ok...the execution of SQUARE here would be just JSR into that code part....indeed a bulk of the work is just JSRing like nuts 19:08:26 they're _crappy_ TIL'S 19:09:08 no, no, no...they're good TIL! it exploit the natural subroutine features of the CPU :) 19:09:50 now....to makes our life a bit interesting, let's see how the direct threading works 19:10:31 direct threading, for the most part, basically is just subroutine threading without the JSR part....i.e. just a list of addresses 19:11:15 but the code field now must have the code JSR DOCOLON....so in a nutshell, the direct threading version looks like this: 19:12:07 [flags/6] [word SQUARE] [link to next word up in the dictionary] [code field: JSR DOCOLON] [DUP] [STAR] [DOSEMI] 19:12:15 follow me so far? 19:12:16 um what exactly IS a til? 19:12:22 and DOCOLON is the word that executes the list of addresses 19:13:39 tcn: um, sort of...DOCOLON just pushes the IP (instructiopn pointer) onto the return stack), and sets IP to the start of this list of addresses 19:13:49 NEXT is the workhorse 19:14:25 DOSEMI does the opposite of DOCOLON...it pops the value off the return stack and places it into IP and falls to NEXT 19:14:40 note: DOCOLON is also called ENTER (for example, in IsForth) 19:15:07 and DOSEMI is called EXIT 19:15:38 so, DOCOLON, DOSEMI, and NEXT makes up the Forth inner interpreter...that's right...there are *two* interpreters in Forth: one is the outer interpreter, which interfaces between the human and Forth, and the inner one interfaces the Forth with the machine 19:16:54 CosmicRay: I440r is working on a project called IsForth, where he envision doing away with libc and all that fat layers completely...just interface directly with Linux kernel itself 19:17:25 tcn: CosmicRay has a lot to learn, so please don't confuse him needlessly ;) 19:17:29 interesting 19:17:38 heh I'm not following extremely closely but I am logging 19:17:47 heh 19:19:49 um....ah....now what is indirect threading? ok, you've seen how the direct threading works (sort of anyway hehe)...note the asymmetry between JSR DOCOLON and the other compiled words there? and it isn't quite portable....well, the indirect threading provides the solution by just lopping the JSR part off, thus its version would look like this: 19:20:03 [flags/6] [word SQUARE] [link to next word up in the dictionary] [code field: DOCOLON] [DUP] [STAR] [DOSEMI] 19:20:54 --- nick: CosmicRay -> CosmicRay-away 19:22:02 but you then wonder: how to "run" that? the answer is simple....whereas IP in direct threading is one level away, IP is two levels away in indirect threading...that is, you have to fetch twice in a row....@@IP instead of @IP 19:22:34 hope that makes sense...of course you will have to "play" with it on your paper to see how it works 19:24:10 now the token threading does away with the addressing ....you just enumerate them.....it is somewhat similar to bytecode language like you would find in Java Virtual Machine, but it is much more abstract and arbitrary...and much more portable..... 19:24:23 in fact Open Firmware uses token threading 19:25:52 the idea behind Open Firmware is that you just code up Forth drivers onto the ROM and all that and put it onto the cards....then it should work on *any* machine that supports Open Firmware, regardless of CPU, architectural quirks (ISA, PnP, whatever) 19:26:02 cool, huh? 19:26:23 I hope I answer your question, tcn 19:26:57 eh? 19:29:35 you want to know the "inside" mechanism on how Forth is laid out and how Forth "works"? well, I gave you the whole answer above! 19:30:28 * TheBlueWizard rubs his fingers...a lot of typing of late hehe 19:30:29 adu asked that 19:31:21 oh....sorry hehe...I'm using BitchX client, which isn't that great for looking up earlier conversations 19:31:26 heh 19:32:22 I like mIRC over BitchX.....I don't have X windows on my Linux yet...I decide to wait til woody goes stable then I will build X windows...I tend to do it piece by piece...great way to learn ;) 19:33:44 heh 19:33:46 anyway....for CosmicRay's benefit I shall illustrate a bit of how IF, etc. works...it is neat, albeit rather strange 19:34:44 : IF ?COMP COMPILE 0BRANCH HERE 0 , ; 19:35:06 oops 19:35:12 : IF ?COMP COMPILE 0BRANCH HERE 0 , ; IMMEDIATE 19:37:01 : ELSE ?COMP COMPILE BRANCH HERE 0 , SWAP HERE SWAP ! ; IMMEDIATE 19:37:37 : THEN ?COMP HERE SWAP ! ; IMMEDIATE 19:37:47 Explanation: 19:40:18 ?COMP checks to make sure that the word being executed is in a compiling state....the outer interpreter (INTERPRET) sets and clears the STATE variable, which determines whether it is interpreting or compiling 19:41:09 HERE returns a pointer to the next available cell in the dictionary space...in fact the definition is: : HERE DP @ ; 19:41:52 of course @ means to retrieve a value pointed to by a pointer. DP is a variable 19:42:16 clearly DP is a mnemonic for Dictionary Pointer 19:43:34 , appends the value to the end of the dictionary area....its definition is: : , DP @ ! DP @ CELL+ DP ! ; 19:43:48 i don't like that STATE stuff.. the old-school forths like CMFORTH did it better 19:43:57 ! puts a value into the meory pointed to by a pointer 19:44:22 I understand...I am just using traditional Forth for clarity 19:44:38 and for CosmicRay's benefit :) 19:44:58 yeah, let's not confuse him 19:45:08 there are humdreds of Forth dialects and varieties....I agree I find cmForth kinda nifty.... 19:45:13 :) 19:45:32 SWAP swaps two values on the stack, obviously 19:45:45 the way Starting Forth explains it is like what cmForth does 19:46:38 0BRANCH is the primitive word (all Forth words eventually must invoke primitive words, which are written in machine code) 19:47:33 ok, having explained each words, now let's see how IF works 19:49:40 --- nick: CosmicRay-away -> CosmicRay 19:49:43 Having ensured that it is in compiling state (if not, it will ABORT with error message back to QUIT/INTERPRET), it then put 0BRANCH, then remembers that particular spot right after 0BRANCH, then appends a 0, since it doesn't know where to branch to, yet 19:50:09 that's it for IF word 19:51:58 the ELSE word is more complicated....it puts down BRANCH 0 pattern (similar to IF, and remembering the place), then swap the just remembered place with the place remebered by IF, and "resolve" the address there by putting address (HERE) in that place 19:52:37 THEN simply resolve the remembered place 19:53:42 --- quit: adu (Ping timeout for adu[adsl-63-201-88-118.dsl.snfc21.pacbell.net]) 19:53:59 an astute reader would notice that IF ... ELSE ... ELSE ... ELSE ... etc..... THEN is perfectly legal in Forth (assuming nothing extra has been added to the stack)...it'd be a fun exercise to figure out the behavior of that sequence :) 19:54:35 BEGIN .... AGAIN is easily implemented: 19:54:49 : BEGIN ?COMP HERE ; 19:54:53 oops 19:54:58 : BEGIN ?COMP HERE ; IMMEDIATE 19:55:40 : AGAIN ?COMP COMPILE BRANCH , ; IMMEDIATE 19:56:43 19:57:37 Forth is said to be an amplifier...it tends to make bad programmers worse and good programmers better programmers ;) 19:58:22 I find it odd that after a while immersed in Frth, I come back to C and C looks quite ungainly large, etc...hehe 19:58:35 then again C has its virtues... 19:58:57 * TheBlueWizard is doing a bit of philosophizing/musing for CosmicRay's benefit 19:59:49 I will leave BEGIN ... WHILE ... REPEAT and BEGIN ... UNTIL implementations as a fun exercise 20:00:23 heh 20:00:29 I'm still just logging and watching :-) 20:01:00 again, as one may notice, in Forth, evrything is made up of tiny programs and routines...indeed there are tiny compilers everywhere... ." is a tiny compiler in its own right, for example 20:01:51 hehe 20:02:26 one of the coolest words in Forth is the BUILD ... DOES> ... I can't think of any equivalent in C or almost any other languages.....the best I can describe it is that it lets you creates a compiling word 20:03:14 you mean CREATE ... DOES> 20:03:17 Forth traditionally don't have ARRAY...in part cuz it is easy to define using BUILD ... DOES> construct 20:03:52 tcn: yeah..... CREATE ... DOES> thank you....I was used to one dialect...that is one downside of Forth :-/ 20:04:08 one rare dialect :) 20:04:37 I think the correct one was .... :) 20:04:41 SQL is worse in that regard 20:04:49 * TheBlueWizard 's brain is messed up now ;) 20:04:57 --- join: adu (andrew@adsl-63-201-88-118.dsl.snfc21.pacbell.net) joined #forth 20:05:07 wb 20:05:14 ha ha ha....and I've seen M$ Transact SQL...quite diffo! 20:05:28 rello adu 20:05:33 relo 20:05:35 anyway.... 20:05:38 i crashed 20:06:17 : ARRAY CREATE CELL* ALLOT DOES> SWAP CELL* + ; 20:06:22 u got the windoze blues :) 20:06:59 ohhhhhhh macos :) 20:07:00 example of usage of ARRAY: 52 ARRAY CARDS 20:07:27 yes, macos crashes less often than windows, but still more often than linux 20:08:00 crash freq: unix < mac < win 20:08:10 EXpository of ARRAY: it is actually a two-step execution (quite confusing if you try to grok the "inside" mechanism ;) 20:09:44 CREATE creates a dictionary entry (CARDS in the example above), and then allots a number of cells after that entry (52 cells) 20:10:42 DOES> terminates the execution of the first part....the first part is called the compiling step. DOES> actually does a number of modifications behind the scene 20:11:18 then when one type 5 CARDS, it would execue the second part (just after DOES>) 20:11:30 s/execues/executes/ 20:13:08 DOES> would leave the address of the start of the alloted area on the stack at the start of the execution, so all I have to do is to SWAP to get at the value (5), multiply it by cell size, then add the starting address and the result together to form a pointer to the desired indexed cell 20:13:45 so, 5 CARDS would be like C's &cards[5] 20:14:03 and 5 CARDS @ is like C's cards[5] 20:14:27 and of course 7 5 CARDS ! is like C's cards[5]=7; 20:14:47 hope this little example of CREATE ... DOES> helps 20:15:33 CREATE ... DOES> is pretty powerful...the CONSTANT, VARIABLE, VOCABULARY and USER are done using this construct 20:16:36 --- quit: tcn (Ping timeout for tcn[207.198.30.48]) 20:16:42 basically put, CREATE { whatever data structure you think up of...such as triangular array} DOES> {do simple work on that data structure} ; 20:17:29 in one narrow sense one could say it is a class/object constructor with just one method 20:17:46 * TheBlueWizard steps down from the soapbox 20:17:55 all done! enjoy! 20:18:23 * TheBlueWizard notes it is 11:18, and needs to sleep 20:19:35 gotta go to bed...bye all! 20:19:59 --- part: TheBlueWizard left #forth 20:26:48 holly jeeeeeeeeez 20:27:02 thats pretty complex 20:31:51 --- nick: CosmicRay -> CosmicRay-away 22:00:40 --- part: adu left #forth 22:35:05 --- join: edrx (edrx@200.222.133.96) joined #forth 23:09:19 --- quit: edrx ([x]chat) 23:59:59 --- log: ended forth/01.01.26