all-checked = [#todo completed: true]
would match each of the records with both topic: 'todo' and completed: true. And the following commit block would once per matching record. But what is desired here is one value for all the matching records (an "aggregate" in Eve lingo).Personally I think we would be much better off with a dedicated aggregate function instead of using if/else here. And count (which is an aggregate function), should have a default value for when no records match. Then could get rid of the if/else there also, and have something like:
all-checked = all[#todo completed: true]
none-checked = none[#todo completed: true]
todo-count = count[given: [#todo completed: false], default: 0]
Disclaimer: I'm just an Eve user/contributor all-checked = all[in: [#todo], where: [completed: true] ]
none-checked = none[in: [#todo], where: [completed: true] ]
todo-count = count[in: [#todo], where: [completed: false], default: 0] all_checked = todo.select(&:completed?)
none_checked = todo.reject(&:completed?)
todo_count = todo.count(&:completed?) var allChecked = todos.All(todo -> todo.IsCompleted);
var noneChecked = todos.None(todo -> todo.IsCompleted);
var todoCount = todos.Count(todo -> todo.IsCompleted);Try Avail[1]:
allChecked = select element from todos list where [element is completed]
allNotChecked = select element from todos list where [element is not completed]
todoCount = count of element in todos list where [element is completed]
I'm cheating a tiny little bit: `todos list` would probably need to be defined above as a method (I don't remember if one can have variable names with a space inside the name in Avail) and `_is completed`/`_is not completed` would also need to be defined.Rebol or Red could be also interesting in this regard, also Forth and Factor. Still, Avail goes the farthest in terms of allowing you to write a truly human-readable code (EDIT: however, they support all of Unicode for names and such, so you can go nuts with sigils too, if you want).
(Possibly also Inform 7[2], but I don't know it, so can't really say much.)
As the person that initially mentioned sigils, I did not say that they are always evil. I just said that you cannot use them and at the same time claim that you have a human-centered fully intuitive programming language.
I'm very fine with using -> symbols for anonymous functions... In fact, I'm fine with other sigils as well, if they are explained properly.
> allChecked = select element from todos list where [element is completed]
To me, knowing nothing about this language, this reads like collecting the subset of the completed elements out of all the elements. But the original task was to compute whether all elements are completed, i.e., whether this subset is equal to the whole. So you're doing something else, or your language is misleading me.
Of course not; but they are not human-readable. I thought that the posters above me used Ruby and C# examples to say that they (Ruby and C#) may be human-readable. I'm not sure if that was the intention, so I just noted that -> and &: are also sigils.
> So you're doing something else, or your language is misleading me.
It's the former! However, it's what the two posters before me did in Ruby and C#. The fact that all three of us misinterpreted the Eve code is interesting in the context of this discussion...
Correct Avail code would look like this:
areAllEntriesChecked ::= (count of element in todos where [element is checked])→boolean
Anyway, that's not "my language" at all, I just happen to know quite a bit of strange languages and wanted to share info on one with an interesting take on readability. They call it "articulate programming", which seems to be an evolution of Knuth's literate programming.Ha! You seem to be right about the Ruby, I missed that too. The C# looks correct to me, though: https://msdn.microsoft.com/en-us/library/bb548541(v=vs.110)....
Imo, literate programming should be solved by more expressive languages, not prose commentary layered on top.
Edit: found the source: [0] https://news.ycombinator.com/item?id=12819973
I wonder why people say/think that. The language uses sigils like @ and #. Sigils automatically make a language non-"human readable" since they have no "human meaning". And no, "you just have to learn the meaning of the language constructs and then you can read it" is not "human readable" in a useful sense. From what I gather, in Eve the @ sign refers to databases. That's fine, but "database foo" is human readable in a sense that "@foo" certainly isn't.
Or look at this example from http://play.witheve.com/#/examples/todomvc.eve
Why aren't these just ? Is the triple negation relevant? What is #todo? Is there some sort of implicit iteration over the database where #todo is bound to successive entries? If so, how are the individual flags combined to really arrive at an "all checked" or "none checked" value?I know plenty of languages that are more "human readable" than this.
It might still be a nice language once you learned it. But this, too, won't be the holy grail of "programming for non-programmers".