Skip to main content
12 events
when toggle format what by license comment
Oct 13, 2020 at 12:15 comment added allo @leftaroundabout Interesting point. But I guess this is getting really of topic here now, so let's just agree that a instructor not knowing the python syntax does not have to be a sign of incompetence.
Oct 12, 2020 at 11:21 comment added leftaroundabout @allo well, that's what I meant by free monoid (not commutative monoid). Thus the monoid morphism does take care for ordering (but not associativity, meaning you could replace for i in 1..5: action with for i in 1..3: action followed by for i in 4..5: action). The monoid of endofunctors is better known as a monad.
Oct 12, 2020 at 11:06 comment added allo @user3067860 The problem you're mentioning is that very little problems in math require ordered loops. something like i \in {1,...,N} does not imply ordering. For example a sum or product works for any permutation of the indices. A foreach loops looks (in many languages) like a english description, but for i in X uses an ordered X, which is not described in the code. The pascal syntax uses an explicit to, which is a bit more explicit on describing a monotonic ordering.
Oct 8, 2020 at 21:29 comment added Ian Sudbery My first CS class was "foundations of algorithmics" and was taught in ML, a lanuage for/foreach loops nor return functions. I didn't learn much about how programs are made in the real world, but I sure as hell understood recursion, memory and space complexity, worst vs average case performance, and how 6 different sort algorithms differed from each other. More directly relevantly, I know many programming teachers who, in an intro class, won't teach idioms that don't exist in the core specification of more or less all languages.
Oct 7, 2020 at 21:26 comment added user111388 "Computer science is not programming." Funnily enough, this is exactly what the people on Workplace SE are complaining about - CS graduates cannot program at all.
Oct 7, 2020 at 20:37 comment added CCJ "Python's iterators are somewhat idiosyncratic" bit of an understatement XD
Oct 7, 2020 at 20:20 comment added user3067860 @allo I was a double major, math+cs. I'm pretty sure at least a quarter of my fellow math majors would have had trouble with Pascal syntax, loops pretty much didn't exist for them (except maybe as a way to teach summation and product notation). Brilliant in other respects, but very much did not think procedurally.
Oct 7, 2020 at 19:31 comment added leftaroundabout @allo foreach loops are perfectly appropriate for the theoretic computer science literature, just phrase it as “A is a function { 1 … N } → ℤ; we represent it as an element L in the free monoid over ℤ. Consider now a monoid morphism into the category of endofunctors...”
Oct 7, 2020 at 18:51 comment added allo @user3067860 Looking at pseudo code, you can be happy when computer science researchers use C syntax. Usually they are a lot more happy with Pascal syntax like "for i:=1 to N do". Ideas like "a loop can be implemented by a foreach loop using a generator" are nothing you want to use in theoretic computer science literature, because it makes understanding the (pseudo) code much harder for people who are not used to this concept. The Pascal syntax on the other hand can even be understood by mathematicians.
Oct 6, 2020 at 19:20 comment added user3067860 Not surprised if a professor doesn't know or naturally use iterables. Most professors seem to have stalled on syntax as it was taught to them in their schooling, which will be in the C/C++ days for many. In fairness, many of my industry colleagues seem to have the same problem (sure we're using the latest version of Java, but we only use language features that were available in Java 6).
Oct 6, 2020 at 16:40 comment added Bob Brown Upvoted for "computer science is not programming." The reverse is even more true.
Oct 6, 2020 at 13:42 history answered leftaroundabout CC BY-SA 4.0