2022-03-04 00:36:27 I think 1 is a word: 2022-03-04 00:36:51 : 1 1 1 + 1 - ; 2022-03-04 04:26:17 : 1 0 1+ ; 2022-03-04 04:27:15 haha i had to define 1 that way in sectorFORTH :-p 2022-03-04 04:28:18 and it only has minus, so i had to define plus as : + invert 1+ - ; 2022-03-04 04:28:51 and then : 2* dup + ; and now you can make numbers :-) 2022-03-04 05:29:13 That's how 1 is defined in axiomatic set theory, : 1 0 1+ ; 2022-03-04 05:29:32 oh interesting 2022-03-04 05:29:32 Well depending on whether 0 or 1 is chosen as the start of the natural numbers 2022-03-04 05:29:44 i like 1 more than 0 :-) 2022-03-04 05:30:08 I think the empty set is used as 1 2022-03-04 05:30:53 i picked minus as a primitive specifically to make zero easier 2022-03-04 05:31:37 rp@ pushes the return stack pointer... so 0 becomes : 0 rp@ rp@ - ; and then along with 0= : 1+ 0 0= - ; 2022-03-04 05:32:24 Nice 2022-03-04 05:32:30 It is a cool exercise 2022-03-04 05:32:53 i managed hello world 2022-03-04 05:33:49 i find it fascinating how forth can be built from literally nothing 2022-03-04 05:34:12 so different to c 2022-03-04 07:45:19 dave0: Kind of an interesting exercise thinking about how you might actually write a C that builds up like forth 2022-03-04 07:49:43 that'd be awesome 2022-03-04 11:21:12 I think you'd first have to figure out how to make C in a more interactive way. 2022-03-04 11:22:06 C actually does "build up," but the process for doing so has a "special syntax." On the other hand, built-up extensions in Forth look exactly the same as the starting stuff. It keeps working exactly the same way, all the way up. 2022-03-04 11:23:19 I think part of why we can make extensibility work so well in Forth is because you can think of Forth at the "individual word level." I.e., it's largely "syntax free." 2022-03-04 11:28:45 i found seed7 that is apparently extensible and looks like pascal 2022-03-04 11:29:05 https://github.com/ThomasMertes/seed7 2022-03-04 11:29:32 Predefined constructs like arrays or for-loops are defined in libraries. 2022-03-04 11:29:36 inch resting 2022-03-04 11:31:41 seems interpreted but compilable thru C 2022-03-04 11:31:58 The later stuff, that supports operator overloading, gets closer to being "really extensible." 2022-03-04 11:32:59 hla 2022-03-04 11:57:11 there is the CINT project if you want an interactive C interpreter 2022-03-04 12:00:05 but thats not what this is about 2022-03-04 13:16:41 MrMobius: what exactly do you have to type in on a command line to get that interactive C to "do something"? 2022-03-04 13:16:50 I suppose you can probably run functions? 2022-03-04 13:17:14 Maybe evaluate expressions? 2022-03-04 13:17:40 I'm thinking about Python interactivity here - I guess it's similar? 2022-03-04 13:18:10 In Python if you define a function interactively it takes lines until you don't indent one - I guess with c it would look for the closing }? 2022-03-04 13:22:30 I think certain aspects of Forth's interactivity is helped along by the fact that it has a "distinguised datum" - the item that's on top of the stack. 2022-03-04 13:23:02 for example, you can [ out of compile mode and do something and ] back in, and then USE that data item you left on the stack. 2022-03-04 13:23:06 perhaps an unused token 2022-03-04 13:23:25 Can't think of a smooth way to do that in C, unless there was some privileged variable you stored the value in. 2022-03-04 13:23:38 also better syntax 2022-03-04 13:23:47 So the compile mode logic knew where to look for it. 2022-03-04 13:23:50 i like what smalltalk has going on 2022-03-04 13:24:22 Forth really isn't any "one advantage," primarily - it's really a synthesis of a number of nice things working together. 2022-03-04 13:25:20 I didn't say that very well - hopefully you guys know what I meant. 2022-03-04 13:26:17 I.e., [ ... ] becomes more useful BECAUSE there is a stack. 2022-03-04 13:26:35 ye 2022-03-04 13:26:43 forth is lots of little things 2022-03-04 13:26:58 You could invent a way to do that in interactive Python too, but it would be unclear how to get the following compile mode stuff to "get at it." 2022-03-04 13:27:50 Yeah, lots of little things. That just play together EXTREMELY well. 2022-03-04 13:28:37 KipIngram, havent used CINT so I dont know. its just an example of an interactive C that might inspire ideas