00:00:00 --- log: started retro/10.10.26 08:03:01 ThisSucksToReadIMO:( 09:29:48 foucist: this_sucks_too_IMO 09:49:06 how.about.this? 09:49:32 dots are easier to type than underscores since there is no shift key involved. 09:49:45 (underscores _or_ caps) 10:06:05 as far as reading goes, it seems like your brain would adapt itself to whatever you use after a while 10:06:43 to,s from,s <- ruby to_s from_s in an alternate universe 10:07:00 * docl invents comma-case 10:11:17 :D 10:11:26 this.is.pretty.nice.too! 10:12:38 dots are ok 10:13:40 this.can.also.segue_into_these_too.it.wouldn't.make.senseToCamelCaseAllOfASudden! 10:13:58 I think dots are mentioned in the style guide... 10:14:09 foucist: that's wrong. 10:14:21 :P 10:14:42 choose a style, be consistent ;) 10:15:17 nah my point is that ruby has both snake_case and OO.chain.ing so that's probably more consistent than mixing in camel case ;) 10:15:24 altho it has camel case too! 10:15:29 for specific things 10:15:35 like class names 10:16:41 retro has lowercase and camel case only, at least in the core language. some of the examples and optional stuff uses other formats (the hangman game comes to mind; it uses dashes) 10:27:46 * crc needs better names for +times and -times 10:28:05 times is like for, right? 10:28:40 drop times/for and use each instead 10:29:18 crc: why + and - times anyways? why not just one times ? 10:29:36 123130 neg times == 123130 times ? 10:29:39 er 10:29:43 -times 10:29:54 1 neg +times == 1 -times ? 10:30:58 foucist: +times and -times push a loop index to the stack before each execution of a quote 10:31:50 [ ] times = for next 10:31:50 [ ] -times = for tors next 10:31:50 [ ] +times = fori nexti (though fori and nexti have been removed, leaving just +times now) 10:32:19 tors ? 10:32:28 top of return stack 10:33:14 ok 10:33:33 what about iter? 10:33:43 iter +iter -iter 10:45:02 iter + a modifier word could work ok 10:46:15 what i like about each is that you can iterate over items or iterate a specific number of times easily 10:47:11 like.. [1..20].each {|i| puts i} or [3,4,12,6,5].each {|x| puts x} (where i or x is completely optional naming) 10:47:28 there is also .each_with_index {|x,i| for the case you need both 10:47:44 times/for could be potentially consolidated into each 10:47:52 not sure how that would look in forth 10:48:53 i think FOR is like GOTO, ultimately a bad coding smell 10:49:27 foucist: I use for only in a couple of places now; mostly moved over to the times combinators 10:50:02 ah 10:50:17 crc: what do you do for iterating over a collection of items 10:50:23 arey ou using +times etc? 10:50:39 are you getting the size of the colelction first? 10:51:51 10:52:35 foucist: times, +times, and -times are counted loops, they expect the number of cycles to be on the stack before execution 10:55:27 they don't fetch from a collection; I'd write a custom combinator for that 12:47:48 { 1 .. 10 } [ putn ] each 12:47:48 assuming that { } .. and each are defined in the future 12:59:27 the problem is how to implement { 1 .. 10 } 12:59:55 well that part is optional isn't it? 12:59:59 if you write { 1 .. 1000 } you won't want 1000 values on the stack 13:00:03 forth already has datastructures for collections of data 13:00:13 arrays and such 13:00:19 i guess you're talking about .. 13:00:25 .. and ... for ranges 13:01:07 what if it is { 1 .. 1000000 }? will you store that in memory? 13:02:51 yiyus: probably not, just setup a range object/structure 13:04:30 i'm sure it can be done, but not so sure is worth the complication 13:04:42 would be glad to be wrong though 13:04:58 crc: the .. word isn't necessary to get the benefit of each.. as long as each can take in an array or other suitable collection datastructure that retro has 13:05:50 yiyus: yeah not sure 13:06:30 foucist: each could be written to work on a linked list I suppose 13:06:48 yeah 13:14:11 different vocabularies can provide version of each appropriate to the data structures they handle 14:38:30 : each ( lq- ) [ swap @ tuck over do over ] while ; 14:38:31 last [ 0; d->name puts space ] each 16:12:34 docl: that leaves some stuff on the stack 16:46:01 : each ( lq- ) [ swap @ tuck over do over ] while 2drop ; 16:50:45 : each ( lq- ) [ swap @ tuck over do over @ ] while 2drop ; 16:51:06 that keeps it from passing 0 to the quote 17:07:59 foucist: are you comfortable with linked lists in retro? 17:08:34 docl: how's that? 17:08:38 not too familiar i guess 17:08:47 haven't looked at forth code for probably 4 years now 17:09:02 like the dictionary in retro. when you type "last" it gives you the most recently added element. 17:09:18 that element contains the address of the next element 17:09:31 so you can do @ @ @ ... until you get to the one you want 17:09:59 then do +1 +1 +1 (in other words increment the memory value) until you get to the field you want. 17:10:42 does that make sense so far? 17:11:39 er sorry, it's actually 1+ to increment the tos by 1 17:12:54 docl: so what's your each code doing in this case 17:12:59 anyway there are built in words to increment by the exact right amount for the field you want 17:13:08 ok 17:13:30 it's kind of complicated by the fact that we are dealing with quotes (anonymous words) 17:14:06 my each assumes that the quote consumes one value (the memory address of the list element) 17:14:36 d->name increments by the amount you need to get to the string that is the name of the word 17:15:10 iirc, d->class increments by 1, d->xt increments by 2, and d->name increments by 3. 17:15:51 (there used to be a field for the count i.e. length of string, but it was dropped when we moved to null-terminated strings) 17:15:55 docl: correct, though that is subject to change if I add new fields to the dictionary 17:16:26 the only guaranteed field is that the first value in a header will be a link to the previous header 17:16:43 right, I'm just giving the numbers so foucist gets the general idea of how it works 17:16:47 ok 17:17:10 always best to use the d->whatever words for portability to future versions 17:18:46 foucist: if you look up "while" it is a loop that repeats and consumes the tos each time, and exits only if that was zero. 17:19:21 docl: i mean, does your each word here do anything that retro doesn't already have? is it basically going through each item and making it available within the loop? 17:19:27 the linked list's bottom element contains 0 instead of an address. 17:19:34 sorry i'll read what you just typed in a moment 17:21:44 back 17:21:58 what it does is take the quote and execute it with the linked list element on the top of stack each time. 17:22:00 foucist: it cleans up a case of walking through a linked list. e.g.: 17:22:00 : words last [ d->name puts space ] each ; 17:22:00 : words last repeat @ 0; dup d->name puts space again ; 17:22:46 hmm 17:23:03 docl: I'd do something like: 17:23:03 : each [ &@ dip 2dup push push do pop pop over @ ] while 2drop ; 17:23:03 to keep the copy of the quote/index off the main stack during each cycle 17:23:11 one of the biggest issues i have with forth right now is the requirement to load so much into your brain.. i.e. to remember exactly what the fields are 17:23:18 and manually incrementing by 1 or whatever 17:23:23 isn't it like that? 17:23:32 no, there are words that automate that bit 17:23:36 we have named accessors for the fields 17:23:39 or manually popping/pushing/swaping a fixed number of times 17:23:42 d->xt d->name etc. 17:23:57 what about named accessors to get rid of thinking about the stack too ? 17:23:58 if possible 17:24:33 do you really want to not think about the stack? 17:24:39 crc: that's kind of some crazy code right there "2dup, 2push, do 2pop.. :P 17:24:49 can't that be factored out completely 17:25:31 docl: why not? seems like way too much to keep track of mentally all the time, always checking against stack errors.. seems like a mental overhead 17:25:31 foucist: you don't have to see the implementation to use the word :) 17:25:45 crc: that's true, but unfortunately you do :P 17:27:33 it's a small cost overall; once the code is working, I only need to revisit it on occasion. (e.g., most of the core code is only looked at when I get in a mood to rewrite or seek a cleaner solution) 17:30:10 yeah 17:30:38 crc: but even if a forth coder never touched the core words, wouldn't he expect to have to do lots of stack manipulations for some words? 17:30:55 and be required to keep all that straight in his head 17:31:15 you can usually use a variable instead of the stack if you need more than one or two values 17:31:34 true 17:31:49 it's not a big issue if you keep stacks shallow 17:32:06 well isn't the rule of thumb 3 values on the stack? i.e. 2 on main, 1 on return that sort of thing? 17:32:10 I use a lot more variables and such in retro than mainstream forthers would consider kosher 17:32:12 i.e. avoid variables unless you're going to 4 values 17:32:15 ah 17:32:29 three or four values on the stack; more is generally a headache waiting to happen 17:32:44 crc: what's an example of a modern mainstream forth? anything actively worked in/developed in the past few years? 17:33:01 because my impression was that retroforth is pretty much the mainstream forth.. 17:33:16 gforth maybe? 17:33:19 foucist: gforth, pforth, swiftforth, and mpe; e.g., the ANS compliant ones 17:33:30 * docl doesn't pay much attention to other forths 17:33:36 oh i don't consider ANS forths to be mainstream forths 17:33:53 is factor mainstream? 17:33:59 not yet 17:34:02 well it's not a forth perse :P 17:34:04 per se* 17:34:31 well, what's the mainstream CM-like non-colorforth forth? 17:34:37 that's gotta be retroforth ? ;) 17:35:24 retro has exactly one word using more than four elements: tri* which isn't used anywhere yet 17:35:37 heh 17:35:50 what's tri* for 17:35:50 what's tri* fomath? 17:35:56 math? 17:36:03 tri* applies three quotes to three values on the stack 17:36:24 INSANE! 17:36:24 tri* ( xyzqqq- ) Apply q1 to x, q2 to y, and q3 to z 17:36:26 :P 17:37:02 docl: yeah i filter out ANS forths mwhaaha since they aren't chuck mooreish enough for me :P 17:37:09 altho i guess those are technically more mainstream 17:37:35 foucist: it's an exposed factor of tri@ 17:37:44 tri@ ( xyzq- ) Apply q to x, y, and z 17:38:48 anyway: 17:38:48 {{ 17:38:48 : ( qa- ) [ @+ swap [ swap dup &do dip ] dip ] times 2drop ; 17:38:48 ---reveal--- 17:38:48 : array.each ( aq- ) swap @+ dup 1 > [ ] [ 2drop ] choose ; 17:38:50 : buffer.each ( anq- ) -rot ; 17:38:52 : ll.each ( lq- ) [ &@ dip 2dup push push do pop pop over @ ] while 2drop ; 17:38:54 }} 17:40:33 cool 17:40:39 is ---reveal--- like private or something 17:40:43 i.e. the stuff below are private? 17:40:56 stuff above ---reveal--- is private 17:41:21 so that stuff will make it work for arrays and shit? 17:41:34 you've hacked the interpreter to understand that array.each is specific to arrays already? 17:41:40 arrays, linked lists, and strings/similar buffers 17:41:42 no 17:41:44 array. 17:41:48 k 17:41:49 retro has no knowledge of types 17:41:53 yeah 17:42:08 presumably you can keep track of the words to use with something 17:46:56 foucist: what do you think, is it lame not to have types? :P 17:47:04 crc: so how would you be calling array.each when you're actually passing in an array 17:47:21 just like that basicaly 17:47:27 pointer-to-array [ ... ] array.each 17:47:30 yeah 17:47:50 didn't we have it set up so you could do \array each to get each from the array vocab? 17:47:59 docl: dunno, but if you were gonna have types might as well put in OO too right? :P 17:48:06 :) 17:48:18 we did at one time; I need to get that back (lost when I made some changes a while ago) 17:48:27 crc: what did it look like? 17:48:31 was everything an object? 17:48:42 was it message/stack-based ? 17:49:10 foucist: I think crc was talking about the \ prefix 17:49:18 \array. to access a word in the array vocabulary 17:49:30 which is kind of an object system in a way 17:49:38 it'd be \array'word now (since names end in a ' these days) 17:50:06 crc: oh you're not talking about OO :P 17:50:07 darn 17:50:43 I did dabble with an object system, but it never became usable enough for real work 17:51:08 problem i've seen is most forth OO systems are based more on C++'s idea of OO 17:51:14 which is kinda crappy 17:51:35 isn't an object just another kind of linked list? :P 17:51:55 docl: why not? ;) 17:52:01 vocabs are kinda like objects already 17:52:35 yeah i think some things in forth are already analogous to objects 17:52:43 chain: ;chain 17:54:37 chain: table 30 variable: pounds "This is a table" variable: description ;chain 17:57:27 docl; that still leaves us without the abilility to make a new object based on an existing one without a lot of messy scaffolding 17:58:19 hmm. maybe we need a function cloner? 17:58:52 I have some ideas, but haven't taken the time to actually try implementing anything yet 17:58:55 i guess bringing in OO does add overhead in terms of defining each object 17:59:15 crc: havey ou looked much at the delegation/prototype based stuff etc 17:59:23 not recently 18:01:50 I commited the .each words and also a toggle for the formatted output to let puts not process the output and just display it as-is. 18:16:14 * crc is off to bed now; goodnight everyone 18:16:27 : ll.each ( lq- ) [ &@ dip 2dup push push do pop pop over @ ] while 2drop ; 18:16:27 : tonull [ 1+ dup @ ] while ; 18:16:27 : copy-header dup tonull over - here tuck push dup 1+ allot copy pop @last over ! !last ; 18:16:30 : clone ( l- ) [ copy-header ] ll.each ; 18:16:51 : tonull [ @+ ] while ; 23:59:59 --- log: ended retro/10.10.26