After reading SICP, I recently discovered streamjs . The developer referenced linqjs as an
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I haven’t used either library, but, here’s my initial analysis (I’ve read quite a bit of SICP, but not the whole thing admittedly).
stream.jsis an implementation of a functional style data structure for a list. Many data structures in a functional language tend to be recursive, much like theStreamstructure. It is composed of a head element, and aStreamfor the tail (subsequent elements). Here, lazy evaluation can be achieved by allowing the tail to be a function (i.e. infinite sequences).Now, to answer your question, all of the functions provided by
linq.jsshould be able to be defined with other common higher order functions like map, reduce, walk, fold, etc.Sure,
stream.jsdoes not implement theAny()method fromlinq.js, but you can just do that withreduce().