Are you asking us to implement a strongly-typed, functional language in ruby and js? If not, please explain how you would apply practical functional language techniques in a dynamic language. By functional language I mean referentially transparent. By practical techniques I mean partial application, first-order functions, and lazy evaluation, among others.