2023-01-18 00:01:25 Still, can somebody recommend a forth cheatsheet? Such as a list of all basic words/constructs, with one line explaining what it does for each, all in one page? 2023-01-18 00:01:57 I don't want to read an entire book, I pretty much got the idea, I just want to get a database of things I can do to actually start writing forth 2023-01-18 00:37:03 Many of these books have "glossary" sections, Stalevar. That's the closest thing I can think of to a "cheat sheet." A Forth system might have hundreds of words. Of course, there are very common ones. Some you just have to learn, such as the word ! which stores the second item on the stack at the address called out by the top item, or @ which takes the top item as an address and replaces it with the 2023-01-18 00:37:04 contents of that address. 2023-01-18 00:37:32 Arithmetic is pretty straightforward, you have + - * / all of which operate on the top two stack items, replacing them by one result. 2023-01-18 00:38:04 Stack operatores. swap exchanges the top two items, dup duplicates the top item, over copies the second item to the top, and so on. 2023-01-18 00:38:25 I haven't looked at Starting Forth in a long time, but i'd be surprised if it doesn't have a glossary. 2023-01-18 00:39:30 Alright, I will try to take a look at the end of SF book to see if it does. But anyway, as you can see, dc and forth are similar enough that I was able to write simple forth stuff after learning it for like 30 minutes 2023-01-18 00:46:48 Forth isn't hard to learn. But dc doesn't have colon definitions, does it? 2023-01-18 00:47:04 The man page mentioned macros, but a macro is different from a compiled Forth word. 2023-01-18 00:47:54 This might be a start: 2023-01-18 00:47:56 https://archive.org/details/FigFORTHGlossary/page/n5/mode/2up 2023-01-18 00:48:10 Fig Forth is a very old Forth, but the most common words won't have changed much. 2023-01-18 00:48:36 It will at least get you the memory operations, stack operations, arithmetic, and basic compiler operation. 2023-01-18 00:51:06 Here is a glossary offered up by the standards people: 2023-01-18 00:51:08 https://forth-standard.org/standard/core 2023-01-18 00:51:26 Unfortunately not in "cheat sheet" format - you have to click on a word to see anything about it. 2023-01-18 00:51:54 Here's one more: 2023-01-18 00:51:56 http://www.mosaic-industries.com/embedded-systems/c-ide-software-development/c-compiler/forth-library-v44/forth-words-a-d 2023-01-18 00:52:57 I see that last one looks like it's for a 16-bit Forth; it mentions things being 16-bit quantities, whereas these days they're often 32 or 64. 2023-01-18 00:53:19 Any given Forth you look at will have a "cell size," either 16, 32, or 64 bits. 2023-01-18 00:54:28 A larger word system, though, will give you memory store and fetch operations for the smaller sizes as well. For a 64 bit system, storing 64, 32, 16, and 8 bit quantities would usually be words ! h! w! and c!. 2023-01-18 00:54:36 Similar for @ which is the fetch word. 2023-01-18 00:55:01 On the stack everything is 64 bits - even characters are stored in 64-bit cells. 2023-01-18 00:55:09 for a 64-bit system, that is. 2023-01-18 01:09:07 yeah, I see 2023-01-18 01:09:29 In meantime I wrote a checksum calculator in Radio 86rk format in dc 2023-01-18 01:09:44 $ head -c-5 ../checksum.v6.rkr | tail -c+5 | od -An -tx1 -vw1 | tr a-f A-F | dc -e '16doi[q]sq100ddsh*[dz?z3R-2!=qd3R+lxx]dsxx+sdr101*lh~3R+lh%rlh*+p' | grep -o ....$ 2023-01-18 01:09:44 1EA4 2023-01-18 01:10:05 OK, not entirely in dc, since it doesn't have any option to read a byte from binary stdin 2023-01-18 01:10:34 Does forth have some word which reads one byte from stdin, and with some check for EOF ? 2023-01-18 01:12:24 Since dc doesn't have either, I rely on od -An -tx1 -vw1, and since it will read nothing after last byte, stack depth wont change as expected, so I use it as end of input detector (z measures stack depth) 2023-01-18 01:15:00 KipIngram, [q]sq is equivalent of : q q ; 2023-01-18 01:15:50 except say, conditionals expect registers (variables), so I need a variable holding q, I can't use bareword q 2023-01-18 01:15:58 while in forth it would do nothing 2023-01-18 01:17:07 also dc doesn't have drop, so I use sd instead ( store to (d)ump variable ) 2023-01-18 01:18:59 And dc also doesn't have anything like printf / format / whatever, so I can't print checksum in desired format with leading zeroes, so I add 10000 to it, and then use grep ....$ to print last four digits, including zeroes 2023-01-18 01:19:42 KipIngram, so I am kinda looking for something like dc, but without aforementioned deficiencies 2023-01-18 01:20:47 Also I store loop body in x variable, so I can use lxx to load x and e(x)ecute it unconditionally 2023-01-18 01:21:43 actually maybe I can shift the loop body around to use conditional execution 2023-01-18 01:24:39 KipIngram, do you think Forth is going to be it, or maybe I should use some other stack-based language? 2023-01-18 01:46:56 KipIngram, also thanks for the links, but they won't do it. But I remembered I have https://github.com/cesarblum/sectorforth which means that if something is implemented there, it's essential, so I can use its readme to know the basics of forth 2023-01-18 01:50:05 Well, I'm unnaturally fond of Forth - I'm likely biased on judging its fitness for some things. 2023-01-18 01:50:36 I do believe Forth is a language with humble starting capabilities that can be made into anything you want it to be. 2023-01-18 01:50:47 And all the while, it will continue to feel like the same language. 2023-01-18 01:51:19 Always just new words for the dictionary, but as you build up those words can accomplish nigh on anything. 2023-01-18 01:51:56 Yeah, but same goes with procedures or functions in Pascal, C, C++ or whatever, or even dc macros maybe 2023-01-18 01:52:20 I'm wondering if anybody attempted to write something somewhat complex in dc 2023-01-18 01:52:34 The biggest thing I wrote in dc was 99 bottles of beer 2023-01-18 01:52:41 Not really. C functions look very different from C "operations." 2023-01-18 01:52:58 The "shape" of stuff you add is different from the stuff you build it out of. 2023-01-18 01:52:59 ( but with singular for 1 bottle and things ) 2023-01-18 01:53:03 That's not the case with Forth. 2023-01-18 01:53:18 then how about Tcl? 2023-01-18 01:53:40 my_function(a, b) is different from a + b 2023-01-18 01:53:49 You can redefine even things like if, for and while, but it's not advised because it will break subroutines 2023-01-18 01:54:12 You can define ::mathop::+ or something in Tcl too 2023-01-18 01:54:14 afair 2023-01-18 01:54:14 But in forth it's a @ b @ + so the + word just takes its arguments from the stack and leaves its results. And that is the case for any new word you write. 2023-01-18 01:54:39 I got the idea, then how about Tcl? 2023-01-18 01:54:40 It has a "seamlessness" that other languages lack. 2023-01-18 01:54:43 Except maybe Lisp. 2023-01-18 01:54:49 And others of that ilk. 2023-01-18 01:55:00 Tcl is not lisp 2023-01-18 01:55:18 But it is also quite powerful in this regards 2023-01-18 01:55:33 you can redefine everything but basic 15 rules of syntax 2023-01-18 01:56:47 Ah, also Rebol 2023-01-18 01:57:13 https://en.wikipedia.org/wiki/Red_(programming_language) and this one 2023-01-18 01:59:57 I don't know tcl. I was really referring to the "major languages," say C, Python, etc. 2023-01-18 02:00:14 Java. 2023-01-18 02:00:35 Hey, you should google up a paper called "The Seven Ur languages." You might find it interesting. 2023-01-18 02:02:03 I'm about to hit the sack. I have to fast eight hours before that dental work tomorrow, so I stayed up until now to have last food. 2023-01-18 02:02:10 That's done now. 2023-01-18 02:02:47 You mean, hit the stack? 2023-01-18 02:02:54 :-) 2023-01-18 02:03:15 Good luck with you quest. Catch you later. 2023-01-18 02:03:26 Thanks, good night 2023-01-18 09:40:18 Forthran 2023-01-18 09:44:40 Stalevar: https://www.taygeta.com/fsl/docs/551.jvn.fall01/ftran111.f 2023-01-18 09:45:11 and other related bits at https://www.taygeta.com/fsl/docs/551.jvn.fall01/programs.htm 2023-01-18 09:49:53 I was just trying to make a pun 2023-01-18 09:50:38 crc, I still can't find a real short one page forth guide, which just lists the most common expressions with explanations 2023-01-18 09:50:53 Stalevar: ad did not succeed in FORMULAting one? 2023-01-18 09:50:56 maybe someone needs to write it 2023-01-18 09:51:11 s/ad/and/ 2023-01-18 11:19:07 Well, the tooth is out. 2023-01-18 11:19:38 The dentist has been killing people all this time? 2023-01-18 11:19:56 Reverse pun, sorry. 2023-01-18 11:20:10 that got a snort out of me, 2023-01-18 11:20:12 :-) 2023-01-18 11:20:31 Well, i was "moderately sedated" for this, which I wasn't terribly happy about. 2023-01-18 11:20:47 You hear horror stories about bein put under. 2023-01-18 11:20:52 But... all is well. 2023-01-18 11:29:50 I've had worse. I was under-anaesthesised once. Woke up on the table. 2023-01-18 11:30:42 Apparently I tried to get up because I needed to "go home" and burst the stitches they were half way through. 2023-01-18 11:31:44 I'm not sure how that wasn't apparent on the ECG monitor, but how and ever... 2023-01-18 11:43:38 Stalevar: I had started on something like that for my Forth, but it's not finished 2023-01-18 11:43:41 https://gist.github.com/crcx/5192a8d36134042f35175d6689a00ff4 2023-01-18 11:48:15 Yeah, but why not there is thing for forth? 2023-01-18 11:48:23 Yeah, that was what I was thinking about 2023-01-18 11:49:17 crc, https://bpa.st/APCSM 2023-01-18 11:59:05 forth systems often have poor documentation 2023-01-18 12:21:22 I expect what may happen in a lot of those cases is like the situation with mine. I'm writing it "for me." I may share it when I regard it as "done enough." But it's still really for me, and if others find it useful that's fine, but it's not really my motivation. 2023-01-18 12:22:07 I have a particular way I plan on doing the documentation, and the system doesn't support that yet, so I've not done much. 2023-01-18 12:23:14 I write mine primarily for my personal use, but still try to achieve a solid set of documentation 2023-01-18 12:24:10 mainly for yourself as you like many do not have foggiest idea what the code does when you revisit it six months from now? 2023-01-18 12:25:28 I've actually done alright on that front this time. 2023-01-18 12:25:49 I have revisited some of it like a year later and it was fairly evident to me what I was doing. 2023-01-18 12:26:12 Long term I do plan to get some documentation attached to it. 2023-01-18 12:26:29 I want to have it accessible via links form the source. 2023-01-18 12:26:50 So I need some measure of progress toward a file system to set that up. 2023-01-18 12:27:02 I've already worked out how I plan to store the links. 2023-01-18 12:27:18 It'll be hierarchical; I'll be able to link from light comments to more detailed comments too. 2023-01-18 12:27:21 Wiki-like. 2023-01-18 12:28:00 When that's all working I may find myself more interested in a large monitor, or multiple monitors, or whatever. 2023-01-18 12:47:42 Zarutian_iPad: programs I write for long-term use are commented extensively, so that's not a big issue in my experience 2023-01-18 12:48:11 ... would you in six months have trouble following ... 2023-01-18 18:13:02 You know, I remember this "feature" of old HP calculator programming instructional materials. 2023-01-18 18:13:10 They used PROMPT for all input. 2023-01-18 18:13:17 PROMPT PROMPT PROMPT PROMPT 2023-01-18 18:13:41 I never liked it - I liked just pounding all my inputs onto the stack and then executing the program, and then finding all my outputs on the stack. 2023-01-18 18:13:57 They also insisted on using VIEW to display all the output, one by one. 2023-01-18 18:14:18 The problem with both of those things is that it forces the program to be interactive. 2023-01-18 18:14:35 You can't use it as a "subroutine" from some other program. 2023-01-18 18:15:27 But I figure they liked it because it gave them a way to show off their fancy (at the time) alpha capabilities; each prompt would tell you what it was prompting for, and each VIEW would tell you what it was. 2023-01-18 18:15:53 The HP41C was the first consumer calculator that could do that, so not surprising they wanted to push it in front of you at every opportunity. 2023-01-18 21:12:07 Hey, this looks educational: 2023-01-18 21:12:09 https://misclab.umeoce.maine.edu/education/VisibilityLab/reports/SIO_80-13.pdf 2023-01-18 21:12:35 It presents the actual algorithmic operation of solar system ephemeris calculations. 2023-01-18 21:16:25 It turns out to be pretty simple to pop onto a calculator any one particular bit of solar system info. They've worked out polynomial approximations that are quite accurate over some period of a couple hundred years. 2023-01-18 21:17:29 What I think would be more interesting, and challenging, would be to see how "complete" a system you could pack onto a machine. Not only complete in covering all relatively easy to observe objects, but also complete in the sense of presenting the information to you in as many useful ways as possible. 2023-01-18 21:17:55 I've a fair idea of what all of the objects would be, but I'm not very clear at all on all the questions you might like to be able to ask. 2023-01-18 21:18:22 Position in sky right now, rise and set times, time something is highest in the sky. 2023-01-18 21:18:47 Maybe the season a particular object will be favorable for viewing at your location on Earth. And so on. 2023-01-18 21:18:59 Lots of ways you could slice and dice it. 2023-01-18 21:24:19 how does it handle mercury being in retrograde 2023-01-18 21:37:15 I've nowhere near studied it enough to answer that. 2023-01-18 21:39:00 One way (which I am not claiming good performance for - it's just something that would avoid "quirky" things) would be to fit your polynomials to the solar coordinates of the planets (for example), and then for the date and time you're interested in coordinate system tranform that to geocentric coordinates. 2023-01-18 21:39:15 No retrograde in the solar centric motion. 2023-01-18 21:39:29 The transformation would bring that in automatically. 2023-01-18 22:22:38 That's probably the best way to do it anyway, since the two-body influence of the sun dominates all the motions. The rest get added in as perturbations. 2023-01-18 23:04:07 hi everyone 2023-01-18 23:07:39 Is there a typical Forth implementation used when text entry is difficult? 2023-01-18 23:08:41 I am thinking of writing an implementation where the input has to be in morse code (so, A-Z, 0-9, space, the chars ?_".@'-;!(),:+=/ and a few control chars) 2023-01-18 23:09:25 i figure comparison operators could be digraps LL less than GG greater than 2023-01-18 23:19:44 I can't say that I've ever encountered that application... I think you're in uncharted territory. 2023-01-18 23:20:13 But I don't see any reason you couldn't make it work. 2023-01-18 23:22:57 Found another article on ephemeris creation: 2023-01-18 23:22:59 https://www.astro.uvic.ca/~tatum/celmechs/celm10.pdf 2023-01-18 23:23:15 Looks like there's a whole book there, with simple URL tweaking. 2023-01-18 23:23:41 yes, all chapters seem to be there. 2023-01-18 23:25:44 ToC here: https://www.astro.uvic.ca/~tatum/celmechs.html 2023-01-18 23:29:06 Oh, now that is an interesting point he makes. 2023-01-18 23:29:12 Consider the differential equation: 2023-01-18 23:29:35 dy/dx = (x+y)/(x-y) 2023-01-18 23:29:48 No clue what it's application is - may just be a motivating example. 2023-01-18 23:30:20 Anyway, for initial condition (x=1, y=0) this has a closed form solution: 2023-01-18 23:30:41 ln(x^2 + y^2) = 2*atan(y/x) 2023-01-18 23:30:48 Or at least a solution not involving derivatives. 2023-01-18 23:31:14 So, great - if you need y at one or a few x's, then you can solve that solution. 2023-01-18 23:32:11 But... if you need an entire TABLE of y = f(x), across some broad range with fine resolution, then it turns out for a given table size and accuracy it is much more computationally efficient to numerically integrate the differential equation than it is to use the derivative-free solution. 2023-01-18 23:32:42 Because using that "solution" requires a number of evaluations of transcendental functions, whereas the numerical integration requires only arithmetic. 2023-01-18 23:34:55 Heh. 2023-01-18 23:34:59 'It is assumed that the reader of 2023-01-18 23:35:00 this chapter, however, wants to be able to carry out a numerical integration without calling upon 2023-01-18 23:35:02 an existing routine that has been written by somebody else. 2023-01-18 23:35:04 " 2023-01-18 23:35:16 That's a person I can respect. 2023-01-18 23:42:52 very nice