Hacker News new | past | comments | ask | show | jobs | submit login

Elixir is a beautiful language. I love the pipe operator and the elegance of the language. Much more consistent than the language I use daily (Python). Also: Coming to Python from Scheme I was missing the difference between destructive vs non-destructive operators [^1]. In Python I'd use `my_list.sort()'. That does not return the sorted list but `None', whereas `sorted(my_list)' returns a sorted copy of `my_list'. That's why I can't use method chaining in Python like this: `my_list.sort().first().to_str()'.

Re diving in Lisp:

1. I deleted my previous `.emacs` file and started from scratch.

2. I learned all about the internal help system of Emacs. `C-h f' will let me look up help for a function (it's "docstring"), `C-h v' will let me look up a variable, etc. - Navigating help via `C-h i' and then 'm' (for menu) will let me search the TOC entries in the help page. `l' (lower L) will let me go back in help.

3. Read good old recommended Lisp books. Seibel and many more are the classics.

4. Write code! Practical code that you need. Solve problems. Think of use-cases. - For instance, I needed to parse my Kindle annotations, which are saved like a log file in a file on the Kindle itself (the file is named `My Clippings.txt'. I had written a parser in Python to get the entries out of the file, now I did it in Elisp. Or you need a convenience function that performs several steps you need daily in your text-editing or org-files (creating template files, navigating the headars, whatnot).

5. Read the source code of the packages. They have wonderful examples for how to write code in Elisp. For instance `org-table.el'. It gave me many ideas for how to write idiomatic Elisp. - You can go to the source code of a package by looking up a function you use (`C-h f org-table-create RET', then click the hyperlinked package name `org-table.el'; that'll bring you right to the function in the package).

6. Read good code. For instance: Magnar Sveen. He has written many excellent packages. `dash.el' and `s.el' and some more. Check his github, read the code, and check his http://emacsrocks.com/ videos.

---

[^1]: "The names of procedures and syntactic forms that cause side effects end with an exclamation point ( ! ).". Source: https://www.scheme.com/tspl2d/intro.html




Applications are open for YC Summer 2021

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: