News for hackers. Stuff that matters.
Re:Study of non-programmers' solutions to programming proble... by zyxley on Saturday April 16, 2016 @04:39AM (#11509850)
The "sets instead of loops" one makes me think of Ruby, where operations on sets are a basic part of the philosophy in a way they aren't in a bunch of languages.

Even the basic "do this 5 times" is expressed in the same way as a set comprehension:

    this_set_of_items.each do |item|
      puts "hey, look at #{item}"
    end
 
    5.times do |index|
      puts "look, a line!"
    end
Re:Study of non-programmers' solutions to programming proble... by DanitaBaires on Saturday April 16, 2016 @07:47AM (#11510239)
I took it more like the way you specify certain jQuery operations such as:

    $('.card').hide();
to mean "hide all cards", or

    $('.card.green').show();
to mean "show all green cards". It's really comfortable to think about operating on the set like this and not having to worry about looping on the individual items.
Re:Study of non-programmers' solutions to programming proble... by buro9 on Saturday April 16, 2016 @09:16AM (#11510460)
In fact thinking of it as a set frees computing to do things concurrently invisibly.

A lot of other comments here say "ah, but that's just JS iteration still"... but there's really nothing to prevent it being the equivalent of a Go routine... no order implied, no iteration implied, but all the things in the set will have the functions hide() or show() called.

Re:Study of non-programmers' solutions to programming proble... by rileymat2 on Saturday April 16, 2016 @07:08AM (#11510143)
I am not sure that would count as working on the set. It looks like iteration.

From the article:

a) 1___ 2___ 3___ 4___ 5___ 6___ 7___ 8___ 9___

Thinks of them as a set or subsets of entities and operates on those, or specifies them with plurals. Example: Buy all of the books that are red.

b) 1___ 2___ 3___ 4___ 5___ 6___ 7___ 8___ 9___

Uses iteration (i.e. loop) to operate them explicitly. Example: For each book, if it is red, buy it.

In your case it looks like you are operating on each item and not on the set.

Re:Study of non-programmers' solutions to programming proble... by de_Selby on Saturday April 16, 2016 @04:53AM (#11509879)
It sounds very like array programming, eg APL and it's derivatives
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:

  (1 to 5) foreach { _ =>
    println("look, a line!")
  }
That's really nothing to do with Sets.
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.