Talk:Practical numbers: Difference between revisions

m
 
(15 intermediate revisions by 4 users not shown)
Line 1:
 
 
==One of many examples of using Haskell in Python.==
The following are excerpts from Houts Haskell and Python entries on [[Padovan n-step number sequences]] . Hout states that it is ''not'' Haskell typing and yet the valid Haskell type information ''is copied verbatim'' in the Python. It may have another name but he uses that
to hide that hie is deliberately obscuring Python by ignoring tits typing and substituting Haskell typing in examples.
 
Python has its own syntax for typing and its own syntax for typing in comments that is being deliberaterly ignored in by Hout who instead inserts abnother languages typing in Python examples. This is highly un-idiomatic, Python programmers learn would need Haskell knowledge to read this Python example, are highly unlikely to see this in idiomatic Python programs.
 
;Haskell:
<pre>
padovans :: Int -> [Int]
padovans n ...
 
recurrence :: Int -> [Int] -> Maybe (Int, [Int])
recurrence n = ...
 
main :: IO ()
main = ...
...
</pre>
 
;Python:
<pre>
# nStepPadovan :: Int -> [Int]
def nStepPadovan(n): ...
 
# recurrence :: Int -> [Int] -> Int
def recurrence(n): ...
 
# main :: IO ()
def main(): ...
...
</pre>
 
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:16, 1 April 2021 (UTC)
 
: Absolutely Donald – the Python and Haskell functions '''do indeed''' have the same type semantics, and the nested values defined by those two solutions '''are indeed''' intended to parallel each other, but those are '''comments''' in the Python code – '''very''' helpful to the mental clarity of the coder and reader, but, like any comment, '''not''' parsed by Python interpreters or compilers. They are not syntactic, they are not "in a language", they are just helpful comments, in a helpful and universal notation.
 
: The Python tooling is the only objective judge of whether I am doing what you call "using Haskell in Python". If I were, the interpreters and linters would very soon choke and tell us. No language that constrained the content of comments would be much use.
 
: Rosetta Code aims to show how languages are '''similar''' as well as different (as the landing page puts it).
: The composition of pure functions is not only a useful and coherent approach to general problem-solving, it is also deeply anchored in the underlying mathematics of function composition, and, like the Hindley-Milner notation which worries you, it is language-independent, and good at foregrounding what languages '''share'''.
 
: Are addition and concatenation Python 'features' ? Do we avoid them because other languages can also express them ?
: No. They are universal relationships which any useful language will have some way of expressing.
 
