|
VikingofRock posted:I'd guess the shaggarpinion is that C# is the better language and that Java has better tooling, but we'll have to wait for The Shaggar Themself to come by and give the appropriate biblical analogy for the relevant langs. i mean, this is the correct opinion.
|
# ? Oct 27, 2016 22:57 |
|
|
# ? May 22, 2024 17:01 |
|
hackbunny posted:no, I'm not using python 3 MyPy is optional typing thing for Python. You can get it to work with Python 2.7, but it becomes larger PITA to use in doing so (your type annotations and assertions become comments instead of part of the language...).
|
# ? Oct 27, 2016 23:29 |
|
Symbolic Butt posted:I don't like chaining too many functions/methods, they get hard to understand fast. even C# linq people try not to get too crazy and break chains into smaller steps and give names to them. C# and Java let you chain higher order functions together in a use-able way and actively encourage it. they do not bill themselves as funclangs. they just recognize that this functionality is absurdly practical and useful.
|
# ? Oct 28, 2016 00:26 |
|
even stupid plang javascript is trying to push you toward this idiom https://www.airpair.com/javascript/posts/mastering-es6-higher-order-functions-for-arrays
|
# ? Oct 28, 2016 00:43 |
|
comedyblissoption posted:sorry, but python lacking these extraordinarily useful features is why it is a lovely language. I have no idea what you're talking about, working with java 8's functions is an exercise in boilerplate and frustration but sure having andThen method is so much better because oh my god I don't want to write f(g(h(x))), that's barbaric
|
# ? Oct 28, 2016 00:52 |
|
f(a, g(b, h(c, x))) is less readable than: c#-ish/javascript-ish: code:
code:
code:
|
# ? Oct 28, 2016 01:05 |
|
you can do x.h(c).g(b).f(a) in python, you just have to include \ if you're breaking lines because of semantic whitespace (like Asymmetrikon said) but insinuating that python DOESN'T SUPPORT IT is disingenuous
|
# ? Oct 28, 2016 01:26 |
|
the thing with python not having a funclang-like syntax for function composition is because there's an active effort on not making things too smart, one way of doing obvious basic stuff etc. it'd just turn into one of those features that people use to show off, to refactor perfectly fine procedural code into more ~elegant~ code. and that probably would slow down the resulting bytecode because surprise surprise python wasn't originally designed with those features in mind (as you can see I have a slight beef with generators...)
|
# ? Oct 28, 2016 01:28 |
|
im the guy writing python when im concerned about speed enough to avoid generators
|
# ? Oct 28, 2016 01:30 |
|
Symbolic Butt posted:perfectly fine procedural code hmmm.
|
# ? Oct 28, 2016 01:35 |
|
fart simpson posted:im the guy writing python when im concerned about speed enough to avoid generators I don't avoid generators, I just don't like when people try too hard into refactoring code to use them everywhere
|
# ? Oct 28, 2016 01:38 |
|
Symbolic Butt posted:you can do x.h(c).g(b).f(a) in python if not, it's really a moot point
|
# ? Oct 28, 2016 01:43 |
|
comedyblissoption posted:haskell-ish: mystes fucked around with this message at 02:06 on Oct 28, 2016 |
# ? Oct 28, 2016 02:01 |
|
VikingofRock posted:I'd guess the shaggarpinion is that C# is the better language and that Java has better tooling, but we'll have to wait for The Shaggar Themself to come by and give the appropriate biblical analogy for the relevant langs. c# is mostly a better language, but java does some things better (enums, exceptions) and java has maven which is the best thing ever. C# has better web frameworks (asp.net mvc/webapi/signalr) java has better data libraries (mybatis/mybatis-spring). I prefer working in c# cause of the work I'm doing now but I wouldn't mind doing java at all.
|
# ? Oct 28, 2016 02:06 |
|
comedyblissoption posted:are there standard and widely used collection libraries that do this you mean doing something like this? Python code:
another example Python code:
Python code:
|
# ? Oct 28, 2016 02:48 |
|
what's the equivalent of this pseudocode in pythoncode:
|
# ? Oct 28, 2016 02:54 |
comedyblissoption posted:what's the equivalent of this pseudocode in python Python code:
|
|
# ? Oct 28, 2016 03:12 |
Probably you would just write it as a for loop though.Python code:
|
|
# ? Oct 28, 2016 03:19 |
|
VikingofRock posted:Probably you would just write it as a for loop though. but that isn't functional
|
# ? Oct 28, 2016 03:33 |
|
VikingofRock posted:Probably you would just write it as a for loop though. yeah, this is what I meant by "perfectly fine procedural code" anyone who mastered the accumulator loop pattern pretty much got 70% of real world programming skills
|
# ? Oct 28, 2016 03:43 |
|
the main issue with the procedural style is when you start adding more complexity the obfuscation factor starts increasing rapidly
|
# ? Oct 28, 2016 05:16 |
|
yeah i think the idea that functional style method chaining is more complex or harder to read than procedural loops is completely backwards
|
# ? Oct 28, 2016 05:19 |
|
Symbolic Butt posted:yeah, this is what I meant by "perfectly fine procedural code" my programming languages have mastered the accumulator loop pattern with a function called "reduce" or "fold"
|
# ? Oct 28, 2016 05:21 |
|
comedyblissoption posted:what's the equivalent of this pseudocode in python from functools import reduce from operator import mul reduce(mul, [x*100 for x in [1, 2, 3, 4, 5] if x*100 < 300])
|
# ? Oct 28, 2016 05:47 |
|
Communist Pie posted:from functools import reduce lol
|
# ? Oct 28, 2016 06:57 |
|
Are we just ignoring that:code:
|
# ? Oct 28, 2016 06:57 |
|
mystes posted:Edit: Oh this isn't the terrible programmer thread. just zipWith
|
# ? Oct 28, 2016 06:59 |
|
Maluco Marinero posted:Are we just ignoring that: Yeah this is a really silly argument. Python "supports" functional composition to the same degree that C# does. To whit: neither of them support it as a language feature* but their standard libraries have types that return composable results (e.g. functools vs the extension methods in LINQ). It's not like it's a hard pattern to implement. If you use libraries that are built around functional composition surprise surprise you have functional composition. While there's nothing in Python's core lib that looks as nice as, say, Haskell you dip into data processing packages like pyspark and your code looks nearly identical to comedyblissoption's pseudo code. * ignoring linq expressions which were there only to introduce the idea of functional composition to fussy .NET devs afraid of change
|
# ? Oct 28, 2016 07:14 |
|
fart simpson posted:yeah i think the idea that functional style method chaining is more complex or harder to read than procedural loops is completely backwards I didn't say either of those things dumbass, my argument is that python was not designed to be a functional language and it's silly to shoehorn these things just to conform with comedyblissoption's standards of what makes a Not Bad programming language.
|
# ? Oct 28, 2016 12:59 |
|
fart simpson posted:my programming languages have mastered the accumulator loop pattern with a function called "reduce" or "fold" functional programming is neat and I'm glad newer programming languages have been moving towards it
|
# ? Oct 28, 2016 13:02 |
|
guido and acolytes' claim that a procedural accumulator loop is clearer than a functional pattern is plain false. a map or a reduce is a very specific pattern with no room for ambiguity, while a general loop can capture pretty much any computation you can think of. personal preference is one thing, but one pattern captures objectively more semantic information than the other one. reminds me of arguments like "why would I ever use meters when I can visualize what a yard looks like?" that said, I do prefer the loop style in python, but only because they purposely butchered functional programming to make it less pleasant to use
|
# ? Oct 28, 2016 13:11 |
|
Volte posted:guido and acolytes' claim that a procedural accumulator loop is clearer than a functional pattern is plain false. I disagree, it's definitely clearer for most working programmers for sure. but that's just a matter of social circumstances, the vast majority of people learn to code with ifs and loops and not maps and filters. I can't fault python's conservative attitude here, it's not in their best interests to risk alienating people in order to push features that doesn't even bode well with the language.
|
# ? Oct 28, 2016 13:32 |
|
Dr Monkeysee posted:While there's nothing in Python's core lib that looks as nice as, say, Haskell you dip into data processing packages like pyspark and your code looks nearly identical to comedyblissoption's pseudo code. chaining a bunch of functions together that are just taking in non-functions isn't a counterexample to my claim that python poorly supports chaining higher order functions. a higher order function is a function that takes a function as a parameter and this style is often used in transforming data of collections. the pyspark et al libraries are the counterexample and it looks like something you'd do in C#: http://standarderror.github.io/notes/Data-munging-cheat-sheet/ unfortunately the python community is such that if you collaborate with others they might pitchfork you if you use such libraries, but I take back my claim that python is awfully bad. it's now a reasonable dynamically typed language (which still makes it bad much like linted javascript)
|
# ? Oct 28, 2016 13:45 |
|
Symbolic Butt posted:I disagree, it's definitely clearer for most working programmers for sure. but that's just a matter of social circumstances, the vast majority of people learn to code with ifs and loops and not maps and filters. the familiarity of a language to common idioms and pushing common idioms over superior alternatives can be bad though. rich hickey (the clojure guy) makes a compelling case of why catering to the industry norm of imperative style is disastrous: https://www.infoq.com/presentations/Simple-Made-Easy
|
# ? Oct 28, 2016 13:48 |
|
also I think the reason fold is shunned by a lot of "working" programmers is because of pedagogy and the way it's taught as some complicated recursive thing. the best way to teach it is that fold is an encapsulation of the following pattern: a0 f a1 f a2 f a3 where f is an infix operator it's really simpler than the equivalent for loop and any programmer that can understand that can understand fold if it's properly taught
|
# ? Oct 28, 2016 13:51 |
|
the python3000 debacle goes a pretty long ways towards my distrust of the stewards of the language, i am not sure why it is so hard for platform maintainers have such a hard time grasping that the software written in/on/against the platform will always be vastly more valuable than the platform itself if it is even moderately successful java people gets it. microsoft built an empire on knowing it but appears to have since forgotten. the most no-effort profitable parts of ibm are still based on having a basic level of respect for others investment into your stuff
|
# ? Oct 28, 2016 13:56 |
|
at least its not swift lol
|
# ? Oct 28, 2016 14:02 |
|
Mr SuperAwesome posted:at least its not swift lol whatw wrong with swift, i like it
|
# ? Oct 28, 2016 14:25 |
|
One of the few presentations I actually managed to watch in its entirety, it's very good.
|
# ? Oct 28, 2016 14:42 |
|
|
# ? May 22, 2024 17:01 |
|
why does this class layout make no loving sense, why is the base class in the right place but the base's base at the rear end end of the class why doesn't it show in the debug symbols *notices "virtual public" thinks nothing of it* *notices typecasts access memory* *resolves symbol for memory* *"vbtable" * *remembers about "virtual public" *googles virtual inheritance* -> god drat when you think you know a language. c++ can still surprise me sometimes
|
# ? Oct 28, 2016 14:57 |