00:00:00 --- log: started forth/21.02.23 00:01:00 --- quit: nihilazo (Ping timeout: 264 seconds) 00:15:43 --- nick: fiddlerwoaroof_ -> fiddlerwoaroof 01:37:39 --- join: inode joined #forth 02:47:44 --- quit: remexre (Ping timeout: 256 seconds) 02:51:17 --- join: remexre joined #forth 03:38:07 --- quit: hosewiejacke (Ping timeout: 240 seconds) 03:45:47 --- join: hosewiejacke joined #forth 03:49:05 --- join: f-a joined #forth 04:21:47 --- quit: hosewiejacke (Read error: Connection reset by peer) 04:22:38 --- join: hosewiejacke joined #forth 04:36:57 --- quit: f-a (Quit: leaving) 04:37:33 --- join: f-a joined #forth 06:08:39 --- join: Zarutian_HTC1 joined #forth 06:08:39 --- quit: Zarutian_HTC (Read error: Connection reset by peer) 06:17:20 I am trying to write a toy forth in assembler 06:17:25 re: the dictionary 06:17:33 re: a single word in the dictionary 06:17:56 I understand that each entry has to contain: 06:18:00 - the name of the word itself 06:18:10 - a link to the previous word 06:18:23 my question is 06:18:43 should I also put a flag to highlight that the word is a primitive (i.e. assembler?) 06:19:15 otherwise I have difficulty getting how forth would understand the following address list 06:19:39 (i.e.: go there and execute (asm) or go there and execute (forth)) 06:19:44 gah, I am not sure I was clear 06:29:34 --- join: wineroots joined #forth 06:36:21 f-a, you could put a subroutine call in assembly at the beginning of the address list 06:36:43 and have the subroutine start executing the list of addresses found directly after the return address 06:36:48 mhhhhh 06:37:11 but also yes you can do it other ways 06:37:28 --- join: nihilazo joined #forth 06:42:02 --- quit: dave0 (Quit: dave's not here) 06:43:38 --- quit: Zarutian_HTC1 (Ping timeout: 240 seconds) 06:52:55 --- join: elioat joined #forth 07:06:57 --- quit: nihilazo (Quit: Gateway shutdown) 07:11:31 --- join: nihilazo joined #forth 07:17:34 --- quit: f-a (Quit: leaving) 07:17:50 --- join: f-a joined #forth 07:29:47 --- quit: hosewiejacke (Ping timeout: 240 seconds) 07:35:11 --- join: hosewiejacke joined #forth 07:42:28 --- quit: f-a (Quit: leaving) 08:05:48 --- quit: hosewiejacke (Ping timeout: 272 seconds) 08:10:29 ah f-a is gone, alas... 08:12:11 yeah was gonna link my docs, lol 08:54:48 --- join: f-a joined #forth 09:05:45 --- quit: elioat (Quit: elioat) 09:06:45 I'm confused at the ** word in chapter 6 of starting forth 09:06:56 it seems a lot more complex then it needs to be and I don't quite understand 09:07:27 there's the version on the web that uses tuck and some other things that aren't in the book so far, and the version in the PDF which just seems needlessyl complex, although that said I can't think of a simpler version 09:07:42 --- join: elioat joined #forth 09:07:46 I cannot find it 09:07:57 https://www.forth.com/starting-forth/6-forth-do-loops/ 09:10:40 which definition are you referring to, nihilazo 09:10:53 the one that is given as an answer to the problem 09:11:02 of writing ** 09:11:27 : ** ( n1 n2 -- n1**n2 ) 1 SWAP ?DUP IF 0 DO OVER * LOOP THEN NIP ; 09:11:35 I'm not sure how "nip" works 09:12:44 the version in the book uses rot and stuff 09:12:51 which I'm not sure why it should need 09:13:21 (I get what all these things are except nip, but I just feel like ** should be simpler than it is) 09:13:36 1 2 nip .s <1> 2 ok 09:13:58 pops the *second* element of the stack 09:14:33 ah ok 09:15:36 also ?dup is a nice shortcut, didn't really get why it was a word before but after writing "else drop then" a few times having ?dup is cool 09:15:47 yeah 09:16:10 is there any recommendation for how to format forth code over multiple lines? Like, a standard kind of style guide 09:16:48 no idea 09:16:58 but I have witnessed forth users are allergic to standards xD 09:17:38 one line gets messy and other than the "dup [condition] if [whatever] else \n" pattern idk if there is any way forth code is "meant" to be written on multiple lines 09:17:59 I've been putting starts of loops on their own lines and conditions on their own line with indenting the stuff inside them like with other languages but it looks odd 09:18:19 http://www.forth.org/forth_coding.html 09:18:21 apparently 09:22:52 huh ok 09:23:45 that seems designed to work with specific tools 09:23:53 I guess I'll just do what feels right 09:24:58 --- quit: jedb (Ping timeout: 272 seconds) 09:49:51 --- quit: gravicappa (Ping timeout: 256 seconds) 10:03:29 --- join: hosewiejacke joined #forth 10:05:21 --- quit: f-a (Quit: leaving) 10:05:37 --- join: f-a joined #forth 10:18:43 --- join: hosewiejacke2 joined #forth 10:20:42 --- quit: hosewiejacke (Ping timeout: 272 seconds) 10:26:26 --- join: Zarutian_HTC joined #forth 10:26:27 --- quit: hosewiejacke2 (Ping timeout: 240 seconds) 10:32:55 https://pastebin.com/BDxLGC55 my forth skills suck ;_; 10:34:44 this is exponentiation? 10:35:51 yeah 10:36:06 from starting forth book 10:36:23 personally I'd do a single loop that goes through the exponent (the b in a^b) and chomps off the lsb each time, taking advantage of the fact that a^b = a^(b&1) * (a^2)^(b >> 1) 10:36:31 and that might be cleaner, and should be more factorable 10:36:57 the book comes up with 10:36:59 1,1: ** ( n1 n2 -- n1**n2 ) 1 SWAP ?DUP IF 0 DO OVER * LOOP THEN NIP ; 10:37:06 (spoiler) 10:37:29 --- join: hosewiejacke2 joined #forth 10:37:53 ah 10:41:28 I was trying to do something with trying to leave the input number on the stack and then loop keeping another thing 10:41:36 y'know what I think my idea might work 10:41:37 idk 10:51:06 --- quit: Zarutian_HTC (Ping timeout: 256 seconds) 11:16:47 --- quit: hosewiejacke2 (Ping timeout: 240 seconds) 11:20:37 --- join: Zarutian_HTC joined #forth 11:50:07 --- quit: f-a (Ping timeout: 264 seconds) 11:52:00 --- join: f-a joined #forth 12:05:50 --- quit: elioat (Quit: elioat) 12:28:11 --- join: elioat joined #forth 13:12:24 --- quit: rann (Ping timeout: 264 seconds) 13:14:57 --- join: rann joined #forth 13:43:01 --- quit: elioat (Quit: elioat) 13:59:35 --- join: dave0 joined #forth 14:26:47 --- quit: xek (Ping timeout: 240 seconds) 14:39:36 --- quit: spoofer (Remote host closed the connection) 14:46:41 --- quit: phadthai (*.net *.split) 14:46:41 --- quit: bluekelp (*.net *.split) 14:49:19 --- join: phadthai joined #forth 14:49:19 --- join: bluekelp joined #forth 14:52:28 --- join: spoofer joined #forth 15:32:08 --- join: elioat joined #forth 15:47:39 --- quit: f-a (Read error: Connection reset by peer) 15:48:25 I think the point of the book example is more about how loops work rather than an efficient exponentiation 15:51:39 --- join: f-a joined #forth 16:15:40 nihilazo: This is roughly how I write forth over multiple lines https://pastebin.com/raw/1GUvETZg 16:16:12 And yes you're right there is no 'standard' way, but if you look at people's code you'll definitely see some idioms 16:18:35 ah, the stack contents under the instructions, nice tough 16:18:37 *touch 16:19:10 Also f-a and nihilazo, try writing Forth on paper if you feel like the stack is getting too much 16:19:40 Just a weird thing I noticed that sometimes it was easier to write Forth on paper when I was new to it 16:21:30 And not every word can be as elegant as : WASHER WASH SPIN RINSE SPIN ; 17:12:31 f-a: I can't speak for every forther but I personally have to refactor and rewrite words often to get reasonable stack flow 17:12:48 Sometimes writing forth feels a bit like trying to optimise register usage in assembly 17:13:07 I'm just going to leave this here https://pastebin.com/raw/bCPuM5sT 17:13:07 assembly is the demented little brother of forth 17:14:06 I tried using r> >r but I think I did it with do and so screwed shit up? 17:14:33 Yes, DO leaves its loop control on return stack, so you can't use previously stashed stuff 17:15:52 Can probably factor what I've written for repeated squaring 17:33:19 --- quit: elioat (Quit: elioat) 17:34:58 Okay this is a bit better IMO https://pastebin.com/raw/b5fBA5er 17:36:40 rshift is…? 17:38:21 rightwards bitshift 17:39:41 I can't use 2/ because that preserves the highest bit 17:46:30 --- join: jedb_ joined #forth 17:47:59 --- quit: f-a (Read error: Connection reset by peer) 17:51:41 --- join: f-a joined #forth 18:07:56 --- nick: kiedtl\x1b -> kiedtl 18:08:10 --- nick: kiedtl -> kiedtl\0 18:31:27 --- join: boru` joined #forth 18:31:33 --- quit: boru (Disconnected by services) 18:31:38 --- nick: boru` -> boru 19:00:58 --- nick: ornxka_ -> ornxka 19:13:08 --- quit: f-a (Quit: leaving) 19:19:38 --- quit: dave0 (Ping timeout: 240 seconds) 19:20:32 --- quit: lispmacs (Ping timeout: 256 seconds) 20:06:32 --- join: gravicappa joined #forth 20:42:21 --- join: X-Scale` joined #forth 20:43:22 --- quit: X-Scale (Ping timeout: 260 seconds) 20:43:23 --- nick: X-Scale` -> X-Scale 20:52:46 --- quit: sts-q (Ping timeout: 272 seconds) 21:07:34 --- join: sts-q joined #forth 22:55:48 --- join: dave0 joined #forth 23:10:23 veltas, I like your code style. Mine is quite vertical as well. 23:24:23 --- join: xek joined #forth 23:30:30 --- quit: xek (Remote host closed the connection) 23:35:00 --- join: xek joined #forth 23:59:59 --- log: ended forth/21.02.23