00:00:00 --- log: started forth/20.12.01 00:14:44 --- quit: dddddd (Ping timeout: 246 seconds) 00:31:25 --- join: xek joined #forth 00:37:56 --- quit: gravicappa (Ping timeout: 265 seconds) 00:38:51 --- join: gravicappa joined #forth 02:13:36 --- quit: gravicappa (Ping timeout: 260 seconds) 02:17:00 --- join: gravicappa joined #forth 02:23:05 --- join: dave0 joined #forth 03:01:20 --- quit: gravicappa (Ping timeout: 246 seconds) 03:17:36 --- join: gravicappa joined #forth 04:22:13 --- quit: hosewiejacke (Ping timeout: 256 seconds) 04:49:52 --- join: hosewiejacke joined #forth 05:13:29 I have a begin-while-repeat loop, and I'd like to do short-circuit evaluation in the while condition. I've read about Wil Baden's conditionals, but meanwhile I'm thinking to myself, maybe I should un-learn the short-circuit idea and think differently. 05:18:35 put the condition in its own word which returns early to short-circuit? 05:21:17 "returns early", does this involve some return stack manipulation? 05:22:15 --- join: Gromboli joined #forth 06:01:30 no, just : condition? first-test if true exit then second-test if true exit then third-test if true exit then false ; 06:01:46 --- join: dddddd joined #forth 06:01:57 (assuming what you want is a logical OR) 06:09:29 Ah I see 06:13:19 I'm doing Advent of Code 2020 to learn some Forth, here's my day 1.0 solution for a naive way to solve the problem of given N numbers, find the pair whose sum is equal to 2020, and multiply them: https://gist.github.com/neuro-sys/3197152e07b1dd95c85ad9245a6588d5 06:13:32 Any comments on it to improve? 06:14:34 I'll try doing it different ways until I get more comfortable 06:14:49 --- quit: dave0 (Quit: dave's not here) 06:15:43 i'll let someone more experienced respond. i would say it looks pretty much how most of my forth turns out (except i tend to have less newlines) 06:16:16 (also isn't there a cell+ word?) 06:16:43 Ah right cell+ is better 06:43:38 --- quit: hosewiejacke (Ping timeout: 240 seconds) 06:53:10 --- join: hosewiejacke joined #forth 07:00:28 what forth are you using, by the way? gforth? 07:02:03 Yes, but I'm trying to keep it minimal for now 07:02:26 For instance, not resorting to local variables 07:02:46 i should just install and play with gforth already 07:03:21 It is convenient and the documentation is nice. But I can't compare to any other. 07:08:50 Oh that stack juggling I did was not needed. Now I updated the gist with a simpler version. 07:26:00 --- quit: the_cuckoo (Quit: WeeChat 1.9.1) 07:42:12 --- join: the_cuckoo joined #forth 07:45:25 Hmm, puzzled by >NUMBER in gforth. 0 S" 123" >NUMBER fails. Seems like it expects 4 cells in the stack. 07:47:44 --- quit: gravicappa (Ping timeout: 272 seconds) 07:58:04 I wrote this word definition to load a text file containing numbers delimited by new line, and store them in a dictionary entry like this: https://gist.github.com/neuro-sys/3f0cef186e881ea33525b7332d9d3512 07:59:33 I wonder how I can put the last line into a definition. 08:00:55 Ah I got it. 08:02:47 Forgot the length after S" 123" ? 08:03:28 (I updated the gist for my previous question after I figured it out) 08:03:42 hosewiejacke: Hmm, let me check 08:05:00 S" 123" leaves ( c-addr u ) on the stack, so I'm not sure 08:05:57 Oh yes, my bad. 08:06:46 i think >number wants a base below the string 08:07:20 nevermind i misread 08:07:27 https://gforth.org/manual/Line-input-and-conversion.html#index-_003enumber--ud1-c_002daddr1-u1-_002d_002d-ud2-c_002daddr2-u2--core 08:08:04 seems like it wants an initial value 08:08:11 0 S" 123" >NUMBER 08:08:39 i don't know a double means in this context or whether 0 counts, sorry 08:09:52 (i.e. does that mean dword, or does it mean two cells, or does it mean double-length floating point?) 08:10:05 Oh it's a double 08:10:31 I missed that. So the first value which is an accumulator should be 2cell 08:11:43 0. S" 123" >NUMBER \ indeed works 08:13:10 The Forth Programmer's Handbook says it wants an unsigned, double-precision integer. 08:40:50 --- quit: hosewiejacke (Ping timeout: 246 seconds) 09:03:22 --- quit: tangentstorm (Changing host) 09:03:22 --- join: tangentstorm joined #forth 09:12:24 --- quit: _whitelogger (Remote host closed the connection) 09:15:22 --- join: _whitelogger joined #forth 09:55:27 --- join: gravicappa joined #forth 10:58:52 --- join: hosewiejacke joined #forth 11:26:50 --- quit: hosewiejacke (Ping timeout: 260 seconds) 12:04:31 --- quit: gravicappa (Ping timeout: 260 seconds) 12:50:53 --- quit: jn__ (Quit: No Ping reply in 180 seconds.) 12:52:21 --- join: jn__ joined #forth 13:03:37 --- join: cantstanya joined #forth 13:21:29 --- quit: xek (Remote host closed the connection) 13:28:22 --- quit: proteusguy (Ping timeout: 265 seconds) 13:30:56 --- join: proteusguy joined #forth 13:37:51 --- quit: proteusguy (Ping timeout: 260 seconds) 13:46:03 --- quit: tolja (Ping timeout: 256 seconds) 14:37:26 --- join: tolja joined #forth 14:42:08 Is there a nice way to prevent including the same file more than once? I think I should set a flag and check that. 14:46:00 I re-implemented my solution to use linked list instead: https://gist.github.com/neuro-sys/81628d981b229ae576976ae88538ff0b 15:02:34 --- join: xek joined #forth 15:04:51 --- quit: xek (Client Quit) 15:07:50 --- join: proteusguy joined #forth 15:14:00 --- join: xek joined #forth 15:14:16 --- quit: xek (Remote host closed the connection) 15:33:22 neuro_sys: use REQUIRE instead of INCLUDE 15:34:10 inode: Thanks 15:34:22 check "5.17.1 Forth source files" for more info 15:34:32 Will do 16:20:12 --- quit: proteusguy (Ping timeout: 264 seconds) 16:32:18 --- join: proteusguy joined #forth 17:17:10 --- join: dave0 joined #forth 18:18:13 --- join: boru` joined #forth 18:18:16 --- quit: boru (Disconnected by services) 18:18:18 --- nick: boru` -> boru 18:27:44 --- quit: ptrkriz (Remote host closed the connection) 18:32:53 --- join: Zarutian_HTC joined #forth 18:41:36 --- quit: Gromboli (Read error: Connection reset by peer) 19:08:17 --- quit: dave0 (Quit: dave's not here) 19:30:52 --- join: jedb_ joined #forth 19:33:34 --- quit: jedb (Ping timeout: 260 seconds) 19:39:49 --- join: jedb__ joined #forth 19:42:28 --- quit: jedb_ (Ping timeout: 265 seconds) 20:02:28 --- join: hosewiejacke joined #forth 20:49:18 --- quit: sts-q (Ping timeout: 240 seconds) 20:54:59 --- join: sts-q joined #forth 21:17:28 --- join: gravicappa joined #forth 21:31:39 --- quit: hosewiejacke (Ping timeout: 261 seconds) 22:16:05 --- nick: jedb__ -> jedb 22:40:45 --- join: hosewiejacke joined #forth 23:59:59 --- log: ended forth/20.12.01