Code Select
(define fibs
(lazy-cat '(0 1) (map + fibs (rest fibs))))
(fibs 10) ; ==> 55
How to do this?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
#!/usr/bin/newlisp
(define (url-translate str)
(replace "%([0-9A-F][0-9A-F])" str (format "%c" (int (append "0x" $1))) 1))
(print "Content-type: text/htmlrnrn")
(print (eval-string (url-translate (env "QUERY_STRING"))))
(exit)
# end of file
<html>
<body>
<h3>newLISP server and JS demo</h3>
<script type="text/javascript" language="javascript">
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
function newLispEval(expr) {
xmlHttp.open("GET", "eval.cgi?" + expr, false);
try {
xmlHttp.send(null);
} catch (e) { alert(e.message); }
return xmlHttp.responseText;
}
var answer;
answer = newLispEval("(+ 3 4)");
document.write(answer);
document.write("<BR>ok.");
</script>
</body>
</html>
<!-- end of file -->
newlisp.exe -c -d 1235
http://localhost:1235//tmp/1/test1.html
newLispEval("(set 'x 3)");
newLispEval("(+ 'x 4)");
Quotehttp://localhost:1235//my">http://localhost:1235//my projects/q1/test1.html
Quotehttp://localhost:1235//D/tmp/1/test1.html">http://localhost:1235//D/tmp/1/test1.html
<html>
<body>
<h3>newLISP server and JS demo</h3>
<script type="text/javascript" language="javascript">
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
function newLispEval(expr) {
xmlHttp.open("GET", "http://localhost:8080", false);
try {
xmlHttp.send(expr);
} catch (e) { alert(e.message); }
return xmlHttp.responseText;
}
var answer = newLispEval("(+ 3 4)n");
document.write(answer);
document.write("<BR>ok.");
</script>
</body>
</html>
<!-- end of file -->