2025-08-22 10:47:02 CREATE SCAN-CHAR 0 C, : SCAN ( addr1 u1 -- addr2 u2 ? ) SCAN-CHAR C! SCAN-CHAR 1 SEARCH ; 2025-08-22 10:47:24 Another way to do this, if SEARCH is going to be defined anyway 2025-08-22 10:48:25 ( addr1 u1 c -- addr2 u2 ? ) that should be 2025-08-22 10:50:31 Or if you can take address of return stack : SCAN ( addr1 u1 c -- addr2 u2 ? ) >R RP@ 1 SEARCH RDROP ; 2025-08-22 11:08:37 And also assuming you're a little endian kind of person 2025-08-22 12:19:15 olle: I think of declarative ↔ imperative as being opposite directions along an axis, not positions on it 2025-08-22 15:21:30 You know I've noticed a pattern in my embedded coding that goes from doing everything in a very imperative way, until I understand the problem really well and it gets a highly declarative refactor 2025-08-22 15:21:45 Or moderately declarative anyway 2025-08-22 15:22:31 Because eventually I'm conscious of the 'parameters' in their simplest form, and would rather just keep the imperative part as short as possible, as that's where most of the bugs lie 2025-08-22 15:22:40 Provided the declarative part is correct and easy to maintain 2025-08-22 15:23:54 The better I understand a problem the more declarative I like the code to be, for C that mostly looks like me using a lot of tables that fully or 90% specify the problem, and not having too much actual executable code handle it all. 2025-08-22 15:24:15 In Forth I guess that involves a lot of tables or arrays, and using DOES> words more 2025-08-22 15:36:08 Hello, is this the place to ask if I can't get to compile gforth, or is there a better channel for that? 2025-08-22 15:37:13 veltas: using claude, it did give me working word (after one broken implementation), see http://forth.works/temp/ai-forth-1.txt 2025-08-22 15:39:32 swampman`: I don't think any gforth devs are here, best way to reach them would probably be the mailing list at https://lists.gnu.org/mailman/listinfo/gforth or the comp.lang.forth newsgroup 2025-08-22 15:40:44 Thanks, I'll ask them there then. 2025-08-22 15:44:14 I've never had much luck getting gforth to compile from source :( 2025-08-22 15:46:07 Well, maybe I got another question though. Suppose I want to use pforth for my program, is there an equivalent to open-dir/close-dir like the one in gforth, but in pforth instead? Whenever I try to use those in pforth, it says the word is undefined, but in gforth it's available. So my questions would be: 1) Is it really a gforth-only feature or can I use it in pforth (or other implmentations for that matter) too? 2) What would be the 2025-08-22 15:46:08 alternative if those are actually only available in gforth? 2025-08-22 15:46:16 Sorry for the textwall, btw. 2025-08-22 15:49:13 My guess would be that open-dir and close-dir are part of the standard, however, pforth hasn't gotten around to implement it, unlike gforth. 2025-08-22 15:49:13 open-dir isn't a standard word, and looks to be a wrapper over opendir(3) from libc 2025-08-22 15:49:55 Ah, okay. 2025-08-22 15:51:20 So, is there any other way to iterate through a directory in Forth without using open-dir, or rather using only standard words? 2025-08-22 15:54:08 not that I'm aware of; the file access words in ANS don't include anything for directories 2025-08-22 15:54:58 Hmm. 2025-08-22 15:55:27 file access is an optional part of ANS, http://maschenwerk.de/DPANS/dpans11.htm 2025-08-22 15:56:55 http://maschenwerk.de/DPANS/dpansa11.htm#A.11 2025-08-22 16:30:30 forthBot: LOAD ini.fth 2025-08-22 16:30:30 File ini.fth with MOON loaded 2025-08-22 16:30:36 forthBot: MOON 2025-08-22 16:30:36 Phase de la lune pour Fri August 22 2025 2025-08-22 16:30:36 🌘 Croissant descendant La lune s'efface, une nuit calme a venir ! Illumination 0% 2025-08-22 16:40:08 swampman`: You can ask for help with gforth here 2025-08-22 16:40:30 I'm the unofficial gforth IRC support desk because I'm always answering questions on here about it 2025-08-22 16:41:02 The main advice I give, which sounds like it will apply to you, is it helps to install e.g. gforth 0.7.3 either from your package manager or by building from source first, and install that 2025-08-22 16:41:13 Because later gforth source needs gforth installed in order to build 2025-08-22 16:42:31 The easiest way to open a directory in pforth is probably to add the relevant POSIX directory functions yourself, pForth is written in C so it should be easy to add other C functions 2025-08-22 16:44:25 e.g. opendir() 2025-08-22 16:46:18 The gist of my problem is that it seems like I need some kind of gforth already installed just to compile gforth. I'm on Alpine Linux, which doesn't have gforth in its repositories. It complains about there being no gforth in the path while configuring. I already tried it with "alias gforth=pforth", which expected to fail, as it did. Then I attempted running all kinds of flags, like described on Stackoverflow by a guy with a similar 2025-08-22 16:46:19 issue. I suppose there has to be a way to compile gforth without gforth, otherwise source-based distros and BSD ports could get it, but I haven't figured it out yet. 2025-08-22 16:46:44 *could -> couldn't 2025-08-22 16:47:04 Build gforth 0.7.3 from source 2025-08-22 16:47:13 And install 2025-08-22 16:47:32 And then you should be able to build a new snapshot / master 2025-08-22 16:48:14 pForth's design philosophy is to rely only on standard ANSI C, and ANSI C has no function for enumerating directories, just for creating/renaming/deleting files. 2025-08-22 16:50:17 This is relevant for pForth using custom C functions: https://github.com/philburk/pforth/blob/master/csrc/pfcustom.c 2025-08-22 16:52:17 crc: Thanks for running through claude 2025-08-22 16:52:30 veltas: no problem 2025-08-22 16:52:32 Interesting, so it got the result after being given the error 2025-08-22 16:54:00 I've found claude to be particularly helpful for non-forth stuff, and better for the few forth things I've tried than chatgpt or gemini 2025-08-22 16:57:54 I've been doing a large python project at work, and it's been *very* useful there 2025-08-22 17:00:15 I've asked ChatGPT to "really think about it" so I'll see what it gets 2025-08-22 17:01:08 Clearly a very powerful tool 2025-08-22 17:01:13 try grok 2025-08-22 17:01:38 I really hate Python but it's the sort of thing I can imagine LLMs shine at 2025-08-22 17:02:26 pforth is fun. I last ran it in 2010, but also tried to get it running during a board bring up project last year. I couldn't get it integrated into my team's CMake build system because CMake is terrible, so I gave up on that side project. 2025-08-22 17:02:46 forthBot: S" Un gros python multicolore dans une forêt enchantée "S IMAGE 2025-08-22 17:03:02 https://i.ibb.co/jZ5BjppS/mforth-image-x-Toiaz.png 2025-08-22 17:03:13 remcycles: Sounds like the issue is CMake 2025-08-22 17:03:48 100% CMake. If it was done in plain Makefiles I would have had it running. 2025-08-22 17:04:12 I really hate sawing a 2x4 with a dull blade, but that's something a 800 pounds gorilla must be pretty good at. 2025-08-22 17:05:44 ChatGPT's answer is full of issues, and yet the code is also much closer to what I wrote than copilot or claude 2025-08-22 17:07:44 Ah ChatGPT is trying to use the return stack inside a do loop, rookie mistake 2025-08-22 17:08:27 I don't know why the standard doesn't mandate that J and J' access the first and second return stack items outside the loop frame, but it doesn't 2025-08-22 17:09:40 It has the OVER I + C@ R@ which is almost verbatim what I wrote, but with R@ instead of OVER 2025-08-22 17:10:02 And uses OVER which makes no sense as depth is 1 there 2025-08-22 17:10:11 It's so close 2025-08-22 17:12:14 Okay after pointing out the return-stack / do-loop issue and the incorrect use of OVER, it's come up with pretty good code that's basically what I wrote 2025-08-22 17:14:43 But it starts with ROT SWAP ROT and documents this as \ addr u ch -> addr ch u 2025-08-22 17:15:18 I might prompt "is there an easier way to do the first line that does addr u ch -> addr ch u" 2025-08-22 17:17:31 Wow that's really confused it, it's now suggesting >R SWAP R> 2025-08-22 17:17:47 It's like it doesn't understand the stack notation order 2025-08-22 17:18:12 Because it doesn't understand anything. 2025-08-22 17:18:13 Rant: LLMs are the antithesis of Forth's ideals. Bloated resource hogs that attempt to solve a problem in the most roundabout way possible using an implementation that no one understands or can extend easily. 2025-08-22 17:18:35 You're definitely right about that, 100% 2025-08-22 17:19:24 It's also true about a whole load of stuff that's in my life and I can't really easily change right now, but still valid, and I am interested in what we can do to reverse the tide of useless bloat ruining everything and wasting our energy resources 2025-08-22 17:20:27 Not to criticize your attempts to use it, of course. I'm just overwhelmed by the endless AI hype cycle and ready for the next AI winter (if any). 2025-08-22 17:20:46 AI is not only an insult to life itself, but Forth too. 2025-08-22 17:21:37 Hayao Miyazaki 2025-08-22 17:22:41 That's been my favorite quote this year, but it's actually quite old now. Before this current GPT wave. 2025-08-22 17:25:29 ChatGPT is finally at exactly the code I had after pointing out a number of strange stack issues 2025-08-22 17:26:46 Definitely agree that reducing bloat is a good goal. There's a lot of bloat even in the field of embedded systems. Too bad efficiency isn't a more widely shared value. 2025-08-22 17:27:26 I use an LLM for some work things, to save me considerable typing. My personal stuff is all 100% handcrafted code. 2025-08-22 17:31:19 We had a survey at work about how we use or could use AI. I quoted Miyazaki in my response. I'm boycotting AI and hope I'm never asked to use it at work. 2025-08-22 17:33:33 for me, a factor is ongoing severe rsi issues. I'll use tools to help mitigate that, even if they aren't ideal 2025-08-22 17:34:57 That's understandable. 2025-08-22 17:35:01 I generally discourage use of LLM tools unless there's an actual use case 2025-08-22 17:35:17 and then try to keep the use to the minimum required 2025-08-22 17:35:52 ACTION is looking at possibly setting up something in-house for this in the future 2025-08-22 19:03:02 Environment for cleobuline inactive, freeing... 2025-08-22 19:19:43 veltas: I did manage to compile gforth the way you said (as in I downloaded the 0.7.3 version and compiled that instead). Do you know what to do when gforth complains about not being able to "open image file gforth in path .:"? 2025-08-22 19:20:00 *gforth.fi 2025-08-22 19:20:12 That's the name of the image or whatever. 2025-08-22 19:25:25 It seems like gforth seems to work if I execute it from the compilation directory. Maybe some files are missing when I did the make clean install. 2025-08-22 19:25:30 I don't know. 2025-08-22 19:29:32 https://ghostbin.lain.la/paste/v3hc5 2025-08-22 19:29:37 This is the full error. 2025-08-22 20:29:47 Nevermind, it works now. 2025-08-22 20:32:19 crcx: made with the help of grok https://github.com/cleobuline/forth-bot-gmp-irc-threaded-multi-users 2025-08-22 20:37:34 cleobuline: my bots were written by hand, using a non-traditional set of tools written entirely in retroforth, running in a chroot over openbsd