In Haskell, I can do this to handle an infinite list.
takeWhile (<1000) [1 ..]
Is there a way to do this in CoffeeScript?
StreamJS allows you to create "endless" lists in javascript.
Using the (roughly) coffeescript port :
# Stream.range() creates a list from 1...Infinity numbers = Stream.range().until (x) -> x > 1000
Not like built-in primitives, but they can be hacked, as in most other languages. At least someone plays CoffeeScript with him; see https://github.com/swannodette/fun.coffee/blob/master/src/fun.coffee . For solutions that look less “hacked,” you can read on CPS and maintain proper tail calls, see http://blog.mozilla.com/dherman/2011/01/30/proper-tail-calls-in-harmony / .
Source: https://habr.com/ru/post/906782/More articles:Webcore NSBeep ()! when copying from uiwebview - copy-pasteHow to reconfigure eclipse to use 64-bit JVM - javaWebcore NSBeep () in console while debugging iOS app? - warningsNetbeans - a generating class of objects from a database - netbeans-7IL Interface Code - c #HTTP caching in WCF web API seems inconsistent in browsers - httpMultiset erases the last element - c ++MVC3 after [RequireHttps] how to ensure non-https usage - c #Where is the Main method in the forms application? - user-interfaceSeparate or identical folders for debug / release output when using .NET (C #)? - .netAll Articles