2023-09-17 06:31:38 :O 2023-09-17 06:45:45 about the error handlers, it can end being useful cause they can return something on the stack and execution should continue 2023-09-17 06:47:06 for example they could take input from the user if an argument was wrong and push it on the stack 2023-09-17 06:47:26 execution should resume after the error word 2023-09-17 06:48:19 and an unhandler error should terminate the program 2023-09-17 06:48:27 unhandled* 2023-09-17 06:48:43 at least looks much better than just printing an error 2023-09-17 06:49:58 and you have a return stack, so you can even play more tricks 2023-09-17 11:32:06 Yeah, I guess you could try to have an exception handler "correct" a bad situation. However, in the vast majority of cases the error occurs because you did something wrong - such a handler would have to be able to figure out "what you really intended" and that doesn't strike me as very easy. 2023-09-17 11:32:37 I'm content to just do what's necessary to keep the system from crashing - I fail gracefully and put things back as they were to start with so I can try again. 2023-09-17 11:33:07 That way I don't have to fret over "what part of my input line ran and what part didn't?" 2023-09-17 11:33:28 If there's an error - none of ran. Clean and simple. 2023-09-17 11:33:34 And well-defined. 2023-09-17 11:41:12 Bayes theorem questions sure are popular on Quora. Always seem like someone's homework problem. 2023-09-17 12:26:55 What??? 2023-09-17 12:26:57 https://www.youtube.com/watch?v=94mV7Fmbx88 2023-09-17 12:27:41 probably for folks trying to get into data science or AI 2023-09-17 12:39:50 I just find it fascinating that Pythagorean triples and the Fibonacci sequence are related. Numbers are just so cool. 2023-09-17 13:07:22 KipIngram: yeah it blows my mind how often the value of sin(pi) crops up in maths 2023-09-17 13:09:12 at least they put beangate behind them 2023-09-17 13:24:56 beangate? 2023-09-17 13:28:34 "Pythagoras's Belief That Beans Are Human May Have Killed Him", etc 2023-09-17 13:43:16 thrig: serious? 2023-09-17 13:47:13 https://www.britannica.com/science/Pythagoreanism etc 2023-09-17 13:53:03 weird 2023-09-17 13:53:09 oh well, the maths still works out 2023-09-17 14:42:14 seems to work 2023-09-17 14:42:23 (oh(my(cat"is")very)"nice") it can read this 2023-09-17 14:43:41 it seems able to read them with any combination of spaces or lack of them 2023-09-17 14:44:26 and for what the interpreter knows, ( and " are just a word 2023-09-17 14:45:37 ((( will be read as three separate words 2023-09-17 14:46:13 actually the first ( will trigger the reading of the other and the other the last one 2023-09-17 14:46:46 i never got used to the " strings" 2023-09-17 14:47:00 i always forget the space and i dislike it a lot 2023-09-17 14:47:20 now i'm happy 2023-09-17 15:00:38 lisp 2023-09-17 15:00:57 I think you just want a lisp 2023-09-17 15:02:43 yes 2023-09-17 15:03:16 my lang is becoming a lisp gradually 2023-09-17 15:03:38 it was never a forth :/ 2023-09-17 15:03:59 but every time it gets closer and closer to lisp 2023-09-17 15:04:53 from the start it used lists as code, then quote and quasiquote, then lexical scope and closures 2023-09-17 15:05:07 now it can read s-expressions properly 2023-09-17 15:05:40 just need apply and eval 2023-09-17 15:09:45 it's weird to see how i made a path from forth to lisp 2023-09-17 16:02:12 You made a path to lisp while chatting in a Forth channel. :-) 2023-09-17 16:03:33 It's kind of fun thinking about how you might implement lisp in Forth. Hint: ) does all the heavy lifting. 2023-09-17 16:04:16 ( just says "open a new list" (like on a stack of lists - ( would tell you to push an empty list onto the stack. 2023-09-17 16:04:31 All the items other than ( and ) would have you append to that list. 2023-09-17 16:04:48 And finally ) would "process" the top list on the stack, leaving the result as an "item." 2023-09-17 16:06:07 in my case ( reads by "words" and if it finds another (, a : or a " it will execute that word 2023-09-17 16:06:50 Yeah, that's the recursive version of what I just said, I think. 2023-09-17 16:06:59 recursion vs. iteration. 2023-09-17 16:07:21 : does the same, but it makes a new environment for the new word and sets it as the current environment 2023-09-17 16:07:23 Or something along those lines. 2023-09-17 16:07:55 so if another : is executed, it will be created inside the other : automagically 2023-09-17 16:07:56 Yeah, that's one place where your setup deviates quite a lot from Forth. In most Forth's, : just makes a dictionary entry and changes STATE. 2023-09-17 16:08:30 For me a second : does exactly what the first one did - just makes a header and points it at HERE. 2023-09-17 16:08:48 No differences at all. 2023-09-17 16:08:59 KipIngram: your ; can be grouped? like ;; 2023-09-17 16:09:02 my : works in the same way as vms14's - so the execution of the word creates the inner words 2023-09-17 16:09:09 or it was a different kind of ; 2023-09-17 16:09:13 vms14; Don't think of ;; that way. 2023-09-17 16:09:19 ;; is a word, of its very own. 2023-09-17 16:09:28 It just happens to return two levels instead of one level. 2023-09-17 16:09:34 hmm 2023-09-17 16:09:43 The pattern ; vs. ;; is just a naming convention. 2023-09-17 16:09:52 I don't have ;;; or ;;;; etc. 2023-09-17 16:10:14 i can make them be together like ;;; they would be recognized as three words 2023-09-17 16:10:14 The compiler doesn't in any way treat ;; as ; ; 2023-09-17 16:10:37 Yeah, because your : is looking for the next ; 2023-09-17 16:10:41 Makes sense. 2023-09-17 16:11:28 it reads by words, but i can hook the ; to the reader so it does the same as it does with ( ) and " 2023-09-17 16:11:28 When I have : nested, the inner one sets STATE=1 just like the outer one does, but since it was already 1 it doesn't matter. 2023-09-17 16:12:36 In particular, when I nest : items, it doesn't create any kind of "nested" dictionary structure. No "scope" funny business. 2023-09-17 16:12:42 Just makes another name in the dictionary. 2023-09-17 16:13:32 I do have those .: words, and generally they are not visible later, but to achieve that I explicitly remove them from the dictionary when I'm ready to. 2023-09-17 16:18:08 in my case ; is not even a word 2023-09-17 16:18:27 it's just a token for : 2023-09-17 16:18:58 same for ) 2023-09-17 16:19:42 Right. Just delimiters. 2023-09-17 16:20:29 the first times i tried to implement ( and ) i did push tokens on the stack xD 2023-09-17 16:20:56 i thought it would be cool cause i could manipulate them and alike 2023-09-17 16:21:16 but it sucked so much cause they got in the way when executing words 2023-09-17 16:22:10 So, in normal Lisp, if I had something like this: 2023-09-17 16:22:17 i tried once to count how many elements are pushed since i execute the list start delimiter 2023-09-17 16:22:25 ((...explained below...) 3 4 ) 2023-09-17 16:22:39 And ...explained below... resulted in '+', would that yield 7? 2023-09-17 16:22:56 an error 2023-09-17 16:22:59 Or rather (...explained below...) results in '+' 2023-09-17 16:23:08 ah, it should work 2023-09-17 16:23:13 let me check 2023-09-17 16:23:16 Can you "compute operators" like that? 2023-09-17 16:23:30 it depends on what explained below is 2023-09-17 16:23:44 Anything that produces '+' 2023-09-17 16:23:47 () is a function call in lisp unless it's quoted 2023-09-17 16:24:12 but you can for example call a funtion that returns another 2023-09-17 16:24:39 ((find-fun "something") something args) 2023-09-17 16:24:46 it should work 2023-09-17 16:25:53 ((lambda (x) x) 'oh) 2023-09-17 16:25:56 Ok - that's what I was asking. 2023-09-17 16:25:58 for example 2023-09-17 16:26:23 in scheme i guess you have to call apply or funcall 2023-09-17 16:26:23 That would work in the Forth implementation of it I described above. 2023-09-17 16:26:41 oh i guess in scheme also works the same 2023-09-17 16:27:39 It's not particularly hard to write Forth that processes infix arithmetic either. 2023-09-17 16:27:54 just call next 2023-09-17 16:28:00 And supporting normal precedence of operators is readily done too. 2023-09-17 16:28:38 i never saw how forth achieves metaprogramming 2023-09-17 16:29:08 What do you mean by metaprogramming? 2023-09-17 16:29:10 in my case i have lists as code, which makes it very easy 2023-09-17 16:29:19 KipIngram: code that generates code 2023-09-17 16:29:30 for example lisp macros 2023-09-17 16:29:39 i know forth does not need them 2023-09-17 16:29:43 "generating code" is just adding data to the end of the dictionary. 2023-09-17 16:29:53 they achieve the same goals in different ways 2023-09-17 16:30:09 right 2023-09-17 16:30:20 in forth is even more usual than in lisp 2023-09-17 16:30:31 I don't see why you think it would be hard? 2023-09-17 16:31:02 it's hard in other kind of languages because of their syntax 2023-09-17 16:31:07 For the most part that's what's done with STATE. As you find words in the dictionary, if STATE=0 you execute them. If STATE=1 you add them to the end of the dictionary. 2023-09-17 16:31:38 well in forth you have the definition opened 2023-09-17 16:31:46 When you come to ; it's an immediate word, which executes right away - it adds a return to the end of the dictionary and sets STATE=0. 2023-09-17 16:31:49 this does not usually happen in other langs 2023-09-17 16:32:00 Sure it does - it just happens at compile time. 2023-09-17 16:32:45 By the time you run a C program it's finished - can't add more code then. 2023-09-17 16:33:18 SBCL is a C program and can add more code 2023-09-17 16:33:26 :o 2023-09-17 16:33:28 But the C compiler does something very similar while it runs. It starts with an empty buffer and as it processes your source it adds code to it. 2023-09-17 16:33:37 actually sbcl is mostly written in lisp 2023-09-17 16:33:51 Yeah, seems like that ought to be possible. 2023-09-17 20:40:44 Hah hah - I've been watching Mathologer videos. He always wears a math pun/joke t-shirt for these videos. In this video I'm watching now, the t-shirt says "25.8069 IS THE ROOT OF EVIL." 2023-09-17 23:27:21 Next t-shirt: "This Fibonacci joke is as bad as the last two you heard combined."