Re: Array and Hash-Table References
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Thu, 20 Sep 2007 18:52:30 +0200
In article <1190300644.908440.52520@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Kyle McGivney <KyleMcG@xxxxxxxxx> wrote:
On Sep 19, 6:46 pm, are <Propon...@xxxxxxx> wrote:
What are the pros and cons of a Lisp in which (AREF x 3) and (GETHASH
'c y), for example, becomes (x 3) and (y 'c), respectively? The
latter are more concise; is there a down side?
I'm sure this conversation has hit this board a few times before, so
stop me if I'm posting an old idea:
It is called 'funcallable data'. One place where Common Lisp has
it is 'Generic Functions'. Generic Functions are both
CLOS objects and Functions. See here for an example usage:
http://doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf
It is not current practice and introduction
would confuse people. There is some benefit of stable
coding styles and not introducing more
obfuscation.
what about the syntax #z(a 3) for (aref a 3)?
(defun access-array (stream char arg)
(declare (ignore char arg))
(let ((args (read stream)))
`(aref ,(first args) ,(second args))))
(set-dispatch-macro-character #\# #\z #'access-array)
You could either try and write a #y for hash tables or extend this
somehow to check the type of the data...
Kyle
--
http://lispm.dyndns.org
.
- References:
- Array and Hash-Table References
- From: are
- Re: Array and Hash-Table References
- From: Kyle McGivney
- Array and Hash-Table References
- Prev by Date: Re: Lisp and OCaml
- Next by Date: Re: Lisp and OCaml
- Previous by thread: Re: Array and Hash-Table References
- Next by thread: Re: Array and Hash-Table References
- Index(es):
Relevant Pages
|