Talk:Egyptian division: Difference between revisions

m
Reverted edits by Thundergnat (talk) to last revision by Hout
m (Reverted edits by Thundergnat (talk) to last revision by Hout)
 
(3 intermediate revisions by 3 users not shown)
Line 41:
:: The Perl and Python versions are absolutely consistent with the task description, and of course there's not much to be gained from antiquarianism or reconstructive archaeology here :-)
:: The kernel of Nigel's point does, however, seem interesting and fruitful to me – the heart, motivation, and logic of the algorithm is precisely to derive division from more primitive operators – and I think we might get a simpler (and perhaps more interesting ?) task description by foregrounding that, even tho it would cost us some tweaks to some of our first drafts. Asking people to show how one could formalise this algorithm, in a given language, '''purely in (arithmetic) terms of addition/subtraction''', seems like a more interesting task constraint, for example, than over-specifying the intermediate data structure. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 17:19, 11 August 2017 (UTC)
 
:: The point is that if you use exponentiation and multiplication you can generate each row of the table as needed, so the requirement to first create the table and store it is just a pointless restriction. The beauty is that the table can be produced just by adding the previous row to itself.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 11:49, 12 August 2017 (UTC)
 
That is an interesting point by Nigel, and some nice replies. I originally was debating adding extra information on how the table could be created by bit shifting, and the summations gave the binary result, but left all that guff out for a simpler task. I had not thought of restricting mathematical operators in Nigel's manner - now I know, it would be a valid but different task. I don't think it would be good to change the current task however. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:06, 11 August 2017 (UTC)
Line 46 ⟶ 48:
:P.S. Nigel, we tend not to sign examples on the task page, relying on the page history to track authorship. This also encourages others to correct errors they may spot etc. It's the wiki way on RC :-) --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:13, 11 August 2017 (UTC)
:: How about just adding a simple 'extra credit' clause – 'Show that Egyptian division can be performed in your language without making any use of multiplication, division or exponentiation operators' [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:55, 11 August 2017 (UTC)
 
==Haskell 'lazy lists' example==
 
Two thoughts about the current draft of this:
First, to avoid using (*) (in this exercise in deriving division from addition and subtraction), the function which you '''iterate''' for 'doubling' could either be <code Haskell>(+) >>= id</code> or the equivalent <code Haskell>join (+)</code> (where join is imported from Control.Monad).
Second, perhaps the task really needs a formulation which returns a remainder as well as a quotient ?
10,327

edits