is it ok to (setf (get :const :prop) :val)?

This is a discussion on is it ok to (setf (get :const :prop) :val)? within the lisp forums in Programming Languages category; Geshundteit....

Go Back   Application Development Forum > Programming Languages > lisp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #21  
Old 11-05-2008, 01:41 PM
George Neuner
Guest
 
Default Re: Amen


Geshundteit.
Reply With Quote
  #22  
Old 11-05-2008, 02:22 PM
budden
Guest
 
Default Re: is it ok to (setf (get :const :prop) :val)?

Hmm, I noticed that I didn't explain one detail rather explicitly. I
planned to _join_ Symbolicweb development. So, there was a large
amount of code already at the moment I tried to introduce an iterate.
It is a significant circumstance and may be this was a main reason of
misunderstanding.

Reply With Quote
  #23  
Old 11-05-2008, 02:26 PM
budden
Guest
 
Default Re: Amen

Я тебя не понял
Reply With Quote
  #24  
Old 11-05-2008, 02:44 PM
Kaz Kylheku
Guest
 
Default Re: is it ok to (setf (get :const :prop) :val)?

On 2008-11-05, budden <budden01@mtu-net.ru> wrote:
> And (as I wrote before, now repeating), iterate exports too many
> symbols with very general names.


Iterate's interface is badly designed. It should use keywords for its clauses,
or else follow the LOOP design so that symbols from any package whatsoever will
match the clause identifiers using string equality.
Reply With Quote
  #25  
Old 11-05-2008, 02:51 PM
Kaz Kylheku
Guest
 
Default Re: is it ok to (setf (get :const :prop) :val)?

On 2008-11-05, Tamas K Papp <tkpapp@gmail.com> wrote:
> On Wed, 05 Nov 2008 09:07:40 -0800, budden wrote:
>
>> And, again, no one answers the questions I ask.

>
> That should be a clue.


He has a point in that if you're using some package that defines a COLLECTING
symbol, oft-used in your code, then using iterate's COLLECTING throughout the
same codebase will be a pain in the butt.

Looking at the iterate source, it appears it would be very easy to hack it to
provide keyword synonyms for all of the clauses, allowing for :COLLECTING to be
used instead of ITERATE:COLLECTING.
Reply With Quote
  #26  
Old 11-05-2008, 03:09 PM
Tamas K Papp
Guest
 
Default Re: is it ok to (setf (get :const :prop) :val)?

On Wed, 05 Nov 2008 19:51:10 +0000, Kaz Kylheku wrote:

> On 2008-11-05, Tamas K Papp <tkpapp@gmail.com> wrote:
>> On Wed, 05 Nov 2008 09:07:40 -0800, budden wrote:
>>
>>> And, again, no one answers the questions I ask.

>>
>> That should be a clue.

>
> He has a point in that if you're using some package that defines a
> COLLECTING symbol, oft-used in your code, then using iterate's
> COLLECTING throughout the same codebase will be a pain in the butt.


My impression was that he is not trying to modify iterate, but overhaul
the Lisp package mechanism because of minor difficulties he encountered
using iterate. Certainly an interesting approach.

> Looking at the iterate source, it appears it would be very easy to hack
> it to provide keyword synonyms for all of the clauses, allowing for
> :COLLECTING to be used instead of ITERATE:COLLECTING.


You can already use keywords everywhere else but the clause name, eg

(iter
(for i :from 2 :to 5)
(summing i))

I always do this, at it also plays nice with Emacs's syntax highlighting.
A modification of iterate which only used keywords would be nice. So why
doesn't budden fix that instead of redesigning CL?

Tamas
Reply With Quote
  #27  
Old 11-05-2008, 05:40 PM
budden
Guest
 
Default Re: is it ok to (setf (get :const :prop) :val)?

Greetings, Kaz!
You seem to be the second person after Lars who understood me.
And I found one analogy in addition to loop. Why does cl-who
suggests
(:a (:href ...)) instead of (a (href ...))? It is due to the same
clearness of that: you'll never get symbol conflicts, your html
pseudocode looks just the same in any package. This is the same thing
that I have already done to iterate.

>*So why doesn't budden fix that instead of redesigning CL?

Hmmm is my English really so poor? I have this done already and I
reported this fact three of for times in the topic. Or is this a
prejudice?

Didn't tested, but
(iter (:for i :from 1 :to 10) (:collect i))
works on a Lispworks personal for windows and on an sbcl 1.0.20. Some
more iterate constructs worked too. Iterate was loaded with asdf-
install/asdf in both cases. Original file iterate.lisp has version
1.4.3.

