00:00:00 --- log: started forth/18.06.21 00:35:26 --- join: mtsd (~mtsd@77.110.61.100) joined #forth 01:17:17 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 01:29:09 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 01:33:15 --- quit: dave69 (Quit: one love) 01:35:35 --- quit: ThirtyOne32nds (Ping timeout: 256 seconds) 01:59:25 --- join: dave9 (~dave@207.213.dsl.syd.iprimus.net.au) joined #forth 03:24:22 --- quit: nighty-- (Remote host closed the connection) 03:42:18 --- join: ThirtyOne32nds (~rtmanpage@31.sub-174-204-10.myvzw.com) joined #forth 04:15:42 lf94> Why is this wrong? : ?> (a b -- n) > ; 04:16:13 you're going to have to elaborate on "wrong" 04:17:41 ( is a word. you need a space after it. otherwise i don't know what your definition is supposed to do. looks like it is meant to preserve values iff one a > b or something ? 04:39:13 lf94: ( and ) are words that alter the interpreter so that anything after ( is not processed except ), which makes everything normal again 04:39:39 So your definition should be: `: ?> ( a b -- n ) > ;` 04:40:41 --- quit: ncv (Remote host closed the connection) 04:49:58 --- join: ncv (~neceve@90.218.62.205) joined #forth 04:49:58 --- quit: ncv (Changing host) 04:49:58 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 05:04:57 --- join: impomatic (~digital_w@host81-136-104-94.range81-136.btcentralplus.com) joined #forth 05:05:02 --- quit: dys (Ping timeout: 260 seconds) 05:10:44 I didn't think ) was a word. 05:11:28 I thought ( was basically ')' WORD, so that it plucks everthing up to the ) out of the input stream (treating the ) like a space in normal usage). 05:11:50 So ( just moves the >IN pointer to just past the ) and then things carry on as normal. 05:12:08 So you don't actually need to separate ) with a space; you could have this: 05:12:17 : ?> ( a b -- n) > ; 05:15:10 But that looks like it's just a renaming of > so I'm not sure I see the point. 05:22:29 KipIngram is correct in how ( works. I'm not aware of any dialects using a ) word to implement comments. 05:50:43 --- quit: mtsd (Quit: Leaving) 05:51:14 --- join: karswell_ (~user@cust125-dsl91-135-5.idnet.net) joined #forth 05:55:02 --- nick: karswell_ -> karswell 06:38:39 mine repeatedly calls word (which takes no argument) until what's returned is a ")", and it handles nesting 06:39:12 the side-effect being that the ) also has to have a space before it, but I like that better stylistically anyway 06:40:31 but nobody should care about what mine does except for me I guess 06:48:31 Actually I think handling nesting is a good feature. 06:48:41 You could temporarily comment out a block of code that contained comments. 06:48:59 I think I consider that superior. 06:49:30 Well, wait - how does it handle nesting? Seems like the first ( would still find the first ) rather than its matching ). 06:49:41 Unless you check for ( along the way and keep a count. 06:51:30 --- join: dys (~dys@tmo-122-193.customers.d1-online.com) joined #forth 07:06:03 Ok, I re-read your comment and I'm guessing that's exactly what you meant - it calls WORD looking for ) *AND* it handles nesting, as saparate logic. When I first read it I interpreted the nesting handling as a "side effect" of the other part. 07:06:28 I keep a count 07:06:38 and yeah I use it to comment out blocks of stuff all the time 07:06:51 I think it's clearly better, zy]x[yz. Nesting would break the conventional approach. 07:11:01 I agree, that's why I did it 07:11:25 I did a ton of non-conformant stuff 07:12:14 * crc likes non-conformant stuff 07:15:50 Me too. Seems in the spirit of Forth. 07:18:20 So I'm finalizing this number conversion stuff. I don't like BASE; it makes it so you can't know for sure what a block of code is going to do, or if it's even going to compile, unless it explicitly sets BASE. 07:18:48 I allow numbers of the form [optional -][decimal radix:]digits. 07:18:59 So 16:A04D 07:19:06 Or 2:101011 07:19:45 I also allow x: and b: as special radix setting characters, so x:A04D and b:101011 07:20:09 If no radix: is given then it's decimal. 07:21:03 I want to support much more general literals eventually (lists, arrays, etc.) so this will have to be replaced, but that's how I'm doing it now. 07:21:13 I'll do the other after I have a regular expression toolkit working. 07:23:21 --- quit: dave9 (Quit: one love) 07:23:31 KipIngram, I'm pretty sure we are actually the same person 07:24:00 I also got rid of base and dec and hex and instead parse a radix#number syntax 07:24:05 16#abc 07:24:32 :-) 07:24:41 I have noticed we seem to think alike a good bit. 07:24:43 I didn't do the x# and b# though 07:24:50 I suspect Forth tends to attract our type. 07:28:38 masochists, you mean? 07:39:14 --- quit: pierpal (Quit: Poof) 07:39:33 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 07:43:21 I like the idea of using a radix rather than a global BASE. I'll implement this as an optional thing for my Forth. (no BASE in my core system, the default number handler is decimal only) 07:47:30 last night in bed I was thinking: one of the reasons forth is so powerful is because of how composable functions are, and the lack of syntax 07:48:36 I was also thinking, could you make a json "parser" via words 07:48:46 { "thing": "ok" } 07:48:53 {, :, and } being a word 07:49:20 it would look more like { " thing" : " ok" } though 08:06:51 right 08:06:52 still 08:06:55 isnt that amazing? 08:06:59 what other language lets you do this 08:07:22 tcl, sort-of 08:08:07 but yeah, that seems to be the big selling point of forth. there are no-batteries-included, and then there's forth - no syntax included. you build your language to describe your problem space 08:10:13 https://gist.github.com/crcx/3f710c063754490c9a260fea30425058 (quick & dirty implementation allowing numbers w/radix in my forth) 08:13:16 Mine's about a dozen one-line defintions, with NUMBER at the top. 08:13:28 Heavily utilizes that "grandparent return" mechanism. 08:14:13 Haven't rendered it to assembly language yet - still polishing on it. 08:14:40 I want to also support x: for hex and b: for binary; working that in now. 08:15:30 Right now I have it case insensitive, with 0-9, A-Z, and a-z all representing up to 62 digits. 08:15:43 So I'll be able to do Sumerian base 60 if I choose. :-) 08:16:03 But I'll likely wind up making it case insensitive. 08:18:55 --- quit: pierpal (Quit: Poof) 08:19:15 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 08:20:49 at one point I was semi-considering making the default dozenal (http://dozenal.org/) - including the radix prefixes - just to be contrarian 08:21:28 :-) 08:22:24 When I've done this in the past, I've been sort of loose and sloppy about it. Allowed multiple - and : characters, - characters in the middle, etc. 08:22:31 -4-07 would be 407, etc. 08:22:40 Worked completely right for "right" numbers, but allowed some malformed stuff. 08:22:47 I'm trying to get it rigourous this time. 08:23:21 One thing that helps make the stack manipulations more feasible is that I'm doing this in single precision; I just don't feel the need for doubles on a 64-bit system. 08:24:19 One thing I really like about 64-bits, though, is that I'll be able to treat double precision floating point numbers as standard stack items. 08:37:28 0> is less than zero? 08:37:57 To me these tiny words that combine very tiny words is not worth it 08:38:15 0 < is better than 0> 08:40:18 The combined words can be better optimized by the implementer 08:41:08 https://github.com/shepheb/forthboy/blob/master/cpu.fs 08:41:17 Is this good forth? Looks ugly to me 08:46:46 some of his words are probably longer than what would be considered "good forth," but I'm guilty of it too so I can't criticize too much 08:46:59 Just from a quick look, it could be factored better, and some of the definitions seem messy. But I’d need to study it to make a better assessment. As an emulator, there may be performance reasons for some of the less factored bits. (Though use of inlining could help) 09:56:52 --- quit: ncv (Ping timeout: 245 seconds) 10:37:37 so modifying the compiler is part of forth's strength? 10:38:52 yes 10:56:14 --- join: ncv (~neceve@unaffiliated/neceve) joined #forth 11:05:49 where can I learn about it? 11:06:04 I studies learnxinyminutes.com/forth to get the basics down 11:06:07 studied 11:06:23 is there a similar document, that goes over the core concepts of modifying the compiler? 11:09:35 I'm not aware of anything that concise. Starting Forth chapter 11 has some coverage of this. 11:09:38 https://www.forth.com/starting-forth/11-forth-compiler-defining-words/ 11:09:48 Cool, thank you :) 11:09:56 Also your radix code is very cool :D 11:21:14 I updated the code to remove the use of the 'Number' and 'Mod' variables 11:25:49 I'm surprised C is dramatically faster than forth 11:25:51 http://dan.corlan.net/bench.html 11:26:02 gforth must be a bad compiler? 11:27:40 why does that surprise you? 11:30:29 because it feels pretty close to the hardware 11:30:35 but it's interpreted 11:30:46 most Forth systems I've looked at do substantially less optimization of code generation 11:30:51 ah, so I wonder about the speed of compiled forth 11:31:39 I would say forth is more about development optimization rather than runtime optimization 11:32:00 it can be both 11:32:01 so why not :) 11:32:07 you follow the conventional wisdom of make it work, measure it, then optimize 11:32:09 VFX and iForth (both commercial) are the fastest I've seen 11:32:25 I'd like to see these benchmarks with those :D 11:32:29 the third phase in forth being to reimplement hot words in assembler 11:32:46 or refactor the algorithm 11:36:04 right 11:45:32 http://home.vianetworks.nl/users/mhx/mm.html 11:45:39 VFX forth is very close to C 11:45:48 iforth wins my a nice margin 11:45:52 my/by 11:52:19 is forth case sensitive 11:52:30 I much prefer does>, create, cell+ etc as lowercase 11:56:11 lf94: depends on your FIND word. You could do the equiv to touppercase if your dictionary words are all upper case. 12:09:42 lf94: gforth is case insensitive 12:12:26 defining compile time / run time words is a lot to take in haha 12:12:43 seems simple enough 12:29:43 --- quit: ncv (Ping timeout: 256 seconds) 12:44:47 --- quit: pierpal (Quit: Poof) 12:45:06 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 12:57:15 I'm attempting to translate the "Storage handling" section of this http://lll-docs.readthedocs.io/en/latest/lll_reference.html to Forth. But to me, this is silly. The best way is to just maintain a list of constants IMO: 0x00 constant myvar1, 0x01 constant myvar2, etc 12:59:13 and then use directly with the opcodes/words: myvar1 21312312 sstore; 13:12:14 https://gist.github.com/lf94/467a496ad0d51d004aa2835a2f7087f8 13:13:06 The former more closely matches what is actually happening on the evm, with values being pushed/popped from the stack 13:13:17 But IMO, the lisp is cleaner 13:13:35 maybe this is just because I am not used to reading forth yet 13:14:38 I feel like forth makes me always wonder "what's on the stack", and the lisp not so much 13:22:39 --- quit: pierpal (Quit: Poof) 13:22:57 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 13:23:20 --- quit: pierpal (Client Quit) 13:23:42 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 13:24:59 --- quit: groovy2shoes (Ping timeout: 260 seconds) 13:26:19 --- join: groovy2shoes (~groovy2sh@unaffiliated/groovebot) joined #forth 13:39:13 --- join: pierpa (4f2c3a2d@gateway/web/freenode/ip.79.44.58.45) joined #forth 15:04:03 What is the GForth runtime bit for ;? 15:04:19 I want to test this number conversion stuff in GForth, which means I have to implement ;, ;;, and ;; 15:04:42 SEE ; shows something called EXIT, but [COMPILE] EXIT throws an unrecognized word error. 15:05:26 It occurs to me that [COMPILE] ; might work, but doesn't seem quite perfect. 15:05:55 Oh, wait - I didn't have a space after EXIT, think. 15:27:21 --- quit: groovy2shoes (Ping timeout: 255 seconds) 15:31:12 --- join: groovy2shoes (~groovy2sh@unaffiliated/groovebot) joined #forth 16:07:23 --- quit: Keshl (Read error: Connection reset by peer) 16:07:29 --- join: Keshl_ (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 16:08:49 --- quit: Keshl_ (Read error: Connection reset by peer) 16:09:20 --- join: Keshl_ (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 16:16:25 --- quit: Keshl_ (Read error: Connection reset by peer) 16:16:30 --- join: Keshl__ (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 16:27:45 Ok, success. 16:28:07 Got GForth into a "compatibility mode" of sorts and chased down a couple of bugs in the code itself. 16:28:23 It works; I tested it fairly lightly, but I tried to get the "interesting cases." 16:56:28 GForth doesn't have COMPILE? 17:02:39 Oh. POSTPONE. 17:02:43 --- quit: pierpal (Ping timeout: 240 seconds) 17:02:49 Duh - I just read that the other day. 17:07:17 --- quit: dys (Ping timeout: 245 seconds) 17:19:39 --- join: nighty-- (~nighty@kyotolabs.asahinet.com) joined #forth 17:29:05 Ok, just used ;;, ; in my code - ;;, gets me the right effect and ; ends the definition. Couldn't figure out how to get GForth to implement ;; happily. 17:29:22 If anyone wants to see this code the GForth is here: 17:29:24 https://pastebin.com/fRJ6AxDW 17:44:09 --- quit: dddddd (Remote host closed the connection) 17:48:45 --- join: Keshl___ (~Purple@24.115.185.149.res-cmts.gld.ptd.net) joined #forth 17:48:59 --- quit: Keshl__ (Read error: Connection reset by peer) 17:50:49 --- nick: Keshl___ -> Keshl 18:22:47 Well, I overlooked the obvious. I validated that all the digits were in 0-9 A-Z a-z, but I totally forgot to compare each digit to the working radix for validity. 18:22:49 :-) 18:23:01 had to add a definition for that and tuck its call into ABSORB. 18:23:03 Seems to work now. 18:23:14 Still fits in a block, but I did like 15 lines better than 16. 19:08:41 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 19:13:26 --- quit: pierpal (Ping timeout: 256 seconds) 19:15:44 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 19:28:01 --- quit: pierpa (Quit: Page closed) 19:39:21 So I am considering the idea of having :: as an alternate to :. Words defined with :: would only be visible on the same source block. 19:39:44 I defined a whole mess of "helper words" for NUMBER, most of which are utterly application dependent and won't be used anywhere else. 19:39:50 I hate having them clutter up my dictionary. 19:40:17 Obviously I can link them out in the assembly source, but I was thinking of "similar situations. 19:40:20 " 19:40:55 --- quit: impomatic (Ping timeout: 248 seconds) 19:44:19 makes sense 19:45:05 --- quit: pierpal (Quit: Poof) 19:45:23 --- join: pierpal (~pierpal@host45-58-dynamic.44-79-r.retail.telecomitalia.it) joined #forth 19:50:31 KipIngram: or why not have a kind of nesting definitions? 19:50:52 Also possible. Just something that has to be kept up with. 19:50:58 Like your nested comment counter. 19:51:15 say : NUMBER : helper-word bla bla ; something helper-word ; 19:51:30 Yes, sort of like how I'd do it with vocabularies. 19:51:40 My favored vocabulary structure allows hiding helper words like that. 19:51:59 It just involves the necessary setup and setting of context and current correctly. 19:52:43 helpers definitions then define the helpers, get helpers in context but forth definitions (or "parent" definitions) to do the exposed words 19:52:58 And you'd never need helpers in context except when compiling those particular words. 19:53:19 So this mechanism really already exists - I just saw :: as a possible VERY lean alternate. 19:53:37 That adds zero extra LINES of code. 20:02:37 well with nesting you only need one counter variable, compiling jumps around nested definitions and to fix up back links when done with each level. 20:16:39 --- quit: pierpal (Remote host closed the connection) 21:08:28 --- quit: ThirtyOne32nds (Ping timeout: 256 seconds) 21:34:11 --- join: dave9 (~dave@207.213.dsl.syd.iprimus.net.au) joined #forth 22:42:52 --- join: dys (~dys@tmo-096-85.customers.d1-online.com) joined #forth 23:15:19 --- join: ThirtyOne32nds (~rtmanpage@190.sub-174-204-6.myvzw.com) joined #forth 23:23:45 --- quit: ThirtyOne32nds (Ping timeout: 276 seconds) 23:59:59 --- log: ended forth/18.06.21