Re:Study of non-programmers' solutions to programming proble...
by ssmoot on Saturday April 16, 2016 @07:26AM
(#11510188)
That's just Array.forEach in JS. Or in Scala:
That's really nothing to do with Sets.
[ Parent
| on HN ]
Re:Study of non-programmers' solutions to programming proble...
by pbhjpbhj on Saturday April 16, 2016 @08:30AM
(#11510331)
Logically it can be expressed as operating on the set {1, 2, 3, 4, 5} - I think that's the point: one can perceive it differently, either as a set operation or as a loop/iteration.
Re:Study of non-programmers' solutions to programming proble...
by ssmoot on Saturday April 16, 2016 @12:01PM
(#11511049)
module Numeric
def times(&b)
(1..self).each(&b)
end
end
It's really no different than the Scala you'd write for the same thing: implicit class LongHelpers(l: Long) {
def times(f: => Any) = (1L to l) foreach f
}
10 times println("here's a line!")
To interpret that as a Set operation would make the definition of a Set operation so broad as to be useless IMO.
Re:Study of non-programmers' solutions to programming proble...
by nlpexprt on Sunday April 17, 2016 @12:22PM
(#11515062)
sets aren't ordered
Re:Study of non-programmers' solutions to programming proble...
by pbhjpbhj on Wednesday April 20, 2016 @07:36AM
(#11533622)
The set of ordered sets is a subset of the set of sets. Totally ordered sets, which I think are synonymous with chains(?), are still sets.
But yes, I was talking loosely: my point was to differentiate between a mental model of iterating over a sequence (or ordered set) and applying a set-like transformation. My mental picture was of a field formed by a matrix operation on a limited space as being composed of the summation of a series of vector transformations; my maths language doesn't really allow me to properly describe it however. Loosely: you can break down a [subset of] 3D transformation[s] of a surface in to a series of 2D transformations performed iteratively, or you can apply a 3D transformation; they're different mental images of acquiring the same result.