2024-07-22 02:02:26 lf94: I appreciate anything that goes beyond the 1 2 + . demo of forth. The Sam Falvo posted by Andreas Wagner on YT is a stand-out in that regard. 2024-07-22 02:03:06 I think microcontroller applications are the most interesting use-case, though. 2024-07-22 03:32:05 Love Forth on embedded systems. It's like what it was born for. 2024-07-22 10:58:27 I agree with traveler, anything is better than nothing, there's not a ton of content 2024-07-22 10:58:51 Streaming might be good too, there are lots of coding streamers but no Forth streamers I don't think 2024-07-22 10:59:13 Literally anything though, please submit in here and I will check it out 2024-07-22 14:59:22 who tf wants to sit there and watch somebody else program in real time? i never understood that. 2024-07-22 14:59:31 gen z, man 2024-07-22 15:01:45 Gen Z didn't start that trend 2024-07-22 15:02:02 It's the sort of thing you half-watch for a little and then maybe have in the background for company 2024-07-22 15:59:22 I should start making coding reaction videos 2024-07-22 16:00:18 char *foo = malloc( /cut/ I know what you're thinking... are they going to remember to free it? Let's find out /cut/ 2024-07-22 16:00:58 free(foo); *type type* important_func(*foo) /cut/ OMGGGGGGGGGGGGGGGGGG 2024-07-22 16:01:19 tiktok sensation, guaranteed 2024-07-22 18:18:26 can someone give me an example of how to use >number? (I am trying to read a number from the input, and am considering that or to write my own word instead) 2024-07-22 18:24:08 If you do NUMBER from scratch, it gets fairly involved. Particularly if you are doing something with the decimal point. Basically you have to notice and "remember" the possible - sign at the beginning, do an unsigned conversion of the number, and then negate it if that - was present. I do it as a state machine, but mine's extra fancy and will permit base specification via : 2024-07-22 18:25:08 0 0 s" 123" >number 2024-07-22 18:25:18 However you handle alternate bases, once you're beyond base 10 conversion of ascii digits to digit "values" requires some minor hoop jumping - you have to know to skip over the characters between 9 and A. 2024-07-22 18:25:49 To convert 0-9 to a value, just subtract 48. But for A and above, you have to subtract a bit more. 2024-07-22 18:27:06 opinion on base markers like 0x 0b 0o and 0q ? 2024-07-22 18:28:06 i use a generic radix prefix notation. 8#123 for octal, for example 2024-07-22 18:28:58 and just to be difficult, my default base is hex. so if you want to write a number in decimal, you have to write a#123 2024-07-22 18:29:55 i also allow commas in numbers so it's a little nicer on the eyes to write bitmasks in binary: 2#0000,1000,0011,0101 2024-07-22 18:30:42 I use _ underscores as verilog and vhdl does 2024-07-22 18:31:49 those languages have to use an underscore because the comma is a token. i figured, forth isn't limited by that, so why not embrace it? 2024-07-22 18:31:58 KipIngram: What I had in mind was just to read in natural numbers, so the main problem would be overflowing (then again, I am just playing around so it isn't that important) 2024-07-22 18:32:30 because in Iceland and other nordic a comma is the decimal 'point' 2024-07-22 18:32:48 GeDaMo: Thanks, that works with strings, now I just have to combine it with accept. 2024-07-22 18:32:59 Ah. That spares you putzing with the - sign, then. 2024-07-22 18:33:03 And any other frills. 2024-07-22 18:33:07 Commas are quite Anglo-centric. Many other countries switch , and . (so . is the separator and , is the decimal point). 2024-07-22 18:33:09 there are no countries other than the US 2024-07-22 18:33:12 comma in numbers then just looks wierd to me 2024-07-22 18:33:54 zelgomer: United Soviets of America? 2024-07-22 18:33:56 If you're going strictly base 10 it should be a pretty easy affair. For overflow I'd just check before adding or multiplying by 10 that my result wouldn't overflow. 2024-07-22 18:34:02 (And in some places, the comma is a scale separator, but not in thousands). 2024-07-22 18:34:07 so when you write c, does it bother you that you have to use , to separate arguments and . to write floats? 2024-07-22 18:35:11 I.e., when it's time to multiply by 10 make sure your number so far is less than 6554. 2024-07-22 18:35:26 Personally I don't worry about overflow. 2024-07-22 18:35:38 I expect myself to know what I'm doing when I use it later. 2024-07-22 18:39:50 KipIngram: Is just trying to multiply a safe way to check an overflow in forth? 2024-07-22 19:16:04 I've never used a system that checks for overflow on arithmetic operations. 2024-07-22 19:16:35 The ones I've used basically just do mod 2^N math and leave it at that. 2024-07-22 19:20:46 common lisp and scheme do. They transparently upgrade to bignums 2024-07-22 19:21:04 so it's never incorrect, your program just gets mysteriously slower 2024-07-22 19:24:30 So does Python. 2024-07-22 19:33:17 I though Python is always bignums 2024-07-22 19:35:04 my forth can do math operations by wrapping (like C), by saturating, and by throwing error on overflow 2024-07-22 19:35:31 e.g. 1 1 + <-wrappng 1 1 +s <-saturating 1 1 +o <-overflow 2024-07-22 19:35:47 makes sense 2024-07-22 19:35:52 :) 2024-07-22 19:44:08 I ended up with this definition https://0x0.st/XpjY.f, but was wondering if there was some way I could allocate the memory on the stack (something like auto char buffer[80]; in C) and discard it? 2024-07-22 19:46:54 Could you use the pad area for that? 2024-07-22 19:49:52 pad area? 2024-07-22 19:50:49 https://forth-standard.org/standard/core/PAD 2024-07-22 19:51:30 "The size of the scratch area whose address is returned by PAD shall be at least 84 characters." https://forth-standard.org/standard/usage#usage:transient 2024-07-22 20:00:58 ah, very useful! thanks! 2024-07-22 20:12:06 now I have https://0x0.st/Xpjh.f, but I wonder if there is a better way to express the last line? thinking in lisp, I'd maybe write a macro that takes a list of symbols and numbers indicating how to re-order the stack. 2024-07-22 20:13:01 There's a 2drop 2024-07-22 20:15:12 perhaps `2drop drop nip` 2024-07-22 20:15:19 Are you just dropping the value left by accept? You could drop that there 2024-07-22 20:16:36 You could use D>S to go from a double cell value ot a single 2024-07-22 20:24:07 ah, I forgot about the other value by accept, dropping that right away is certainly cleaner 2024-07-22 20:24:34 or actually I can pass that directly to >number