00:00:00 --- log: started forth/01.06.18 02:54:12 --- join: cleverdra (jfondren@1Cust134.tnt3.florence.sc.da.uu.net) joined #forth 03:09:31 * aaronl is away: sleep 04:22:22 --- join: Fare (fare@ppp69-net1-idf2-bas1.isdnet.net) joined #forth 05:23:34 --- join: klooie (kloo@213-84-79-23.adsl.xs4all.nl) joined #forth 05:23:36 hi. 05:24:00 hello klooie 05:27:19 cleverdra, could you give me pointers to a forth interpreter for unix-alikes and a tutorial? 05:27:50 www.forth.org has a 'compilers' page, and the first option on it, gforth, works pretty well with unix. 05:28:00 i have programmed in forth before, but i was 9 and don't really remember. 05:28:29 what i do remember is not liking it and sticking to BASIC. 05:28:32 .. but times change. :) 05:28:46 thanks. 05:28:47 It also comes with a tutorial and some extended documentation, and www.forth.org's documentation section also has some tutorial stuff (not much) and dpANSForth, which is useful with gforth since gforth doesn't define all the words it has, some taht are defined in dpANSForth 05:29:12 Good morning, cleverdra. 05:29:18 I wish I'd run into Forth when I was 9 =/ 05:29:40 g'morning, Trey 05:30:52 it took me fifteen years to realize that all the programming languages i knew are algol-type and that i'm really missing out. 05:31:03 (not counting assembly) 05:31:48 i should have persisted with forth. 05:32:09 Yes. www.ultratechnology.com has some general forth papers in their dated index, too, and the 'forth' link on the main page leads to an interesting article. 05:32:16 Yeah, you should have =) 05:58:06 heh, the gforth info doesn't waste time explaining anything. 05:58:18 there are two tutorials in there 05:58:27 one doesn't waste any time, and the other wastes some time 05:58:37 I think the other one is called 'introduction' or something =) 05:58:47 i'm sitting here wondering what the hell nip and tuck do. 05:59:01 it's not obvious from a few tests. 05:59:52 right, to the introduction i go. :) 06:01:07 klooie - nip removes the second element on the stack, and tuck copies the first element of the stack to be below the second. Try doing such stack-word tests with numbers. For instance, '1 2 3 tuck .s' helps. 06:01:23 i like the errors gforth gives, they're very intimidating. 06:02:26 =) those backtraces will be more helpful when you're getting them from a nested word 06:03:22 ah yes, first element being the element on top which .s shows last (to the right). 06:04:51 funny operations, but not as bad as lisp's cadaddadr. :) 06:04:57 yeah, the TOS is rightmost. 06:05:58 If you don't factor well, klooie, you'll daydream about 'cadaddadr' =) 06:06:27 or maybe that's overstating it a bit... oh well. 06:06:47 dired, factoring? 06:06:48 no idea, cleverdra 06:06:58 dired, factoring is IMPORTANT! 06:06:58 OK, cleverdra. 06:07:06 dired, gforth? 06:07:07 no idea, cleverdra 06:07:15 "an obvious mathematical breakthrough would be a way to factor a prime number." -- bill gates. 06:08:06 i haven't actually seen lisp code that traverses cons cells like that, i think the lisp book was just trying to scare me. :) 06:09:06 ``an later, bill gates was heard to say, "An obvious astronomical breakthrough would be a way to filter out some of the light from black holes."'' 06:09:51 * klooie smiles and reads more about forth. 06:12:03 I think so too, klooie -- at least, most of my list-processing words were recursive in nature, and mostly used car and cdr. 06:13:27 a second lisp book i'm still reading advises the use first,rest,second,n-th etc. 06:13:34 s/the/to/ 06:13:45 I never really like those. 06:14:12 *nod* car and cdr help me visualize the cons chains somehow. 06:14:49 yeah =) first/rest/second/n-th don't seem to carry the same information. 06:17:45 i really like lisp, but it'll be a while before i feel really at ease with it. 06:19:13 * klooie removes an arbitrary "really" from that sentence. :) 06:20:46 Try 'The Little Schemer'. It's applicable to lisp (and nearly every other language in existence, read on:), and is mostly about recursive functions. It's very, very good. I think the first chapter is online somewhere. 06:21:26 * klooie giggles. 06:21:39 Most forths unfortunately do not have automatic optimization of tail-recursions, though it's trivial to add this. Flux is a notable exception. 06:21:47 what's funny? 06:22:02 you told me about "the little schemer" after chewing me out for not using the words "recur" and "recurse" as in that book. 06:22:16 oh =) 06:22:21 i googled for it, found a chapter on-line (not the first) and told you. 06:22:25 hee. I remember that. 06:22:57 it's still on my list. 06:23:54 "the gentle introduction" talks a lot about cons cells and recursion. 06:24:46 "succesful lisp" which i'm reading now is about the features of the language, data types, CLOS, the macro-reader and so on. 06:25:45 i've recently graduated from typing at clisp's prompt to clumsily using emacs and ilisp. 06:26:09 Cool =) 06:26:09 (both those books are on-line by the way) 06:26:30 Cool =) 06:26:38 dired, un*x forth is http://www.immersive.com/marc/computing.html 06:26:40 OK, cleverdra. 06:26:47 care to have URLs? 06:27:04 Yes, please. I was just about to search for the introduction. 06:27:50 "common lisp: a gentle introduction" (or whatever the exact title may be) is at http://www.cs.cmu.edu/~dst/LispBook/index.html. 06:28:00 you will find the reluctant dragon in there. :) 06:28:12 "succesful lisp" : http://www.psg.com/~dlamkins/sl/contents.html 06:29:08 why doesn't anybody ever complain about off-topic discussion on opn? 06:30:40 Because OPN is cool? =) 06:31:10 possibly. :) 06:31:24 the atmosphere is certainly good. 06:31:33 I'm just glad that #linux and #C are nice. I don't know why I, and only I, am banned from EFnet #C, and the EFnet linux's are horrors. 06:33:29 i don't know about EFnet #c, but i like the atmosphere in the old EFnet channels where the same people having been hanging out for ages, too. 06:34:04 usually not as friendly, but i enjoy the somewhat competitive elitist attitude. :) 06:34:30 Yeah, there are some like that. EFnet #Perl is still nice, though it used to be much better. 06:35:15 cleverdra: I suggest you pick another name for the word in the topic. 06:35:21 Never mind. 06:37:08 But you'll notice I mentioned 'linux' channels. You know, I got kicked from EFnet #Linux yesterday for answering this question: ~"Doesn't Sun give away x86 Solaris" with "Yeah, though 'giving away' still doesn't mean that you get the source -- some people care about that." After being cursed at, flamed randomly, and kicked, I was insulted by my kicker (who, just to tell me, isn't a communist) and threatened repeatedly to "not push i 06:37:20 Trey - hm? 06:37:39 Trey - what did you think it was called? =) 06:38:49 That was so amazing, I decided to hang out in OPN's #Linux. Elitist attitudes are cool, when the people are elite. 06:40:49 I originally didn't follow the R-stack machinations properly. 06:41:09 ah. 06:41:54 i tend to stay away from linux channels in general because they are teeming with newbies. 06:42:14 There's a page out there somewhere that attempts to standardize (or at least classify for environmental depencies) the different kinds of interpreters relating to use of the return stack. 06:42:45 klooie - sometimes I like answering newbie questions. They're rarely difficult. 06:42:58 plus i don't use linux much myself, nor do i like it or the gpl. 06:43:30 That's cool. EFnet #Linux people seem to dislike it. 06:43:46 * klooie is an openbsd person. 06:44:08 and professionally it's been aix and solaris so far, not linux. 06:44:35 Solaris or Slowlaris? 06:44:53 Yeah. I only came back to the #Linux channels when I got into cLIeNUX. For a long time I was into OpenBSD, but with my current setup OpenBSD's security is kinda wasted. 06:45:24 solaris on efficient sparc machines, trey. :) 06:46:00 klooie: I did Solaris when they called it SunOS. 06:46:55 aye, i've used 4.1.x but not earlier. 06:47:50 i like openbsd not only for the security, but for its simplicity, cleanliness and excellent documentation. 06:48:36 Funny, those are nearly the same reasons I like cLIeNUX =) Documentation especially. 06:48:47 well i'll have to look at that some time then. 06:48:52 dired, openbsd is www.OpenBSD.org 06:48:52 OK, cleverdra. 06:49:12 klooie - if you do, dired can tell you some about it (clienux, clienux2, clienux3) 06:49:25 i hadn't heard of it until you mentioned it just now. 06:50:05 Yeah. It's... different. 06:51:44 The person who makes cLIeNUX also makes libsys, a library of syscalls that allows you to program in C without libc, and H3sm, a 3-stack Forth with a 'data' stack of 'pytes' that are sized 1-255 bytes, set on the fly and as integral to the system as cells are in gforth. He also has a patch to linux that lets a Forth run as a kernel thread, which is interesting, and some other programs. 06:52:01 H3sm is primarily what drew my interest his way. I'm playing with that right now. 06:52:10 wow, sounds like an interesting guy. 06:52:49 it's time for me to do some exercise. 06:52:57 you're going to program? 06:52:59 see you later, and thanks for pleasant conversation. 06:53:11 physical exercise for a change. :) 06:53:14 have fun, klooie 06:53:19 oh, that kind. 08:24:52 --- join: edrx (edrx@200.240.18.57) joined #forth 08:25:55 --- quit: edrx ([x]chat) 09:52:47 --- join: cleverser (jfondren@1Cust138.tnt4.florence.sc.da.uu.net) joined #forth 09:54:24 --- quit: cleverdra (Ping timeout for cleverdra[1Cust134.tnt3.florence.sc.da.uu.net]) 09:55:55 --- nick: cleverser -> cleverdra 10:02:44 --- join: grurp (grurp@pc19954.batc.tec.ut.us) joined #forth 10:03:29 hello grurp 10:03:39 Yo 10:04:35 --- join: edrx (edrx@copacabana-ttyS16.inx.com.br) joined #forth 10:09:26 forth is fun. :) 10:29:01 --- quit: edrx ([x]chat) 10:29:27 --- join: edrx (edrx@copacabana-ttyS16.inx.com.br) joined #forth 10:33:49 --- quit: edrx ([x]chat) 10:34:04 I think so, klooie. 10:35:27 it's so light and simple.. and complex. :) 10:35:48 The more you learn about it the lighter and simpler and more complex it'll become. Really. 10:36:23 i need better learning material. 10:37:11 taygeta has stuff, some of it very interesting, a significant subset of which is compressed in archaic ways (.arc!?) 10:37:26 this on-line bit is telling me how forth is a compiler, an interpreter and sometimes an operating system or something in the middle. 10:38:08 Yeah. 10:38:35 It's not really an interpreter in the traditional sense either -- Forth has its own terminology for these this, and Forth needs it. 10:38:42 s/ these// 10:38:45 i was surprised when gforth spewed assembly in response to "see +". 10:38:54 Yeah, isn't that cool? =) 10:39:03 very. 10:39:20 In one of the tutorials I think they give you an alternative assembly of + you could use. 10:39:21 "built-in" would've been a much simpler adequate response. :) 10:40:10 alternative assembler definition, assuming that you're on x86 I think. 10:40:26 i don't really understand the loop constructs where stuff gets swapped about to work with multiple 'variables'. 10:40:43 sorry to say i am. 10:40:44 Some of the forths do just that, say "built-in" or the equivalent. If you look, you'll see the Forth-coded decompiler gforth uses to show you the assembler. 10:40:59 wow. 10:41:39 DO LOOPs are kinda wierd, yes. It puts the counter on the return stack, I know, but I don't know much else about it 10:42:22 : countdown 0 ?do . cr loop ." BLASTOFF!" ; etc. 10:42:36 I usually use begin loops or recursion. 10:42:46 s/ loops/s/ 10:43:26 :) 10:43:30 * klooie continues reading. 10:45:22 in pseudo-ColorForth (watch out, IFs are nondestructive in this example, and ; is a bit different) 10:45:25 : countdown if dup . cr 1- countdown ; then ." BLASTOFF!" ; 10:45:49 Maybe I shouldn't've shown you that... oh well. 10:46:08 * klooie shrugs. 10:46:17 i don't know if i know enough to be confused. 10:46:51 forth reminds me of lisp in the sense that your own functions are (or feel like) first-class citizens. 10:46:56 err, it actually contains an error. 10:47:09 Yeah, you can even tick words in Forth =) 10:47:22 --- quit: Fare (Leaving) 10:47:26 most languages i'm familiar with have a clear distinction between built-in goods, and library or user code. 10:47:45 oh, I misread your first sentence. 10:47:52 like you're using the language, not extending the language itself. 10:48:48 * klooie shrugs. 10:49:00 Yeah. In Forth there's no syntax to put up some words as being more important or more special than others. 10:49:47 You don't like `:'? You can rewrite it. How about ';'? Maybe you want tail-call optimization? That's trivial to add, with a small modification to the interpreter. 10:50:21 :) 10:50:46 with lisp it sometimes feels like you're making lisp understand what you need. 10:51:07 oh, and by 'interpreter' I don't mean C code and a recompile, I mean something you can do in-Forth. 10:52:18 I don't think I've used scheme enough to get that same feeling. I used to program in Guile all the time, but it's long start-up time got to me after a while. 10:52:42 well i have yet to write my first useful program in lisp. 10:53:03 I wrote a Mud Client, if that counts =) 10:53:23 the "succesful lisp" book conveyed me that feeling. 10:53:53 That you have to make lisp understand what you need? 10:53:59 you define the kinds of things you want to deal with, after which you can do useful things on the prompt. 10:54:04 with lisp, and with forth too it seems. 10:54:07 * klooie nods. 10:56:58 Oh, neat thing about gforth -- it stores history in ~/.gforth_history or the like, which is all your input, and it never bothers to truncate this file or clean it. I looked up one day and found a 10MB in my home directory -- which was *filled* with neat code I'd forgotten about. You could write an application, testing and redefining step by step until you've got it *just right*, or near enough, then exit and extract the program from 10:58:45 There are two ways that I've heard Forth programming described, re the remark you just made: 11:00:36 1) As a language builder. You create a vocabulary to express your program and what it does, and then you use this vocabulary to talk to the computer. e.g., you define a bunch of words relating to maps and game movement, until at the end you've one word, SOKOBAN, that expresses your entire program. Interpret that word and you've the game, 'sokoban'. 11:01:18 2) Similar. Instead of building a language for your program, you extend your virtual machine to accomplish the given task. 11:01:26 Adding instructions, say. 11:01:35 * klooie nods and smiles. 11:02:27 all the examples i see are relatively simple numeric thingies, but if you can write say x86 disassemblers - geez. 11:03:01 And x86 assemblers -- there are lots of those with varying complexity and conformance to assembler idioms. 11:03:03 the part of forth that isn't in forth is really small isn't it? 11:03:48 klooie - well, look at Gforth. There is 1.5MB or something of it. The documentation is built partially with gforth itself -- I think a few kilobytes are in C. 11:05:04 Look in the directory gforth extracts to and you'll see most of the system in little Forth files. vt100 for instance, which implements screen commands like 'page' and 'at-xy' -- by emitting ANSI escape sequences 11:05:54 um, there are three different object-oriented packages with gforth, and a C-like structs package. You can get a package by one of the makers of Gforth that implements nice garbage collecting. 11:06:35 No, I think in most systems the C/Forth ratio is very small. There are exceptions though, like all-C systems designed to be used as libraries, and PFE, which I guess is made by a C person. 11:06:46 dired, isforth? 11:07:07 * cleverdra pokes dired. 11:08:27 dired, wake up! 11:08:27 Trey: huh? 11:08:34 o/~ OK o/~ Anyway. There are also many all-assembly Forths. eforth in particular tries to implement the entire system in as little "low-level" assembler as possible, so that most of it can be portable. It also has Forth extensions, and alternate Forth implementations for some of its asm words. It's mostly assembly, though. 11:08:40 dired, what is isforth? 11:08:40 bugger all, i dunno, cleverdra 11:08:42 dired, isforth? 11:08:45 * cleverdra frowns. 11:09:00 dired, what is isforth? 11:09:01 trey: bugger all, i dunno 11:09:04 Hmmm. 11:09:05 Well, darn. isforth.sourceforge.net then. or whatever .??? 11:09:19 --- join: futhin (thin@h24-67-113-99.cg.shawcable.net) joined #forth 11:09:26 hey futhin! 11:09:29 i'm there. 11:09:46 isforth is another all-assembly Forth. You need a patched version of nasm, though. 11:10:20 Trey, do you remember what the isforth guy's name is? 11:10:32 I440r? 11:10:41 Yep. 11:10:51 dired, seen i440r? 11:10:52 i440r was last seen on #forth 19 hours, 58 minutes and 2 seconds ago, saying: hi ppl [Sun Jun 17 15:12:49 2001] 11:10:53 Well, his /nick anyways. 11:12:09 so much to explore, and i have to study for AIX certification the time to come. 11:12:32 hello cleverdra! 11:13:18 anybody seen the movie Pi? it was pretty cool 11:13:29 No, I haven't heard of it. 11:13:41 Is it about Pi? 11:13:45 ooh, you should check it out then. but it's kinda weird 11:14:16 it's not really about pi, there's some pi stuff, but not really 11:14:46 brb 11:14:56 "Pi" got a little too wacky for me in the second half. :) 11:32:11 & 11:35:10 --- join: Fare (fare@ppp69-net1-idf2-bas1.isdnet.net) joined #forth 11:36:14 hello Fare. 11:36:46 hi 11:38:22 dired, flux? 11:38:22 no idea, cleverdra 11:38:43 dired, flux is a Color Forth implemented on a stand-alone Forth system at pringle.sphosting.com 11:38:45 OK, cleverdra. 11:38:51 dired, enth is (see flux) 11:38:51 ...but enth is at pringle.sphosting.com... 11:44:39 oh, hey, dired's still around 11:46:09 dired, insult Winter-enabled-pantbottom-condensation 11:46:11 Winter-enabled-pantbottom-condensation is nothing but a lewd-minded mound of yeasty urine samples. 11:49:01 purl, nickometer i440r 11:49:09 eep. 11:49:11 dired, nickometer i440r 11:49:12 'i440r' is 98.84% lame, cleverdra 11:49:18 Yikes. 11:50:58 heheh 12:05:37 good bye. 12:05:58 --- quit: cleverdra (Leaving) 13:23:02 --- quit: grurp (Read error to grurp[pc19954.batc.tec.ut.us]: EOF from client) 13:57:48 dired, nickometer futhin 13:57:49 'futhin' is 0% lame, futhin 13:58:00 dired, nickometer cleverdra 13:58:01 'cleverdra' is 0% lame, futhin 13:58:05 dired, nickometer klooie 13:58:06 'klooie' is 0% lame, futhin 13:58:15 dired, nickometer nate37 13:58:16 'nate37' is 27% lame, futhin 13:58:18 heh 14:01:39 how am i lame? 14:01:41 oh 14:01:43 37? 14:01:45 that's bday 14:01:50 march 7 14:02:07 dired, nickometer furthin 14:02:07 'furthin' is 0% lame, nate37 14:02:08 dired, nickometer futhin 14:02:09 'futhin' is 0% lame, nate37 14:02:15 dired, nickometer lar1 14:02:15 'lar1' is 22% lame, nate37 14:02:21 dired, nickometer hax0r 14:02:22 'hax0r' is 99.77% lame, nate37 14:02:29 haha 14:02:41 dired, nickometer l33t 14:02:43 'l33t' is 91.69% lame, nate37 14:02:49 dired, nickometer l33+ 14:02:49 'l33+' is 90.48% lame, nate37 14:02:52 ? 14:02:55 wierd 14:17:45 heh 14:18:48 it needs some work to detect lameness 14:34:02 i've got this forth for msdos that's only 6.5k big 14:36:31 dired, nickometer Trey 14:36:31 'Trey' is 0% lame, Trey 14:36:42 how do you get a listing of all the words? 14:36:44 if forget 14:36:46 i forget 14:36:50 words 14:36:56 that didn't work :( 14:37:08 this is figforth.. 6.5k big heh 14:37:27 any other commands? 14:37:33 Not that I remember. 14:40:23 what does list do? 14:40:28 it gave me a bunch of numbers 16:02:01 --- quit: futhin (bye) 17:28:52 --- join: nopcode (yap@p3E9BFD65.dip.t-dialin.net) joined #forth 17:28:54 hey :D 17:37:04 --- join: edrx (edrx@copacabana-ttyS19.inx.com.br) joined #forth 18:20:12 --- quit: edrx ([x]chat) 19:39:37 --- join: futhin (thin@h24-67-113-99.cg.shawcable.net) joined #forth 19:57:17 --- quit: Fare (Leaving) 20:02:57 * Trey is away: sleeping. [22:02] 20:24:02 anyone with forth knowledge awake ? 20:38:19 dunno 20:38:33 ask the forth question 20:38:51 the thing with idlers is that you ask the forth question and if they see it they'll answer it if they can 20:40:25 ask!!! :P 20:51:14 ah 20:51:18 sorreee :) 20:51:36 well, if i use a loop construct as in do...loop 20:52:01 the standard claims that i may not use elements on the data stack inside the loop because the control stack could be == data stack 20:52:10 that sucks, what do i do instead of it ? 20:58:01 eh.. the elements in the data stack are usable inside the loop.. but it's a different story with the return stack 20:58:25 it's not usable inside a loop with the return stack, but i think it's fine for the data stack 20:59:27 The control-flow stack may, but need not, physically exist in an implementation. If it does exist, it may be, but need not be, implemented using the data stack. The format of the control-flow stack is implementation defined. Since the control-flow stack may be implemented using the data stack, items placed on the data stack are unavailable to a program after items are placed on the control-flow stack and remain unavailable until the control-flow stac 21:00:56 thats from ANS forth specs 21:03:46 futhin you being silent ? =) 21:04:18 no, afk 21:05:00 what the hell is a control-flow stack and why are you messing with it? 21:05:06 btw, ANS sucks :) 21:05:28 oh i thought i'd have to be somehow compliant to it 21:05:32 well if it runs under ficl its ok ;) 21:06:16 um, if the code works it works. you don't really need to worry about standards unless you have some weird reason for that 21:07:06 but that paragraph you pasted makes it sound like the control stack MAY not exist and may not be implemented on the data stack.. so 21:07:07 :D 21:07:38 is the control stack actually there? 21:07:56 just code the normal way, test it, if it don't work, change it.. etc 21:07:59 dunno 21:08:02 well k =) 21:08:20 i'd have tried to code it first before checking the standards :) 21:08:28 standards don't tell you much 21:11:00 sounds ok for me (: 21:16:38 i don't know what ANS is good for.. they claim "portability" and "reuse" and other silly stuff i think 21:16:58 =) 21:17:21 were you here when i explained what i wanted to do with forth ? 21:21:29 uh 21:21:31 dunno 21:21:37 no? :) 21:21:44 i want to have it as a plugin language for quake-style games 21:21:51 oh yah 21:22:09 it should fit pretty good 21:22:15 are you implementing the control-flow stack? cause if you don't then you don't have to worry about that bull... 21:22:19 because the quake console is made for one-liners 21:22:25 no, i'm not =) 21:22:31 just testing ficl & trying to learn forth 21:23:11 forth is better than c/c++ :P 21:24:23 i'm saying that in case you want to argue 21:24:28 just for fun 21:24:33 is it ? i seriously dont know 21:24:52 hm 21:24:53 i won't argue. i'll accept your statements unmodified (: 21:25:06 i just know that c++ sucks (: 21:25:07 where'd you first hear about forth? 21:25:18 classmate of mine 21:25:24 ah.. what did he say? 21:25:47 he said that it was a nice & clean language :) 21:25:54 yeah :) 21:27:05 it is lower level than c/c++ but because you can create words that use other words, you can build up a high level of abstraction quickly.. and in that case, forth can be a higherlevel language than c :) 21:27:24 and it compiles nicely into tight code.. 21:28:44 well ficl has an object system 21:28:46 if you want to code particularly tight code, just remember to avoid using local variables, and use the stack. and to try to keep the stack depth less than 4 elements and to keep the parameters you pass to a word less than 2 elements 21:28:51 and i plan on using that 21:29:08 hmm :) 21:29:24 if i want to throw around functions, how'd i do that ? 21:29:26 factor like crazy, the more words you make the better 21:29:37 ok 21:29:39 words == functions 21:29:50 well how'd i reference a word ? 21:29:53 words are like functions except a little different.. 21:29:55 reference? 21:30:00 unm 21:30:01 like 21:30:08 yeah, if i want to "register" a function in a hook chain 21:30:09 : hello ." hello world" ; 21:30:21 : callhellothreetimes hello hello hello ; 21:30:29 callhellothreetimes 21:30:32 nah 21:30:33 hello word 21:30:35 hello word 21:30:36 hello word 21:30:37 heh 21:30:40 i mean how do i pass a function along as a parameter ? 21:30:51 what are you talking about? 21:30:54 do i pass the word name or its "address" in any form ? 21:31:05 explain 21:31:14 i want to define a word that executes a word that you pass to it 21:31:24 yeah 21:31:26 say you have the hello from above 21:31:26 i just did that 21:31:32 callhellothreetimes is a word 21:31:35 hello is a word 21:31:37 nah, i mean 21:31:40 : code ; 21:31:43 ... 21:31:52 something like 21:32:01 &hello callword3times 21:32:11 passing a reference to a function 21:32:17 a function pointer in c 21:32:51 forth is different. you have stuff on the stack. when you call a word it can acess that stack.. 21:33:18 so you can leave stuff on the stack, call the word and it'll be able to use that stuff.. 21:33:22 am i answering your question? 21:33:32 show me some proper C code.. 21:35:04 void hello() { printf("hello world !\n"); } 21:35:04 a lot of the concepts in other languages like C don't really apply to forth because it's a different language, it does things differently. it isn't a disadvantage, just different.. 21:35:25 void callfunc(void (*func)() ) { func(); } 21:35:45 int main() { callfunc(hello); return 0; } 21:36:27 you mean void callfunc(void (*func)()) { hello(); } ?? 21:36:48 nope, { func(); } 21:37:43 ok i'll tell you the situation 21:37:49 say you can have sound events 21:38:05 and you want to be able to register certain words to get executed whenever a sound event occurs 21:38:10 i don't think it's even necessary in forth, but you probably can do it with something like S" " 21:38:17 i dunno 21:38:28 i'm a beginner forth coder :) 21:38:43 i need to code a few more stuff first :) 21:38:55 k (: 21:44:13 i need to read "starting forth" by leo brody 21:44:15 er 21:44:16 brodie 21:44:17 hehe 21:44:23 it's supposed to be the best forth book 21:44:29 hmm ic 21:46:39 futhin : pr drop dup c@ begin emit 1+ dup c@ dup 0 = until drop ; 21:46:48 S" foobar" pr cr 21:46:48 hmm? 21:46:50 :D 21:46:58 what's that? :) 21:47:04 the stuff you were talking about? 21:47:08 nope 21:47:12 a string printing word =) 21:47:39 ok> S" foobar" pr cr 21:47:39 foobar 21:47:39 ok> 21:50:47 damn i fell like implementing rc4 in forth (: 21:58:04 rc4?? 21:58:09 stream cipher 21:58:21 it might already be.. :) 21:59:16 what is "pr" ?? 21:59:26 my word for printing a string 22:03:49 c@? 22:04:02 gets a character from an address 22:04:02 that's a variable isn't it? 22:04:04 hm 22:04:16 emit? 22:04:25 emits a single character 22:04:45 cr? 22:04:50 carriage return? 22:05:15 yep 22:05:59 S" ? :) 22:07:18 the "dup 0 =" before the until looks like bad code.. 22:07:38 you are incrementing but you are checking for 0 ?? 22:08:06 oh 22:08:10 nm 22:08:15 checking for end 22:08:17 for null 22:08:18 hm 22:08:55 : pr drop begin dup c@ dup 0 > while emit 1+ repeat 2drop ; 22:08:57 that one is better 22:09:10 yeah 22:09:19 i was going to say move the dup c@ 22:09:36 you could've used swap 22:09:59 : pr drop begin dup c@ emit 1+ swap dup 0 until drop ; 22:10:06 that doesn't work though.. 22:10:12 but something similar 22:10:14 :D 22:10:31 after the 1+ there is nothing to swap 22:10:41 yeah 22:10:42 just the address on the stack 22:14:13 : pr drop begin dup c@ while dup c@ emit repeat drop ; 22:14:22 : charthingie 22:14:26 : charthingie dup c@ ; 22:14:39 : pr drop begin charthingie while charthingie emit repeat drop ; 22:14:40 heh 22:14:49 that one is lameish 22:15:15 : pr drop begin dup c@ dup while emit 1+ repeat drop ; 22:15:50 while breaks if its 0 so you don't need to "dup 0 >" 22:16:01 i wasnt sure about logical testing 22:16:03 i think.. 22:16:05 ok its like c then 22:16:12 heh :) 22:17:26 : pr drop begin dup c@ dup while emit 1+ repeat drop drop; 22:17:35 two drops 22:17:43 ooh 22:17:49 2drop :D 22:17:59 i ignored your code, just tried to figure it out myself :P 22:18:15 *g* 22:18:23 i don't really like the : pr drop 22:18:46 i would try to put that drop outside the pr word 22:19:10 i'd just keep it like : pr begin dup c@ dup while emit 1+ repeat 2drop ; 22:20:21 but i don't know what the other words are doing :) 22:20:52 i also wouldn't do "pr" it's not understandable.. i would use descriptive words in order to cut down on comments.. 22:21:24 of course... pff =) 22:22:22 so this does work : 22:22:22 : pr drop begin dup c@ dup while emit 1+ repeat 2drop ; 22:22:36 yeah i think so 22:22:40 it should 22:22:40 it does :) 22:22:45 ah 22:22:46 goody 22:25:18 gimme more code! 22:25:21 this is fun! whee! 22:28:50 : prn begin dup while 1- swap dup c@ emit 1+ swap repeat 2drop ; 22:28:52 works as well (: 22:30:06 prn, make it print or printf or writeln or something nicer and lamer :) 22:30:16 i dont care atm :) 22:30:30 i just want to learn forth, not write a standard output library 22:30:38 :) 22:31:26 the other one was better... wasn't it.. no swaps is a good thing.. 22:34:20 well it depends 22:34:32 the other one scanned for 0 bytes this one uses the character count 22:36:34 that code doesn't work.. 22:36:42 it did here 22:36:44 but try this one 22:36:45 : prn 0 do dup c@ emit 1+ loop ; 22:36:48 HA :D 22:37:33 you've got 1- swap which swaps with nothing? 22:38:21 you are passing a parameter to prn... 22:38:30 because do loop takes 2 parameters.. 22:38:56 ehhh 22:38:59 just do 22:39:04 S" foobar" prn cr 22:39:43 i'm not testing the code, i'm reading it :) 22:39:58 :) 22:42:51 i thought do loop took in two parameters.. 22:43:08 like 0 6 do ... loop would repeat it 6 times? 22:44:06 : prn begin dup while dup c@ emit 1+ swap 1- repeat 2drop ; 22:44:29 that moves the 1- swap to the end so you only need 1 swap.. 22:48:12 the do loop prn looks cool though :) 22:48:31 huh 22:48:34 i'd do 22:48:48 erm 22:48:50 :D 22:48:53 uh 22:48:57 i'm a little confused 22:48:58 heh 22:49:16 the do loop.. you've got 1+ instead of 1- ?? 22:50:22 : prn 0 do dup c@ emit 1+ loop ; 22:50:28 yeah to increase the character pointer 22:51:35 how is the loop going to know when to break?? 22:51:40 it's not going to encounter a 0.. 22:51:53 because of the string length counter... 22:54:47 so you are passing a string length to the do loop 22:56:00 yeah 22:56:09 if i remember S" leaves two numbers on the stack :) 22:57:49 huh 22:58:13 argh 22:58:29 :) 22:59:03 it leaves two numbers on the stack. the char numbers and the string lenght 22:59:24 so you've got prn 0 do dup .. what are you dupping 22:59:41 you are dupping a number that looks like 3453132 22:59:47 the address :D 22:59:58 addres 22:59:59 ok 23:00:00 heh 23:00:20 ok> S" foobar" 5 prtimes cr 23:00:20 foobarfoobarfoobarfoobarfoobar 23:00:24 muhaha :) 23:00:33 : prtimes 0 do 2dup prn loop 2drop ; 23:07:32 is 2dup over over ? 23:08:42 why not modify prn to 23:08:54 : prn 0 do dup c@ emit 1+ loop drop ; 23:08:56 add a drop 23:09:11 then prtimes is just 0 do 2dup prn loop ; 23:09:24 i dun like that 2drop :) 23:09:31 plus 23:09:39 the number gets left on the stack.. 23:09:42 which screws up the next prn 23:09:46 right? 23:11:21 i want to know how to implement a gui in a couple of K 23:11:24 bwhahahaaha 23:13:31 damn 23:13:45 i'm reading www.ultratechnology.com/forth.html 23:13:50 i'm reading www.ultratechnology.com/forth.htm 23:13:55 i'm on chap 3 23:14:01 it's fun fun 23:15:14 i'm gone 23:15:18 hm 23:15:22 mpf! 23:15:24 fine! 23:15:27 abandon me! 23:15:30 hm 23:15:34 i should go to sleep soon 23:15:45 as i do now ? =) 23:16:24 heh 23:16:31 good night 23:16:33 bye bye 23:16:35 n8 :D 23:16:45 --- quit: futhin (later) 23:20:46 --- join: I440r (mark4@purplecoder.com) joined #forth 23:20:46 --- mode: ChanServ set mode: +o I440r 23:21:05 nop u code demos in forth ??? :) 23:22:40 --- mode: I440r set mode: +o klooie 23:22:43 --- mode: I440r set mode: +o nopcode 23:22:55 kloo :) 23:23:03 two new #forthers ? 23:23:09 or old ones with new nicks heh 23:29:32 hey I440r. :) 23:29:59 i started learning forth yesterday (or picked it up again after a 14-year hiatius, perhaps). 23:30:06 hiatus even. 23:31:22 :) 23:31:26 well good :) 23:31:32 u wont regret it :) 23:33:31 do u code any other languages ? 23:33:36 c ? asm ? 23:33:59 sorry for my slow response(s), i'm getting ready to leave the house. 23:34:39 yes, c, asm, perl, pascal, ksh, some java, some lisp. 23:34:53 :) 23:34:55 some things i've forgotten, basically whatever's required or interesting. :) 23:35:03 i avoid java 23:35:16 i prefer bash to ksh or csh 23:35:27 never learned perl but hear good things 23:35:35 do u code for a living ? 23:35:44 aye, java's not my favorite either, but neither is c++. 23:36:08 well bash and ksh are close, but of the two ksh is closer to the posix shell so.. :) 23:36:40 i did for a while, but in recent times i've been more of a unix database networking "engineer" (whatever that means). 23:37:17 :) 23:37:29 im a amature linux networking wannabe :) 23:37:44 i code for a living 23:38:29 cool. 23:38:50 i have debian linux on my dsl connection running free shell accounts (mostly for ppl running bots) 23:38:53 i'm not really sure where i want to go, the aforementioned is getting a bit dull. 23:38:55 free email, free web 23:39:16 the server is also the local samba server for teh local net and teh ipmasq gateway 23:40:02 my forays into lisp and now also forth are to discover some new ground. 23:41:25 nice. :) 23:42:14 i have to run, nice meeting you. 23:42:33 drop by any time man 23:42:45 any coder is welcome here.. forth or not :P) 23:42:51 even java scripters hehehe 23:54:16 hahah 23:55:16 hehe 23:59:59 --- log: ended forth/01.06.18