Fix markup. Add metadata.
This commit is contained in:
+17
-11
@@ -1,10 +1,16 @@
|
||||
#+TITLE: Livesort: Hy vs Lissp
|
||||
#+SUBTITLE: Exploring and comparing lisps on Python
|
||||
#+AUTHOR: Mike Pelletier
|
||||
#+EMAIL: (concat "livesort" at-sign "mkp.ca")
|
||||
#+KEYWORDS: hissp, lissp, hy
|
||||
|
||||
* Livesort: Hy vs Lissp
|
||||
|
||||
This is a small application I am developing in parallel in both Hy and Lissp for the purpose of exploring and comparing the languages. I wrote it first in Lissp and performed a direct transliteration to Hy, learning both languages as I went. So far, my observations are superficial and the application is (not even) a single iteration deep.
|
||||
|
||||
Hissp attempts to provide a pure, minimal, Lisp-like environment. It's certainly not bashful about the fact that it is built on top of Python -- it compiles directly to Python expressions -- but it's not attempting to fully expose Python-the-language. It is just trying to be the best (ie most minimal) Hissp it can be and fully exposing Python-the-language would compromise that. It would be too hairy and baroque. Hissp does fully expose Python's model to Lissp and allows complete interoperability, and you can inject Python whenever you want (which I have attempted to avoid).
|
||||
|
||||
In contrast, Hy attempts to be Python in all it's glorious half century of simple, benevolent creep, re-expressed in s-expressions and with the power of metaprogramming. I haven't spent a lot of time with it but it has a lot of polish. Emacs has `hy-mode` and it integrates nicely with an `inferior-lisp-shell` just like you expect. When a `unittest.TestCase` has an error, hitting `C-x [backtick]` takes you to the exact line of .hy code that generated the error. This was a huge change from Lissp where I was encouraged to roll my own primitives and debugging was primitive. Hy is planning a 1.0 soon and yeah, I can kinda see where they are coming from. There is a lot of work in this. And it's kinda hairy. But not in a bad way.
|
||||
In contrast, Hy attempts to be Python in all it's glorious half century of simple, benevolent creep, re-expressed in s-expressions and with the power of metaprogramming. I haven't spent a lot of time with it but it has a lot of polish. Emacs has ~hy-mode~ and it integrates nicely with an ~inferior-lisp-shell~ just like you expect. When a ~unittest.TestCase~ has an error, hitting ~C-x [backtick]~ takes you to the exact line of .hy code that generated the error. This was a huge change from Lissp where I was encouraged to roll my own primitives and debugging was primitive. Hy is planning a 1.0 soon and yeah, I can kinda see where they are coming from. There is a lot of work in this. And it's kinda hairy. But not in a bad way.
|
||||
|
||||
Hissp feels like something that a clever person (not me) could read and digest in an afternoon, sleep on it, and be ready to push the state of the art the next day. Hy feels like... Python.
|
||||
|
||||
@@ -23,28 +29,28 @@ Hissp can also be expressed as "readerless" tuples-of-tuples-and-strings, and so
|
||||
The literal cursor control codes embedded everywhere are awful.
|
||||
|
||||
*** Interactive
|
||||
When `sys.stdin` is not `/dev/tty`, re-open the tty and use it for interactive control. Give the user controls similar to `less` but with live sorted contents. Don't exit automatically.
|
||||
When ~sys.stdin~ is not ~/dev/tty~, re-open the tty and use it for interactive control. Give the user controls similar to ~less~ but with live sorted contents. Don't exit automatically.
|
||||
|
||||
*** Keys
|
||||
|
||||
Multiple keys may be specified in order of decreasing significance. There is always a final implicit key which is the raw value of the line itself.
|
||||
|
||||
**** `--key=mtime`, `--key=ctime`
|
||||
**** ~--key=mtime~, ~--key=ctime~
|
||||
Treat the input lines as paths and sort based on the corresponding mtime and/or ctime.
|
||||
|
||||
**** `--key=numeric`
|
||||
Treat the input as a string representation of a numeric value (*a la* `sort -n`).
|
||||
**** ~--key=numeric~
|
||||
Treat the input as a string representation of a numeric value (*a la* ~sort -n~).
|
||||
|
||||
**** `--key=shuffle`
|
||||
**** ~--key=shuffle~
|
||||
Insert a randomized key.
|
||||
|
||||
**** `--reverse`
|
||||
Invert the meaning of the next `--key`. There is always a final implicit key which is the raw value of the line itself.
|
||||
**** ~--reverse~
|
||||
Invert the meaning of the next ~--key~. There is always a final implicit key which is the raw value of the line itself.
|
||||
|
||||
**** `--slice=[start][:end]`
|
||||
Consider only a substring for the purpose of the next `--key`. If used on the implicit key, slice the output.
|
||||
**** ~--slice=[start][:end]~
|
||||
Consider only a substring for the purpose of the next ~--key~. If used on the implicit key, slice the output.
|
||||
|
||||
There should be a regexp version of this, too.
|
||||
|
||||
**** `--batch`
|
||||
**** ~--batch~
|
||||
Don't run interactively. Don't livesort. Just process all the input, and then output the entire sorted output.
|
||||
|
||||
Reference in New Issue
Block a user