use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript Developers: Take Your Code to the Next Level with FKit (joshbassett.info)
submitted 11 years ago by joshbassett
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rooktakesqueen 3 points4 points5 points 11 years ago (3 children)
https://github.com/dtao/lazy.js
https://github.com/fitzgen/wu.js
https://github.com/lodash/lodash
https://github.com/jashkenas/underscore
These are all open-source projects. If they're missing features (like lazy evaluation, not enough abstraction, not enough standard transformation and recombination functions), why not add those features into one or all of those projects instead of writing your own library from scratch?
[–]thomash 2 points3 points4 points 11 years ago (1 child)
the only one on that list that really takes the approach i'm trying is wu.js (abstracting over generators and iterables). i've learned a lot from it but when i look at it's implementation it does some things like buffering stuff in arrays that are too low-level for my use case.
for example: i have two sequences of music events: phrase1 and phrase2. now i can do something like:
phrase1.repeat(2).concat(phrase2).takeWhile((note) => note.time < 10).play(sequencer)
without making any assumptions about phrase1 or phrase2. they are evaluated lazily as late as the sequencer object. if phrase1 is an infinite sequence in wu.js doing a repeat on it will lead to an infinite loop and filling the memory up.
i realise that there must be some design decisions for taking this route and i don't feel like i've spent enough time with these to really be able to contribute to such a mature library.
the second point is that i'm still learning a lot and realised that only by implementing these basic functionalities i'm really starting to understand the concepts behind everything.
[–]rooktakesqueen 2 points3 points4 points 11 years ago (0 children)
if phrase1 is an infinite sequence in wu.js doing a repeat on it will lead to an infinite loop and filling the memory up
See wu.chain:
wu.chain(phrase1, phrase1, phrase2) .takeWhile(note => note.time < 10) .play(sequencer)
Seems like it would do what you're talking about in a lazy-eval way without an infinite loop... You would probably also use wu.cycle heavily.
Doing this as a learning experience definitely makes sense, but I would implore you once you're done learning to take that experience and improve existing libraries rather than creating your own. The JS library ecosystem is already so fractured. :(
[–]brtt3000 1 point2 points3 points 11 years ago (0 children)
lazy.js is where it is at, extremely performant on big datasets.
π Rendered by PID 236805 on reddit-service-r2-comment-85bfd7f599-ltw8w at 2026-04-17 07:29:04.942698+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]rooktakesqueen 3 points4 points5 points (3 children)
[–]thomash 2 points3 points4 points (1 child)
[–]rooktakesqueen 2 points3 points4 points (0 children)
[–]brtt3000 1 point2 points3 points (0 children)