2025-05-19 00:02:29 What are you trying to do? 2025-05-19 00:03:01 Multiply 32-bit numbers? 2025-05-19 00:04:35 You can define M*/ using M* and M/ although I don't fancy trying right now, I did do it once 2025-05-19 00:04:41 I think it might be defined that way in gforth 2025-05-19 00:06:42 https://termbin.com/wnzh 2025-05-19 00:06:57 m*/ operated with doubles right? 2025-05-19 00:08:04 https://git.savannah.gnu.org/cgit/gforth.git/tree/extend.fs#n48 2025-05-19 00:10:52 under pforth 2025-05-19 00:10:52 65536. 2 1 m*/ d. 131072 ok 2025-05-19 00:11:18 Looks like gforth doesn't have D* 2025-05-19 00:12:01 also just in case 2025-05-19 00:12:03 4294967295. 2 1 m*/ d. 8589934590 ok 2025-05-19 00:12:28 no m*/ at eforth :| 2025-05-19 00:12:45 pforth runs under 32 bit 2025-05-19 00:12:59 -1 u. 4294967295 ok 2025-05-19 00:14:13 If you see the link I posted it has a definition of M*/ which you should have most or all of the words in eforth for 2025-05-19 00:14:33 bonsoir 2025-05-19 00:16:07 another non-gforth source? 2025-05-19 00:16:56 Sorry? 2025-05-19 00:17:21 me too 2025-05-19 00:20:09 heh https://www.forth.org/fd/FD-V07N5.pdf 2025-05-19 00:23:11 forthBot: 1 127 << . 2025-05-19 00:23:11 170141183460469231731687303715884105728 2025-05-19 00:24:11 forthBot: SEE << 2025-05-19 00:24:12 : << << ; 2025-05-19 00:24:23 haha 2025-05-19 00:26:15 forthBot needs no floats then 2025-05-19 00:28:04 forthBot: 170141183460469231731687303715884105728 NUM-TO-BIN CR 2025-05-19 00:28:05 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 2025-05-19 00:28:22 :) 2025-05-19 00:29:06 cleobuline: https://en.wikipedia.org/wiki/Schizophrenic_number 2025-05-19 00:29:44 I did that once in lisp but I woudn't be able to do yet in forth 2025-05-19 00:29:55 anthk_: I found this in my files https://termbin.com/3o2q 2025-05-19 00:30:55 If you want a non-gforth implementation 2025-05-19 00:31:47 :-) 2025-05-19 00:32:04 i will try 2025-05-19 00:32:50 uhm 2025-05-19 00:32:50 65536. pi* d. 2025-05-19 00:32:51 205887 ok 2025-05-19 00:33:48 : pi* 355 113 m*/ ( n -- n * pi ) ; 2025-05-19 00:33:56 I have to practice more with forth and then find a forth junior job 2025-05-19 00:34:24 I'd be amazed if anyone found any Forth jobs out there 2025-05-19 00:34:38 stop destroying my dreams 2025-05-19 00:34:58 soon we will need Forth back 2025-05-19 00:35:14 small computers, EMP/low power resistant 2025-05-19 00:35:14 Well if you have a job where any language will do, and nobody will review/maintain your code apart from you, you can use Forth 2025-05-19 00:35:16 you mean collapseOS? 2025-05-19 00:35:20 Or use Forth on throwaway stuff 2025-05-19 00:35:38 not so bad, but we had a blackout in Spain a few weeks ago 2025-05-19 00:35:46 I used Forth at work to do a simple job in a script that nobody else will ever see 2025-05-19 00:35:57 I'm spanish too lol 2025-05-19 00:36:01 FM radio worked, but computers had to be either 5V phones, or stuff like hospitals and cell towers with generators 2025-05-19 00:36:02 from bcn 2025-05-19 00:36:16 vms14: just run whois 2025-05-19 00:36:28 ah, not from the unix server I'm ssh at 2025-05-19 00:36:28 :| 2025-05-19 00:36:33 well, basque countr 2025-05-19 00:37:38 in the blackout gopher and gemini protocols worked. TLS is complex, but gopher and IRC, once you have sockets supports, it's a dumb exercise 2025-05-19 00:38:04 gforth has sockets, but I think pforth doesn't have them 2025-05-19 00:38:14 (networking ones, not local unix) 2025-05-19 00:38:49 pi* is a cool definition 2025-05-19 00:38:53 I like that 2025-05-19 00:38:56 veltas: I'm lazy 2025-05-19 00:39:18 I came from Unix philosophy, keep it simple, stupoid; 2025-05-19 00:39:35 You could also define PI as a fraction e.g. 355 113 2CONSTANT PI 65536. PI M*/ D. 2025-05-19 00:40:23 Forth is definitely part of the 'keep it simple' ecosystem 2025-05-19 00:42:07 some have done complicated things on top of unix 2025-05-19 00:44:24 The stuff that I consider 'UNIX' is very very dead, and for good reasons 2025-05-19 00:47:23 One of the most 'alive' things about UNIX is C 2025-05-19 00:58:54 there is a way to avoid pick? 2025-05-19 00:58:57 : l ( a b c -- a a b c ) 2 pick -rot ; 2025-05-19 00:59:08 I'm making the exercises of the book 2025-05-19 00:59:40 it says you should use as few words as possible 2025-05-19 01:05:54 oh the site gedamo gave me gives solutions 2025-05-19 01:05:56 http://www.sovietov.com/app/forthwiz.html 2025-05-19 01:06:09 rot dup 2swap 2025-05-19 01:06:19 never thought of 2swap 2025-05-19 01:09:29 that tool is kind of amazing 2025-05-19 01:09:50 it can give you several different solutions, I wonder how it is implemented 2025-05-19 01:16:08 the last one was cool 2025-05-19 01:16:11 : n ( a b c -- a a b b c c ) rot dup 2swap 2dup rot ; 2025-05-19 01:16:28 I should actually practice more like that 2025-05-19 01:17:01 https://paste.c-net.org/StripesPlanner 2025-05-19 01:18:06 and that site is giving me the same answer for the n so I did it right 2025-05-19 01:18:19 although I would never thought of swap2 if it weren't for that site 2025-05-19 01:18:25 2swap* 2025-05-19 01:19:04 pforth can show the builtings of some operations 2025-05-19 01:19:09 with help and see 2025-05-19 01:19:40 with 2025-05-19 01:19:41 S" HELP" ENVIRONMENT? 2025-05-19 01:20:02 from 'help nip; 2025-05-19 01:20:03 ' 2025-05-19 01:20:03 * drop the value under the top of stack, inverse of => TUCK 2025-05-19 01:20:04 simulate: : NIP SWAP DROP ; 2025-05-19 01:22:13 the exercises were cool 2025-05-19 01:23:20 I guess I should try more of the style of the last one 2025-05-19 01:23:58 the book says you cannot master forth without mastering the stack, which I believe to be true 2025-05-19 01:51:13 this forth might be closer to forth79 https://github.com/howerj/libforth 2025-05-19 02:24:11 Environment for anthk_ inactive, freeing... 2025-05-19 02:28:05 Environment for cleobuline inactive, freeing... 2025-05-19 12:39:46 anthk_ that libforth seems cool 2025-05-19 12:39:51 https://raw.githubusercontent.com/howerj/libforth/refs/heads/master/libforth.c 2025-05-19 12:40:00 it has a lot of comments explaining everything 2025-05-19 13:35:01 vms14: I'd suggest F83 and GForth as exemplary 2025-05-19 13:36:58 vms14: you can create code words in assembly in the repl in DEBUG.COM 2025-05-19 13:37:55 also it turns out that a lot of old operating systems had this functionality 2025-05-19 13:38:17 RT-11, the DEC 10/50 monitor, ITS, TENEX 2025-05-19 13:39:12 most of the time it doesn't mean the REPL is about to crash, and crashes aren't scary, just annoying 2025-05-19 13:40:08 veltas: generally the difference between 0/1 and -1/0 is just an inc or dec 2025-05-19 13:43:21 I assume the reason for using -1 for true was so that you don't need separate bitwise and Boolean not 2025-05-19 13:45:28 21:37 < veltas> Very few embedded controllers are as simple to control GPIO as setting some addresses to 1 or 0, or -1 and 0. 2025-05-19 13:46:35 well, STM32's "bit banding" gives you an area of the memory map where each byte is a hardware alias for a single bit 2025-05-19 13:46:45 and I think it covers the GPIO space 2025-05-19 13:47:36 so you ought to be able to on and off GPIO bits there? I forget if other ARM microcontrollers (other than the abundant STM32 clones) support bit-banding 2025-05-19 13:49:15 you could make things like led on work polymorphically with double dispatch: : on 1 swap execute ; : off 0 swap execute ; 2025-05-19 14:03:57 sorry, bit-banding maps each bit to a *word*: https://developer.arm.com/documentation/100166/0001/Programmers-Model/Bit-banding/About-bit-banding 2025-05-19 14:04:09 and it's not STM32-specific 2025-05-19 14:11:25 https://github.com/ForthHub/F83 2025-05-19 14:12:03 yeah, that F83 2025-05-19 14:22:40 vms14: no doubles on libforth I guess 2025-05-19 14:26:03 you could add them I guess 2025-05-19 14:26:16 I would like a forth implementation that I could mess with 2025-05-19 14:26:27 but I guess the best option is to make your own 2025-05-19 14:27:00 I think the best option is GForth 2025-05-19 14:27:01 I want to play with xlib in forth 2025-05-19 14:27:19 I haven't tried doing xlib in it tho 2025-05-19 14:27:24 xentrac I do not know how to add -I flags and the others, only the -l with add-lib 2025-05-19 14:27:26 maybe that would change my mind 2025-05-19 14:28:01 an option could be making some object file or alike, but it's sad 2025-05-19 14:28:52 I added curses bindings, but making some simple wm in forth or just creating windows should be fun 2025-05-19 14:29:14 https://paste.c-net.org/ShamefulSquirm 2025-05-19 14:29:21 those are the curses bindings 2025-05-19 14:29:36 vms14: -I /usr/include or -I /usr/local/include or -I /usr/X11R6/include 2025-05-19 14:29:49 I know 2025-05-19 14:30:00 now how do I add those flags in gforth's c bindings 2025-05-19 14:30:54 it uses libtool to create them 2025-05-19 14:30:54 so maybe I could learn how libtool works and add them 2025-05-19 14:31:04 but it's weird that it only provides add-lib for the -l flags 2025-05-19 14:31:41 on eforth, the words from yesterday didn't fully work 2025-05-19 14:41:06 I see a wm in forth :0 2025-05-19 14:41:07 https://www.reddit.com/r/Forth/comments/11bm4ka/ann_swapwm_was_dupwm_a_minimalistic_window/ 2025-05-19 14:41:15 veltas: yeah, that'll be awesome! 2025-05-19 14:42:40 I mean vms14! 2025-05-19 14:44:41 but it's in a forth called fox 2025-05-19 14:44:49 there is also bigforth + minos 2025-05-19 14:45:11 https://bernd-paysan.de/bigforth.html 2025-05-19 14:49:15 this is a bit interesting I guess 2025-05-19 14:49:16 https://github.com/Jos-Ven/A-smart-home-in-Forth/ 2025-05-19 14:49:23 it uses a server and runs in gforth 2025-05-19 14:52:24 I like Bigforth but I think he may have stopped working on it 2025-05-19 14:55:21 bigforth was created by some Enlightenment user maybe 2025-05-19 14:55:22 I just wanted to have fun while learning forth :/ 2025-05-19 14:56:17 if I try to make my own will be in perl or js which do not have memory and then I will refuse to fake it with arrays 2025-05-19 14:56:33 vms14: use eforth and muxleq 2025-05-19 14:56:39 but if I refuse then I will just create a different thing 2025-05-19 14:57:07 I was taking a look at it 2025-05-19 14:57:08 https://github.com/chochain/eforth 2025-05-19 15:01:07 vms14: that's the one for arduino 2025-05-19 15:01:18 the one for muxleq it's https://github.com/howerj/muxleq 2025-05-19 15:02:19 after compiling muxleq, edit muxleq.fth and enable floats at constant opt.float 2025-05-19 15:02:24 set it to 1 at the file 2025-05-19 15:02:47 among the 1 constant opt.better-see and opt.control contants 2025-05-19 15:03:03 then to create a new subleq image: ./muxleq ./muxleq.dec < muxleq.fth > new.dec 2025-05-19 15:03:27 I miss m*/ but I might implement it *correctly* one day 2025-05-19 15:06:22 Did you try my M*/ ? 2025-05-19 15:06:32 Or gforth's? 2025-05-19 15:09:28 yes, but didn't fully work I think 2025-05-19 15:09:37 does it work well with doubles? 2025-05-19 15:10:02 I need to check that m*/ again 2025-05-19 15:27:24 Which one? 2025-05-19 15:27:57 I don't know 100% if my one works, but I think gforth's should 2025-05-19 15:28:10 If you have a case that fails on mine tell me and I don't mind looking into it 2025-05-19 15:28:32 Bear in mind M*/ in standard doesn't support negative denominators 2025-05-19 15:49:34 ah, TIL 2025-05-19 15:50:52 not an issue by design 2025-05-19 15:51:56 eforth under subleq/muxleq it's nice once you add some missing stuff 2025-05-19 16:02:50 not much, I just miss m*/ 2025-05-19 16:04:22 well, on pforth -200000. 2 1 m*/ d. -400000 ok 2025-05-19 16:04:57 and not an issue for the denominator, I would reverse the parts 2025-05-19 16:05:01 by negating both 2025-05-19 16:07:46 uhm it has */mod 2025-05-19 16:11:39 so 2025-05-19 16:11:46 : */ */mod nip ; 2025-05-19 16:12:58 no doubles but */ was missing 2025-05-19 16:13:44 and I have no d* d/ neither, but if m*/ supported doubles it would be the best thing ever 2025-05-19 20:31:45 is this https://termbin.com/ajht a right approach? 2025-05-19 22:31:58 xentrac: I wouldn't claim that -1 as true is expensive, just more expensive than 1, and I've not profiled this exhaustively but it just seems to be so from writing e.g. x86 and Z80 Forth kernels 2025-05-19 22:32:41 I wouldn't be surprised if it's just a larger binary and no impact on performance in latest CPUs, and we're talking about optimising something that's sort of inherently slow now anyway ... the Forth stack model 2025-05-19 22:33:16 Not slow but just not the best way to talk about a CPU with a decent number of registers 2025-05-19 22:40:55 well on eforth: 50000. pi* d. 2025-05-19 22:40:55 157079 ok 2025-05-19 22:41:17 that with the code from https://termbin.com/ajht 2025-05-19 22:42:12 it should be um*/ and maybe ud* ud/ by definition 2025-05-19 22:43:19 on pfrth 2025-05-19 22:43:23 pforth 2025-05-19 22:43:24 -100.000 50 100 m*/ d. -50000 ok 2025-05-19 22:43:37 um/mod can do arbitrary length division 2025-05-19 22:43:40 on eforth, totally mangled 2025-05-19 22:43:53 mmm true, and nip 2025-05-19 22:43:55 or swap drop 2025-05-19 22:44:05 And D- 2025-05-19 22:44:16 And um* can do arbitrary length multiplication etc 2025-05-19 22:44:48 I find it interesting that in Forth these sorts of things are exposed, most languages have no way to do this 2025-05-19 22:45:17 But it's standard on pretty much all arch's now to provide mixed precision mul/div 2025-05-19 22:46:32 d*'s stack comment is wrong 2025-05-19 22:46:56 That would be ( d n -- d*n ) 2025-05-19 22:47:12 yes, I realized 2025-05-19 22:51:22 I have um/ 2025-05-19 22:54:37 veltas: yeah, the extra dec is definitely nonzeo expense 2025-05-19 22:55:35 wrt the Forth stack model, I think it's inherently slower for straight-line code but inherently faster for subroutine call and return 2025-05-19 22:55:44 True 2025-05-19 22:56:17 (on a machine with a decent number of registers, at least) 2025-05-19 23:02:24 This is one of the reasons I came back to Forth, was optimising my assembly code for size 2025-05-19 23:02:42 yeah, it's also good for size 2025-05-19 23:02:48 And it occurred to me that the most efficient way to pass things around was to leave them on the stack 2025-05-19 23:03:02 Even though that's not actually a common style for Forth 2025-05-19 23:03:28 isn't it? 2025-05-19 23:03:41 I mean specifically to leave stuff on stack after processing it 2025-05-19 23:03:58 oh, I see 2025-05-19 23:04:03 you're right 2025-05-19 23:04:12 It's less conventional to do that, although there's plenty of exceptions. Some dialects do this a lot though. 2025-05-19 23:04:38 It's faster and less memory to leave stuff on stack, but the rules quickly become convoluted 2025-05-19 23:05:06 smaller program size I mean 2025-05-19 23:05:08 so for example * + would leave the product and sum of the same two values on the stack? 2025-05-19 23:05:25 Could do 2025-05-19 23:05:53 Or in the 'accumulator' 2025-05-19 23:06:04 That's what an accumulator is for, after all 2025-05-19 23:06:18 Lots of ways to skin a cat 2025-05-19 23:07:08 it accumulates cat skins 2025-05-19 23:09:07 forthBot: LOAD "ini.fth" 2025-05-19 23:09:08 Fichier chargé 2025-05-19 23:09:13 forthBot: CAT 2025-05-19 23:09:13 /_/ 2025-05-19 23:09:14 ( o.o ) 2025-05-19 23:09:14 > ^ < 2025-05-19 23:10:21 forthBot: :D 2025-05-19 23:10:51 Unknown word: :D 2025-05-19 23:10:51 Unknown word: "test.fth" 2025-05-19 23:10:58 oh case sensitive 2025-05-19 23:11:01 skin concatenation 2025-05-19 23:12:10 Sorry vms14, it's 6-bit ASCII o' clock 2025-05-19 23:17:44 200.000 2 1 m*/ d. 2025-05-19 23:17:45 400000 ok 2025-05-19 23:18:26 unsigned stuff works, not with neg values 2025-05-19 23:18:44 at least under eforth 2025-05-19 23:18:46 pforth works 2025-05-19 23:24:53 vms14: all words in forthBot are capitalized 2025-05-19 23:25:35 forthBot: LOAD "ini.fth" 2025-05-19 23:25:35 Fichier chargé 2025-05-19 23:25:43 forthBot: :D 2025-05-19 23:25:53 forthBot: CR 2025-05-19 23:25:53 :D 2025-05-19 23:26:04 forthBot: :D CR 2025-05-19 23:26:04 :D 2025-05-19 23:27:49 forthBot: CREDIT 2025-05-19 23:27:49 Brought to you by Cleobuline https://github.com/cleobuline/forth-bot-gmp-irc-threaded-multi-users/tree/main Site https://labynet.fr 2025-05-19 23:28:17 well, pforth works great 2025-05-19 23:28:18 100.000 pi* pi/ d. 100000 ok 2025-05-19 23:28:57 : pi* 355 113 */ ; 2025-05-19 23:29:04 : pi/ 113 355 */ ; 2025-05-19 23:29:58 I'll keep eforth for niche stuff 2025-05-19 23:30:01 under subleq 2025-05-19 23:58:33 You might get -1 for free the same as 1 if you have a constant generator register