Lisp's Influence on Ruby
- jksmith - 5868 sekunder sedanNow that I'm out of the corporate tyranny and have my own company, I use lisp for everything. There's certain satisfaction in writing config files and persisting data directly in s-expressions. Any json requirements are triggered by exports to foreign systems.
- hyperrail - 4697 sekunder sedanOne way I find traditional Lisp style more painful for functional code than Ruby is that fully functional-style Lisp pushes me to read and write code the opposite way from how I think about it. In the author's example:
the equivalent Lisp code would either be written in imperative style as multiple statements that each write to a temporary variable or (let) binding, or would look like this:orders .select { |o| o.placed_at > 1.week.ago } .group_by(&:customer_id) .transform_values { |group| group.sum(&:total) }
where I now have to read from bottom to top to understand the order of operations on the `orders` record set, even though when I wrote the code earlier, I "logically" thought from first operation to last when deciding which high-level operations to use in which order.(reduce #'+ (map (lambda (o) (getf o 'total)) ; this group_by replacement function ; might be written as hash-table code (my-group-by 'customer-id (remove-if-not (lambda (o) (> (getf o 'placed-at) (- (my-now) (* 60 60 24 7)))) orders))))Other imperative languages that support functional code either make you do things imperatively to get the "logical" ordering of functional operations like I feel Lisp pushes you to do, or they do something like Ruby where things can be chained left to right in a "single" statement even for operations that were not thought of ahead of time by the creators of opaque data structures you later need to operate on. (Everything is a user-extensible object like Ruby, unified function call syntax in D, extension methods in C#, or pipelines of structured objects in PowerShell.)
- evw - 9049 sekunder sedanFor folks that want all of this plus macros (and a lot of other great things), check out Elixir.
- danlitt - 11077 sekunder sedan> He’s described Ruby’s design as starting from a simple Lisp, stripping out macros and s-expressions
Put the macros back! It would be so cool!
- dismalaf - 11343 sekunder sedanI love Ruby, use it for most of my projects that don't require performance.
Nothing I would love more than a Ruby with a Common-Lisp like compiler and runtime. Unboxed types, native compilation, partial compilation, live image (Ruby has this but "faster Rubies" like Crystal don't), etc...
- pjmlp - 14862 sekunder sedanThat is actually Lisp influence on Smalltalk, and Perl, that eventually influenced Ruby.
- DonHopkins - 12608 sekunder sedanWhat have the Lisps ever done for us?
- tug2024 - 14602 sekunder sedan[dead]
Nördnytt! 🤓