Python syntax in Lisp and Scheme
Thomas F. Burdick
tfb at famine.OCF.Berkeley.EDU
Wed Oct 8 02:24:35 EDT 2003
hs at heaven.nirvananet (Hartmann Schaffer) writes:
> In article <xcvpth8rcfh.fsf at famine.ocf.berkeley.edu>,
> tfb at famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> > Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> writes:
> >
> >> I find the Lisp syntax hardly readable when everything looks alike,
> >> mostly words and parentheses, and when every level of nesting requires
> >> parens. I understand that it's easier to work with by macros, but it's
> >> harder to work with by humans like I.
> >
> > You find delimited words more difficult than symbols? For literate
> > people who use alphabet-based languages, I find this highly suspect.
> > Maybe readers of only ideogram languages might have different
> > preferences, but we are writing in English here...
>
> well, there are a few occasions where symbols are preferrable. just
> imagine mathematics with words only
Oh, certainly. Unlike most languages, Lisp lets you use symbols for
your own names (which is easily abused, but not very often). A bad
example:
;; Lets you swear in your source code, cartoonishly
(define-symbol-macro $%^&!
(error "Aw, $%^&! Something went wrong..."))
;; An example use
(defun foo (...)
(cond
...
(t $%^&!)))
And, although you generally use symbols from the KEYWORD package for
keyword arguments, you don't have to, and they don't have to be words:
(defgeneric convert-object (object new-type)
(:documentation "Like an extensible COERCE."))
(defun convert (object &key ((-> to)))
"Sugary"
(convert-object object to))
(defconstant -> '-> "More sugar")
;; Example usage
(convert *thing* -> (class-of *other-thing*))
Of course, these are lame examples, but they show that Lisp *can*
incorporate little ascii-picture-symbols. Good examples would
necessarily be very domain-dependant.
--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'
More information about the Python-list
mailing list