2024-02-03 14:29:01 crc did you manage to install pforth or another forth in termux? 2024-02-03 14:29:28 i can only install gforth, but i can't use rlwrap with it properly for some reason 2024-02-03 14:30:09 oh nvm, just needed the always-readline option 2024-02-03 14:44:03 trying to learn forth after all this time 2024-02-03 14:50:43 making the guess a number game as the starting forth book asks 2024-02-03 14:50:47 : check 2dup = if ." correct" 2drop else < if ." too high" else ." too low" then then ; 2024-02-03 14:51:03 : guess swap dup rot check ; 2024-02-03 14:51:47 you put the secret number once on the stack, guess must mantain that number 2024-02-03 14:53:47 i'd like to get used to forth, for now stills being hard to even manage the stack 2024-02-03 14:54:21 also ?stack seems to do nothing in gforth, but the word exists 2024-02-03 14:54:59 and it's sad it has no blocks and no editor words 2024-02-03 14:55:07 i wanted to play with that 2024-02-03 14:59:38 i suppose the check word has also to drop the secret number when it's correct 2024-02-03 15:00:03 check 2dup = if ." correct" 2drop drop else < if ." too high" else ." too low" then then ; 2024-02-03 15:00:40 funny 2024-02-03 15:17:37 how do you print a newline 2024-02-03 15:18:24 Joao003: CR should be the right word. 2024-02-03 15:18:24 using the word CR 2024-02-03 15:18:51 thx 2024-02-03 15:18:55 :D 2024-02-03 15:19:02 have fun with newlines :D 2024-02-03 15:19:09 vms14: That CHECK word looks a bit lengthy.. maybe factoring it into three words, LESSER GREATER EQUAL might be better. 2024-02-03 15:19:47 hahah then i'm glad i decided to divide guess into two words 2024-02-03 15:19:54 also, how do you case your word names (snake_case, camelCase)? 2024-02-03 15:20:12 in my mind there were two things to do, so i made two words 2024-02-03 15:20:22 check the numbers and mantain numbers 2024-02-03 15:20:36 hhmm no idea if there is a convention 2024-02-03 15:20:37 Joao003: depending on the forth you're using it might be case insensitive, so snake_case might be the more reliable option. 2024-02-03 15:20:57 Joao003: But I prefer using a dash instead, EXAMPLE-WORD 2024-02-03 15:20:58 or even no casing >:D 2024-02-03 15:20:59 https://www.forth.org/forth_style.html 2024-02-03 15:21:19 yeah, forthwrights like to scream in their code 2024-02-03 15:21:26 vms14: Now you've seen one forth style :P 2024-02-03 15:21:30 words are usually case insensitive 2024-02-03 15:21:39 I use uppercase to indicate I'm talking about a forth word 2024-02-03 15:22:26 user51 seems to come from the starting forth book 2024-02-03 15:22:28 Maybe it's also worth using on words like IF, BEGIN, CASE and such. 2024-02-03 15:22:36 nah i'd use lowercase to indicate it's a word 2024-02-03 15:22:47 vms14: Only on IRC, I use lowercase otherwise. 2024-02-03 15:23:09 i like the dots instead of dashes or underscores, no idea if most forths will accept them 2024-02-03 15:23:41 gforth seems to accept them 2024-02-03 15:23:58 : oh.my 1 2 3 ; 2024-02-03 15:24:17 Most Forths will accept anything not a space (or whitespace) in names 2024-02-03 15:24:31 i prefer them, they're easier to type and make less visual noise than the other symbols 2024-02-03 15:24:32 You should be able to use Unicode too 2024-02-03 15:24:44 hahaha in my toy lang you can 2024-02-03 15:24:53 not a good idea anyways 2024-02-03 15:24:56 Save a LITERAL today! Use : 0 0 ; : -1 -1 ; :P 2024-02-03 15:26:03 https://ideone.com/ZzfV5n 2024-02-03 15:26:31 XD 2024-02-03 15:27:04 works in gforth 2024-02-03 15:27:31 ideone uses gforth 2024-02-03 15:27:43 also in my lang 2024-02-03 15:27:44 oh 2024-02-03 15:28:04 It says at the top right which version 2024-02-03 15:28:24 i'll save it then 2024-02-03 15:28:37 am i the only one who likes separating the action and condition of begin ... until 2024-02-03 15:29:52 no idea, i'm starting to learn forth so i did not use that loop yet 2024-02-03 15:30:14 ok :) 2024-02-03 15:30:23 you can learn at your own pace 2024-02-03 15:33:24 i was supposed to learn it like a year ago, but decided to do my own concat lang instead 2024-02-03 15:33:47 ? 2024-02-03 15:33:57 just because i liked forth so much, but forth does not usually have libraries to play with, like sockets, database, etc 2024-02-03 15:34:28 i wanted a forth with that stuff, but in netbsd i wasn't able to make gforth use the c bindings 2024-02-03 15:35:03 you made a language? 2024-02-03 15:35:05 still my toy lang is so different from forth that almost nothing applies 2024-02-03 15:35:26 yeah, a toy rpn stack based lang using perl and relying a lot on perl 2024-02-03 15:35:37 not a serious language nor a difficult task 2024-02-03 15:35:57 did you put it on github or something else? 2024-02-03 15:36:10 no, i keep rewriting it 2024-02-03 15:36:42 https://termbin.com/kq0j 2024-02-03 15:36:57 this is the code i have for now, it's missing some words 2024-02-03 15:37:40 but i always had some envy with real forth code 2024-02-03 15:37:54 and cried secretly cause my lang has nothing to do with a real forth 2024-02-03 15:37:58 :D 2024-02-03 15:38:21 and in the end i have sockets and database stuff, but i do nothing with them 2024-02-03 15:38:46 then why make those if you won't use them? for fun? 2024-02-03 15:39:12 cause i wanted forth to become my main language and do any kind of program with it 2024-02-03 15:39:32 but doing the stuff like i did, the language ended having to do nothing with forth 2024-02-03 15:39:40 it's more like a reversed lisp 2024-02-03 15:40:06 like a reversed lisp without superfluous parentheses XD 2024-02-03 15:40:23 i know i can always use C or assembly and make a real forth implementation, but i guess for now i should just learn forth properly 2024-02-03 15:40:37 it has lists '(' is a word that builds a list and pushes it on the stack 2024-02-03 15:40:53 lists can also be evaluated as code 2024-02-03 15:41:04 hmhmhmhmh strings hmhmhmhmh 2024-02-03 15:41:37 but the overall thing just sucks 2024-02-03 15:41:53 it's a toy lang after all, yet i had a lot of fun making it 2024-02-03 15:42:04 and learned some stuff i suppose 2024-02-03 15:42:23 still, the more i learn forth, the better 2024-02-03 15:42:43 i'm learning the basics, so i need some time before going to more advanced stuff 2024-02-03 15:43:22 the day i learn forth properly, if i really need X library i can always implement it 2024-02-03 15:44:10 i have some weird love with forth, specially i love colon words and how it encourages factoring 2024-02-03 15:44:20 ACTION likes stack languages and will make one some time in the future 2024-02-03 15:44:57 i think forth would be very good as a main dev language, but the fact i can't do some stuff always turned me off 2024-02-03 15:45:23 still, nothing to worry as i end doing nothing even if i have that "stuff" 2024-02-03 15:46:00 and i have to learn forth properly so i can steal more ideas and have a more correct language 2024-02-03 15:46:08 that is actually useful for something 2024-02-03 15:46:46 i only stole the parameter stack and the sense of colon words 2024-02-03 15:47:01 there is not even compile time, but read time 2024-02-03 15:47:06 XD 2024-02-03 15:47:08 it sucks 2024-02-03 16:43:06 lol i didn't know I and J are just general words to take copies from the return stack 2024-02-03 16:43:22 i thought they were special purpose words for loops 2024-02-03 16:43:57 but i'm reading I takes a copy from the last item on the return stack and J the same for the third item 2024-02-03 17:15:06 vms14: I just use my forths under termux 2024-02-03 17:18:04 I do apparently have a gforth installed in it as well, but haven't run that since last summer 2024-02-03 17:22:16 poor unloved gforth 2024-02-03 17:46:47 vms14: the latest pforth builds & runs under termux without any issues 2024-02-03 17:47:43 i use andronix which gives you a fake chrooted debian so you can use the debian repo and apt install stuff 2024-02-03 17:48:20 but pforth didn't show up, i took a .deb but i have to update libc 2024-02-03 17:48:56 anyways don't worry as the problem was with gforth and rlwrap, but i just needed to add -a as argument to rlwrap and now works fine 2024-02-03 17:49:46 since i use the phone's keyboard which is the same as a blackberry i don't have the arrow keys and i need vi mode 2024-02-03 17:50:46 now everything is fine, except that gforth does not seem to have some words like ?stack 2024-02-03 17:50:58 well the word exists, but seems to do nothing 2024-02-03 17:52:23 I just use straight termux; haven't really tried andronix or similar chroot stuff yet. 2024-02-03 23:13:10 i feel like learning to program from the first time 2024-02-03 23:13:16 for* 2024-02-03 23:13:25 : box ( width height - ) 0 do dup dup dup mod 0= if cr then stars loop drop ; 2024-02-03 23:13:36 i wonder if i really need those dups 2024-02-03 23:13:53 it just prints a box with asterisks 2024-02-03 23:14:46 x mod x always equals 0 2024-02-03 23:15:25 right wth 2024-02-03 23:15:33 why does even work 2024-02-03 23:19:17 https://ideone.com/BJHRsD 2024-02-03 23:20:15 i was supposed to use I there 2024-02-03 23:21:43 vms14> i feel like learning to program from the first time -- agree, that's how i felt, too, and i was skeptical for a long time. still am, to some degree. but i think this is a good sign you're going to learn a new way of thinking about things 2024-02-03 23:22:31 why is the code on stars spaced sooooo much 2024-02-03 23:22:52 though having said that, i'm not sold on forth's do/loop/i/j stuff and tend to not implement it 2024-02-03 23:23:55 i don't understand why that code is working 2024-02-03 23:24:08 it shouldn't 2024-02-03 23:24:11 wtf 2024-02-03 23:24:30 Joao[3] it was a newline 2024-02-03 23:25:09 it was different code also, i was playing with begin again repeat etc 2024-02-03 23:25:18 zelgomer i had that feeling with lisp 2024-02-03 23:25:38 but i guess here is even bigger this feeling 2024-02-03 23:27:30 i keep trying to get why it does work 2024-02-03 23:29:55 describe "works" 2024-02-03 23:30:06 i think you should see a filled box of stars 2024-02-03 23:30:09 draws the boxes i tell it 2024-02-03 23:30:42 i try different numbers, keeps working fine 2024-02-03 23:31:28 https://ideone.com/HFTy6z 2024-02-03 23:31:40 : box 0 do cr dup stars loop drop ; ( equivalent code ) 2024-02-03 23:32:38 no leading newline: https://paste.sh/LWzPZi-7#poBvV-GgkktrujYNLqfFHHus 2024-02-03 23:33:45 ah right 2024-02-03 23:34:03 no need for mod actually since i'm using a loop on stars 2024-02-03 23:34:04 ty 2024-02-03 23:34:09 also it's better practice to use .( *) instead of 42 emit 2024-02-03 23:34:14 that's why it worked 2024-02-03 23:35:37 hahaha 2024-02-03 23:35:55 that's why i say it feels like learning for the first time 2024-02-03 23:36:02 i have no idea of what i'm doing 2024-02-03 23:36:17 i need to make those exercises so i get used to it 2024-02-03 23:38:35 .( wasn't a compile time print? 2024-02-03 23:38:43 i guess you meant ." 2024-02-03 23:40:12 yeah fixed: https://paste.sh/LWzPZi-7#poBvV-GgkktrujYNLqfFHHus 2024-02-03 23:41:40 i like 42 emit cause it shows what is really the answer of life 2024-02-03 23:41:55 only forthwrights do know the real answer 2024-02-03 23:42:09 XD 2024-02-03 23:42:17 it's an asterisk, which kind of makes sense if you think about shell metacharacters 2024-02-03 23:42:24 * means everything 2024-02-03 23:43:17 very meta