Talk:Church numerals: Difference between revisions

m (→‎Created a stub for a Church Numerals: made 3 alternate implementations into lambda functions...)
 
(5 intermediate revisions by 4 users not shown)
Line 81:
<pre>[1,7,12,81,64,1,0,3,1,0,1]</pre>
: Note that alternate implementations are suggested for those languages that don't have Haskell's full set of built-in functions and functional concepts.--[[User:GordonBGood|GordonBGood]] ([[User talk:GordonBGood|talk]]) 03:18, 30 December 2021 (UTC)
:: Nice variant ! Do add it to the main page. Late in the day, and really no need, I think, to start expanding requirements, but also no reason at all for individual contributions not to go an extra mile, as you have done so interestingly here. Many thanks ! [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 09:25, 30 December 2021 (UTC)
::: @Hout, I have contributed two different Haskell variants implementing the extended Church functions as well as C#, F#, and Nim equivalents for your perusal.--[[User:GordonBGood|GordonBGood]] ([[User talk:GordonBGood|talk]]) 13:01, 1 January 2022 (UTC)
 
===Worker-wrapper transformation in Haskell===
Line 93 ⟶ 95:
: (I moved your comment here – given the essentially anonymous/collective character of contributions, the talk page seems the more natural home for it) [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 17:39, 13 September 2018 (UTC)
:: OK [[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 19:02, 13 September 2018 (UTC)
 
===RankNTypes & coercion===
This is a nice task, it is good at showing different type systems. Several examples refers to Haskell's RankNTypes. What does it do? Does it make all Church numerals the same type? In the C++ implementation of division, I had trouble with 4-2 and 3-1 being different types even though they are both 2. Is that the cause of needing coercion? [[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 21:14, 23 December 2022 (UTC)
 
===0^0===
Also, it is amazing that 0^0 works out to 1. Still trying to wrap my head around that one. [[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 21:17, 23 December 2022 (UTC)
 
:0^0 is (generally) defined to be 1, which is not necessarily what you might expect, as you note... As a justification, consider x^n: x^n = x(x^(n-1)), so 2^3 = 2(2^2), 2^2 = 2(2^1) and so 2^1 must be 2(2^0). As 2^1 is 2, 2^0 must be 1 and similarly, every integer to the power 0 must be 1. If you imagine drawing a graph of y = x^0, it would be the straight line y = 1. If 0^0 isn't 1, there would be a discontinuity at x = 0. --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 23:21, 23 December 2022 (UTC)
 
:: Yes, it is amazing that it works out naturally with Church numerals too which seem to come at it from a different angle. [[User:Garbanzo|Garbanzo]] ([[User talk:Garbanzo|talk]]) 08:05, 27 December 2022 (UTC)
125

edits