: Booleans and integers, and lists, tuples and strings are also sets of values which have mathematical and language-independent definitions, and we can represent these sets in more or less '''any''' complete and practically useful language.
: Hindley-Milner notation is useful precisely because it has a mathematical generality which lets us define (and reason about) value structures which are '''not''' language-dependent, and '''do''' help us think about how complex values can (or can't) click together into the patterns that we need. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:11, 1 April 2021 (UTC)
 
 
Hout wants to pass-off a Haskell like style of programming that was rejected by the Python community when put to members of the steering committee, as idiomatic Python. Hout wants to hide the Haskell style used and present his code as idiomatic Python when it is not.
 
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:16, 1 April 2021 (UTC)
 
: Ah ... so here we see the the focus '''already''' shifting away from an attack on '''comments''' to the admission of a broader intention to "discourage" the whole approach of composing pure functions in Python.
 
: Apparently the '''whole approach''' should be labelled "Haskell" or "not Python", and harassed ...
 
: You appeal to a story about "The Python Community", the details of which I haven't personally followed closely or been in any way involved in, though I '''am''' aware of not only of a largish literature on functional programming in Python, and of significant use of Python for this approach to composing code, let alone the acknowledgment in the opening paragraph of the Python itertools module of debts to languages like SML and Haskell,
: but isn't this the '''Rosetta Code''' community here ? Is dismissing my approach as "passing off" consistent with the goal of comparing and learning from '''different''' approaches ?
: I think we have a larger problem here ...
:[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:11, 1 April 2021 (UTC)
 
:Incidentally, you make a statement about what I "want to do" (apparently this is "present my code as idiomatic Python")
: Well, how do you know ? Have you considered '''asking''' me what I want to do ?
: The answer is very simple, I want to contribute, to Rosetta Code, '''well-linted and reliable''' examples of how problems can be solved, by using Python to define and compose pure functions.
: I am very much aware that that is a minority approach. I happen, however, to find that it is a very '''good''', and actually rather interesting approach, which makes code more reliable, and faster to rewrite and refactor, and which increases levels of code reuse.
: I am certainly '''not''' alone in finding that to be the case. There's a whole literature on functional programming in Python.
: Others will take a different approach. The Rosetta value lies precisely in helping a person with a grounding in one approach to learning another.
: Divergent approaches are a form of '''wealth''' for Rosetta Code, not a source of threat.
:[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:30, 1 April 2021 (UTC)
 
==Two of many examples of using Haskell in Python.==
Hout states that he is not using Haskell in Python below; until I show on this page what I had linked it is made too obvious for even Hout to sustain the lie.
 
Looking at function names used in this task and just one of the other tasks Hout has examples for Hout uses the names of many functions defined in the Haskell language in his Python, (and Applescript), examples, hiding that they are Haskell translations rather than trying to be idiomatic language entries - the kind of code the language community would have you write.
 
This table shows exact function names found in his examples that come with Haskell but not Python, which has it's own functional tools and library.
 
::{| style="text-align: left;" border="4" cellpadding="4" cellspacing="4"
|+ '''Functions defined in languages'''
|-
! Name || In Haskell || In Python
|-
| take || Yes || No.
|-
| unfoldr || Yes || No.
|-
| chunksOf || Yes || No.
|-
| primeFactors || Yes || No.
|-
| until || Yes || No.
|-
|}
 
Hout wants to '''pass-off''' idiomatic(?) Haskell as Python. He has denied this, and is now reduced to stating that it passes the linter; and personal jibes.
 
There is some progress however, Hout has taken on board that Python doesn't use Haskells <code>fst</code> function to get the first item in a Python list, for example.
 
I object to Houts lies and midirections in his attempts to pass off Haskell translations as idiomatic Python.
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 09:41, 2 April 2021 (UTC)
 
: Paddy I think we've already established that you disagree with my approach.
 
: (Those functions and function-names incidentally, are '''not''' peculiar to Haskell – they are part of a broader tradition of pure functional – i.e. mathematically based – programming. You will also find them, for example in SML, another of the languages to which the Python '''itertools''' module acknowledges a debt in the opening paragraph of its documentation. Borrowing functions and function names from that tradition is a well-established Python practice)
 
: All of that, however, is beside the point. We already know that you take a different approach. The question is, how to we '''handle''' differences of approach on Rosetta Code ?
: What is the solution ? (See the topic at the end of this thread for a summary of the solutions that various contributors have put to you, in the hope of some response).
 
: I notice that some rather dark themes are re-emerging in your discussion here. Are we now returning to the more exotic theories, perceptions and techniques which I thought you had put behind you in 2019 ?
:: See [Talk:Tree traversal - Rosetta Code]( http://rosettacode.org/wiki/Talk:Tree_traversal )
: [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 13:12, 2 April 2021 (UTC)
 
== Haskell type hints are not valid Python==
Line 215 ⟶ 328:
 
== Create a new language code (my awkward attempt at a bit of diplomacy) ==
Can I just ask, would you (Hout) be opposed to creating a new language code? Call it anything you like: [[Python (Functional)]], [[Functional Python]], [[Python-H]], [[Phython]], and explain on that new Category page it is just standard Python [3] written with Haskell/MH type annotation comments (or however you want to phrase it), and perhaps add a link on the existing [[Python]] Category page to it. In fairness I have to ask whether you (Paddy/Donald) would object to such a link/category. It seems to me that could resolve this clash of styles and be independently useful anyway. (My apologies if that's all just crazy talk.)
 
Just so you both know, I have actually learnt a few things from these arguments, not that I'm suggesting they should continue. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 13:06, 31 March 2021 (UTC)
Line 239 ⟶ 352:
:: See https://www.rosettacode.org/wiki/Rosetta_Code:Village_Pump/Discouraging_approaches
:: Can you advise me one how one adds such topics to the main listing of the Village Pump page ?
:::From the look of thinksthings new vptopic tags stopped working properly around 2015. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 17:08, 1 April 2021 (UTC)
:::: Ah ... thanks. Sounds like I misread that. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 17:53, 1 April 2021 (UTC)
 
Line 301 ⟶ 414:
The Pythonic thing is to optimise for '''clarity''', the Rosetta thing is to show differing approaches '''side by side'''. Angry unilateral deletion, and the enforced reduction of clarity in the name of "compliance" is not just sad and foolish – it constitutes direct and disgraceful attack on the health and wealth of Rosetta Code, and on the principles of PEP8 itself.
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 20:01, 31 March 2021 (UTC)
 
 
==Acceptable Solutions ?==
 
We have a problem.
 
The Rosetta Code aim (defined on the landing page) "to aid a person with a grounding in one approach to a problem in learning another" is blocked here.
 
Disapproval of divergent approaches has again, after a respite of several months, degenerated into:
:# hostile retitling of entries as "unidiomatic", even when they are more thoroughly linted than those labelled "idiomatic"
:# hostile "improvement" notices applied to code that is working and linted
:# deletion of all type comments, and their replacement with compiler type notation which requires debugging and is less easily readable
:# multiply repeated deletions of attempts to show two approaches side by side.
:# rhetoric dismissing a particular approach as "not to be be encouraged" and not to be used with a particular language.
 
There is no need for us to change each others minds, but on Rosetta Code all contributors '''should''' be able to safely show a variety of working and well-linted approaches, without fear of "discouragement" and attack.
 
What is the way forward ?
 
Fellow contributors have suggested, as Wherrera puts it, creating and distinctly indexing the subcategory of Python solutions that code in a particular way. (My own description of the way that is again being attacked would be something like the ''composition of pure curried functions'', i.e. one approach to ''functional composition'' in general).
 
Particular suggestions have been:
 
:# A new language code, perhaps some variant of Functional Python, Curried Python etc
:# The labelling scheme used by Wren, leading to path names like Task::Python::Functional::Folding
:# Comments written in English rather than in the Hindley-Milner notation which you experience as "Haskell".
 
Paddy or Donald, you have not yet had a chance to respond to these proposals.
 
Can we ask you what it would take for you to feel that you didn't have to "discourage" approaches and views which differ from your own ?
 
Would you feel able to share with us why you were able to refrain from this kind of behaviour for a number of months, and have recently returned to it ?
 
It there anything we can do to help you "live and let live" again ?
 
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 07:23, 2 April 2021 (UTC)
 
== Rosettacode's purpose ==
 
Please keep in mind that the purpose of Rosettacode is to illustrate how a coding task can be implemented in multiple languages.
 
Please do not just delete code which was written with that purpose in mind.
 
If bulk becomes a problem, the code can be moved to a secondary page and linked from to the primary page. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 15:49, 2 April 2021 (UTC)
6,951

edits