00:00:00 --- log: started forth/16.10.08 00:54:09 --- quit: mnemnion (Remote host closed the connection) 00:56:37 John[Lisbeth]: Instead of memorizing stack manipulators, consider forgetting about them. 00:57:52 Just embed your arguments where they belong, and only then slice your code up into factors. 01:02:47 I like designing my functions before I design my arguments 01:03:06 I do things manually for the computer and then get the computer to follow the patterns of what I am doing 01:03:54 If you need stack manipulators at the front of your words that means you are creating interfaces. If you are creating interfaces that means your words are not existing as one thing well (Forth). Forth words are not unix commands... 01:04:00 --- join: mnemnion (~mnemnion@2601:643:8102:7c95:4598:2ea0:5521:623) joined #forth 01:04:38 forth words work alot like how unix commands work 01:04:49 We are not operating on streams of data. Forth words shouldn't talk to each other through the stack anymore than they would without factoring. 01:05:41 forth words manipulate the stack 01:08:19 --- quit: mnemnion (Ping timeout: 240 seconds) 01:14:41 A Forth program executes in four phases: design time, edit time, compile time, and run time. The former phases are enough unless there are externalities on the latter. For instance, filtering data streams is only necessary for the world beyond I/O. Therefore, do your parsing as early as possible. 01:15:00 Use math, never use conditionals. 01:15:29 conditionals are fine 01:18:45 Conditionals are for exceptions to your theory of the problem. If you have a lot of exceptions to the rule in your theory, your theory is, well, inconsistent and very likely wrong. 01:19:38 conditionals are for logic 01:21:17 John[Lisbeth], conditionals explode complexity. pointfree's advice is right on the money. 01:21:44 in certain situations they are very efficient 01:23:58 John[Lisbeth], in certain situations they're necessary but almost never more efficient if there's an alternative (such as a jump table for example). 01:24:26 oh well 01:35:25 at a certain point 01:35:31 you have to bootstrap to save yourself effort 01:49:49 the whole point of computers was to have them to thinking work for us 01:51:47 It makes sense not to describe things in such a way that is more than is necessary to solve your problem 01:52:08 But the way I see it that is just one idiom among many programming idioms out there 01:56:19 John[Lisbeth], you've just described algorithms - which often can be used to generate decisions without relying on conditionals. Think functional-style for example. Fits very well for any pointfree language. 01:56:57 functional programmers still use conditionals in their work I don't know what you're talking about 02:04:51 --- join: mnemnion (~mnemnion@2601:643:8102:7c95:4598:2ea0:5521:623) joined #forth 02:09:28 --- quit: mnemnion (Ping timeout: 250 seconds) 02:34:33 John[Lisbeth], no one says don't use conditionals. We're saying avoid them whenever possible. 06:09:49 --- log: started forth/16.10.08 06:09:49 --- join: clog (~nef@bespin.org) joined #forth 06:09:49 --- topic: 'Forth Programming | logged by clog at http://bit.ly/91toWN | http://projects.forthworks.com/standards/DPANS/ | www.greenarraychips.com' 06:09:49 --- topic: set by crc!sid2647@gateway/web/irccloud.com/x-incoycbnpesmfspg on [Fri Nov 06 18:58:45 2015] 06:09:49 --- names: list (clog mnemnion groovy2shoes true-grue X-Scale fiddlerwoaroof Quozl` dograt +proteusguy ggherdov`__ rpcope APic impomatic systemsgotyou backer_ rprimus djinni bluekelp npr reepca segher_ pointfree eldre irsol octo_ karswell nighty crc eatonphil Keshl John[Lisbeth] zy]x[yz taij33n Vendan pdewacht _longines cantstanya carc jeremyheiler diginet2 phadthai yunfan ovf hexagon5un M-jimt nighty- CORDIC DGASAU ASau dzho nerfur beretta OriansJ`) 06:12:19 --- quit: mnemnion (Ping timeout: 240 seconds) 07:08:50 --- join: mnemnion (~mnemnion@2601:643:8102:7c95:4598:2ea0:5521:623) joined #forth 07:13:59 --- quit: mnemnion (Ping timeout: 240 seconds) 07:23:02 --- join: dys (~dys@x4d02b121.dyn.telefonica.de) joined #forth 07:30:09 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 07:51:31 --- join: rgrinberg (~rgrinberg@24-246-56-85.cable.teksavvy.com) joined #forth 07:58:06 --- quit: ASau (Quit: ERC (IRC client for Emacs 24.5.1)) 08:23:40 --- join: ASau (~user@netbsd/developers/asau) joined #forth 08:46:08 pointfree: when you say "Just embed your arguments where they belong, and only then slice 08:46:08 your code up into factors."... could you elaborate on that a bit? What do you mean by "embed your arguments where they belong"? 08:57:17 --- join: nal (~nal@adsl-64-237-237-101.prtc.net) joined #forth 09:03:08 --- quit: Zarutian (Quit: Zarutian) 09:13:36 --- join: ASau` (~user@176.5.32.136) joined #forth 09:15:35 --- quit: ASau (Read error: Connection reset by peer) 09:23:09 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 09:24:10 --- join: Zarutian_ (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 09:24:10 --- quit: Zarutian (Read error: Connection reset by peer) 09:24:11 --- nick: Zarutian_ -> Zarutian 09:30:16 --- nick: ASau` -> ASau 09:59:49 --- join: mnemnion (~mnemnion@2601:643:8102:7c95:4598:2ea0:5521:623) joined #forth 10:21:31 --- quit: nal (Ping timeout: 248 seconds) 11:05:59 --- quit: rgrinberg (Ping timeout: 260 seconds) 11:16:43 --- quit: Zarutian (Ping timeout: 260 seconds) 12:14:52 --- join: MickyW (~MickyW@p57A2FD7C.dip0.t-ipconnect.de) joined #forth 12:51:59 --- quit: groovy2shoes (Ping timeout: 240 seconds) 13:37:43 --- join: groovy2shoes (~groovy2sh@unaffiliated/groovebot) joined #forth 13:53:56 reepca: a simple example of embedding an argument where it belongs is to do 1 BIT# LSHIFT OR instead of 1 SWAP LSHIFT OR where BIT# is some word that calculates the bit to be tested. BIT# may reference a variable somewhere down the line but ideally it's just tied into a forth lexicon leveraging math. Math is could be called generality you get for free. 13:54:34 To make it read like the : WASHER WASH SPIN RINSE SPIN ; style code, you can slice it up into factors according to how it would make sense in natural language and accurately describe what's inside. : BITS BITS POS ; : TEST LSHIFT OR ; BITS TEST 13:58:19 --- quit: karswell (Read error: Connection reset by peer) 13:58:21 --- join: karswell` (~user@187.124.114.87.dyn.plus.net) joined #forth 13:58:46 Without an application to constrain the code to that example still looked too general. Here's some code from ForthFS: : CONVERSING COMPREHEND SPEAK ; : CONVERSATION BEGIN CONVERSING UNTIL DONE ; ( COMPREND parses the received 9P messages through a lexicon. SPEAK is the response to what has been COMPREHENDed. The server and client BEGIN CONVERSEing UNTIL they are DONE ) 14:08:12 --- quit: MickyW (Quit: Leaving. Have a nice day.) 14:15:11 --- join: nal (~nal@adsl-64-237-237-101.prtc.net) joined #forth 14:25:55 --- join: newcup (newcup@peruna.fi) joined #forth 14:27:18 --- quit: karswell` (Remote host closed the connection) 14:28:20 --- join: karswell` (~user@187.124.114.87.dyn.plus.net) joined #forth 14:40:19 --- quit: groovy2shoes (Ping timeout: 240 seconds) 14:44:55 --- join: groovy2shoes (~groovy2sh@unaffiliated/groovebot) joined #forth 15:20:27 Okay, so using my fibonacci example, it might look something like : fib 1 0 0 fibs# do next-fib loop drop ; ? 15:23:02 er... I might have my do arguments mixed around 15:27:43 : fib 0 1 fibs# 0 ?do next-fib loop swap drop ; There that's better 15:28:06 anyway, would it be a bad idea to have fibs# be implemented as just stack manipulation to get at the 3rd stack item down? Would that be too brittle? 15:45:26 --- quit: true-grue (Read error: Connection reset by peer) 16:37:26 reepca: I'd ask a question like: why do I want 100 numbers from the fibonacci sequence? If there is no reason why you want the first 100 fibonacci numbers or any particular sequence of fibonacci numbers then you can delete the FIBS word from you code because there's no purpose to it. If some other part of your code depends on FIBS then that's where you get the required # of fibs 16:37:39 ...and you can easily embed that into the definition without juggling. Your requirements originate from outside the code, such as from sensors or actuators. If you have no requirments then no code is required! 16:40:01 --- join: Zarutian (~zarutian@168-110-22-46.fiber.hringdu.is) joined #forth 16:40:55 I want 100 numbers from the fibonacci sequence because project euler says I do (well, technically I want the even-valued ones, and then I want to sum them...) 16:48:50 Then just embed the literal number 100 into your definition. Forth is interactive and has editor words and the like. Move it to the edit time stage of execution. There's no need to handle that number input at run time, it's editing. 16:51:27 for some reason I don't like the idea of redefining a word every time I want to use it to get a different output 16:51:42 I should probably clarify, I'm thinking of fib as producing the nth fibonacci number, not the entire sequence 17:22:41 --- quit: ASau (Remote host closed the connection) 17:23:00 --- join: ASau (~user@176.5.32.136) joined #forth 17:23:01 --- quit: ASau (Changing host) 17:23:01 --- join: ASau (~user@netbsd/developers/asau) joined #forth 18:00:24 reepca: "An integer formula for Fibonacci numbers" http://paulhankin.github.io/Fibonacci/ 18:07:09 huh... that seems a bit complex. 18:08:56 --- quit: Zarutian (Quit: Zarutian) 18:12:10 reepca: when you play enough with it, try some better programming language. :) 18:15:31 ASau: Like? 18:16:46 I would say that even C is better, but you may choose something better as well. 18:17:57 At least very few C programmers will recommend you unrolling loops manually, hardcoding constants and so on. 18:21:16 DGASAU 18:21:34 I don't have anything nice to say in response. 18:26:16 reepca: what book are you using to learn Forth ? 18:27:20 I've read quite a bit of starting forth, some various papers, quite a bit of thinking forth, a lot of reddit and alas too much c.l.f stuff. 18:27:31 I don't think I've actually finished reading any single book though 18:28:53 nice 18:29:40 I did some Postscript in the past. It's has a lot of Forth inspiration, with all those graphical capabilities added. 18:31:10 Mostly from http://www.math.ubc.ca/~cass/graphics/manual/ 19:22:39 --- quit: groovy2shoes (Ping timeout: 240 seconds) 19:27:45 --- join: rgrinberg (~rgrinberg@blk-212-79-74.eastlink.ca) joined #forth 19:44:11 --- quit: rgrinberg (Ping timeout: 248 seconds) 20:23:46 --- join: rgrinberg (~rgrinberg@blk-212-79-74.eastlink.ca) joined #forth 21:37:47 --- quit: rgrinberg (Ping timeout: 248 seconds) 21:46:55 --- join: malyn (~malyn@54.201.34.233) joined #forth 21:55:47 X-Scale: it looks like there is a js port of postscript 22:21:31 I still think conditionals can be really good in certain situations 22:21:42 like with filtering data 22:35:08 --- join: rgrinberg (~rgrinberg@blk-212-79-74.eastlink.ca) joined #forth 22:45:14 --- quit: rgrinberg (Ping timeout: 260 seconds) 23:59:59 --- log: ended forth/16.10.08