Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #45240
| Newsgroups | comp.lang.forth |
|---|---|
| Date | 2016-02-01 20:41 -0800 |
| References | (2 earlier) <2f129938-910a-4d50-8698-44530c57700b@googlegroups.com> <9f186b06-c421-431a-8c5b-84981d9bc40f@googlegroups.com> <f00fb3c7-f785-4611-a8a8-2e478f10707f@googlegroups.com> <665d20c6-7ddd-44e1-80dd-766716a79c82@googlegroups.com> <b5c2be54-f635-4e36-8ece-2791240a2858@googlegroups.com> |
| Message-ID | <72571aea-4373-46e1-a575-e495c9683d07@googlegroups.com> (permalink) |
| Subject | Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; |
| From | hughaguilar96@gmail.com |
On Monday, February 1, 2016 at 3:23:38 AM UTC-7, humptydumpty wrote: > On Monday, February 1, 2016 at 11:32:39 AM UTC+2, Julian Fondren wrote: > > Thanks for this list of words. I didn't like your YC , and this > > list helped me to say why. > > ... > > I know, when I start to write a word, whether it'll have a loop > > or not. Then it's just a question of whether I want to use DO > > or not. If I'm basically iterating over an array - there is a > > start and endpoint and they are connected by definite increments > > from one to other - then I use DO. Otherwise, BEGIN. > > > > I don't say, I'll use one of BEGIN ... WHILE ... REPEAT or else > > BEGIN ... UNTIL or else BEGIN ... AGAIN. Because these are all > > really just conveniences upon BEGIN ... AGAIN. If you need to > > do some post-loop work then you can EXIT to a caller that does > > it or you can branch past the loop to do it. > > > > Then nothing stop to write: > > : BA BEGIN execute AGAIN ; > > and inside word whom XT is fed to BA to write 'XT' to loop again, > 'XT EXIT' to an earlier loop again and 'RDROP EXIT' to exit BA > whenever wish to. > > > And likewise I don't *think* about which variants of DO ... LOOP > > I want. It just works out that the code requires one of them. > > > > So I approach the word with an understanding that it'll be > > looping, I decide on DO or BEGIN , and then I no longer care > > about looping structures, I just care about what the word > > requires. > > > > With your words, I would have to ask: do I want YC, or YCC, or > > YCC+, or YCCI, or YCCI+, or YCG, or YCG+, or YCGI, or YCGI+ . > > Even if I'd memorized all of these, I would still have to decide > > between them. And I still have to decide between them before I > > write the body of the loop, because it must pass flags or > > increments to them. > > > The names for those loops I think myself that somehow are poor chosen ... > But everyone can rewrite/use them as he/she wish. Important is ideea behind names. I agree with Julien. The problem here is the idea behind the names --- your HOFs' names describe what the loop does --- your HOFs' names should instead describe what kind of data the HOF iterates over. For example, my EACH tells the user that his xt is executed for each item in the list. The user doesn't have to know what kind of loop is used internally (whether it is a DO loop or a BEGIN loop) --- the whole point of having a HOF is to hide the internal workings of iteration from the user, which includes hiding whether it is a DO loop or a BEGIN loop --- your code isn't really hiding anything, but it is just a shorthand for what the user is already able to do with explicit iteration code. FIND-NODE and FIND-PRIOR are also examples of HOFs whose names tell the user what is being done with the data --- not what is being done with the code --- the goal is that the user should be able to think in terms of data rather than code, and his program should be a description of the resultant data rather than a procedural description of the code that produces this result. Think of your description of the data as being an axiomatic system. Saying that the items in the list are ordered from first to last is an axiom. The user could actually drop this axiom and say that the items are unordered like a set. In this case EACH and FIND-NODE still describe what is done with the data (although duplicates make for a sticky point). FIND-PRIOR no longer makes sense though. Dropping an axiom like this from our definition of a list is similar to how the parallel-line axiom can be dropped form Euclid's geometry and you still get a useful system. The point here is that we are describing the data, not the code. This post has been somewhat philosophical --- but you did say: "Important is idea behind names" --- naming things is a big part of philosophy, and many would say the entirety of philosophy, so you totally asked for a philosophical response! ;-)
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
: YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-28 23:19 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-29 09:49 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-02-02 10:00 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-02 02:32 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-01-29 20:42 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-29 23:27 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-29 23:30 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-01-30 11:32 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-31 10:02 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Julian Fondren <julian.fondren@gmail.com> - 2016-02-01 01:32 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-01 02:23 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-02-01 20:41 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-01 23:36 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-02-02 20:29 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-03 00:05 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-03 00:26 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-02-03 12:17 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-03 06:17 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-03 06:19 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; franck.bensusan@gmail.com - 2016-02-03 01:02 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; franck.bensusan@gmail.com - 2016-02-03 01:23 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-02 17:31 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-01-31 21:19 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-02-01 00:28 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; "WJ" <w_a_x_man@yahoo.com> - 2016-01-31 10:35 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Chris Curl <ccurl609@gmail.com> - 2016-01-31 07:47 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; hughaguilar96@gmail.com - 2016-01-31 20:37 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; "WJ" <w_a_x_man@yahoo.com> - 2016-01-30 09:43 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Julian Fondren <julian.fondren@gmail.com> - 2016-01-30 02:11 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; humptydumpty <ouatubi@gmail.com> - 2016-01-30 11:33 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; "WJ" <w_a_x_man@yahoo.com> - 2016-01-31 10:11 +0000
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Julian Fondren <julian.fondren@gmail.com> - 2016-01-31 08:04 -0800
Re: : YC ( .. xt xt |0 -- .. ) BEGIN WHILE execute REPEAT ; Julian Fondren <julian.fondren@gmail.com> - 2016-01-31 08:31 -0800
csiph-web