[parenscript-devel] Loops that return a value

David Sargeant david at dsargeant.com
Tue Jan 15 14:17:37 UTC 2013


It seems that the looping constructs don't currently return a value.  In other words, they don't return an array of the results.  CoffeeScript allows for both scenarios, that is, looping for side-effects and looping that returns an array of results.  I'm thinking it would be very useful to have dotimes*, dolist*, for-in*, etc. that return an array of results.  Below is an example from coffeescript.org.  Let me know what you think.


David


countdown = (num for num in [10..1])

------------------------------------

var countdown, num;

countdown = (function() {
  var _i, _results;
  _results = [];
  for (num = _i = 10; _i >= 1; num = --_i) {
    _results.push(num);
  }
  return _results;
})();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20130115/0cdfe372/attachment.html>


More information about the parenscript-devel mailing list