[–] 4 points 1 month ago

The polish notation is the simplest thing to wrap you head around. Instead of operations being special syntax exceptions, they're just functions! Functions that take parameters.

the only syntax of lisps are (myfun p1 p2 p3)

Mathematical operations are no exception (unlike otger languages). To make it simpler, think of it like this: + is just an alias (macro) for a function named plus which does addition. (plus 1 2 4 5) is the same as (+ 1 2 4 5). We don't use infix notation because then that would be a syntactic exepction (like other languages) while this is the only syntax we have in lisp, for everything it's really simple.

and also, how is (1 + 2 + 4 + 5) (15 chars) better than (+ 1 2 4 5) (11 chars)? It's a conceptual shift and once you make it, it makes so much more sense.

  • source
  • parent
  • context
  • [–] 3 points 1 month ago (3 children)

    Explain how it works or what it is?

    It's just a feed you can follow (think of following someone on IG or twitter). You'll get notified about the new content on that feed.

    You can subscribe to all the feeds that are interesting to you and now you have a place to read the all and get notified when something new is out.

  • source
  • parent
  • context
  • [–] -2 points 1 month ago

    This greatly depends on language design and implementation.

    For example, Clojure has all of these and much more, and it's still much simpler and hassle free than rust. The functions are just functions, but the forms and lists that are very powerful.

    functions are just

    (defn foo [a b] (print "do thing"))
    
    (foo 1 2)
    

    With the power of destructuring that maps provide us, we can have named arguments:

    (defn foo [a & {:keys [b c]}] (print a b c))
    
    (foo 1 {:b 2, :c 3})
    

    and for multi-arity functions, there's no special syntax. It's still just plain functions and forms

    (def foo
      ([a] (print "I only have one" a)
      ([a b] (print "I have two" a b)))
    

    It also has more advanced ways of polymorphysm with methods and protocols.

    It depends on the design of the language.

  • source
  • view more: ‹ prev next ›