2024-06-06 00:03:58 divya: Starting Forth for forth 2024-06-06 00:04:22 Practice makes perfect 2024-06-06 00:04:43 for bit stuff 2024-06-06 00:06:07 veltas: I did check it, but the arrays were mostly 1-dimensional. I shall check more, or if you have any particular chapter in mind? 2024-06-06 00:06:10 I mean use XOR to flip, AND to get, OR to set 1, INVERT AND to clear to 0 2024-06-06 00:07:24 LSHIFT and RSHIFT helpful for getting multiple bits at once 2024-06-06 00:08:38 Just AND is enough to get one bit as e.g. IF checks for non-zero values, so can check if a single bit is set 2024-06-06 00:11:29 If you want 2 dimension arrays then index of e.g. row 2 column 1 would be 2 * 3 + 1 = 7 if zero indexing is used 2024-06-06 00:12:23 Going other way; column is 7 mod 3 = 1, row is 7 / 3 = 2 2024-06-06 00:13:12 In our case a cell is a 16+ bit vector 2024-06-06 00:13:32 So we don't need to 'allocate' an array, just use a cell 2024-06-06 00:13:56 And we can use the bitwise operations to manipulate our 'vector' 2024-06-06 00:19:13 I can check the state of a bit like so: row 2 column 1 I can do 7 RSHIFT 1 AND 2024-06-06 00:19:37 7 is 2*3 + 1 2024-06-06 00:21:38 Just so that I understand it, how would you pick row 1 (2nd) of this matrix: 2024-06-06 00:21:45 0 0 1 2024-06-06 00:21:48 1 0 1 2024-06-06 00:21:51 1 0 0 2024-06-06 00:22:25 3 rshift 7 and 2024-06-06 00:23:32 why do we have the 3 and 7 here? Sorry again, I don't know why I can't see this. 2024-06-06 00:24:20 It's okay 2024-06-06 00:24:46 3 is to move the 3 bits to the 'end' 2024-06-06 00:25:19 7 is 111 in binary, so when we AND it clears the other bits, we are just left with the value of the 3 bit row 2024-06-06 00:26:25 Rows 0, 1, 2: 7 AND 3 RSHIFT 7 AND 6 RSHIFT 7 AND 2024-06-06 00:30:45 I understand if it's all greek to you now, but work through it in binary on paper maybe 2024-06-06 00:31:58 It will click eventually 2024-06-06 00:34:46 I am trying to do it on paper, we do 6 for the last row because we need to move it 6 bits (from last two rows containing 3 + 3) ? 2024-06-06 00:35:11 Yup 2024-06-06 00:35:16 Okay 2024-06-06 00:36:46 Going to sleep but have fun with that 2024-06-06 00:37:01 Not a lot of games can store their whole state in one cell! 2024-06-06 00:37:12 Weirdly appropriate game for forth 2024-06-06 00:39:23 haha thank you for your help, veltas really appreciate. Glad to see such a supportive community in Forth. I'll hangout more here. 2024-06-06 09:48:38 divya: Try this: : 3. ( row -- ) 0 <# # # #S #> TYPE SPACE ; 2024-06-06 09:48:56 To print with at least 3 'digits' or bits if in binary base 2024-06-06 09:49:17 SPACE just prints a space, if you want a trailing space like the normal . word 2024-06-06 09:49:29 Up to you if you want that trailing space though 2024-06-06 09:53:16 <# # #S #> etc are used to format numbers 2024-06-06 09:55:35 they work with double-cells so I push 0 first to add the 'top half' of the double-cell 2024-06-06 09:55:46 <# starts a new formatted number 2024-06-06 09:56:15 # converts one digit at a time, starting at the right end of the number 2024-06-06 09:56:43 why words printed by `words` are not sorted? 2024-06-06 09:56:49 They are sorted 2024-06-06 09:56:55 In order of appearance 2024-06-06 09:57:14 i see 2024-06-06 09:57:16 Usually it starts at most recent word, highest search order list, and prints them out until it reaches oldest word 2024-06-06 09:58:07 If you want to sort them then iterate over all names and put them in an array and sort it, lots of forths don't even have a 'sort' word though 2024-06-06 09:58:42 If you need to implement a sort I recommend heap sort or quick sort 2024-06-06 10:00:38 For some sizes or kinds of data: bubble sort, insertion sort, or counting sort might be better 2024-06-06 10:02:57 #S converts at least one digit and then continues until only zero digits would be left 2024-06-06 10:03:24 #> finishes the string, dropping the calculation and putting the address and size of the formatted number string on stack 2024-06-06 10:19:04 i see 2024-06-06 10:19:12 i usually go with timsort 2024-06-06 10:20:53 Overly complicated and O(n) space complexity 2024-06-06 10:21:25 If you don't need a stable sort then heapsort is a less bloated option 2024-06-06 10:21:38 if it's not too large, i've had good results with shellsort ... it's not much harder than insertion sort and it's quick on medium sized arrays 2024-06-06 10:21:43 And if you don't care about real-time and have 'random' trusted data quicksort is easier and faster 2024-06-06 10:22:01 shellsort is inherently slower, but it is at least easy to implement 2024-06-06 10:22:29 It's an important consideration 2024-06-06 10:22:48 Size does matter, if the sizes are known and bound then shellsort, insertion sort, bubble sort all might be appropriate 2024-06-06 10:22:56 If it's partially-sorted obviously that changes it too 2024-06-06 10:23:29 heapsort is not too hard to implement, it's a bit weird to understand but understanding it is optional 2024-06-06 10:23:51 There's plenty of pseudocode / example C implementations to copy it from 2024-06-06 10:24:32 The fact it uses constant space and guarantees O(n log n) performance is why it's important 2024-06-06 10:27:42 In Forth (and everywhere) don't just select the most generic algorithm, understand the choices and pick the right one for the job 2024-06-06 10:27:48 Sometimes that will be shellsort etc 2024-06-06 11:05:45 veltas: the 3. word would just extend the number of digits/bits? 2024-06-06 11:39:17 divya: The one I defined prints at least 3 digits 2024-06-06 11:39:31 You can have more if you want, just need more #'s 2024-06-06 12:51:55 It doesn't extend the number, rather it prints at least 3, so you see e.g. 001 010 100 1000 10000 etc 2024-06-06 14:04:15 Trying to learn PDF again 2024-06-06 14:22:14 Why is positive y upwards in PDF coordinates 2024-06-06 14:22:54 I guess it was meant for document viewing before printing, but it's just hard to imagine why y axis goes in opposite direction of text 2024-06-06 14:23:26 Questionable decision even for OpenGL, yet alone documents 2024-06-06 14:36:55 I've always just assumed they were thinking of it like plotting a graph. 2024-06-06 14:37:11 But I've always found it odd too. 2024-06-06 14:38:20 Math types always seem to like to emphasize quadrant 1. 2024-06-06 14:41:54 I don't know why your remark reminded me of this, but I learned for the first time the other day how A-type paper dimensions work the other day. The details I mean. All of the A sizes have height-to-width ratio square root of two, because you can split that in half the long way, rotate 90 degrees, and get another size with the same ratio. And A0 is a sheet with area 1 square meter. 2024-06-06 14:42:02 So nice and common sensical. 2024-06-06 14:42:22 A lot more rational than our 8.5x11 "letter size" common in the States. 2024-06-06 14:42:51 The benefit is that you can scale your page image and it fits any A size the same way. 2024-06-06 14:43:49 Before the A sizes in our country we had imperial ones like foolscap folio 2024-06-06 14:45:25 The A sizes have a sensible ratio yes, but the size is totally arbitrary, it's so A0's area is 1m^2 2024-06-06 14:45:59 Yeah - like I said. 2024-06-06 14:46:22 I don't think that can be useful, I would have preferred e.g. the width of A4 being something memorable, and chosen so that the length was similar to foolscap folio 2024-06-06 14:46:22 Previously I'd just known that the A sizes were "a little different from ours," but I hadn't realized the "logic" behind it. 2024-06-06 14:46:45 It's kind of like a "metric system" for paper. Not literally, but just "rational" kind of like the metric system is. 2024-06-06 14:47:10 Although, I guess calling something involving square root of 2 "rational" is kind of humorous. 2024-06-06 14:47:20 Yeah I don't really like the metric system, so I'm biased 2024-06-06 14:48:00 I don't really like or dislike it. I'm comfortable with our non-metric units from a lifetime of usage, but I'm an engineer, so I'm fine with metric too. 2024-06-06 14:48:07 I personally think 'most people' find meaningful sizes like 8.5x11 easier than crazy irrational dimensions in every system of measurement 2024-06-06 14:48:18 But the golden ratio was the one good decision there 2024-06-06 14:48:35 Fun fact - on the rationa/irrational number front, the golden ratio phi, 1.6..., is the "most irrational" number. 2024-06-06 14:48:55 Oh sorry it's not golden ratio 2024-06-06 14:48:59 But it is irrational 2024-06-06 14:49:13 No, I know - I threw in an unrelated bit there. 2024-06-06 14:49:16 Sorry about that. 2024-06-06 14:49:19 I've often heard it stated that it's somehow related to golden ratio 2024-06-06 14:49:24 Didn't mean to connect phi to the paper discussion. 2024-06-06 14:49:26 But obviously that's a myth 2024-06-06 14:49:31 I am the one who did that 2024-06-06 14:49:34 But it's my bad 2024-06-06 14:49:57 The golden ratio's continued fraction expansion is "1's all the way down" - that's why the regard it as "most irrational." 2024-06-06 14:50:42 1+1/(1+1/(1+1/(1+1/(...)))) 2024-06-06 14:51:51 Whatever level you chop that off at for calculation, the error is worse for phi than for any other number. 2024-06-06 14:52:15 Interesting 2024-06-06 14:52:34 pi, on the other hand, has a couple of rather large numbers show up in its continued fraction, and if you cut off at those levels you get a quite accurate approximation, given how many levels you calculated. 2024-06-06 14:52:55 I've had to deal with other page sizes because if I'm rendering an old text-only document on paper I need to select e.g. US Legal, as was used for an old Forth standard 2024-06-06 14:53:02 Since if you have n + 1/m, the bigger m is the more accurate you are if you neglect the 1/m part. 2024-06-06 14:53:04 To make it 'look right' with page numbers, margins, etc 2024-06-06 14:53:12 I'm sorry - the bigger n is. 2024-06-06 14:53:27 Right. 2024-06-06 14:53:52 And with the magic of computers you can give whatever page size you want 2024-06-06 14:54:01 As long as it's imperial, because PDF uses pt :P 2024-06-06 14:54:09 No but there's a lot of precision really 2024-06-06 14:54:48 Screens and printers also are all imperial, because they're all DPI 2024-06-06 14:55:00 But imperial is metric these days, as the imperial standard def relies on metric 2024-06-06 14:55:02 So it works out in the end 2024-06-06 14:56:06 Things like this tend to have interesting histories, as we've tried to take deviant standards that grew up in separate parts of the world and "consolidate" them somehow, as the world has gotten smaller and more interconnected. 2024-06-06 14:56:21 The history of TV screen sizes is pretty interesting too. 2024-06-06 14:56:46 Yeah TV screens are still given in inches in the UK 2024-06-06 14:57:19 In marketing anyway 2024-06-06 14:57:26 I'm sure the box has it in metres somewhere 2024-06-06 14:57:43 Other areas have remained disconnected - for example, there just hasn't been any real pressure to consolidate the 50 Hz / 60 Hz difference in electrical grids. 2024-06-06 14:58:01 The US and European grids just dont' have much to do with each other so far. 2024-06-06 14:59:16 The power differences create some hilarious problems like I hear the US now have induction hobs that have *batteries* inside to trickle charge during the night so they have enough power to boil water on demand 2024-06-06 14:59:49 Whereas in the UK we take for granted that the wall can boil water in seconds, and is also less likely to kill people somehow 2024-06-06 14:59:59 I hope we don't need to boil too much water... 2024-06-06 15:00:04 I don't pretend to understand 2024-06-06 15:00:05 I didn't know that - that's interesting. 2024-06-06 15:01:43 Yes it was in a video where they explained what an induction hob and said it was quite new, to the bemusement of me and my wife 2024-06-06 15:01:44 I've done a fair bit of beer brewing in the past, and the limitations of electrical heating with our setup becomes clear pretty fast when you want to boil six or seven gallons. 2024-06-06 15:01:49 Apparently it's new to the US(?) 2024-06-06 15:03:02 Serious electric brewers find a way to use 240 volts; most of our homes are wired to be 240 capable, but the majority of our outlets are just 120. 2024-06-06 15:03:27 The 240's are used for like the electric oven, the electric dryer, and so on - the big stuff. So you only find them in a couple of places in your house. 2024-06-06 15:04:02 I think our plug design might be a little safer than yours 2024-06-06 15:04:38 But I've heard it stated, apparently, this could be a myth... that the 120V outlets just seem to be more likely to stop a human heart on electrocution 2024-06-06 15:04:55 Wouldn't surprise me. It's definitely easy in some cases here for your fingers to slip around the plug and you find yourself grabbing the prongs. 2024-06-06 15:05:04 Yeah that's impossible in UK design 2024-06-06 15:05:07 And they engage power with enough still sticking out to get hold of. 2024-06-06 15:05:12 Just outright impossible, it's actually quite well designed in UK 2024-06-06 15:05:31 The only real defense we have against that is that most plugs these days have little wings in the rubber that your fingers will hit if they slip. 2024-06-06 15:05:32 One of the few things we did better, probably because US had standard electrics earlier 2024-06-06 15:05:32 That helps. 2024-06-06 15:05:40 Usually first adopter gets the worst implementation 2024-06-06 15:05:45 Yeah. 2024-06-06 15:06:01 And economies of scale make change later slow. 2024-06-06 15:06:02 e.g. mass produced food is dire in UK because we were early industrial revolution food producers 2024-06-06 15:06:09 The industry is all "tooled up" and doesn't want to change. 2024-06-06 15:06:52 I remember when I was young everyone over a certain age would just eat tinned food constantly 2024-06-06 15:06:57 like it was desirable 2024-06-06 15:09:32 Are you talking about "canned food" or things like packaged means (which used to be called "TV dinners" here in the US)? 2024-06-06 15:09:52 packaged meals 2024-06-06 15:10:33 Those used to be in metal packages so you could put them in the oven - these days they're generally in cardboard and we call them "microwave meals." 2024-06-06 15:11:39 I suppose the "TV dinner" name came from "Mom wants to watch TV instead of cook," since back then the cooking was hugely associated with the lady of the house. 2024-06-06 15:17:04 No I literally mean food that comes in tin cans 2024-06-06 15:17:21 Well not made from tin these days but you know 2024-06-06 15:17:34 The metal cylinders with food inside, you use a can opener to get at it 2024-06-06 15:17:39 And heat it up 2024-06-06 15:18:04 The UK has a very 'food is fuel' view about food, which has changed in recent decades but it's still pervasive 2024-06-06 15:18:11 Bread sandwiches etc 2024-06-06 16:36:26 Yeah. I know what you mean. We have some in our pantry, but we rarely ever eat that sort of thing. We mostly eat fresh and frozen produce and so on these days. 2024-06-06 16:58:34 Historically I've done more cooking in our house than my wife, but recently I've been leaning a lot on these "sheet pan meals" that come from the freezer section in a bag. So easy - you just pour them out on a sprayed cooking tray, single layer, and bake them for 25 minutes at 450. Meat, vegetables, potatoes of some kind usually. One bag will feed three people pretty handily, and you do NOT feel like 2024-06-06 16:58:36 you're eathing "mass produced food," even though you are. 2024-06-06 16:59:06 It's about as easy as a meal can get, seems fairly healthy. 2024-06-06 17:00:16 um, before I turn on ignore-mode for this channel in rcirc, just wondering if it might be possible to take the food related discussions to PMing 2024-06-06 17:00:42 Sure, sorry about that. 2024-06-06 17:05:19 veltas: Regarding the built in <# # etc. formatting, that starts at the left and works right, doesn't it? What I was describing was starting at the right and working left, so you'd know how many pad 0's to add on at the end. 2024-06-06 17:05:40 I guess you could still count using <# #... and then pre-pend 0's. 2024-06-06 20:25:58 KipIngram: No that starts at right and works left 2024-06-06 20:32:27 any of you guys still coding for this one?: 2024-06-06 20:32:29 https://oldcomputermuseum.com/sol_20.html 2024-06-06 20:35:47 Would have to make a Forth ROM for it, only 1KB of RAM 2024-06-06 20:36:04 Only 1KB of ROM 2024-06-06 20:36:05 too much memory? 2024-06-06 20:36:44 You'd struggle to put a decent forth in it, or justify using forth dictionary etc, on 1KB of RAM even with the ROM providing Forth 2024-06-06 20:37:10 I agree with the subtitle they gave it, 'terminal computer' 2024-06-06 20:37:33 It has 8K of RAM 2024-06-06 20:37:35 well, the minimual system comes with 8KB ram 2024-06-06 20:37:38 only 1K video RAM 2024-06-06 20:37:50 Ah I see 2024-06-06 20:37:57 Then you can play with it 2024-06-06 20:38:00 could load the forth from cassette 2024-06-06 20:38:10 1KB is good for assembly programming very simple apps 2024-06-06 20:38:24 Like CHess! :P 2024-06-06 20:38:39 Yes just don't expect to play against the computer :P 2024-06-06 20:38:39 https://en.wikipedia.org/wiki/1K_ZX_Chess 2024-06-06 20:40:38 Oh 1K chess does play against you but quite badly apparently 2024-06-06 20:40:48 I wouldn't know, I don't know chess that well, still impressive 2024-06-06 20:40:57 it looks cool except for the fact that several chess rules are not supported 2024-06-06 20:41:02 like castling 2024-06-06 20:41:49 It would be pretty hard to play a normal game of chess without castling 2024-06-06 20:43:22 https://www.sol20.org/manuals.html 2024-06-06 20:43:28 https://www.sol20.org/manuals/img/SolTerminalComputerUsersManual.12-78-img.pdf 2024-06-06 20:55:39 Ah nice PDF 2024-06-06 20:55:46 US Letter 2024-06-06 20:56:14 Reminds me of when we used to eat US Letter, came in a can back then obviously 2024-06-06 20:56:20 A tin can I mean 2024-06-06 20:56:39 An apple 2 chess program used to beat my ass on a regular basis 2024-06-06 20:56:50 but that was 48k 2024-06-06 22:42:22 There was a time I was decent at chess, but I kind of lost interest when I reached the point where the next logical stage in my development required memorizing openings. 2024-06-06 22:42:52 I never knew my rating, though. 2024-06-06 22:43:02 isn't that the next step after learning the rules? 2024-06-06 22:57:36 you can play chess960 to cut down on the memorizing front 2024-06-06 23:23:36 I'm sure there are ways I could move forward some. All that came right around the time I started college, though, and college can be a busy time. I also more or less stopped reading fiction while I was in college, and didn't start again until quite a while after. Really not until I bought an ereader. 2024-06-06 23:24:09 That's a different kind of reading from studying a textbook - took me a little while to get fluid at it again. 2024-06-06 23:24:59 When I first asked the question I was mostly interested in learning about the programming methods, not so much looking for a way to play.