I took a more look at a source now. I found I use what actually is a
named function in an iterate and it is called keywordize. Maybe what I
did is not that correct and a simple approach is possible. But that is
enough for me. Maybe someone more smarter would do it.

>>>>>>>>>>>>>>>>>>>patch follows

*** iterate-orig.lisp 2008-11-06 00:41:31.000000000 +0300
--- iterate.lisp 2008-11-06 01:11:42.000000000 +0300
***************
*** 797,807 ****
;; example. Plus, we want to catch Iterate special clauses.
(assoc symbol *special-form-alist*))

(defun walk-special-form (form)
(let ((*clause* form)
! (func (cdr (assoc (car form) *special-form-alist*))))
(if (null func) ; there's nothing to transform
(list form)
(apply func form))))

#+nil
--- 797,810 ----
;; example. Plus, we want to catch Iterate special clauses.
(assoc symbol *special-form-alist*))

(defun walk-special-form (form)
(let ((*clause* form)
! (func (cdr (assoc (if (keywordp (car form))
! (find-symbol (string (car
form)) :iterate)
! (car form))
! *special-form-alist*))))
(if (null func) ; there's nothing to transform
(list form)
(apply func form))))

#+nil
***************
*** 1027,1036 ****
--- 1030,1040 ----
(t
(clause-error "No iterate function for this clause; do ~
(~S) to see the existing clauses." 'display-iterate-clauses)))))))

(defun apply-clause-function (func args)
+ (when (keywordp func) (setf func (find-symbol (string
func) :iterate)))
(let ((*initial* nil)
(*decls* nil)
(*step* nil)
(*final* nil)
(*finalp* nil))
***************
*** 2296,2305 ****
--- 2300,2315 ----
,(if (stringp (car body))
(car body)))))

(defun install-special-clause-function (symbol &optional doc-string)
;; Put it at the end, if not already present.
+ (let* ((key-symbol (intern (string symbol) :keyword))
+ (entry (assoc key-symbol *special-clause-alist*)))
+ (if (null entry)
+ (augment *special-clause-alist* (list (cons key-symbol doc-
string)))
+ (setf (cdr entry) doc-string))
+ symbol)
(let ((entry (assoc symbol *special-clause-alist*)))
(if (null entry)
(augment *special-clause-alist* (list (cons symbol doc-string)))
(setf (cdr entry) doc-string))
symbol))
***************
*** 3577,3586 ****
--- 3587,3601 ----

(defmacro me (x)
`(progn (setq *print-pretty* t) (macroexpand-1 ',x)))
|#

+ (eval-when (:load-toplevel :execute)
+ (dolist (x (cdr *clause-info-index*))
+ (let ((i (car x)))
+ (eval `(defsynonym ,(intern (string i) :keyword) ,i)))))
+

(eval-when (:compile-toplevel :load-toplevel :execute)
(when (and (boundp '*old-sharpL-func*) *old-sharpL-func*)
(set-dispatch-macro-character #\# #\L *old-sharpL-func*)))
>>>>>>>>>>>>>>>>>>>patch ended here

Reply With Quote
  #28  
Old 11-05-2008, 07:47 PM
Kenny
Guest
 
Default Re: Amen

George Neuner wrote:
> Geshundteit.


I don't think you noticed the time of the post.

hth,kenny
Reply With Quote
  #29  
Old 11-05-2008, 11:41 PM
George Neuner
Guest
 
Default Re: Amen

On Wed, 05 Nov 2008 19:47:21 -0500, Kenny <kentilton@gmail.com> wrote:

>George Neuner wrote:
>> Geshundteit.

>
>I don't think you noticed the time of the post.
>
>hth,kenny


I saw it. You say your bedtime prayers online?

George
Reply With Quote
  #30  
Old 11-06-2008, 03:13 AM
Kenny
Guest
 
Default Re: Amen

George Neuner wrote:
> On Wed, 05 Nov 2008 19:47:21 -0500, Kenny <kentilton@gmail.com> wrote:
>
>
>>George Neuner wrote:
>>
>>>Geshundteit.

>>
>>I don't think you noticed the time of the post.
>>
>>hth,kenny

>
>
> I saw it. You say your bedtime prayers online?


Who could go to bed at a time like...oh, my. Don't tell me you slept
thru it.

kt
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 11:39 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.