00:00:00 --- log: started forth/19.06.04 00:13:44 --- quit: Keshl (Read error: Connection reset by peer) 00:14:07 --- join: Keshl (~Purple@207.44.70.214.res-cmts.gld.ptd.net) joined #forth 00:53:17 --- join: xek (xek@nat/redhat/x-rxctrqcdgndcsdyk) joined #forth 01:13:51 morning forth 01:19:59 <`presiden> morning forthnighter 01:38:01 I need to hack up a forth for stream processing 01:38:12 stream in this case being SIP 01:42:03 in fact it doesn't need to be "stream procesing", waste of cognitive power 01:42:51 <`presiden> so what it need to be then? 01:44:36 just sequential and fast I guess 01:49:57 --- quit: proteusguy (Ping timeout: 248 seconds) 01:51:45 --- join: proteusguy (~proteusgu@mx-ll-180.183.100-72.dynamic.3bb.co.th) joined #forth 01:51:45 --- mode: ChanServ set +v proteusguy 02:03:49 --- quit: ashirase (Ping timeout: 248 seconds) 02:09:01 --- join: ashirase (~ashirase@modemcable098.166-22-96.mc.videotron.ca) joined #forth 02:49:47 --- join: pareidolia (~pareidoli@87.213.124.143) joined #forth 03:57:35 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 04:45:05 --- quit: `presiden (Ping timeout: 272 seconds) 05:30:37 --- quit: proteusguy (Remote host closed the connection) 06:52:41 --- join: proteusguy (~proteusgu@cm-58-10-155-156.revip7.asianet.co.th) joined #forth 06:52:42 --- mode: ChanServ set +v proteusguy 07:41:41 --- quit: tabemann (Ping timeout: 252 seconds) 09:21:14 --- quit: xek (Ping timeout: 245 seconds) 09:21:19 --- join: xek_ (xek@nat/redhat/x-fnwjufibmoraakow) joined #forth 09:38:19 --- quit: xek_ (Ping timeout: 272 seconds) 11:07:49 --- join: PoppaVic (~PoppaVic@unaffiliated/poppavic) joined #forth 11:53:21 --- quit: gravicappa (Ping timeout: 244 seconds) 15:34:27 --- join: rdrop-exit (~markwilli@112.201.166.63) joined #forth 15:34:47 c[_] Good morning Forthers :) 16:08:14 --- quit: john_cephalopoda (Ping timeout: 252 seconds) 16:16:47 --- join: dave0 (~dave0@069.d.003.ncl.iprimus.net.au) joined #forth 16:17:12 hi 16:17:29 hi dave0 16:17:40 hi rdrop-exit 16:21:23 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 17:09:40 bbl 17:11:09 okay cya rdrop-exit 17:12:46 --- join: tabemann (~tabemann@h193.235.138.40.static.ip.windstream.net) joined #forth 18:08:47 --- quit: tabemann (Ping timeout: 272 seconds) 19:08:14 --- join: tabemann (~tabemann@2600:1700:7990:24e0:b944:a349:56b9:12fb) joined #forth 19:08:54 --- quit: proteusguy (Ping timeout: 244 seconds) 19:16:26 --- quit: dave0 (Quit: dave's not here) 19:18:56 --- quit: tabemann (Ping timeout: 248 seconds) 19:19:55 --- join: tabemann (ac0d3189@gateway/web/freenode/ip.172.13.49.137) joined #forth 19:24:38 --- quit: tabemann (Client Quit) 19:25:00 --- join: tabemann (~travisb@2600:1700:7990:24e0:b944:a349:56b9:12fb) joined #forth 19:36:10 --- quit: jedb (Ping timeout: 246 seconds) 20:00:30 --- join: proteusguy (~proteusgu@119-46-178-3.static.asianet.co.th) joined #forth 20:00:30 --- mode: ChanServ set +v proteusguy 20:05:28 does CASE let you use non-literals? e.g. if I do CASE TRUE OF ... ENDOF FALSE OF ... ENDOF ... ENDCASE is that legal? 20:13:57 --- part: PoppaVic left #forth 20:21:47 remexre: yes 20:22:15 all that CASE/OF cares about is the values that one is comparing are single cells 20:22:21 --- join: pierpal (~pierpal@host196-36-dynamic.16-87-r.retail.telecomitalia.it) joined #forth 20:22:42 you could compute the values compared against on the fly, and it wouldn't care 20:23:07 huh 20:23:20 how do people actually implement CASE, I guess is my bigger question 20:23:38 and even then, I write a version of OF that compares *strings* for the hell of it 20:24:02 I've implemented CASE in my Forths 20:24:09 it actually is pretty straightforward 20:24:16 back 20:24:31 hey rdrop-exit 20:24:35 *wrote 20:25:51 IIRC correctly OF compiles something similar to "over = if ..." 20:26:18 I've never bothered adding CASE to a Forth, it's really just syntactic sugar 20:26:46 it's syntactic sugar, but lots of nested IF/ELSE/THENs get ugly-looking fast 20:26:49 oh, okay, I thought it compiled to a jump table or something equivalently fancy 20:27:17 Forthers don't generally like that kind of complexity 20:27:24 lol fair 20:27:37 and anyways, how in hell are you supposed to do comparison against constants even that way 20:27:47 tabemann: I wouldn't next lots of if/else/thens either 20:27:58 that's what I was wondering :) 20:28:20 What were you wondering? 20:28:36 how it'd even work to do comparisons 20:28:56 I don't get the question 20:29:18 I think remexre was wondering if we were doing some kind of fancy optimization for them 20:29:47 Some Forths do I think, but most don't 20:30:09 If you want a jump table, just code a jump table is the philosophy 20:30:54 okay, makes sense 20:31:01 the thing is implementing a jump table is easier if your code is represented as an AST... but Forth really doesn't use ASTs 20:31:22 Many Forths do simple peephole optimizations, constant folding and the like 20:31:55 tabemann: why would that be by definition a jump table is just addresses 20:32:19 No AST required, just like in assembly 20:32:46 --- join: gravicappa (~gravicapp@h109-187-8-54.dyn.bashtel.ru) joined #forth 20:33:09 rdrop-exit: because you'd have to allocate the space for the jump table before you'd've parsed the entire CASE/OF/ENDOF/ENDCASE; you can't know how many entries you'll need before you've parsed the whole thing 20:33:40 unless you assume a maximum number of entries 20:33:53 and allocate the space for that number of entries ahead of time 20:34:08 or you do multiple compilation passes 20:34:22 Well the point was if you want a jump table you just code one, no parsing involved 20:34:42 it's like 2 lines of code 20:34:47 --- quit: dddddd (Remote host closed the connection) 20:35:26 well yes - if you really want a jump table you do create table ' foo , ' bar , ' baz , : jump cells table + @ execute ; 20:35:52 and not bother with CASE 20:37:29 CASE is kinda useless IMO 20:38:17 Just code what you need directly 20:39:21 the main places where I've used CASE is when parsing bytes read from standard input 20:39:34 where the bytes cover too much space to efficiently handle them with a jump table 20:39:57 and there are far too many of them for IF/ELSE/THEN to look anything but extremely ugly 20:40:22 I use a jump table for control-codes and command keys 20:40:28 (this was in my line editor) 20:41:33 I find if ... then; handles most of what I need when I wanted to do a series of checks and not use a jump table 20:42:31 For keymap type situations I use jump tables so I can easily change the behavior of keys on the fly 20:43:46 If I want to make a key value a delimiter I just replace its behavior with delimit 20:44:39 to me I'd find that a jump table would just complicate something - either each jump table, of which there must be more than one, is 256 entries in size - even though most of them would either be handled the same way or would not be handled at all - or extra logic needs to be written to exclude/special case ranges of characters to shrink the table size 20:45:24 Still the simplest and fastest way in most cases 20:45:30 and most flexible 20:45:32 in the end, to me, CASE/OF results in the neatest-looking code for handling this kind of stuff 20:46:13 I disagree in general 20:47:59 Is there a Forthful way to handle parsing e.g. PS/2 scancodes? 20:48:23 for each byte you get (from an interrupt), you're either waiting for more, or yielding a byte 20:48:39 the sequences are variable length up to 6 bytes 20:48:59 rn I've got a state-machine I wrote in asm (mainly for convenience of embedding the state table) 20:50:39 a state-machine is fine for this, you can code it to look so your code looks like a decision table 20:51:33 * tabemann just thought of a neat way to write a state-machine that reminds him of his functional coding 20:52:01 i.e each state is a word, and for each state transition you do r> drop ['] new-state >r exit 20:52:13 which you could easily make a compilation word for 20:52:57 wait 20:53:13 i.e each state is a word, and for each state transition you do r> drop ['] new-state execute 20:53:14 There's been a good number of articles on different approaches to coding state machines and decision tables in Forth 20:53:39 * tabemann is personally a fan of the tail call 20:53:57 Everybody has their favorite way, usually involves making the code look like a table 20:54:10 huh, ok, I'll look around then 21:08:35 Speaking of IF/ELSE/THEN I don't think I've used ELSE in years 21:09:26 I still have it, but the need for it doesn't really come up 21:10:43 It seems to get lost by the time I finalize the factoring of a set of words 21:12:42 OTOH I use ELSE very consistently 21:12:57 As someone posted here a while back, ELSE is often a sign of bad factoring 21:13:23 you're talking to a Haskeller, for whom if without else is meaningless 21:13:58 practically the only time I don't use ELSE if if I can eliminate an ELSE DROP THEN by using ?DUP 21:14:07 Haskell sounds like a bad influence 21:15:50 well, Haskell is a completely different paradigm from Forth - in Haskell, if it weren't for if/else and pattern matching/case, all expressions would either evaluate to a constant or would never return 21:16:24 when I say case, case in Haskell is not like CASE in Forth 21:17:35 As you said Haskell is a completely different paradigm from Forth, best not to bring its baggage to your Forth code 21:17:54 --- join: jedb (~jedb@103.57.72.31) joined #forth 21:20:33 some things, though, like forbidding ELSE, make no sense to me - e.g. I may have a BEGIN/UNTIL loop, and I want to have a test that results in two different outcomes, one of which exits the loop, one of which does not, each with their own extra handling too (so I can't just expose the value of a boolean expression to UNTIL directly) - should I make life harder for myself with no benefit? 21:21:30 None of that requires ELSE 21:22:36 yes, you can replace it with multiple iF/THENs in a row 21:22:44 but I don't see how that's a benefit 21:23:32 Don't forget you can make whatever control structure you need in Forth 21:24:42 You can extend a BEGIN loop with whatever conditional branchings to the top of the loop, or out of the loop you might require 21:26:43 a lot of times BEGIN/WHILE/REPEAT is sufficient, but those don't cover all the cases (e.g. to make that work one might have to put an IF/ELSE/THEN between BEGIN and WHILE 21:27:50 anyways, I need to get to bed - gotta get up early tomorrow - gotta start work early 21:28:04 But you can add loop related words to your Forth to handle any of those cases easily 21:28:47 Ciao tabemann 22:10:43 --- quit: proteusguy (Ping timeout: 272 seconds) 23:25:07 --- quit: jackdaniel (Remote host closed the connection) 23:27:25 --- join: jackdaniel (~jackdanie@hellsgate.pl) joined #forth 23:46:48 hi 23:52:04 --- quit: lchvdlch (Ping timeout: 245 seconds) 23:52:13 --- join: lchvdlch (~nestr0@191.98.151.137) joined #forth 23:59:10 --- join: proteusguy (~proteusgu@180.183.130.105) joined #forth 23:59:10 --- mode: ChanServ set +v proteusguy 23:59:59 --- log: ended forth/19.06.04