2022-04-26 10:31:58 Ok, I think I'm actually beginning to have some "idea glimmers" toward folding APL and Forth together. Except not really "Forth" as in "native Forth" - what I'm picturing would become part of that "Octave/Matlab-like environment" that I want to do someday. 2022-04-26 10:32:31 I'd already decided that would involve a more sophisticated alternate interpreter that I could load up when I wanted it - I think that's where this stuff would fit. 2022-04-26 10:33:24 What sort of motivated me was the APL expression +/+\⍳10 2022-04-26 10:33:39 That turns out to be just a number - 220, calculated from the integers 1-10. 2022-04-26 10:33:56 I decided to tinker with writing that in Forth, and man, that got messy pretty fast. 2022-04-26 10:34:50 I didn't finish. 2022-04-26 10:36:18 The ⍳10 gives you the integers 1-10, the +\ gives you the partial sums, 1 3 6 10 15 ... and the +/ just adds those up. 2022-04-26 10:36:58 But try writing : ⍳+\+/ ... ; so that 10 ⍳+\+/ yields that 220. :-) 2022-04-26 10:58:07 Actually I think better RPN syntax would be ⍳\+/+ 2022-04-26 10:58:24 The operators \ and / would take their required function argument from the input stream. 2022-04-26 11:25:17 : kip 0 11 1 do 0 i 1+ 1 do i + loop + loop ; 2022-04-26 11:26:03 If I had to do this for a program and cared I might just figure out the polynomial to calculate that 2022-04-26 11:26:31 And then of course the word I presented wouldn't be sufficient, but in your example 1 and 10 were literals so it seemed fair 2022-04-26 11:48:14 Yeah, I was trying to write it "explicitly," iteratively, but it did occur to me there was probably a brainy way of getting it. :-) 2022-04-26 11:48:41 But, very nice work - I like it. 2022-04-26 11:49:03 I don't have do loops in my Forth, so I'd immediately have to have more than one definition. 2022-04-26 11:49:28 I think I could have written it in a few minutes, but I just decided it wasn't worth the effort - the real point was that it was "nowhere near as terse" as in APL. 2022-04-26 11:50:01 My system is set up so that the only place I can "loop back to" is the beginning of the word - basically I do everything with tail recursion. 2022-04-26 11:50:24 Though, I *can* put new word labels in the middle of a definition, and then loop back to that later one. 2022-04-26 11:50:45 : foo ...setup... : bar ...loop code... me ; 2022-04-26 11:50:51 That would loop back to bar. 2022-04-26 11:51:04 But... that's still really two definitions. 2022-04-26 11:51:17 And I would probably write it on two lines. 2022-04-26 11:51:46 So foo would be sitting there looking like "a definition," but it would have no ; 2022-04-26 12:00:13 I kind of like it, because it encourages / demands factoring. I write shorter definitions these days. 2022-04-26 12:01:04 And I think that at least in a lot of cases (I'll stop short of saying "most"), a loop body probably deserves to be an identifiable word. 2022-04-26 12:22:34 A long time ago, I had a language where the : simply saved the data, code, and bss offsets and associated it with a label. A lot of things worked out really nicely with that concept. 2022-04-26 12:23:27 That's really the gist of what mine's doing. 2022-04-26 12:23:46 That and it runs ] to put me in compile mode. 2022-04-26 12:24:19 ; compiles (;) and runs [ but I also have ;, that just compiles the (;). 2022-04-26 12:25:08 : also sets the CFA of the new label to (:) (aka docol). 2022-04-26 12:28:00 Anyway, yes, it does work very nicely. I like it a lot better than the old days, when I interspersed my headers with the bodies. 2022-04-26 12:28:15 my ;, word was ;; but sounds very similar. Mine went strait to machine code or assembly. I was interested in having a "forth" like glue language to interoperate with C libs on linux eco system. I was happy with the experiment. 2022-04-26 12:28:47 I have ;; to - it has the effect of r> drop ; 2022-04-26 12:28:54 Double return. 2022-04-26 12:29:02 Except as a primitive. 2022-04-26 12:29:15 too 2022-04-26 12:29:43 I guess my ;, is what a lot of systems call 'exit' 2022-04-26 12:30:15 right. I remember one nice thing was it was easy to do the peep-hole TCO optimization that a `call xxx, ret` pattern could become `jmp xxx` It was a pleasant surpise that resulted. 2022-04-26 12:30:15 To me the ;, name says "well, do ; except we're not done yet." 2022-04-26 12:30:28 ;, does make more sense. 2022-04-26 12:30:44 Well, I figure I win a few, lose a few. :-) 2022-04-26 12:31:17 Honestly using . for ; and , for ;, would be even more "literate." 2022-04-26 12:31:40 Especially if you recognized them regardless of whether they had spaces around them or not. 2022-04-26 12:32:36 But history and tradition are powerful forces. 2022-04-26 13:36:22 Gotta love this click bait article teaser in the email Electronics Design sent me this morning: 2022-04-26 13:36:25 Low IQ is Vital in Implantables/Multistage Doherty MMIC Driver 2022-04-26 13:36:30 :-) 2022-04-26 13:37:23 I sub Q - quiescent current. 2022-04-26 14:28:47 KipIngram: "My system is set up so that the only place I can "loop back to" is the beginning of the word" 2022-04-26 14:28:55 I like stuff like that, it's quite elegant 2022-04-26 14:29:12 I did something like this with my interpreted loop lol 2022-04-26 14:29:19 I had a word that conditionally set >IN to 0 2022-04-26 14:31:09 Yes - I played with that idea over the last few weeks some. Makes it easy to time measure interpreter and compiler operations. 2022-04-26 14:31:37 I don't know why it took me decades to even think about doing that. :-| 2022-04-26 14:35:18 I did those timings with a stopwatch, but since then I've written a time word, so now I'm in a position to get some pretty refined insight into system speed. Start something up that will just run several hours or something, and collect a bunch of different samplings. 2022-04-26 14:35:33 It's clear that background OS activities are making things vary. 2022-04-26 14:36:51 It bugs me a little that you can't avoid that in modern systems - seems like it woud be worth having a way to say "give me all of it - no interruptions." Of course, that would have consequences, but it still ought to be a choice you can make. 2022-04-26 14:37:33 Certainly on systems with say 8 cores - it should be easy then for the OS to butt out of a core and let you have it non-stop. 2022-04-26 14:38:45 I think I did this because someone asked if you can have a loop outside of a word 2022-04-26 14:38:55 outside of a colon definition I mena 2022-04-26 14:39:51 Right. 2022-04-26 14:40:04 You can, and you can actually do interesting things with it, too. 2022-04-26 14:40:48 If you wanted to you could create a "marker" word that saved >IN such that you could jump back to anywhere in the line. 2022-04-26 14:42:22 I don't know how many "real applications" would profit from it, but it's great for being able to performance test your system. 2022-04-26 14:45:36 I guess you could use it to init an array or something without creating some kind of function to do it 2022-04-26 14:45:56 Yes, that's true. 2022-04-26 14:46:15 That's "general purpose" enough to qualify as valuable, I think. 2022-04-26 21:54:17 This APL bit is good: 2022-04-26 21:54:19 https://www.dyalog.com/uploads/documents/Papers/dfns.pdf