2023-11-18 02:17:33 MrMobius: Thank you for clarifying, and apologies if I have misinterpreted. 2023-11-18 11:27:34 This is a good treatment: 2023-11-18 11:27:35 https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation 2023-11-18 14:08:08 How do I add all numbers on the stack? 2023-11-18 14:08:21 Loop until stack is empty 2023-11-18 14:09:07 Generally, you don't 2023-11-18 14:09:25 Your code is supposed to know how many elements it's pushed onto the stack 2023-11-18 14:09:56 Booo 2023-11-18 14:10:16 So use array instead? 2023-11-18 14:10:35 why not loop until the stack is empty? 2023-11-18 14:12:06 Yes why not 2023-11-18 14:12:21 How are you detecting the stack being empty? 2023-11-18 14:13:37 By peeking the stack...? Peek poke 2023-11-18 14:14:04 SP@ SP0 - 1- DO + LOOP or something like that. i don't remember all the conventional words and their semantics 2023-11-18 14:14:27 looping with depth should do the trick 2023-11-18 14:14:34 SP@ and SP0 order depends on whether your stack grows up or down, of course 2023-11-18 14:15:20 Another reason to have a bot in here ^^ `help sp@` etc 2023-11-18 14:15:36 Hmmm ... I'd forgotten about depth 2023-11-18 14:16:28 I usually look up words at https://gforth.org/manual/Word-Index.html 2023-11-18 14:16:36 it's really the DO..LOOP part i'm not confident with. when i got into forth i almost immediately went and defined my own control flow words that work a little differently, and i never remember the traditional vocab 2023-11-18 14:16:37 : sum-stack depth 0 tuck do + loop ; 2023-11-18 14:17:13 GeDaMo: maybe start at 1 though since + takes two parameters 2023-11-18 14:17:23 That's what the tuck is for 2023-11-18 14:17:43 aaah 2023-11-18 14:18:10 1 without the tuck works too 2023-11-18 14:18:43 Why is loop compile only? 2023-11-18 14:18:48 : sum-stack begin depth 1 > while + repeat ; 2023-11-18 14:18:49 : sum-stack depth 1 do + loop ; 2023-11-18 14:19:18 ollephone: because in interpet mode your words are interpreted as soon as they're encountered, so there's no way for loop to jump back to a word that's already been parsed, executed, and forgotten about 2023-11-18 14:19:33 ollephone: control flow usually means immediate words which insert things into the current word definition 2023-11-18 14:20:34 You can write looping words for immediate mode if you want 2023-11-18 14:21:00 Kk 2023-11-18 14:21:01 sure, but they would have to be parsing words, and conventionally they aren't 2023-11-18 14:21:03 In gforth it's possible to write 10 0 [do] [i] . [loop] and so on 2023-11-18 14:22:28 You could pass an xt 2023-11-18 14:22:45 Yeah 2023-11-18 14:22:56 xt and array? Like a functional map 2023-11-18 14:23:16 Speaking of control flow, nowdays I call 'if' a ternary operation rather than a statement 2023-11-18 14:35:48 ollephone: https://ideone.com/6e631h 2023-11-18 14:37:58 That looks familiar :P 2023-11-18 14:38:37 :P