00:00:00 --- log: started forth/06.01.18 00:00:22 I did find a spoof email in my box today 00:00:49 :/ 00:04:46 --- quit: snowrichard ("Leaving") 02:08:03 --- part: amca left #forth 04:33:43 --- join: rehges (n=segher@blueice4n1.de.ibm.com) joined #forth 05:06:40 --- join: Cheery (i=Henri@a81-197-18-99.elisa-laajakaista.fi) joined #forth 05:27:59 --- join: PoppaVic (n=pete@0-1pool66-158.nas22.chicago4.il.us.da.qwest.net) joined #forth 06:22:50 --- join: madwork (n=foo@derby.metrics.com) joined #forth 08:17:40 --- join: sproingie (n=chuck@64-121-2-59.c3-0.sfrn-ubr8.sfrn.ca.cable.rcn.com) joined #forth 08:44:58 a nice little lisp on top of retro is gonna rock. as soon as my coding skills mature enough... :) 09:05:09 --- quit: rehges () 09:17:01 --- quit: PoppaVic (Nick collision from services.) 09:17:19 --- join: PoppaVic (n=pete@0-2pool198-47.nas30.chicago4.il.us.da.qwest.net) joined #forth 09:40:43 --- join: segher (n=segher@dslb-084-056-142-220.pools.arcor-ip.net) joined #forth 09:46:13 --- quit: madwork ("?OUT OF DATA ERROR") 09:47:11 --- join: madwork (n=foo@derby.metrics.com) joined #forth 11:15:56 --- quit: PoppaVic ("Pulls the pin...") 12:02:57 --- quit: Snoopy42 (Read error: 145 (Connection timed out)) 12:13:50 --- quit: madwork (Read error: 104 (Connection reset by peer)) 12:18:06 --- join: Snoopy42 (i=snoopy_1@dslb-084-058-117-062.pools.arcor-ip.net) joined #forth 12:27:21 --- join: madwork (n=foo@derby.metrics.com) joined #forth 12:52:12 --- quit: Cheery ("Leaving") 12:59:13 --- quit: EtherNet ("Leaving") 13:13:46 docl: you going to do the dynamic typing stuff? 13:16:23 is dynamic typing like numbers that can be ints or floats depending on context? 13:16:30 yeah 13:16:35 that's what I meant anyway 13:16:45 lisp goes further than just int/float though 13:16:47 I could try my hand at it, I guess 13:16:49 it does fractions 13:16:58 good point 13:17:18 fractions are pairs, right? 13:17:35 afaik you can do something like: 7 99 / 88 * 13:17:37 oops 13:17:45 7 99 / 99 * 13:17:51 cool 13:17:53 and be sure of getting _exactly_ 7 13:18:21 hmm how does it know to store it as a fraction? 13:18:30 that's the tricky bit :) 13:18:38 1.0 0.9 - 0.1 - . 13:18:39 -2.775557561562891e-17 13:18:47 1 9/10 - 1/10 - . 13:18:47 0 13:19:12 :) 13:19:21 I guess you could have a state variable that lets you switch numeric modes 13:19:43 afaik lisp does it automatically 13:19:44 in lisp it depends on the type of the number object 13:20:01 0 for int, 1 for float, 2 for fraction 13:20:23 don't forget bigints :) 13:20:23 1 200 shift . 13:20:23 1606938044258990275541962092341162602522202993782792835301376 13:20:40 : int numeric 0 ! ; 13:21:09 : crash 0 ! ; 13:21:14 he 13:21:16 heh* 13:23:58 docl: give each number a tag of some sort. switching numeric modes will be troublesome 13:24:01 well we're storing numbers on the stack instead of in number objects 13:24:06 esp. if you want to have operations that take two different types 13:24:27 'object' is an abstract concept, doesn't imply any specific storage discipline 13:26:07 yeah, you'll need to store the type on each number 13:26:11 not all numbers will be the same type 13:26:42 so maybe have an array that parallels the stack and gives a type for each element? 13:26:56 don't keep the lisp numbers on the stack 13:27:13 ahh, ok 13:27:17 lisp doesn't work on stacks 13:27:19 it works on lists 13:29:37 well, not even. lisp is an applicative language 13:29:42 so the details of argument passing are not exposed 13:29:52 they might be in registers, or a stack with stack frames (like C) 13:36:33 --- log: started forth/06.01.18 13:36:33 --- join: clog_ (n=nef@bespin.org) joined #forth 13:36:33 --- topic: 'Welcome to #forth. We discuss the Forth programming language, simplicity, and a variety of technical subjects. The rules are simple: don't spam, don't troll, and please speak English.' 13:36:33 --- topic: set by SunDragon on [Sat Dec 10 07:19:28 2005] 13:36:33 --- names: list (clog_ madwork Snoopy42 segher sproingie docl slava @JasonWoof virl @crc clog Raystm2 saon warpzero ccfg OrngeTide skylan madgarden Jim7J1AJH) 13:40:04 hmm. I can make a list of cells. which can be pointers to functions. 13:52:03 --- quit: clog (Read error: 110 (Connection timed out)) 13:52:03 --- nick: clog_ -> clog 13:59:59 --- quit: virl (Remote closed the connection) 14:04:28 --- join: segher_ (n=segher@dslb-084-056-130-142.pools.arcor-ip.net) joined #forth 14:22:57 --- quit: segher (Read error: 110 (Connection timed out)) 14:30:33 10 variable array allot 14:30:33 : try wsparse find if ;; then eval ; 14:30:33 : ( try array @ cell+ dup array ! array + ! ; 14:30:33 : ) array @ dup cell- array ! array + @ .forth ; 14:30:33 : display . ; 14:30:34 ( display 1234 ) 14:31:14 there's actually a lot more work to do than that. 14:31:51 (eval (cons '+ '(2 2))) gives 4 14:32:16 yeah, just a starting point I guess 14:33:15 in lisp, ( and ) do not evaluate anything. 14:33:29 (display 1234) is just a list with two elements, the first one is a symbol 14:34:15 so "find if" is giving me the answer to a question "is it a symbol?" 14:34:45 everything that's not a number is a symbol 14:34:54 they are created when first encountered 14:35:10 so if i write (fdafa fdafa), the symbol is created if necessary, but then both elements are equal 14:35:18 so symbols are unique 14:35:48 find is the wrong query there at that point I'm thinking 14:36:16 symbols are associated to functions (which are themselves objects, and not necessary bound to a symbol) via a lexical context 14:36:21 (lambda ...) creates an anonymous function 14:36:25 (lambda (x) (+ x 2)) 14:37:40 well the dictionary is kind of the lexical context. though symbols are not created as they are found in the current setup. 14:37:54 well, not really; look 14:38:06 (flet ((sq (x) (* x x)) (sq 5)) 14:38:11 the 'sq' is only bound inside the body of the flet form 14:38:28 ahh, cool 14:38:47 somewhat like the loc: symbol in retro 14:39:13 but more generally applied 14:39:20 it happens at runtime, not compile time 14:39:38 (let* ((x 5) (y (+ x 7)) (cons x y)) 14:40:08 neat 14:40:32 you'd have to start by making an object system with numbers, strings, symbols and conses. 14:40:38 then you'd write a reader that converts text to objects 14:40:42 then write an evaluator 14:41:49 converting text to object is like compiling, right? 14:42:29 no, its parsing. 14:42:44 in lisp, compiling is converting expressions to machine code 14:42:54 so the parser takes "(+ 2 x)" and converts it to a list of three elements 14:43:05 the compiler takes this list of 3 elements and produces machine code 14:43:29 factor works exactly the same way, by the way, except the evaluator is postfix. 14:43:44 cool 14:44:25 the parser makes three elements in memory. the compiler makes these into machine code. 14:44:42 this bit is really weird "10 variable array allot" 14:44:49 so parsing is part of the compiling process 14:44:56 "array" is a variable name 14:44:57 no, its independent. 14:45:02 you can parse without compiling in lisp 14:45:09 or you can construct some lists that contain expressions, and compile them. 14:45:26 (read-from-string "(+ 2 2)") gives a list of three elements. 14:45:40 (eval (cons '+ '(2 2))) constructs an expression and evaluates it. 14:45:54 docl: there is no guarantee that the space givin by "allot" will be contiguous with that given by variable. 14:46:05 (compile (lambda (x) (* x 3))) gives a compiled function that multiplies its input by 3 14:46:24 docl: also I think it's weird that you've allocated 14 bytes. (thus leaving the heap non-alligned) 14:47:28 JasonWoof, I just picked an arbitrary number, 10 is probably too short. The heap has been increased by 14 from the start of the variable. 14:48:13 docl: what forth are you using? 14:48:20 retroforth 9 14:48:37 ok, so why are you allocating 3.5 cells? 14:49:06 you should probably use something like this: 14:49:09 I should have allocated 10 cells instead of 10 bytes 14:49:18 : array create cells allot ; 14:49:26 10 cells variable array allot 14:49:43 "variable xxx allot" is _NOT_ cool 14:49:56 you can't always allocate after a variable 14:50:03 it'll work it some forths but not others 14:50:10 anyway, you should be using CREATE 14:50:22 or my ARRAY above 14:50:37 10 array my-array 14:51:10 BTW, variable can be defined like this: : variable create 0 , ; 14:51:34 (and often is, thus making it OK to ALLOT after it) 14:51:48 but it could also be defined like this: : variable here 0 , constant ; 14:52:09 in which case it would be very very bad to allocate after it and pretend you have a contiguous buffer 14:52:22 (as this would lead you to overwrite the code compiled by CONSTANT 14:54:13 what's that version used for? 14:54:44 implementing VERIABLE 14:54:53 variable that is 14:54:59 they do the same thing 14:55:07 : variable 0 : variable: create , ; 14:55:07 both are compatible with ANS forth spec 14:55:19 eh? 14:55:37 that's what retro's is defined as 14:55:57 oh, I get it 14:56:10 so you can do: 8 variable: foo 14:56:12 lets you define an init value with variable: 14:56:17 yeah :) 14:56:28 rather than: create foo 8 , 14:56:36 hi everyone 14:56:40 hi crc 14:56:50 hi crc 14:57:13 docl: ok, so even if you don't care that "variable ... allot" doesn't work in some forths, it would probably be better to do something who's meaning is more clear 14:57:24 yeah good idea 14:57:41 : carray create cells allot ; 14:58:00 : array variable cells allot ; <- is that okay? 14:58:08 no 14:58:13 it allocates one too many cells 14:58:13 has to be create? 14:58:21 variable allocates a cell 14:58:22 the extra is a useful index 14:58:34 it's going to be confusing 14:58:47 when you do debuging you look for off-by-one errors 14:59:13 besides "variable" is used to create variables 14:59:18 you are not creating a variable 14:59:44 CREATE gives you a word that points to the heap. it's used to create buffers 14:59:57 the meaning is more clear 15:00:24 if you want it to allocate one extra cell it'd be better to put that explicitly in your code 15:00:40 : array create 0 , cells allot ; 15:00:52 right 15:02:21 hmm... this might be useful 15:02:41 in my forth I frequently deal whith "objects" that have a size field and data 15:02:44 such as strings and such 15:02:52 makes the index of the array easy to get at 15:03:09 I decided to put the count before the data as normal, but have the pointer point to the data, not the count. 15:03:21 so eg: : array cells dup , create allot ; 15:05:12 that works 15:08:15 one idea I had was put the size at the -1 offset, and the index at the 0 offset. 15:08:37 : array cells dup , create 0 , allot ; 15:22:07 right 15:22:13 don't forget to put CELLS in there somewhere 15:22:41 whatever format you use, it's nice to make accessor words for it 15:23:08 eg: : array@ ( array index -- value ) 15:23:17 yeah 15:23:32 : array! ( val array index -- ) 15:24:04 on top of making more reliable and readable code, it makes it so you can change the format without changing every bit of code that uses the data 15:24:35 (if you always use the index stored within the array structure, you obviously wouldn't have to pass it as in my examples above) 15:25:45 fwiw the format I use for data in my source/editor is: type 2, size 2, create xxx allot 15:26:24 : 2, ( x -- append x as a 2-byte value to the heap ) 15:38:29 : count ( data -- size ) 2 - h@ ; 15:51:45 hmm in the example I put the index in terms of bytes, but cells might be better 15:52:38 well that was size 15:53:07 index was 0 so still ambiguous 16:07:25 --- join: amca (n=plump@as-bri-3-31.ozonline.com.au) joined #forth 16:07:45 --- quit: amca (Read error: 104 (Connection reset by peer)) 18:22:55 --- join: snowrichard (n=richard@adsl-69-155-177-154.dsl.lgvwtx.swbell.net) joined #forth 18:24:39 --- quit: snowrichard (Client Quit) 18:44:12 --- join: amca (n=plump@as-bri-3-179.ozonline.com.au) joined #forth 18:44:24 --- quit: amca (Read error: 104 (Connection reset by peer)) 18:48:54 --- join: snowrichard (n=richard@adsl-69-155-177-154.dsl.lgvwtx.swbell.net) joined #forth 19:00:48 --- quit: snowrichard ("Leaving") 19:28:11 --- join: I440r (n=foo@rrcs-24-242-160-169.sw.biz.rr.com) joined #forth 22:05:11 --- quit: sproingie (Remote closed the connection) 23:59:59 --- log: ended forth/06.01.18