2026-05-27 01:51:53 Stalevar, someone's also made a dedicated RPN calculator application for the PicoCalc, if you want something that isn't Forth and is more like a traditional RPN calculator 2026-05-27 01:54:02 about the PicoCalc, the big thing is that you really should do a lot of research into what you can do with it before you should even consider getting it 2026-05-27 01:55:25 the software that comes with it is all rather dated and unsupported, I highly recommend replacing the Pico 1H it comes with with a Pimoroni Pico Plus 2W, and you should upgrade the firmware for the STM32 that controls the keyboard, backlight, and power when you assemble yours (if you get one) 2026-05-27 01:56:24 also, you have to be extremely careful when assembling it to avoid breaking the screen 2026-05-27 01:57:52 I would say the fragility of the screen is its #1 flaw, but if you assemble it once and keep it assembled from that point on I wouldn't worry about it past the initial assembly process 2026-05-27 02:01:59 about it being an investment... it of course isn't one in the securities sense (and I'm sure you didn't mean it that way either, despite xentrac's snark), but it's a good choice if you want an open-ended programmable device platform integrating a decent-resolution color screen and a keyboard 2026-05-27 02:02:42 one important note, though, is that Clockwork is slow about delivering products; I've heard a figure of about three months time recently from order to arrival 2026-05-27 02:02:53 for the PicoCalc that is 2026-05-27 02:03:03 the uConsole can take a good portion of a year, OTOH 2026-05-27 02:09:39 xentrac, but if I buy this thing I will have it. If not money will be slowly nibbled away by inflation 2026-05-27 02:11:40 tabemann, I mean, it kinda seems a bit expensive for the first glance. What is the bill of materials if you order parts yourself rather than buying the kit? 2026-05-27 02:11:59 3D printing the case is relatively cheap, maybe $10 2026-05-27 02:12:39 Like, I wanted to estimate if they are ripping people off with their prices or it's quite close to self-cost 2026-05-27 02:14:32 tabemann, also I am going to order it from aliexpress or similar, not from CWP, though it'll be more like $130 2026-05-27 02:14:56 Stalevar: yes, cash in fiat currencies is also a bad investment in many ways, but it is usually not as bad at preserving your capital as spending it on a calculator with low resale value 2026-05-27 02:15:46 So it's 1.4 (+40%) of ClockworkPi price 2026-05-27 02:15:55 But shipping is going to be about a week 2026-05-27 02:18:03 tabemann, I think forth is better than RPN calculator because it has RAM-limited data stack depth while calculators only have four registers 2026-05-27 02:18:52 For example you can make sieve of eratosthenes in Forth but can you in RPN calc for PicoCalc? 2026-05-27 02:19:01 my HP 48GX calculator also had RAM-limited stack depth 2026-05-27 02:19:21 but you don't want to try to implement the Sieve of Eratosthenes by indexing into the stack 2026-05-27 02:19:24 Stalevar would probably not call the RPL HP48 "RPN." 2026-05-27 02:19:36 Rather those like HP42, and similar. 2026-05-27 02:19:40 RPL does use RPN though 2026-05-27 02:19:54 xentrac: I am not arguing, just explaining what he likely means. 2026-05-27 02:19:59 Hmmm, can you write SoE in RPL? 2026-05-27 02:20:03 Riviera: understood 2026-05-27 02:20:05 Of course what he says is wrong, like, obviously, no need to argue about it. 2026-05-27 02:20:12 For example I want to know last prime number before 9000 2026-05-27 02:20:17 yes, you can definitely write SoE in RPL; it has arrays 2026-05-27 02:20:37 Of course prime test on odd numbers going down is more efficient 2026-05-27 02:20:47 maybe 2026-05-27 02:20:52 There's many people who prefer the 4=level stack of their calculators, and that's what's making the "better" calculator for them, no matter how many prime number sieves they cannot easily program. 2026-05-27 02:20:59 I'll try it in C 2026-05-27 02:21:01 it's probably in range of 8999 to 8899 2026-05-27 02:21:31 xentrac, in C it's very easy. But does 48gx run C natively? 2026-05-27 02:21:42 or you need to hack it / code on PC and download? 2026-05-27 02:22:23 Riviera, because they started with RPN calcs 2026-05-27 02:22:39 I have started with GNU dc with however many stack levels you want 2026-05-27 02:22:58 Stalevar: I do not see how this is a weaker argument than the prime number sieve example you pulled out of your arse. 2026-05-27 02:23:43 Stalevar: By your logics an ice cream cone is better than your calculators because the ice cream cone can be eaten and enjoyed while the calculators typically can't. 2026-05-27 02:23:50 Stalevar: anyway, waste of time. 2026-05-27 02:24:33 Riviera, what do you mean? We were discussing what firmware might be preferable for PicoCalc. I said forth because it can do arbitrary stuff, just like their default basic, but in RPN 2026-05-27 02:24:39 What are you arguing with? 2026-05-27 02:25:27 I don't know what kind of RPN calc fw they have for CwPi PC but it's most likely something like Free42, which is cool but probably more limited 2026-05-27 02:27:09 https://forum.clockworkpi.com/t/rpn-calculator-for-picocalc-v1/19917/3 2026-05-27 02:27:37 Yes, just 100 levels of stack, though I must admit it's more than enough for calculator like applications 2026-05-27 02:30:58 it's 8999 but on this laptop it takes less than a millisecond of compute 2026-05-27 02:31:09 I don't have the 48GX anymore 2026-05-27 02:31:47 given that literally the first number you try is prime I feel like it would be hard for trial division to lose 2026-05-27 02:32:56 the sieve takes about 62000 CPU instructions more to do 9000 than to do 4 2026-05-27 02:40:47 trial division only has to do 46 trial divisions for 8999 2026-05-27 02:41:36 so even for more challenging values of 9000 such as 10000 it beats the sieve handily in finding the last preceding prime 2026-05-27 02:42:12 back 2026-05-27 02:42:41 it needs about 2000 amd64 instructions to the sieve's 62000 or so 2026-05-27 02:43:09 after we try to subtract off the 133000-instruction overhead of just starting a glibc program 2026-05-27 02:43:11 Stalevar, the screen of the PicoCalc is custom-made -- people have tried to buy it but no one has found a screen quite like it 2026-05-27 02:44:29 and the keyboard is not a separately-buyable part 2026-05-27 02:45:36 about the SoE, I agree with xentrac that you don't want to make an SoE by indexing into the stack 2026-05-27 02:46:21 e.g. the way I've implemented SoE in zeptoforth is by making a bit array in the RAM dictionary where I only store bits for odd numbers 2026-05-27 02:47:24 compare http://canonical.org/~kragen/sw/dev3/trialdiv.c and http://canonical.org/~kragen/sw/dev3/sieve.c 2026-05-27 02:48:20 I figured it would be faster to just use bytes rather than try to index a bit array 2026-05-27 02:49:28 it's faster, but when you're using an RP2040 or RP2350 bit arrays are worth the performance hit (as the CPU is decently fast, but you only get so much SRAM) 2026-05-27 02:50:08 if I was working in gforth I'd use bytes, but that's because I'd have oodles of RAM at my disposal 2026-05-27 02:50:57 also, optimizing to only store odd numbers is worth it, as storing even numbers is essentially wasted memory 2026-05-27 02:51:42 it didn't occur to me how to do the math to do that 2026-05-27 02:51:57 in some sense storing multiples of 3 or multiples of 5 is also wasted memory ;-) 2026-05-27 02:52:50 except that testing for evenness is as simple as 1 AND 0= and does not require a modulus operation 2026-05-27 02:54:19 whereas what you're suggesting adds a significantly greater level of complexity and a definite performance hit (as moduli and divisions are typically much slower than AND's and bitshifts) 2026-05-27 02:54:49 xentrac, how do you put stuff onto canonical org? 2026-05-27 02:55:16 by having bowed down to the greatness that is Mark Shuttleworth? 2026-05-27 02:56:27 Also I see there is tcl calc 2026-05-27 02:56:41 no, by having refused to sell him the domain when he started up his company 2026-05-27 02:56:46 he's a good guy though 2026-05-27 02:57:06 The first program I wrote was calculator, but I put buttons onto word document and typed stuff in VBA editor 2026-05-27 02:57:14 that's awesome 2026-05-27 02:58:05 That's because there was a weird book about computers which my parents bought had VB as only thing which programming was discussed for 2026-05-27 02:58:36 But I didn't release you need to install VB separately and thought that VBA IDE was it and was suprised it didn't have compile button described 2026-05-27 03:01:12 xentrac, what else would you program for if you have computer just bought from company and it only has windows xp, drivers and MS office?? 2026-05-27 03:05:46 that's kind of like how back in the 1980's everyone had BASIC because that's what came with their machine 2026-05-27 03:06:56 I have mixed feelings about BASIC because I hated it as a kid (I knew from using LOGO at school and from reading books from the local library that much better things were possible), but now the vast majority of people don't get a prompt at which they can simply start coding anymore 2026-05-27 03:08:07 Stalevar: hmm, does Windows XP come with DEBUG.COM? 2026-05-27 03:08:45 tabemann were you a LOGO hacker? 2026-05-27 03:08:53 Dunno, I don't have it anymore. When I switched to Linux I did the ritual deletion of Windows XP system files 2026-05-27 03:09:01 yes: https://en.wikipedia.org/wiki/Debug_(command)#Overview 2026-05-27 03:09:06 Like rm -rf /mnt/c:/Windows 2026-05-27 03:09:30 VBA is more rewarding though 2026-05-27 03:09:46 Excel is also pretty decent as a programming environment even without VBA 2026-05-27 03:09:53 Actually you have VBscript and JScript if you insist programming on bare Windows 2026-05-27 03:10:08 highchurch: I played around with LOGO and was aware that you could do stuff like it such as define your own procedures/functions, but I never got the fullest out of it because even though I cajoled a summer school teacher out of a LOGO boot disk I didn't really have any documentation 2026-05-27 03:10:50 I think we could do a lot more to improve programming environments that have a higher ceiling with facilities from Excel. including, actually, improving VBA itself 2026-05-27 03:11:14 Windows XP comes with a web browser, so JS is probably the best answer 2026-05-27 03:11:20 I know very little LOGO, but it's one of those things that seem like there is a branch to an alternate/better present where LOGO was the dominant beginner language 2026-05-27 03:11:23 my big problem with Applesoft BASIC (my family and my local elementary school had Apples) was that it didn't have structured programming or local variables 2026-05-27 03:11:45 highchurch: I wish I had Forth as a little kid 2026-05-27 03:11:48 me too 2026-05-27 03:12:17 as a kid I basically went BASIC (and a bit of LOGO and assembly) > Hypercard > C++ > C > Python > OCaml 2026-05-27 03:12:19 highchurch: agreed 2026-05-27 03:12:31 i dabbled in QuickBASIC as a kid, then only hopped back into programming as a late teen with Common Lisp (which I've had to relearn since then) 2026-05-27 03:12:32 tabemann: you had better taste than I did! 2026-05-27 03:13:12 well I lucked out in that the previous owner of the used Mac my family got as our second computer was a programmer, and they gave us *all* their programming stuff 2026-05-27 03:13:26 been looking into game development, specifically the love2d library for Lua. But every time i see Lua code (or python) my brain flatlines out of boredom. Am I the only one who experiences this? 2026-05-27 03:13:35 so I got things like books on C++ and a C++ IDE and compiler 2026-05-27 03:13:52 but it took me a while to get into that, so in the meantime I'd muck about with Hypercard on the Mac 2026-05-27 03:13:54 highchurch: I like Lua 2026-05-27 03:13:56 that's awesome tabemann 2026-05-27 03:14:10 xentrac: I *want* to like Lua. It seems clean and tidy. 2026-05-27 03:14:14 I liked Python better when it didn't intentionally break backward compatibility every release 2026-05-27 03:14:19 Lua is a lot messier than Python 2026-05-27 03:14:23 is it? 2026-05-27 03:14:43 because you have to shoehorn tables into being all data structures? 2026-05-27 03:15:03 also you have implicit nil, 1-based addressing, and a couple of other things 2026-05-27 03:15:21 I like the idea of Lua, but I'm kind of turned off by implicit nil, 1-based indexing, and like 2026-05-27 03:15:23 haha. I hack around with APL, so I'm comfy with 1-based 2026-05-27 03:15:27 shallow equality 2026-05-27 03:15:44 my favorite lightweight high-level language is Scheme 2026-05-27 03:15:52 ⎕IO←1 2026-05-27 03:16:08 e.g. {3}=={3} is false 2026-05-27 03:16:42 I like how CL has 17 different equality checks. Wasn't it Sussman who said "equality is a complicated thing" 2026-05-27 03:16:52 I like Scheme enough to write a self-compiling compiler in it: http://canonical.org/~kragen/sw/urscheme/ 2026-05-27 03:16:54 ideally you support both shallow and deep equality 2026-05-27 03:17:44 I tried writing a Scheme interpreter in Haskell, but gave up due to the complexities imposed by, well, trying to do all of R7RS-small 'right' in Haskell 2026-05-27 03:17:59 but I feel like it's a bit clumsier than Lua or Python 2026-05-27 03:18:03 (I had a big Haskell phase in the mid 2010's) 2026-05-27 03:18:11 oh, I didn't do all of R5RS, much less do it right 2026-05-27 03:18:28 I only did the parts the Ur-Scheme compiler needed to compile itself 2026-05-27 03:18:52 the thing is if you don't try to do Scheme 'right' Scheme is easy-peasy to implement 2026-05-27 03:19:18 I really like how I can compile standalone executables from Scheme on my phone with Chicken CSC 2026-05-27 03:19:35 it gets more complicated when you try to implement things like equality of recursive data structures (which R7RS-small implementations are supposed to properly implement!) 2026-05-27 03:19:46 and efficient continuations 2026-05-27 03:20:19 I even wrote an algorithm in Haskell for solving that specific problem 2026-05-27 03:20:50 xentrac is Chicken your preferred Scheme 2026-05-27 03:21:05 every so often I play around with Racket 2026-05-27 03:21:32 Stalevar: TI Nspire and HP Prime are locked down but Casio fc-CG50 is not 2026-05-27 03:21:46 whereas if I ever write a program in C or C++ and need a high-level language to embed in it I'd probably use Lua 2026-05-27 03:22:21 just for the record -- Lua's C API is very, very nice, whereas I've dealt with Python's C API and it's one fucking PITA, at least it was in Python 2.x 2026-05-27 03:22:42 (I've dealt with both in my day jobs) 2026-05-27 03:22:57 highchurch: it's just the only one that I've figured out how to build executables with on my phone 2026-05-27 03:23:21 MrMobius, you cannot buy casio fc-CG50 on aliexpress 2026-05-27 03:23:44 but Prime and Nspire are there (though expensive, don't worth it, since PicoCalc cost the same) 2026-05-27 03:24:42 Stalevar: one advantage of buying your PicoCalc from Clockwork is if you do break your screen assembling it they will send you a new screen for very little 2026-05-27 03:24:49 If you chose between PicoCalc, Prime and Nspire and also 84 plus CE, all have color screen and keyboard, what you pick, price difference is negligible, everything about 120-130? 2026-05-27 03:24:53 and they ship it quickly, much quicker than the PicoCalc itself 2026-05-27 03:26:58 xentrac, I don't recommend embedding Python in anything 2026-05-27 03:27:15 embedded Python really sucks to deal with 2026-05-27 03:27:35 tabemann, if I break it I can take a picture and send it to seller claiming it was broken during shipping. It's cheating, but it can get you new screen for free 2026-05-27 03:27:40 Stalevar: you can't really program an HP-48G in C. Someone tried to make a compiler but it never caught on. You can use UserRPL which is like forth but more sophisticated with types or SysRPL which is much faster but doesn't contain any type checking and may crash the calculator. Also assembly on the calculator or on PC 2026-05-27 03:27:45 whereas Lua is specifically designed for ease of embedding 2026-05-27 03:27:55 If they rip off extra 40% compared to ClockWorkPi, I guess it's OK 2026-05-27 03:28:04 Stalevar, they'll ask for your order number 2026-05-27 03:28:25 tabemann, you send it via platform chat, it has order number 2026-05-27 03:28:49 They cannot verify if it's broken during assembly or shipping. But really, I'd rather just not break the screen 2026-05-27 03:29:13 Because even free replacement = waiting extra two weeks 2026-05-27 03:30:03 oh, they don't care if you broke the screen yourself -- just provide the order number and they'll send you a new one for something on the order of $15 USD (with the price including the shipping) right away 2026-05-27 03:30:28 Stalevar: you may want to do some research on Pico calc keyboard quality. I don't know anything to say it's bad but one main selling point of some calculators is they are nice to type on 2026-05-27 03:30:29 however, these days they include precut tape in the package for taping down the screen during assembly to minimize the risk of breakage 2026-05-27 03:30:53 whereas many devices like that are more like typing on a remote control 2026-05-27 03:31:34 Anyway, I got an RPN calculator already, I'm not certain I will get another one at all or not 2026-05-27 03:31:44 MK-52 but dead 2026-05-27 03:31:55 I am going to replace capacitors and see if it works 2026-05-27 03:32:31 MrMobius, I personally don't mind the PicoCalc's keyboard myself, and while some people have had bad stories about the keyboard, oftentimes that's because of software issues with the keyboard interface (and I've personally found that the keyboard works fine *provided* you don't try pressing the keys at weird angles) 2026-05-27 03:32:31 I got it in antique store for $6 2026-05-27 03:33:07 tabemann: are the keys rubber or hard plastic? 2026-05-27 03:33:28 whereas my keyboard driver for zeptoforth works quite well (aside from a minor issue that others have reported that once in a very blue moon the keyboard will simply stop responding, requiring a power cycle) 2026-05-27 03:33:31 MrMobius, given they are on injection mold, it must be same ABS as the case 2026-05-27 03:33:34 tabemann: yeah, I've written Python extensions in C, and I understand the embedding API is even worse 2026-05-27 03:34:36 Stalevar: hopefully. HP always used plastic then switched to rubber for HP49G which everyone hated so went back to plastic for HP50G 2026-05-27 03:34:42 MrMobius, the keys are rubber and have a vertical part in the middle that presses on an SMT switch component 2026-05-27 03:34:52 xentrac, the Lua C API is a breeze in comparison 2026-05-27 03:35:03 Hm... Rubber? 2026-05-27 03:35:09 so I hear but I haven't actually used it 2026-05-27 03:35:23 ick 2026-05-27 03:35:24 To be honest I don't know if plastic or rubber key are better for pocket device 2026-05-27 03:35:25 LuaJIT's FFI is out of this world thoug 2026-05-27 03:35:26 h 2026-05-27 03:35:36 Stalevar: STAINLESS STEEL 2026-05-27 03:35:45 What's the point of making rubber keys at all? 2026-05-27 03:35:54 Plastic is usually cheaper? 2026-05-27 03:36:05 Stalevar, they're one piece 2026-05-27 03:36:20 if they were plastic they'd have to fabricate lots of little moving parts 2026-05-27 03:36:21 Stalevar: if you plan on typing things into it for an hour or two, you want something where you can feel the key register and only have to press once. you don't usually get that with rubber 2026-05-27 03:36:45 MrMobius, these are better than that 2026-05-27 03:37:08 how about brass? 2026-05-27 03:37:12 these have a definite "click" to them, and I've found that they only miss keystrokes when I'm pressing on the keys at a weird angle 2026-05-27 03:37:28 if you're charging US$90 for the calculator you might as well include some brass in the UI 2026-05-27 03:37:53 xentrac, what, have a brass key close a circuit electrically? 2026-05-27 03:39:15 no, just use brass instead of plastic over the rubber domes 2026-05-27 03:39:15 as I've mentioned before, some people have reported missed keystrokes, but part of that is the software rather than the hardware (both on the Pico side and on the STM32 side -- there are better, newer versions of the STM32 firmware available than that it comes with out of the box) 2026-05-27 03:39:41 so the keys are shiny and bacteriostatic 2026-05-27 03:39:46 xentrac, what, for extra bling factor? 2026-05-27 03:39:55 and durability 2026-05-27 03:40:24 this doesn't use rubber dones but rather little metal domes that close a connection when pressure is applied 2026-05-27 03:41:02 that can work, though often those require too much actuation force 2026-05-27 03:41:33 ACTION has never, ever heard of a keyboard with shiny metallic keys, even those über-expensive high-end keyboards that use little magnets that go through coils 2026-05-27 03:43:50 tabemann, SwissMicros DM42n 2026-05-27 03:44:00 Though it costs like a medium range laptop 2026-05-27 03:44:25 But they have stainless steel 2026-05-27 03:47:00 Stalevar, stainless steel is pretty, but doesn't have the bacteriostatic aspect of xentrac's favored bling 2026-05-27 03:47:52 xentrac: the HP48 and similar have metal domes and are about the best calculator you can type on 2026-05-27 03:48:05 tabemann, for bacteriostatic, sterling silver is better 2026-05-27 03:48:37 And it's not all that expensive, maybe $1 for gram 2026-05-27 03:48:51 Stalevar, the problem with silver, though, is that it reacts with sulfur compounds in the air 2026-05-27 03:49:01 copper alloys darken too 2026-05-27 03:49:23 e.g. I've seen old silver objects that are simply black 2026-05-27 03:49:24 tabemann, silver could be anodized with oxyde layer or something 2026-05-27 03:49:51 I didn't know you could anodize silver 2026-05-27 03:50:08 tabemann, or just heated in oxygen atmosphere? 2026-05-27 03:50:09 I was familiar with anodizing being primarily an aluminum thing 2026-05-27 03:50:19 Whatever works, anyway 2026-05-27 03:51:06 tabemann, steel is typically treated with controlled oxidation for example, that's why weapons are black 2026-05-27 03:51:16 one way or another, I think the $75 USD (that's what it was when I got mine) I spent on my PicoCalc was worth it 2026-05-27 03:51:54 Stalevar, yeah, blueing and such 2026-05-27 03:52:04 or phosphating 2026-05-27 03:52:10 tabemann, what do you use it for mostly? 2026-05-27 03:52:37 Stalevar, play around in zeptoforth, write little programs to do random things like that clock example 2026-05-27 03:53:21 tabemann, is there any reason to prefer RPN calculator over pocket forth? 2026-05-27 03:53:28 unlike my other boards I don't need to carry around my laptop to use zeptoforth when I've got it, and it also provides a nice screen and keyboard too 2026-05-27 03:53:39 I think forth is already an RPN calculator but with less alien syntax 2026-05-27 03:53:54 like space instead of enter 2026-05-27 03:54:19 RPN calculators are specifically designed for simple calculations, whereas Forth is more suited for writing arbitrary, complex programs 2026-05-27 03:55:02 tabemann, but in forth you see entire expression and can edit it until you press enter. And if you don't use if/while/loop you don't need to put it into word either 2026-05-27 03:55:30 What's the point of RPN calc if forth does the same thing but better? Besides the fact you can't put forth in calculator in 80s 2026-05-27 03:56:19 Stalevar, that is true (and in zeptoforth, you can, with some limitations, use conditionals and loops without starting a word) 2026-05-27 03:56:35 tabemann, does zeptoforth have readline-like editing or at least cursor keys and insert mode? Or it's as broken as tclsh without rlwrap? 2026-05-27 03:57:20 Stalevar, not quite out of the box (because readline-like editing breaks mass code uploading, so it's not on by default), but it's trivial to enable -- all you need to do is execute ENABLE-LINE 2026-05-27 03:57:47 Then is there a single minus of using forth instead of free42 or whatever? 2026-05-27 03:57:49 and after you do that you can turn it off again by pressing F1, and re-enable it by, at the start of a line, pressing F2 2026-05-27 03:58:14 Stalevar: you don't get decimal arithmetic or absolutely huge floats 2026-05-27 03:58:37 Hm... but you can implement them, can't you? 2026-05-27 03:58:53 like that SwissMicros you mentioned comes with decimal and with *quadruple precision floats* 2026-05-27 03:59:06 quad-fucking-ruple 2026-05-27 03:59:33 Yeah, but dc is arbitrary precision. Want 1000 digits of Pi? Easy 2026-05-27 03:59:42 Stalevar, of course you can implement them if you really feel like it, but Forths normally don't come with it out of the box 2026-05-27 04:00:13 tabemann, imagine forth but with dc-like arithmetic 2026-05-27 04:00:22 And you can add sin / cos / tan as words 2026-05-27 04:01:08 Stalevar, if you simply want a really powerful RPN calculator for cheaper than one of those swissmicros, what I'd almost suggest is buy a PicoCalc, but instead of installing a Pico 2 or like, instead follow the directions some people have on the forum and use it with a 3d-printed back and an RPi Zero 2026-05-27 04:01:19 So would there be a single downside compared to dm42 if you get that working (math functions and arbitrary precision similar to bc/dc)? 2026-05-27 04:01:20 and with linux on that RPi Zero use dc 2026-05-27 04:02:27 Stalevar: there wouldn't be a single downside, except that you'd have to implement all that stuff yourself 2026-05-27 04:02:54 tabemann, but can't you extend forth to dc level? I mean does zeptoforth let you change the way numbers are interpreted so if you type 1451..1514 (100 digits) it will put them in stack as is? 2026-05-27 04:04:40 I don't know much about forth yet. I know you can redefine + - × ÷ but I don't know if you can change the way literals are interpreted 2026-05-27 04:04:54 or you'd need to enter numbers as strings with S" "S ? 2026-05-27 04:05:00 zeptoforth's basic data type is the cell, i.e. a 32-bit signed or unsigned integer; it also supports 64-bit double cells (signed or unsigned integers), 64-bit S31.32 fixed-point numbers as double cells, optionally S15.16 fixed-point numbers as single cells, and on the RP2350 it also supports single precision floating-point numbers 2026-05-27 04:05:34 each 'type' has its own set of words, except that addition and subtraction for fixed-point numbers use the same words as addition and subtraction for integers of the same size 2026-05-27 04:06:42 for instance, if I want to get the square root of 1,000,000 I'd to 1E6 VSQRT V. 2026-05-27 04:07:28 the V prefix is because F is already taken by S31.32 fixed-point numbers, which were implemented before I got around to supporting floating point, and because the underlying ARM instructions are prefixed with V's 2026-05-27 04:08:35 however, if I wanted to get the square root of 1,000,000 as an S31.32 fixed-point number, I'd instead to 1000000,0 SQRT F. 2026-05-27 04:08:51 yes, that's right, the decimal place is marked with a comma 2026-05-27 04:11:09 tabemann, how do you change the way plain numbers are interpreted in forth in forth itself? 2026-05-27 04:11:17 or you need to edit the kernel? 2026-05-27 04:11:39 Stalevar, you can register a routine that parses numbers 2026-05-27 04:11:51 and in practice there is a chain of such routines 2026-05-27 04:11:56 one calling the next 2026-05-27 04:12:06 or more like one calling the previous 2026-05-27 04:12:25 the kernel itself only knows about single-cell integers 2026-05-27 04:12:50 it does know about prefixes for hex, decimal, octal, and binary numbers though 2026-05-27 04:13:01 89324759020498248095 . -2908961348049509985 ok 2026-05-27 04:13:03 ($, #, /, and % respectively) 2026-05-27 04:13:07 in gforth I get this 2026-05-27 04:13:23 Can I write something in gforth to make it remember entire number? 2026-05-27 04:13:36 that's because you stuffed in a huge number 2026-05-27 04:14:14 Yes, I know, it overflows 2^63 2026-05-27 04:14:32 My question is what routine or whatever is called when I do that 2026-05-27 04:14:52 usually Forths don't have overflow detection 2026-05-27 04:15:48 what does gforth do when I type a plain integer with just decimal digits and nothing else? What word is executed or whatever? I imagine it's probably in kernel? 2026-05-27 04:15:58 and this kind of thing is very Forth-specific -- I personally don't know how gforth does it 2026-05-27 04:16:11 ok, what does zeptofoth do? 2026-05-27 04:16:34 You type digits, press enter. What code is called? 2026-05-27 04:17:06 it calls the xt in HANDLE-NUMBER-HOOK 2026-05-27 04:17:20 first it attempts to parse it as a word 2026-05-27 04:17:40 if it cannot find any word by that name, then it calls that xt to try to parse it as a number 2026-05-27 04:18:34 So the repl parser is usually implemented in forth itself? 2026-05-27 04:19:16 in practice each HANDLE-NUMBER-HOOK routine has a VARIABLE where the previous HANDLE-NUMBER-HOOK routine is saved, which it calls, and then only attempts to parse the number itself if that routine returns FALSE 2026-05-27 04:19:51 in zeptoforth the core of the REPL is implemented in assembly, but there are a number of hooks that allow portions to be implemented in Forth 2026-05-27 04:19:58 OK, so you can redefine xt to parse 1000-digit number like it nothing 2026-05-27 04:20:28 I mean, to parse it without overflow 2026-05-27 04:20:28 Stalevar, the problem, though, is in Forth there is no such thing as a 'type' in the sense of C or Python 2026-05-27 04:20:58 tabemann, similar to Tcl I imagine? 2026-05-27 04:21:02 the closest thing to a 'type' is that many Forths (but not zeptoforth) have special stacks for floating point numbers 2026-05-27 04:21:24 Tcl operates in terms of strings, Forth operates in terms of cells 2026-05-27 04:21:42 in Tcl everything is a string (semantically, internally integers are stored as integers usually, but it's speed hack) 2026-05-27 04:22:15 The treatment depends on command word you apply 2026-05-27 04:22:28 yes 2026-05-27 04:22:29 for example word string treats argument as string, word expr as number 2026-05-27 04:22:52 So Forth is same, values are untyped, instead words are typed 2026-05-27 04:23:00 for instance if I want to add two cells I use + whereas if I want to add two double-cells or S31.32 fixed-point numbers I use D+ 2026-05-27 04:23:20 tabemann, similar to OCaml 2026-05-27 04:23:25 you use .+ to add floats 2026-05-27 04:23:36 yeah, I remember that about OCaml 2026-05-27 04:24:17 Also similar to C, char could be number from -128 to 128 or actual character 2026-05-27 04:24:50 Stalevar: to offer a different viewpoint on calculators vs forth, an HP48G or similar does allow you to write very long and complex programs and has a programming language like forth but much more sophisticated. I agree that the DM42 programming may not be as good 2026-05-27 04:25:35 MrMobius, what's your opinion of HP's RPN calculator language whose name I can't remember at this moment? 2026-05-27 04:25:36 I have HP 39gs but I haven't tried to program 2026-05-27 04:25:50 tabemann: RPL? that's what im refering to 2026-05-27 04:25:55 MrMobius, yeah that 2026-05-27 04:27:01 Stalevar: the advantages of the calculator are portability (which doesnt much matter these days now that there are competing devices), better battery life, better to type on and wont crash under normal operation. you probably dont want to use a regular forth on a pico calc if it crashing is unacceptable 2026-05-27 04:27:24 so of course most people dont want or need a calculator these days. it's just a fun thing for 99% of the cases now 2026-05-27 04:28:49 MrMobius, and if they do, they usually get simple calculator for $3 2026-05-27 04:29:00 I have a couple of those laying around 2026-05-27 04:29:05 for the record, if one stays away from @ and ! and >R and R> and like and one makes sure to not explode or implode either stack zeptoforth is quite stable 2026-05-27 04:29:49 In calculator stack is fixed set of variables so you can't get stack underflow even if you tried 2026-05-27 04:30:08 + will pop the numbers and you'll just get zeros at the end 2026-05-27 04:30:23 of course, I've found the easiest way to require my PicoCalc to be power cycled is by overflowing the stack and having it overwrite the task control block 2026-05-27 04:31:26 if I'm lucky I can attach a USB connection to my PicoCalc, pull up picocom, and access my emergency-shit-has-gone-down console to postmortem what happened and reboot without a powerr cycle 2026-05-27 04:32:12 what happens is that I put a guard value at the end of each TCB 2026-05-27 04:32:27 and when the multitasker is invoked it checks that value to make sure it hasn't changed 2026-05-27 04:33:35 if it *has* changed it then determines that the system is in an unrecoverable state, and tries to drop down to a limited console accessible over UART0 (which is redirected to the USB-C on the PicoCalc) to give the user a chance to diagnose what happened and reboot 2026-05-27 04:36:45 MrMobius, in RPL, is the stack limited only by memory, or is it the classic 4-depth stack? 2026-05-27 04:39:14 tabemann, I have just checked + behavior on MK-61 emulator. It seems if you do 1 ↑ 2 ↑ 3 ↑ 4 + + + you get 10 as expected, but if you keep using + you get 11, 12, 13 and so on 2026-05-27 04:39:25 So final 1 isn't popped for some reason 2026-05-27 04:39:50 It stays in the Y (stack variable) forever 2026-05-27 04:40:33 if you do 1 2 3 4 + + + + in zeptoforth it will yell at you about stack underflow (which is far less fatal in zeptoforth than stack overflow) 2026-05-27 04:41:17 note that this is only if you do it from the interpreter 2026-05-27 04:41:58 $ dc 2026-05-27 04:41:58 1 2 3 4 + + + + p 2026-05-27 04:42:03 if you do : bad-example ( -- ) 1 2 3 4 begin + again ; in zeptoforth you'll surely crash your system 2026-05-27 04:42:41 well, that and you then call BAD-EXAMPLE of course 2026-05-27 04:43:57 in gforth it doesn't crash even when you underflow though word but it doesn't seem to have again? 2026-05-27 04:44:26 : AGAIN 2026-05-27 04:44:27 dest? again-like 4306032 compile, It shows something for see again, but I don't know what it is 2026-05-27 04:45:17 : underflow 1 2 3 4 + + + + + ; ok 2026-05-27 04:45:17 underflow 2026-05-27 04:46:15 tabemann, depending on how data stack is implemented, via CPU push/pop or manually via linked list one can probably add code to check undeflow 2026-05-27 04:46:52 And probably if you put data stack at the bottom of memory (or top) it will try to write to non-existant memory and won't break things? 2026-05-27 04:47:13 How does data stack grow from top to bottom or bottom to top? 2026-05-27 04:48:31 What happens on rp2040 when you try to access addresses above physical ram? 2026-05-27 04:48:49 Does it have MMU? 2026-05-27 04:50:29 back 2026-05-27 04:50:31 With MMU you can probably put data stack in separate segment so it will be a hardware exception on under/overflow 2026-05-27 04:50:56 the problem is that on the RP2040 the MPU is very restricted in what it can do 2026-05-27 04:51:17 e.g. you can only protect units of memory powers of two 256 or larger in size 2026-05-27 04:52:05 so you'd have to put a 256 byte block of memory between the data and return stacks that would likely be wasted without some rather creative programming 2026-05-27 04:52:25 and the TCB'd have to take up a power of two 256 bytes or larger in size 2026-05-27 04:52:41 256 bytes isn't that much to care about? 2026-05-27 04:54:13 it is when you've got 16 tasks and only 264 KiB of SRAM 2026-05-27 04:54:56 in that case you've wasted 4 KiB just to keep the return stack of each task from overrunning the data stack 2026-05-27 04:55:10 and another 4 KiB on the extra space to protect all the TCB's 2026-05-27 04:55:43 Hm, 16 tasks? I thought you turn it on, get one REPL and that's it? 2026-05-27 04:56:09 Or basic IDE if you have default fw 2026-05-27 04:56:10 the other problem is that these have to be aligned to 256-byte power of two boundaries, which restricts the sizes of the stacks and other things 2026-05-27 04:56:28 nah, zeptoforth is multitasking and multicore 2026-05-27 04:56:42 Do you need that? 2026-05-27 04:56:56 there's only one *REPL*, but zeptoforth can support many tasks 2026-05-27 04:57:38 Maybe there are other forth`s for rp2??0 ? 2026-05-27 04:57:58 for instance, on the PicoCalc there's one task for the "BIOS" (read: STM32) driver, one for the sound driver, a bunch for the terminal emulator... 2026-05-27 04:58:40 By the way I got rp2350 thing on a flash drive-like 2026-05-27 04:58:48 there are, but zeptoforth is the only one I am aware of that supports multicore or that runs on the PicoCalc (even though last time I checked single-core support for the PicoCalc was in the works for Mecrisp-Stellaris) 2026-05-27 04:59:27 and IMO running on the RP2040 or RP2350 without multicore is a waste of perfectly good hardware 2026-05-27 04:59:28 I have tried to plug it and connect to micropython with picocom but didn't find what to do because it simply gives you same python repl as you get by typing python3 so I found no point and shelved it 2026-05-27 05:00:41 I guess I can try to load some forth on it or whatever. I don't know why I bought it at all, but it was relatively cheap ($5) 2026-05-27 05:01:43 the point of MicroPython is so you can control embedded systems with Python, not to replace Python on your PC 2026-05-27 05:02:47 oh, BTW, one reason to get a PicoCalc and install a Pimoroni Pico Plus 2W (or failing that, a Pico 2W) is then you get to use WiFi with it 2026-05-27 05:03:03 as zeptoforth has optional support for either IPv4 or IPv6 2026-05-27 05:05:54 tabemann, how do you do that tree thing on PicoCalc which is drawn on the screen in shop title picture? 2026-05-27 05:06:08 I guess it's chaotic bifurcation thing but I forgot the formula 2026-05-27 05:06:47 it's done with a PRNG 2026-05-27 05:07:33 where I adjust the length of a line and the angles of each branch, which inherits a certain proportion of the length of the parent branch, according to the PRNG 2026-05-27 05:14:13 https://github.com/clockworkpi/PicoCalc/blob/master/Bin/PicoCalc%20SD/bifdiag.bas 2026-05-27 05:14:19 i think it was this one? 2026-05-27 05:15:24 oh, that I'm not familiar with 2026-05-27 05:15:43 I don't think I've even looked at the programs that come with the Pico 1H that comes with the PicoCalc 2026-05-27 05:16:04 I immediately put a Pico Plus 2W in mine and installed zeptoforth on it 2026-05-27 05:16:58 (in the few months before my PicoCalc arrived I was busy preparing zeptoforth for it using an emulated setup involving a standalone screen, serial to emulate the keyboard, and an SD card reader) 2026-05-27 05:17:31 Wait, it was you who ported zeptoforth? 2026-05-27 05:18:39 yes 2026-05-27 05:18:53 I'm the author of zeptoforth 2026-05-27 05:18:58 the primary author at least 2026-05-27 05:21:01 Hm, I guess I can put zeptoforth-1.16.2/bin/1.16.2/rp2350_1core/zeptoforth_kernel-1.16.2.uf2 into my USB thing and see if it's any better than gforth 2026-05-27 05:21:02 tabemann: limited only by memory 2026-05-27 05:21:22 Stalevar, no, don't do that 2026-05-27 05:21:27 Why not? 2026-05-27 05:21:50 the rp2350_1core versions are only special-purpose ones for if you want to run a different application on the second core 2026-05-27 05:21:53 It won't overwrite the bootloader 2026-05-27 05:22:15 RPI_PICO2-20250415-v1.25.0.uf2 is probably what was on default 2026-05-27 05:22:27 So I can restore it any moment 2026-05-27 05:22:32 Stalevar: not sure on MK-61 but on old HPs, the last register was "sticky" so it copied the last value it held to the next slot when stack items were dropped 2026-05-27 05:23:13 MrMobius, anyway I should try to fix my MK-52 and see in hardware 2026-05-27 05:23:17 Stalevar, don't worry about overwriting anything as long as you have the original UF2 on hand (and a flash nuke to erase everything before you reinstall the previous UF2 if you so desire) 2026-05-27 05:23:21 Its same as MK-61 but with ROM chip 2026-05-27 05:24:13 Stalevar, what you want is zeptoforth-1.16.2/bin/1.16.2/rp2350/zeptoforth_full_usb-1.16.2.uf2 2026-05-27 05:25:12 this will give you a complete setup aside from loadable extras such as zeptoed and will give you a USB console 2026-05-27 05:26:47 unless 2026-05-27 05:26:53 if you have 16 MiB of flash 2026-05-27 05:26:56 you want 2026-05-27 05:27:09 zeptoforth-1.16.2/bin/1.16.2/rp2350_16mib/zeptoforth_full_usb-1.16.2.uf2 2026-05-27 05:27:21 note that if your device has only 2 MiB of flash it will not be supported 2026-05-27 05:28:17 https://ae01.alicdn.com/kf/S93e48c6223284ff29d0e725ed39348b78.jpg 2026-05-27 05:28:25 It has 16M flash chip 2026-05-27 05:28:54 rp2350 has its own flash with uf2 bootloader afair 2026-05-27 05:30:35 it has a 32 Mbit flash chip 2026-05-27 05:30:44 which means 4 MiB 2026-05-27 05:30:57 the bootloader is in mask rom 2026-05-27 05:31:04 it cannot be overwritten 2026-05-27 05:32:02 Stalevar: I remember MK-52 but never liked the landscape mode 2026-05-27 05:32:51 MrMobius, yet if you don't want to lose your program by power cycle it's only option out of soviet stuff, except MK-85, 90, 98, but those are rarity 2026-05-27 05:34:54 MicroPython v1.24.0-preview.201.g269a0e0e1 on 2024-08-09; Raspberry Pi Pico2 with RP2350 2026-05-27 05:34:57 OK, I got this 2026-05-27 05:35:31 I remember the MK-90 too and used to look on ebay but one never came up 2026-05-27 05:35:51 I didnt know about MK-98 2026-05-27 05:36:44 are these old soviet calculators you're speaking of? 2026-05-27 05:37:21 Yes 2026-05-27 05:37:32 Though MK-90 and 98 more like Russian 2026-05-27 05:37:44 because the company existed some time after USSR dissolved 2026-05-27 05:39:37 lemme guess... did some of these calculators print "yeggog" on an error? 2026-05-27 05:42:26 eggog, yes 2026-05-27 05:46:06 except that to a russian, initial "e" is pronounced "ye" 2026-05-27 05:46:21 that's right 2026-05-27 05:47:37 apparently it was easier for the makers of russian calculators to make their calculators print english "error" than the equivalent in russian 2026-05-27 05:47:50 but of course, english "error" is meaningless to the average russian 2026-05-27 05:55:08 ошибка 2026-05-27 05:55:24 I don't think you can do this convincingly on 6 segment 2026-05-27 05:55:48 yeah 2026-05-27 05:55:56 ЕГГ0Г fits perfectly 2026-05-27 05:56:09 ОШИБКА still nope 2026-05-27 06:00:15 I've read that many a russian was bemused by "ЕГГ0Г" 2026-05-27 06:04:41 how about "бЛИН? 2026-05-27 06:04:42 ? 2026-05-27 06:06:01 the problem is displaying "l" and making it not look like "p" on an n-segment display 2026-05-27 06:06:28 and I don't see how you'd print "И" on a 7-segment display 2026-05-27 06:09:17 tabemann: it looks like an English U when you write it out 2026-05-27 06:09:43 MrMobius, I thought that was cursive/italic 2026-05-27 06:10:05 you mean cursive that you don't write out? 2026-05-27 06:10:56 what I mean is that it looks like Latin "U" when it isn't printed 2026-05-27 06:11:43 and that the form that looks like backwards Latin "N" is the printed non-italic form 2026-05-27 06:12:42 it feels really... odd to me that you'd use a form that's normally italic or handwritten on the screen of a calculator 2026-05-27 06:13:05 better to stick with "ЕГГ0Г" 2026-05-27 06:16:57 okay, I should hit the sack soon 2026-05-27 06:17:54 italic? 2026-05-27 06:18:26 but yeah, Stalevar, flash your board with a "universal flash nuke" (e.g. https://github.com/Gadgetoid/pico-universal-flash-nuke), then install zeptoforth-1.16.2/bin/1.16.2/rp2350/zeptoforth_full_usb-1.16.2.uf2 on it 2026-05-27 06:20:17 MrMobius, I know it's not called "italic" in Russian; IIRC it's called something like "kursiv" borrowed from German or like 2026-05-27 06:21:35 Stalevar, once you have done that you will get a /dev/ttyACMx (if you're using Linux) or COMx (if you're using Windows) device that you can connect to with your favorite terminal emulator 2026-05-27 06:22:06 you won't need to mess with USB-serial dongles or anything of that sort 2026-05-27 06:25:10 MrMobius, pancake 2026-05-27 06:25:28 pancake? 2026-05-27 06:25:54 Stalevar: I know but it could also be what you put instead of "ЕГГ0Г" :P 2026-05-27 06:26:48 I don't think they would put it on a serious scientific device 2026-05-27 06:27:10 Remember MK-52 was professional device, given to ship navigators, cosmonauts and such 2026-05-27 06:27:47 For example they carried some MK-52 with space navigation programs on Soyuz spacecraft in case of main computer failure 2026-05-27 06:28:07 Apollo astronauts carried some HP calcs afair? 2026-05-27 06:28:51 tabemann, I have started with dumping flash in case I ever need to restore it 2026-05-27 07:32:16 You won't believe what I found on flash chip from https://ae01.alicdn.com/kf/S93e48c6223284ff29d0e725ed39348b78.jpg this rp2350 flash 2026-05-27 07:33:17 If you need assistance with your therapy device contact your healthcare provider or Philips. 2026-05-27 07:33:34 Lines like this, from some therapy mask for PAP therapy 2026-05-27 07:33:54 Which is supposed to have Wi-Fi and SD card 2026-05-27 09:18:47 0_0 2026-05-27 09:22:03 tabemann: I think americans say "cursive" to mean hand-written words where letters are joined together. I think in UK it's just called "joined-up writing" 2026-05-27 09:22:20 If it's German then that's not surprising, americans seem to borrow a lot more German words than Brits 2026-05-27 09:24:02 One of the more dominant styles of handwriting was "Italian" or "Italic" which among other things was more slanted (although it was all slanted, because that works better with a quill) 2026-05-27 09:24:41 And I guess the convention to call the slanted font face "Italic" may have not been followed everywhere 2026-05-27 09:24:59 Especially in countries without the same alphabet 2026-05-27 09:26:32 I would guess "Italic" makes sense in the Catholic/Protestant part of the world rather than Orthodox 2026-05-27 09:29:37 Also I was pondering if I should reflash the device or preserve for history. I have reflashed and wiped with nuke uf2 2026-05-27 09:29:57 Forth works, though I don't know what to do with it yet. I didn't read the docs 2026-05-27 09:30:42 2 3 + . 5 ok 2026-05-27 09:43:14 What more could you want 2026-05-27 09:43:28 You know what Stalevar, that's always my problem with embedded hobby stuff 2026-05-27 09:43:47 I don't have any ideas for projects at all, I always get the kit out and can't think of anything useful 2026-05-27 09:44:09 veltas, I have ideas but they are too hard for me to implement 2026-05-27 09:44:17 I've had one good idea but I don't have time for it, which is to write something to translate between the two communication standards used by my boiler and thermostat 2026-05-27 09:44:33 I've moved house since so that's no longer necessary 2026-05-27 09:44:55 And the simple on/off relay worked well enough anyway 2026-05-27 09:45:44 I would like to have something like Altair 8800 or IMSAI 8080 but much simpler. Their clones are sold but overly expensive. So my idea was to maybe get Z80, static ram and some chips for front panel 2026-05-27 09:45:57 Awesome 2026-05-27 09:46:15 That sounds cool but would you do more than just a front panel? 2026-05-27 09:46:18 Yes, but I bought most of component and never went to actual building 2026-05-27 09:47:12 It seems that I'd need some chips as buffers for front panel, but I don't know what exact chips are the best 2026-05-27 09:47:34 I have 32k SRAM and Z80 and lots of switches and led 2026-05-27 09:47:54 Why SRAM? 2026-05-27 09:47:58 Also Arduino Mega which I planned to use as front panel replacement 2026-05-27 09:48:15 temporarily 2026-05-27 09:48:38 And why do you need a buffer for the front panel? 2026-05-27 09:49:08 veltas, because you can get 32K in one chip and it's more than enough, the rest 32k could be used for another ram chip or ROM with library of routines 2026-05-27 09:49:37 veltas, as far as I get it it's impossible to implement front panel by wiring leds and switches directly to CPU legs 2026-05-27 09:50:30 Z80 because it's cheaper and easier to wire than original Intel i8080 2026-05-27 09:50:41 And it can run 8080 code 2026-05-27 10:21:39 Okay that makes sense 2026-05-27 10:28:34 .s [ ] ok 2026-05-27 10:28:34 : f ( n -- n! ) dup if dup 1 - .s f * else 1 then ; ok 2026-05-27 10:28:52 I can't just get it to calculate simple factorial 2026-05-27 10:29:15 I try to print stack before every recursive call and get nonsense 2026-05-27 10:33:34 Does it allow a recursive word that way? 2026-05-27 10:33:42 Not using 'recurse'? 2026-05-27 10:33:50 how do I use recurse? 2026-05-27 10:33:57 just put it instead of f? 2026-05-27 10:34:04 Yes 2026-05-27 10:34:21 Putting f usually means "call the old def of f" because f isn't visible until ; 2026-05-27 10:37:28 The problem is that case 0 breaks the stack : f ( n -- n! ) dup if dup 1 - recurse * else drop 1 then ; ok 2026-05-27 10:37:45 I needed to drop 0 because I don't use it in else branch 2026-05-27 10:41:06 The loop's easier to write 2026-05-27 10:41:13 But I guess that's not the point 2026-05-27 10:43:32 Loop is harder to write, but it's not eating return stack 2026-05-27 10:43:49 And harder because I don't remember how to do loops in forth 2026-05-27 10:46:29 limit-plus-1 initial ?do i my-step loop 2026-05-27 10:47:24 Something like : f 1 swap 1 max 1 ?do i * loop ; 2026-05-27 10:47:49 I guess 1+ the limit because it will not multiply by n otherwise 2026-05-27 10:48:13 So : f 1 swap 0 max 1+ 1 ?do i * loop ; 2026-05-27 10:49:07 Factorial at least you're not worried about eating all return stack because you can't really calculate larger numbers anyway 2026-05-27 10:49:14 How do I fetch index variable in ?do loop? 2026-05-27 10:49:32 I 2026-05-27 10:59:45 34 f . 0 ok 2026-05-27 10:59:45 33 f . -2147483648 ok 2026-05-27 10:59:58 : f ( n -- n! ) dup 1 ?do i * loop ; 2026-05-27 11:50:17 You need to increment the limit because it stops when I equals the limit 2026-05-27 11:50:39 I guess 33! is too big 2026-05-27 11:50:49 Or 32! even 2026-05-27 12:54:24 veltas: I think the point is tabemann doesnt know Russian and briefly googled it without knowing much 2026-05-27 12:56:07 Stalevar: 74HC373 or 74HC374 would work well if you want lights on your front panel 2026-05-27 12:56:32 or 74HC244 might work if you just want to show address or data bus 2026-05-27 15:04:29 KipIngram: We're talking about OS's like they are this abstraction over the hardware providing portability etc and then we want to do something as simple as getting the CPU temperature and we realise the OS provides almost no value 2026-05-27 15:04:46 It feels like the main business cases for OS's are most optimised and then almost everything else is just a hack 2026-05-27 15:06:01 Entertaining threads in here https://stackoverflow.com/questions/23314886/get-cpu-temperature 2026-05-27 15:22:46 mornin' 2026-05-27 15:31:10 Morning 2026-05-27 15:31:20 Afternoon here 2026-05-27 15:36:09 dawn here 2026-05-27 15:37:16 you wouldn't really want to expose the CPU temperature to unprivileged processes usually 2026-05-27 15:38:31 (1) it's a sidechannel for wallbanging. (2) it changes slowly enough that the system call overhead is insignificant. (3) it's a source of nondeterminism, and sometimes you want to guarantee reproducible execution 2026-05-27 15:38:45 EGGOG 2026-05-27 15:40:24 What's wallbanging? 2026-05-27 15:43:18 I'm not penalising Linux here for reporting in sysfs, I'm just thinking it's not well documented how you're meant to get the temp 2026-05-27 15:43:45 The whole sysfs thing seems well designed and just lacks proper documentation, it seems to have just enough docs to be maintained and not really enough to be applied 2026-05-27 15:44:32 The situation on Windows is even worse 2026-05-27 15:45:03 It's all a lot more work than I would expect from what seems like an innocent enough question 2026-05-27 15:51:04 wallbanging is exfiltrating information through a sidechannel by using lots of CPU 2026-05-27 15:52:37 the context is that you have some piece of code that is able to observe some piece of confidential information, such as your password, your TLS private key, or your disk encryption key, and you are trying to use OS facilities to prevent it from communicating that information to other processes, so that you don't have to audit its code for backdoors 2026-05-27 15:53:00 so-called "mandatory access control" 2026-05-27 15:53:04 or "confinement" 2026-05-27 15:58:58 hmm, I think https://docs.kernel.org/driver-api/thermal/index.html looks reasonable, and in particular https://docs.kernel.org/driver-api/thermal/sysfs-api.html documents not just how to write the driver but also what it should look like from userspace? 2026-05-27 16:07:37 Then what /sys/class/hwmon/hwmon*/name are you looking for? 2026-05-27 16:09:28 Also that sysfs stuff is buried down the page, it starts presenting itself as how to write drivers, this isn't where people who want to write userspace apps would think to look, but yes it's in there 2026-05-27 16:09:45 yeah, I found it by grepping 2026-05-27 16:10:18 I did find all this myself and have what works well enough for my case, but it wasn't pretty and what I've got wouldn't work e.g. on AMD 2026-05-27 16:11:42 A more direct way to access for CPU temp on intel is via the coretemp entry in /sys/devices, which is only for Intel-brand CPUs apparently 2026-05-27 16:12:54 If this is documented I don't know where it is, it's easy to find on a live system but what if I want to write it portably for any (or 90% of) x86 CPUs? 2026-05-27 16:13:37 And then it may dawn on baremetal devs it's probably easier to look up where it's kept on most Intel and AMD CPU's, all this abstraction has just obfuscated something that wasn't too hard 2026-05-27 16:20:15 veltas, actual limit is much lover, 13! or 14!, I just found it interesting that 34! ≡ 0 (mod 2^32), though it makes sense. 17 even numbers including 8 multiples of 4 including 4 multiples of 8 including 2 multiples of 16 and 32: 17 8 4 2 1 + + + + . 32 ok 2026-05-27 16:22:19 veltas, uhm, CPU temperature can be taken from /proc or /sys I think with simple data read? 2026-05-27 16:25:03 veltas: good point yeah 2026-05-27 16:25:12 I usually use the `sensors` command 2026-05-27 16:26:13 strace says this is reading stuff from /sys 2026-05-27 16:28:08 Stalevar: The issue is there's little documentation on how to specifically get CPU temp on a range of machines/arches 2026-05-27 16:29:00 Answer I guess is to read lm-sensors source 2026-05-27 16:29:12 65 f . -9223372036854775808 ok 2026-05-27 16:29:23 On big brother I can go up to 65 2026-05-27 16:29:49 And then 66! ≡ 0 (mod 2⁶⁴) 2026-05-27 16:36:34 : 33f2p 33 16 8 4 2 1 begin + depth 1 = until ; 33f2p . redefined 33f2p 64 ok 2026-05-27 16:39:04 I find dc easier, no explicit loops constructs at all, you simply define string with `[ ]` then save in register with `d sr x` and execute with conditionals like >r or quit with conditional and execute with lrx 2026-05-27 16:39:23 watching the strace may be adequate without reading the source 2026-05-27 16:43:34 It's adequate for getting my own CPU temp, which is just as good as spelunking in my own /sys, and is not helpful to achieve what I've said which is to get the value portably 2026-05-27 16:45:56 But I'm assuming the source is capable of reading it for most x86 CPUs 2026-05-27 16:51:22 https://learnxinyminutes.com/files/learnforth.fs this one doesn't have while loop 2026-05-27 16:52:20 begin ... while ... repeat 2026-05-27 16:54:35 Stalevar: maybe read Starting Forth 2026-05-27 16:55:31 : sum ( a ... -- a+... ) begin depth 1 > while + repeat ; 33 16 8 4 2 1 sum . redefined sum 64 ok 2026-05-27 16:56:40 xentrac, it has lots of fluff which I already know, such as what is reverse polish notation. Such books are for absolute beginners. I already know stack languages just want reminder on syntax 2026-05-27 16:58:50 maybe Thinking Forth then 2026-05-27 17:05:40 xentrac, maybe forth reference manual? 2026-05-27 17:09:33 gforth info actually works, seem 2026-05-27 17:10:01 https://www.google.com/search?q=mottronix 2026-05-27 17:10:18 You can use `THEN' instead of `ENDIF'. Indeed, `THEN' is standard, and `ENDIF' is not, although it is quite popular. We recommend using `ENDIF', because it is less confusing for people who also know other languages (and is not prone to reinforcing negative prejudices against Forth in these people). Adding `ENDIF' to a system that only supplies `THEN' is simple: 2026-05-27 17:10:36 That's excerpt from /opt/gforth/share/info 2026-05-27 17:11:08 Hm... do you think endif is better than than? 2026-05-27 17:12:50 1 if 2 else 3 endif . unable to parse: endif 2026-05-27 17:12:50 1 if 2 else 3 then . 2 ok 2026-05-27 17:12:58 zeptoforth doesn't know endif 2026-05-27 17:13:16 no 2026-05-27 17:15:06 Adding `ENDIF' to a system that only supplies `THEN' is simple: : ENDIF POSTPONE then ; immediate 2026-05-27 17:15:57 yes 2026-05-27 19:48:58 veltas: i made a how-to guide, although is kind of meh 2026-05-27 19:49:04 and there is also a repl :0 2026-05-27 19:49:13 https://gitlab.com/ohmycat/oh/-/blob/main/how-to.md 2026-05-27 19:49:27 it's incomplete 2026-05-27 19:49:39 and i should remove all and try to make a proper tutorial instead 2026-05-27 19:49:59 you can evalute "words" to push a list of word names on the stack, and "r" resets the stack 2026-05-27 19:55:25 the readme explains internals a bit btw