4 ms·
> "Take a Lisp program, indent it properly, and delete the opening parens at the start of lines and their matching close parens, and you end up with something t
by bluefox 8y ago
> "Take a Lisp program, indent it properly, and delete the opening parens at the start of lines and their matching close parens, and you end up with something that looks rather like a Python program."
Sure, if you write Python in Lisp, but not if you actually take advantage of Lisp.
- sametmax 8y agoWell, technically, same for Python. I mean, you would rather write the Python snippet this way: with open('foo.txt', 'w') as f: f.write('hello world\n') Using print for that doesn't bring much on the table and a newcomer reading the code would wonder why. Plus really most IRL works just need: Path('foo.txt').write_text('hello world\n') Also you never really use readline(), since files are iterable, you generally just loop with for on it. I don't think that's the point of the author. The point is that they look like enough if you remove the cruft, that you can make helpful associations to learn the one you don't know.
- fiddlerwoaroof 8y agoI stopped using python (2.7) a couple years ago once I learned CL. But—if you’re dealing with reading standard input incrementally there are differences between readline() and the interator when it comes to buffering. Or, at least, it was easier for me to get readline to work than it was to figure out how to configure the iterator correctly. This, the whole Unicode mess and the fact that lisp allows you to write at the same level of abstraction (or greater) without sacrificing performance as much, led me to abandon Python for almost everything.
- sametmax 8y agoWhat does this have to do with the above comment ?
- fiddlerwoaroof 8y ago> Also you never really use readline(), since files are iterable
- xyrouter 8y agoWhat is your preferred CL implementation and development environment? How do you distribute your programs/applications? As Lisp source code or as a binary generated by dumping core or some such technique?
- fiddlerwoaroof 8y agoIt depends. I generally use sbcl, unless I'm trying to do something with Cocoa, in which case I use either ccl or Lispworks CAPI. All my projects are open-source (MIT) and some of them are on quicklisp. I actually deploy applications by dumping an image and copying it to the right place.
- fiddlerwoaroof 8y agoI use emacs-with-evil mode + SLIME for developing applications... as I say, "the best implementation of vim is written in Emacs Lisp" or "evil-mode is the text editor for the Emacs operating system".
- flavio81 8y ago>How do you distribute your programs/applications? As Lisp source code or as a binary generated by dumping core or some such technique? In any way you like including creating executable files.
- bluefox 8y agoI think you missed /my/ point. What happens when you "remove the cruft" (parentheses) from the following: (defun example () (ascertain that (+ 1 1) is 2) (ascertain that (+ 1 1) is not zero) (ascertain that 0 is not zero) (ascertain that 0 is zero) (ascertain that (+ 2 2) is 5) (ascertain that (+ 2 2) is not 5) (ascertain that (+ 2 2) is = 4.0) (ascertain that (+ 1 1) is member of '(1 2 3)) (ascertain that 0 is a member of '(1 2 3)) (ascertain that pi is not a member of '(foo bar zot pi)) (ascertain that (error "blah") signals simple-error) (ascertain that (error "blah") signals a serious-condition) (ascertain that (error 'unexpected-result) signals an unexpected-result)) Does it look like Python?
- sametmax 8y agoI don't know, I'm not a lisper. But it looks a lot like: def example (): assert 1 + 1 is 2 assert 1 + 1 is not zero ... assert 1 + 1 in (1, 2, 3) assert 0 in (1, 2, 3) assert math.pi not in (foo, bar, zot, pi) ...
- bluefox 8y agoYou've elided some cases, which I'm guessing don't fit Python's assert so well. And what are foo/bar/zot/pi in your translation? Python has "is"/"not"/"in" which retain some of the English-ness, so my example wasn't totally foreign, but... You should also know that, unlike "assert" in Python, "ascertain" is not something defined by the Common Lisp language. It was defined by a Common Lisp user (me), just some 50-line macro that can be extended at will, to fit whatever clauses I would like it to support, in any way I see fit. I'm glad that you took a stab at answering my question, but I hope you can see my point more clearly - that in Lisp you can taylor the language to suit your needs, and while sometimes Python may provide similar syntax, other times it may not. In fact many operators already existing in Common Lisp have no direct correspondence. You can also find tons more examples in the code of other people. Anyway, hope it at least piqued your interest. Have a good day!
- sametmax 8y ago