Python syntax in Lisp and Scheme
Frode Vatvedt Fjeld
frodef at cs.uit.no
Fri Oct 3 18:22:47 EDT 2003
More information about the Python-list mailing list
Fri Oct 3 18:22:47 EDT 2003
- Previous message (by thread): Python syntax in Lisp and Scheme
- Next message (by thread): Python syntax in Lisp and Scheme
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jcb at iteris.com (MetalOne) writes: > [..] However, from an earlier post on comp.lang.python comparing a > simple loop. > > Scheme > (define vector-fill! > (lambda (v x) > (let ((n (vector-length v))) > (do ((i 0 (+ i 1))) > ((= i n)) > (vector-set! v i x))))) > > Python > def vector_fill(v, x): > for i in range(len(v)): > v[i] = x > > To me the Python code is easier to read, and I can't possibly fathom > how somebody could think the Scheme code is easier to read. It truly > boggles my mind. [..] The scheme example can only have been written by someone who is on the outset determined to demonstrate that sexp-syntax is complicated. This is how I'd write it in Common Lisp: (defun vector-fill (v x) (dotimes (i (length v)) (setf (aref v i) x))) As you can see, it matches the python example quite closely. > [..] If a set of macros could be written to improve LISP syntax, > then I think that might be an amazing thing. An interesting > question to me is why hasn't this already been done. Lisp macros and syntactic abstractions are one of those things whose power and elegance it is somewhat hard to explain to those who have not experienced it themselves first hand. Paul Graham's book "On Lisp" is considered by many to be a good introduction to the subject. I am quite comforatble with Common Lisp's syntax, and I see no particular need for some set of macros to improve its syntax. In fact I have no idea what so ever as to what such a set of macros would look like. -- Frode Vatvedt Fjeld
- Previous message (by thread): Python syntax in Lisp and Scheme
- Next message (by thread): Python syntax in Lisp and Scheme
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list