Reputation
9,395
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
9 41 91
Impact
~433k people reached

Jun
10
comment Recursion, iteration, and …?
After all, also for and while loops are nothing else but iterated functions in disguise.
Jun
10
comment Recursion, iteration, and …?
Maybe iterated function? en.wikipedia.org/wiki/Iterated_function
Jun
8
comment What is Banana split and fusion in functional programming?
@jozefg: Thanks for the link to your post. One question about it. In the sentence "An algebra in this sense is a pair of an object C, and a map F C → C.", is C really supposed to be an object, or rather a category? In other words, I am not sure if F denotes a functor in a category, and the F-algebras are the algebras induced by that functor, of if F is a particular arrow from an object onto itself.
Jun
8
awarded  Notable Question
Jun
7
comment Why isn't lazy evaluation used everywhere?
@JonasElfström: Please, do not confuse mutable state with one of its possible implementations. Mutable state can be implemented using an infinite, lazy stream of values. Then you do not have the problem of mutable variables.
Jun
7
comment Why isn't lazy evaluation used everywhere?
"So, the point is, you should use whatever is best for the task at hand." +1
Jun
7
comment Why isn't lazy evaluation used everywhere?
"Consequently, lazy evaluation simply does not pay on average, eager evaluation is the better fit for modern code.": This statement does not hold: it really depends on what you are trying to implement.
Jun
7
comment Why isn't lazy evaluation used everywhere?
"How many of the functions that you write do not require evaluation of all their arguments?": This is just one example application. What about recursive, infinite data structures? Can you implement them with eager evaluation? You can use iterators, but the solution is not always as concise. Of course you probably do not miss something that you have never had the chance to use extensively.
Jun
7
comment Why isn't lazy evaluation used everywhere?
"Bookkeeping overhead at every use of a value.": I do not think the bookkeeping overhead is bigger than, say, checking for null references in a language like Java. In both cases you need to check one bit of information (evaluated / pending versus null / non-null) and you need to do it every time you use a value. So, yes, there is a overhead, but it is minimal.
Jun
7
comment Why isn't lazy evaluation used everywhere?
"lazy code and state can mix badly": It really depends on how you implement state. If you implement it using shared mutable variables, and you depend on the order of evaluation for your state to be consistent, then you are right.
May
28
comment Are There Tools for Statically Evaluating C++ Functions for Side Effects?
@gbjbaanb: Besides using the mutable keyword, I guess it is possible to use some pointer trick (possibly casting const to non-const at the appropriate place) to by-pass any const constraint.
May
19
comment Where should my team start with becoming “modern”?
Very nice answer (+1), especially the last paragraph. A very modern book (modern in the sense that I find it very relevant today) I am reading recently is SICP.
May
8
awarded  Famous Question
May
8
awarded  Nice Question
May
7
awarded  Famous Question
May
4
comment Why Java does not allow function definitions to be present outside of the class?
@Eugene: You can consider static methods as methods belonging to a singleton object (and this is how Java static methods are used in Scala). On the other hand, with this view you can consider C++ functions as methods belonging to a global world object.
May
3
comment Some people told me that finding all prime factors of a number is an unsolvable problem. Is that real?
Sure, it is not always true. However, even a website software can become complex and having a math / computer science background can give you good tools to manage this complexity.
May
3
comment Some people told me that finding all prime factors of a number is an unsolvable problem. Is that real?
"Practically speaking, math knowledge and computer science knowledge is useful when programming.": This sentence alone would be enough for me to justify an upvote: many programmers maintain that math knowledge is useful for writing your PhD but less useful for solving real-world problems. Anyway, I had already given my upvote when I reached this line.
Apr
29
comment Structuring Procedural vs OO code
My favourite reading regarding OOP versus procedural is a section (mitpress.mit.edu/sicp/full-text/book/…) from SICP. You can basically organize code in a table containing data types and operations. Procedural style organizes code around operations (procedures) while object-oriented style organizes code around types (classes). They are two symmetric approaches to organizing your code and each one can be stronger than the other, according to how you are going to extend your code in the future.
Apr
27
reviewed Leave Open Are first-class continuations useful in modern object-oriented programming languages?