Hacker News new | ask | show | jobs
by weatherlight 1796 days ago
its funny you say that, Ruby ALSO took a lot from Lisp and lisp like langugaes. there's even a built in parser in Ruby that converts the language into S-expressions

  require 'ripper'
  Ripper.sexp('a && b')
  => [:program, [[:binary, [:vcall, [:@ident, "a", [1, 0]]],    :"&&", [:vcall, [:@ident, "b", [1, 5]]]]]]
  Ripper.sexp(<<-RB)
    if a
      b
    else
      c
    end
  RB
  => [:program, [[:if, [:vcall, [:@ident, "a", [1, 5]]],   [[:vcall, [:@ident, "b", [2, 4]]]], [:else, [[:vcall, [:@ident,  "c", [4, 4]]]]]]]]
  
Ruby is just way denser than most lisps.

I love Ruby, Elixir, and Lisp(s)

1 comments

Didn't know that!

One striking similarly Elixir has to lisp style languages is the macro system. You have quoted and unquoted expressions just like lisp.

And like lisp most of Elixir, down to the low level stuff like if statements, modules, and so on, is built up from a few primitives.

Here are the primitives that the Elixir language is built from:

https://hexdocs.pm/elixir/1.12/Kernel.SpecialForms.html