2024-04-27 02:47:43 how do you implement a recurse that works within does> and compiles to only one cell? 2024-04-27 02:48:04 or can you? 2024-04-27 02:48:48 obviously depends on the vm, but i mean the usual dtc or itc vms 2024-04-27 03:39:38 followup question: is there actually ever a good reason to recurse inside of does> ? 2024-04-27 03:49:12 zelgomer: in over 20 years of using Forth, I've never used recurse in a does> 2024-04-27 04:02:01 yeah, that sounds about right 2024-04-27 04:31:17 wait this isn't hard, i'm just stupid. if i really wanted it, i can just make the does> part have a code field. normally it's never uses, but only there so that recurse can point to it like a real xt. 2024-04-27 09:45:55 I know it's not what you asked but RECURSE appearing after DOES> is specifically called out as ambiguous behaviour in ANS 2024-04-27 09:50:11 In my implementations I believe it would call the colon def, not the DOES> def 2024-04-27 09:50:55 It's an interesting question, I've not thought about it until now 2024-04-27 09:51:42 And I'll be honest, it's very rare I use RECURSE at all, maybe I should use it more 2024-04-27 09:51:50 It's probably more 'elegant' 2024-04-27 09:55:59 Anyone here use RECURSE a lot? 2024-04-27 09:56:04 Or recursion generally? 2024-04-27 10:05:50 veltas: KipIngram uses tail recursion 2024-04-27 10:06:27 he uses it for loops 2024-04-27 10:06:53 Yeah I suppose he does, and it is quite elegant 2024-04-27 10:07:53 If you've got a recursive structure then it's natural to use recursion. For example binary trees: http://0x0.st/Xoyq.forth 2024-04-27 10:09:19 I also used it for loops quite often, but RECURSE on it's own can blow up the rstack. gforth has JUMP for that, dunno about others. 2024-04-27 11:17:54 Yeah trees are a good one 2024-04-27 18:10:18 Actually what I really wind up doing is in fact iteration, and kind of looks like iteration in my code. But yes, it's equivalent to tail recursion with return stack optimization. 2024-04-27 18:12:05 What it actually does is conditionally loop back to the most recently defined name in the dictionary; I can put : in the middle of a definition, so I can loop back to some point that's after where I "entered" the word. 2024-04-27 18:12:38 I've thought about adding a feature to let me do that without actually having to add a new name to the dictionary, but I haven't implemented that to date. 2024-04-27 18:13:23 I might call that :* or :? or something; it would just record an address to later be used in the jump. 2024-04-27 18:48:19 there is definitely less use for recursion in forth since you have direct control of your stack 2024-04-27 18:50:34 my forth auto converts an object into a thruthy is a boolean operation is involved, e.g. `'hello' 'world' and` puts 'true' into the stack because the logic-and word "and" pushes 2 operands (in this case 2 strings) and checks if they are thruthy, in the case of strings is: if len>0, does this make sense? 2024-04-27 18:51:08 also, i may have thought of a better way to do recursion than the "recurse" immediate word. instead, how about a dynamic header called "self" that's updated with the currently-defining colon word? so you can always write ": foo self ;" and in that case, when "self" is encountered, its header points to foo. doing it this way means it's a first class word the same as all other words, too, which means foo 2024-04-27 18:51:14 can push itself on the stack with ": foo ' self ;" and it can compile itself into other words ": foo postpone self ;" 2024-04-27 18:53:55 rendar: seems consistent with some other languages 2024-04-27 19:06:02 python for one treats strings that way. lua treats all strings as true. 2024-04-27 19:10:36 (when "false" t) 2024-04-27 19:12:36 zelgomer, yep 2024-04-27 19:13:08 my doubt is, what about 'not' word? `'hello' not` should be false or throw an error?! 2024-04-27 19:13:29 i think, to be consistent, it should push false to the top of the stack 2024-04-27 19:37:45 that's what i would probably expect 2024-04-27 19:38:23 if you're going to treat these as logical operators and not bitwise, then "hello" not -> false 2024-04-27 19:38:52 yes 2024-04-27 20:08:03 just finished replacing my "recurse" with my magic header described above. this is so much better. not sure i'm happy with the name "self" for it, but that's typical for me. 2024-04-27 22:07:51 Looks like in the 1980's, just after Steve Jobs was pushed out, Apple set out to design its own CPU for the next round of Macs. And it was going to be... a stack machine. Evidently that got dropped because the compiler team told the bosses that they had no idea how to write a compiler for it. :-| 2024-04-27 22:08:13 So the switched over to a very advanced multi-core (which hadn't been done yet) RISC design. 2024-04-27 22:08:19 It never made it. 2024-04-27 22:08:49 It was code-named Scorpius and the arhchitecture spec for it is somewhere out there on the web, apparently. 2024-04-27 22:09:41 https://archive.org/details/scorpius_architecture 2024-04-27 22:10:29 It was also going to support SIMD. 2024-04-27 22:16:25 Wow - if they had pulled that off they'd have leapfrogged technology at least a decade. I'm sure it would have cost a pretty penny that much earlier, though. 2024-04-27 22:17:34 But what really gets me about the whole story is that the software team claimed they couldn't write anything good for the stack machine design. 2024-04-27 22:17:51 I thought they were going to say it wasn't fast enough or something. 2024-04-27 22:18:59 We all know here that they COULD have written an OS for a stack machine. I guess they just wanted to be able to take their existing source code, push a button, and have their software, instead of actually thinking. 2024-04-27 22:41:01 KipIngram there is inertia and leveraging involved, its not about just thinking. 2024-04-27 22:41:16 if it was, Think Different would have been a bigger win. 2024-04-27 23:13:28 zelgomer, can you give me an example on how your recurse works? 2024-04-27 23:14:33 KipIngram, wow very interesting, basically they predicted RiscV? 2024-04-27 23:17:02 and they failed, while Moto figured it out and delivered something in the 88K just a year later in lab, and 3 years later in production. 2024-04-27 23:17:23 but not stack based as I recall. 2024-04-27 23:17:29 HP kinda had all this figured out too. 2024-04-27 23:18:19 and what about the transputer folks, in the late 70s and mid 80s. 2024-04-27 23:20:10 say, what is the topic de jure? 2024-04-27 23:21:37 I can look at the logs but just curious 2024-04-27 23:21:49 cpu design? 2024-04-27 23:30:43 cpu design, rpn systems, PID/PIC stuff, software on top of it all, and of course history of forth boot systems and forth controlling the telescopes of the world. 2024-04-27 23:30:57 up to you, kinda big range of stuff, since shit runs on forth. 2024-04-27 23:31:15 I do have that as a T-shirt somewhere from the 70s, with the garage smiley face on top of it. 2024-04-27 23:31:32 I think it says 'stuff', not shit 2024-04-27 23:32:55 PID being Proprotional Integrative Deretive controler? and PIC being that thing MicroChip MCU? 2024-04-27 23:35:20 many PIDs are based on forth systems, or C to forth, or asm. PIC, yes. 2024-04-27 23:35:35 and many others are not :) 2024-04-27 23:36:18 Zarutian_iPad you can chat about anything for the most part, the topic in this channel seems to be a guidance, more than a nazi directive. 2024-04-27 23:36:33 ??? 2024-04-27 23:36:46 Zarutian_iPad what is on your mind? 2024-04-27 23:36:53 what would you like to chat about. 2024-04-27 23:37:32 not what I meant, just curious what the discussion was that I got into the tail end if when I joined into the channel 2024-04-27 23:39:12 https://github.com/organix/uFork/blob/main/fpga/fomu/cpu/cpu.md is yet another Forth cpu but in a project I am working in 2024-04-27 23:39:18 neat 2024-04-27 23:39:25 got some progression with it? 2024-04-27 23:39:46 I can't look it over, no github access on these old puters, sorry. 2024-04-27 23:40:20 this cpu is basically the microcode cpu that is being used to implement a more complex architecture 2024-04-27 23:41:23 this more complex architecture is uFork 2024-04-27 23:42:27 why use a forth cpu for the microcode? its the only thing I know of that can have high code density yet be rather easy to implement 2024-04-27 23:44:52 and I only have 4096 cells of program memory (will have access to 16 kibiCells scratch memory if needed) to do it 2024-04-27 23:47:16 this microcode cpu draws inspiration from excamera j1a, Philips Koopmans book, and other such dual stack machines 2024-04-27 23:50:26 HappyPassover: no github access? or just to old computer without enough memory for the regrettably js heavy github page? 2024-04-27 23:51:10 if latter then here https://raw.githubusercontent.com/organix/uFork/main/fpga/fomu/cpu/cpu.md 2024-04-27 23:52:13 yep, on the former, can see the latter. 2024-04-27 23:52:28 My system is 2006, runs 10.6.8, and is heavily used and liked :) 2024-04-27 23:53:33 windows ten? 2024-04-27 23:54:05 osx 10.6.8 2024-04-27 23:54:13 snow slut 2024-04-27 23:54:28 https://en.wikipedia.org/wiki/Mac_OS_X_Snow_Leopard 2024-04-27 23:55:17 righty! I am actually using an who know old iPad here hence the nick suffix 2024-04-27 23:55:27 :) 2024-04-27 23:55:52 I have 4 of these computers, all 8 core, all xeon, all cheap, and fully upgraded to 32 gigs and such, this may work for me to a death bed. 2024-04-27 23:59:29 https://justine.lol/ape.html is neat, specially when you could make it .docx, .love, and other such zip based formats 2024-04-27 23:59:49 you know just to troll folks a bit