From: ············@gmail.com
Subject: A little help with allegroserve ...
Date: 
Message-ID: <1189497488.521157.131580@w3g2000hsg.googlegroups.com>
I'm experimenting with allegroserve , and I added this to
examples.cl  :

(defun trans2 (z k)
  (if (eq (intern z) '|| )
      '""
      (let* ((a (char-code (coerce (subseq z 0 1 ) 'character )))
             (Q  (cond  ( (or (> a 57) (= a 94) )   2)
                         ( (or (< a 46)  (eq a 47)) 0)
                            (T 1) ))
             (ze (cond ((or (= q 0 ) (= k 0)) '" ")
                       ((= q k)  '""  )
                       (T '" ") )))  (
 concatenate 'string ze (subseq z 0 1) (trans2 (subseq z 1) q)
                                                     ))))

(publish
 :path "/experimental"
 :content-type "text/html"
 :function
 #'(lambda (req ent)
     (let ((lookup (assoc "symbol" (request-query req) :test
#'equal)))
       (with-http-response (req ent)
	 (with-http-body (req ent)
	   (html (:head (:title "DND"))
		 ((:body )
		  "Compute trans2 of "

		  ((:form :action "experimental"
			  :method "get")
		   ((:input :type "text"
			    :maxlength 40
			    :size 20
			    :name "symbol")))
		  #+allegro

		  :p )  (if* lookup
		     then (html :hr (:b "trans2") " of "
                                (:princ-safe (cdr lookup)) " is "
				(:princ-safe   (trans2 (cdr lookup) 0) )
				:br
				:br))
		 :newline))))))

Trans2 itself worcks well , to get an ideea of what it does try
 (trans2  "(var+stuff*-(something-12.3))"  0)
However the web page does not work as expected , the result is empty .
Why does this happen ? Help please.

From: ············@gmail.com
Subject: Re: A little help with allegroserve ...
Date: 
Message-ID: <1189524667.277758.214450@y42g2000hsy.googlegroups.com>
Fixed that up .


 (defun trans2 (z k)
  (if (eq (length z) 0 )     ;replaced the (if (eq (intern z) '|| ) .
       '""
       (let* ((a (char-code (coerce (subseq z 0 1 ) 'character )))
              (Q  (cond  ( (or (> a 57) (= a 94) )   2)
                          ( (or (< a 46)  (eq a 47)) 0)
                             (T 1) ))
              (ze (cond ((or (= q 0 ) (= k 0)) '" ")
                        ((= q k)  '""  )
                        (T '" ") )))  (
  concatenate 'string ze (subseq z 0 1) (trans2 (subseq z 1) q)
                                                      ))))

Seems this is a slightly different type of string or something ...
From: Petter Gustad
Subject: Re: A little help with allegroserve ...
Date: 
Message-ID: <87myvtbjpk.fsf@gustad.com>
············@gmail.com writes:

> Why does this happen ? Help please.

Haven't looked at your code in detail, but in general you can test
the html generator macros using:

(let ((lookup (cons 'symbol "(var+stuff*-(something-12.3))")) 
      (*html-stream* *standard-output*)) 
     (html (:head (:title "DND"))
 		 ((:body )
 		  "Compute trans2 of "
 
 		  ((:form :action "experimental"
 			  :method "get")
 		   ((:input :type "text"
 			    :maxlength 40
 			    :size 20
 			    :name "symbol")))
 
 		  :p )  (if* lookup
 		     then (html :hr (:b "trans2") " of "
                                 (:princ-safe (cdr lookup)) " is "
 				(:princ-safe   (trans2 (cdr lookup) 0) )
 				:br
 				:br))
 		 :newline))

<head><title>DND</title></head><body>Compute trans2 of <form ACTION="experimental" METHOD="get"><input TYPE="text" MAXLENGTH=40 SIZE=20 NAME="symbol"></form><p></body><hr><b>trans2</b> of (var+stuff*-(something-12.3)) is  ( var + stuff * - ( something - 12.3 ) )<br><br>

You can also save the req and ent objects and test your your functions
in the REPL. Great if you're running your Lisp under screen and
connect with SLIME.

Petter
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?