2021-07-07 11:20:14 within a word, I'm hoping to do something like this -- #1 #10 n:between? [ normal ] case where, if a number is within a certain range a quote will be executed. I don't think case can handle this, though 2021-07-07 11:26:45 eli_oat: I think you just want a nested IF statement for that don't you? 2021-07-07 11:27:04 🤔 2021-07-07 11:28:34 nesting an if in a quote? 2021-07-07 11:29:10 Are you trying to do something different than `#1 #10 n:between? [ normal ] if` ? 2021-07-07 11:30:23 I wanna execute 1 branch if between 1 - 10, another if between 11 - 20, another between 21 - 30, etc. 2021-07-07 11:30:33 ahhh 2021-07-07 13:09:19 eli_oat: try this: http://forth.works/share/8d899d501cac472a5eece8ac479a8f7e 2021-07-07 13:10:00 (sorry for not getting to reply sooner; it's been a busy day) 2021-07-07 13:10:43 no worries! 2021-07-07 13:10:50 I should have been working when I was nerd sniped 2021-07-07 13:38:09 thanks so much for this crc! 2021-07-07 13:38:19 I'm gonna need some time to grok this, but I think it'll do the trick! 2021-07-07 14:14:02 crc, in the example you just provided what do 'abc and 'aabc do? 2021-07-07 14:14:05 Are they templates? 2021-07-07 14:16:57 eli_oat: Those are used to reorder the stack. RetroForth's `reorder` word accepts two strings. One represents the pre condition, the other represents the way you want the stack to be. 2021-07-07 14:17:31 ah, and so this dups the first item on the stack? 2021-07-07 14:17:31 It does some magic under the hood to re-arrange the stack implicitly to whatever the author chooses. 2021-07-07 14:18:20 Yeah 2021-07-07 14:18:33 so it's like dup? 2021-07-07 14:18:41 but with more flexibility 2021-07-07 14:19:02 In this case yes. I saw it referred to as "the ultimate stack juggler" in the docs heh 2021-07-07 14:19:28 You can do any type of stack juggle with it though. Eg `'abc 'aaa reorder` would work too 2021-07-07 14:20:00 so in my example above, it would be like doing `drop drop dup`, but easier to comprehend (and probably slower, from what I've read in the docs) 2021-07-07 14:20:40 My understanding of my encounters with it in example code, docs, etc.. is that it makes the code easier to read but also suffers some perf. penalties as a tradeoff. 2021-07-07 14:21:41 gnarly -- that is wild. I'm totally smitten. Thanks for the explainer! 2021-07-07 14:22:28 Also interesting if you find yourself unable to come up with clever stack juggles: http://sovietov.com/app/forthwiz.html 2021-07-07 14:24:27 WAAAHT IZ DIS MAJIK!? 2021-07-07 14:25:47 Pretty neat, eh? Sometimes I will write stuff with `reorder` and then go back later and refactor it to use whatever that thing suggests^ 2021-07-07 14:30:00 rick_carlino1: thanks for answering 2021-07-07 14:30:19 eli_oat: in this case, it's duping the third item on the stack 2021-07-07 14:30:23 np crc! 2021-07-07 14:31:35 `reorder` is a useful tool. It's really handy, but not at all efficient if performance matters. 2021-07-07 14:33:18 `[ over swap ] dip` should do the same as the `'abc 'aabc reorder` 2021-07-07 14:34:35 intriguing 2021-07-07 14:34:40 I'm excited to play with this!