: ) wonderful world ( :

the metasyntactic variable

Archive for September 2007

without comments

Medicine works with correlations. This is good as every experimental science works with them. People having a certain type of cancer, which is a well defined situation, often die in two years, which is also a well defined state. If you have a certain symptom it correlates with the possible causes known by the medical community. But everybody knows that correlation doesn’t have much in common with causality. The latter is stronger.

If you have a certain symptom A and the doctor have information about correlations with B, C and D and B have the highest score (in absolute value) then he or she will, for the first time, try avoiding B. Than C. Than D. Then who knows : )

Let’s see in practice.

  • I’ve trouble with my lungs.
  • Do you smoke?
  • I do.
  • Give up smoking then.

It’s too expensive or time consuming to figure out other possibilities.

In general I honor and respect doctors. It is a wonderful and difficult job.

Let’s see correlation again. So I said A have a strong correlation with B. Let’s suppose avoiding B helps, but not solves the problem. There will be some other effect which will be another symptom. Here we go again. And our case can be worse. Perhaps avoiding B changes the problem which isn’t the previous any more.

Written by grault

September 24, 2007 - 6:58 pm at September 24, 2007 - 6:58 pm

without comments

This is crazy (quote from comp.lang.lisp):

CL-USER> (defmethod fib ((n (eql 0))) 1)
#<STANDARD-METHOD FIB ((EQL 0)) {486206CD}>
CL-USER> (defmethod fib ((n (eql 1))) 1)
#<STANDARD-METHOD FIB ((EQL 1)) {4871255D}>
CL-USER> (defmethod fib (n)
           (let ((answer (+ (fib (- n 1))
                            (fib (- n 2)))))
             (defmethod fib ((x (eql n))) answer)
             answer))
#<STANDARD-METHOD FIB (T) {488E12B5}>
CL-USER> (fib 100)
573147844013817084101

It MEMOIZEs the methods : )

Written by grault

September 19, 2007 - 9:24 pm at September 19, 2007 - 9:24 pm

without comments

One can represent a graph of objects in REPL:

CL-USER> (defmacro link (a b) `(push (lambda () ,b) (cdr ,a)))
LINK
CL-USER> (defmacro new (n o) `(defvar ,n ,o))
NEW
CL-USER> (new *h1* '(1))
*H1*
CL-USER> *h1*
(1)
CL-USER> (new *h2* '(2))
*H2*
CL-USER> *h2*
(2)
CL-USER> (link *h1* *h2*)
(#<FUNCTION (LAMBDA #) {ACE38AD}>)
CL-USER> *h1*
(1 #<FUNCTION (LAMBDA #) {ACE38AD}>)
CL-USER> (funcall (second *h1*))
(2)
CL-USER> (defun succs (n) (mapcar #'funcall (cdr n)))
SUCCS
CL-USER> (succs *h1*)
((2))
CL-USER> (link *h2* *h1*)
(#<FUNCTION (LAMBDA #) {ADFF51D}>)
CL-USER> (succs *h1*)
((2 #<FUNCTION # {ADFF51D}>))
CL-USER> (link *h1* *h1*)
(#<FUNCTION (LAMBDA #) {AE2E13D}> #<FUNCTION (LAMBDA #) {ACE38AD}>)
CL-USER> (succs *h1*)
((1 #<FUNCTION # {AE2E13D}> #<FUNCTION # {ACE38AD}>)
 (2 #<FUNCTION # {ADFF51D}>))
CL-USER> *h2*
(2 #<FUNCTION (LAMBDA #) {ADFF51D}>)
CL-USER> (setf (car *h2*) '(1 2 3))
(1 2 3)
CL-USER> *h2*
((1 2 3) #<FUNCTION (LAMBDA #) {ADFF51D}>)
CL-USER> (succs *h1*)
((1 #<FUNCTION # {AE2E13D}> #<FUNCTION # {ACE38AD}>)
 ((1 2 3) #<FUNCTION # {ADFF51D}>))

Written by grault

September 10, 2007 - 9:08 pm at September 10, 2007 - 9:08 pm