Bulent Murtezaoglu <[EMAIL PROTECTED]> writes:

>>>>>> "ES" == Emre Sevinc <[EMAIL PROTECTED]> writes:
> [...]
>     ES> Şimdi tabii benim kafam karıştı, o LOOP'un içindeki
>     ES> present-symbols sözdiziminin tekabül ettiği şey ile bu
>     ES> do-symbols'un ele aldığı şey bana mı farklı görünüyor
>     ES> gerçekten farklı mı filan.
>
> Bilmem.  Hyperspec ne diyor?

LOOP ile ilgili olarak diyor ki:

present-symbol, present-symbols
   
    These Loop schemas iterate over the symbols that are present in a package. 
    The package to be iterated over is supplied in the same way that package 
arguments 
    to find-package are supplied. If the package for the iteration is not 
supplied, the 
    current package is used. If a package that does not exist is supplied, an 
error of 
    type package-error is signaled.

do-symbols için diyor ki:

Description:
do-symbols, do-external-symbols, and do-all-symbols iterate over the 
symbols of packages. For each symbol in the set of packages chosen, the var 
is bound to the symbol, and the statements in the body are executed. 
When all the symbols have been processed, result-form is evaluated and 
returned as the value of the macro.

do-symbols iterates over the symbols accessible in package. Statements 
may execute more than once for symbols that are inherited from multiple 
packages.

do-all-symbols iterates on every registered package. do-all-symbols will 
not process every symbol whatsoever, because a symbol not accessible in any 
registered package will not be processed. do-all-symbols may cause a symbol 
that is present in several packages to be processed more than once.

do-external-symbols iterates on the external symbols of package.
...


Ve benim kafa karışıklığım devam ediyor. LOOP'taki present-symbols ile
(do-symbols ...) içinde bulunduğum CL-USER paketi için farklı şeyler
döndürüyorlar. En azından denemelerimde öyle görünüyor. do-symbols
daha çok şey döndürüyor. Neden böyle oluyor tam anlayamadım doğrusu.

Kafam şeye gitti, yani işte CL var CL-USER var, CL-USER aslında
CL'deki sembolleri de alıyor filan. Ama bunun konumuzla bir ilgisi
var mı tam bilmiyorum. LOOP makrosu içindeki o present-symbols 
tam olarak hangi kritere göre getiriyor sembolleri pek anlaşılmıyor
HyperSpec'e bakınca çünkü "the symbols that are present in a package"
lafı ile "the symbols accessible in package" tam olarak ayrıştıramıyorum.
Bir şeyler sezer gibi oluyorum ama kafam büsbütün karışıyor.


>
> [...]
>     >> icin ne yapilabilir?  Bu durumda boundp nil verecek, ama *foo*
>     >> pesinde oldugumuz speciallardan biri.  Lispimiz onun special
>     >> oldugunu biliyor, fakat biz kolayca ogrenemiyoruz.  Bunu ANSI
>     >> CL'de deneme yaparak cikartmaktan baska yol gozukmuyor _bana_.
>
>     ES> Deneme yapmak derken?
>
> Mesela 
>
> CL-USER> (let ((foo 25)) (boundp 'foo))
> NIL ;; neden?  foo lexical cunku
>
> CL-USER> (defvar foo)
> FOO ;; simdi special olaral declaim edildi hep sepcial
>
> CL-USER> (let ((foo 25)) (boundp 'foo))
> T   ;; yaa iste o binding special binding onun icin boundp gordu


Güzel örnekler!


>
> ;; pekiyi oyleyse 
> CL-USER> (defun specialp (symbol) (eval `(let ((,symbol 25)) (boundp 
> ',symbol))))
> SPECIALP
> CL-USER> (specialp 'foo)
> T 
> CL-USER> (specialp 'bar)
> NIL ;; yeni sembol 
>
> Ama ne o oyle eval meval?  Deniyoruz yani.  (ben burada aciklayici olsun 
> diye sbcl'in dondurdugu gurultuyu sildim.  Ciddi ciddi boyle denemek isteyen 
>
> (defun specialp (symbol) 
>   (handler-bind ((warning #'muffle-warning))  
>     (eval `(let ((,symbol 25)) (boundp ',symbol)))))
>
> kullanabilir.  Ek lazim tabii.  Mesela keyword veriseniz ne oluyor?  
> Neden?  
>
> Heyneyse kastettigim buydu.  Lisp birsey biliyor, biz bunu biliyor musun 
> diye soramuyoruz deney yaparak buluyoruz.  

Lisp çok şey biliyor.

Biz kafası karışmış faniler olarak kafa patlatıp duruyoruz
o bilgiye erişmek için :)


>
> [...]
>     ES> Bir sonraki ANSI komite toplantısına dahil mi olsak n'apsak? 
>     ES> ;-) [...]
>
> Heh.  KMP ile konus bunu.

Tehlikeli bir adam o, sinirlendiği zaman normal IQ'lu bir insan
beyninin "parse" ederken "stack overflow"a maruz kalabileceği
ve nöropsikolojik hasar yaratabilecek Lisp kodları yazabiliyor.
Kızdırmamak lazım kendisini :)  


-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr


_______________________________________________
cs-lisp mailing list
[email protected]
http://church.cs.bilgi.edu.tr/lcg
http://cs.bilgi.edu.tr/mailman/listinfo/cs-lisp

Cevap