Search found 294 matches
- Thu Dec 09, 2004 3:09 pm
- Forum: Whither newLISP?
- Topic: expand and define-macro
- Replies: 5
- Views: 5169
expand and define-macro
Lutz, It would be nice to have expand work on stuff like (setq a 'r) (expand (a:a b) 'a ) => (r:r b) instead of having to do string manipulation like below (define-macro (def-mac _dm _body) (let (_s (string _dm)) (eval-string (format "(context '%s) (define-macro (%s:%s) %s) (context 'MAIN)" _s _s _s...
- Thu Dec 02, 2004 9:44 pm
- Forum: So, what can you actually DO with newLISP?
- Topic: cgi and html
- Replies: 1
- Views: 2999
on the line with
Kill the space between "(<tab" and "/>"
I don't know how that got in there.
Eddie
Code: Select all
(format "(define-macro (:%s) (format \"<%s%%s\" (<tag /> (args))))"
I don't know how that got in there.
Eddie
- Thu Dec 02, 2004 9:31 pm
- Forum: So, what can you actually DO with newLISP?
- Topic: cgi and html
- Replies: 1
- Views: 2999
cgi and html
I thought I had posted this, but I guess I didn't. And if I did, this is an update. Anyway a convient cgi.lsp for cgi. (context 'CGI) ;; by Eddie Rucker ;; allows easyly interchangable HTML and newLISP code ;; version 0.6 (Dec 2, 2004) -- made code a bit better, turned around the "=" ;; version 0.5 ...
- Mon Nov 15, 2004 7:45 pm
- Forum: newLISP in the real world
- Topic: html
- Replies: 4
- Views: 3696
OOPS! Use the following.
Eddie
Code: Select all
(define (subs w)
(replace "<%([^<%]+?)%>" w (string (eval-string $1)) 0)
(if (> $0 0) (subs w) w))
- Mon Nov 15, 2004 7:43 pm
- Forum: newLISP in the real world
- Topic: html
- Replies: 4
- Views: 3696
Correction. To handle both nesting of "<% %>"s and sequences of "<% %>"s, change the substitute code to (define (subs %w) (replace "(<%([^<%]+?)%>)" %w (string (eval-string $2)) 0) (if (> $0 0) (subs %w) %w)) (setq iftest true dotrue "hello" dofalse "goodbye") (setq text [text]<p><%(if <%iftest%> "<...
- Fri Nov 12, 2004 9:09 pm
- Forum: newLISP in the real world
- Topic: html
- Replies: 4
- Views: 3696
html
Kind of a macro within macro within ... thingy that really helps with html code. (define (<page> %w) (replace "`(.+?)`" %w (string (eval-string $1)) 516) (if (> $0 0) (<page> %w) %w)) ... (let (isfred true val "fred") (print [text]Content-type: text/html <html> <body> <p>`(if test "Hello `val`!" "Yo...
- Thu Nov 11, 2004 9:00 pm
- Forum: Anything else we might add?
- Topic: Making [text][/text] more convenient
- Replies: 12
- Views: 7389
- Thu Nov 11, 2004 5:41 pm
- Forum: Anything else we might add?
- Topic: Making [text][/text] more convenient
- Replies: 12
- Views: 7389
Okidoki! What if {} were made to handle text of indefinite length (just to be not limited to 2048 chars). Then one could use {} for inline and [text][/text] for multiline. The only use I can see for the {} buggers is for pattern matching since I can't use \n, \t, etc. within them. For example I cann...
- Thu Nov 11, 2004 1:55 pm
- Forum: Anything else we might add?
- Topic: Making [text][/text] more convenient
- Replies: 12
- Views: 7389
I see your point lwix. Also check for white space between the [text] and \n.
So that (I'm using "{}" in place of "[text][/text]."
equals
I like it.
Eddie
So that (I'm using "{}" in place of "[text][/text]."
Code: Select all
(print { \t\t\t ; white space
Content-type: text/html
<html>
.
.
.
</html>})
Code: Select all
(print {Content-type: text/html
<html>
.
.
.
</html>})
Eddie
- Wed Nov 10, 2004 7:39 pm
- Forum: Anything else we might add?
- Topic: Making [text][/text] more convenient
- Replies: 12
- Views: 7389
- Sat Nov 06, 2004 5:21 pm
- Forum: newLISP in the real world
- Topic: Passing FLOAT's
- Replies: 24
- Views: 13649
- Sat Nov 06, 2004 4:40 pm
- Forum: newLISP in the real world
- Topic: Passing FLOAT's
- Replies: 24
- Views: 13649
- Wed Nov 03, 2004 10:02 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
In order to evaluate functions you need to add in the (string function as (define (subs w) (replace "`(.+?)`" w (string (eval-string $1)) 0)) This allows stuff like numbers and lists to be substituted. (println (subs [text]Content-type: text/html <html> <body> <p>1 + 2 + ... + 8 = `(apply + (sequenc...
- Wed Nov 03, 2004 8:59 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
- Wed Nov 03, 2004 8:44 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
- Wed Nov 03, 2004 8:43 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
Sometimes I don't just do foolish things. This works maybe a bit faster? I chose the backquotes for less typing. (define (subs w) (replace "`(.+)`" w (eval-string $1) 0)) Example (setq title "The Big Heading" section "Section I") (println (subs [text] <html> <body> <h1>`title`</h1> <h2>`section`</h2...
- Tue Nov 02, 2004 8:50 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
- Tue Nov 02, 2004 5:42 pm
- Forum: newLISP in the real world
- Topic: [text][/text]
- Replies: 8
- Views: 5151
[text][/text]
What would really be wonderful for us cgi tinkerers would be to evaluate variables and functions within the [text] [/text] tags like (set 'title "Today") (pr [text]Content-type: text/html <html> <head> <title>#{title}</title> </head> <body> <p>Today is #{(now)}</p> </body> </html> [/text]) I have do...
- Mon Nov 01, 2004 1:55 pm
- Forum: newLISP in the real world
- Topic: let
- Replies: 6
- Views: 4599
- Mon Nov 01, 2004 1:47 pm
- Forum: newLISP in the real world
- Topic: let
- Replies: 6
- Views: 4599
- Sat Oct 30, 2004 1:24 am
- Forum: newLISP in the real world
- Topic: let
- Replies: 6
- Views: 4599
let
Would it be difficult to fix let so that I could reference other local variables like
This would reduce the amount of nested lets like
What do you think about this one?
Eddie
Code: Select all
(let (x (car L) y (car x) ...)
Code: Select all
(let (x (car L))
(let (y (car x))
...
Eddie
- Mon Oct 18, 2004 8:14 pm
- Forum: newLISP in the real world
- Topic: newLisp Mode for emacs
- Replies: 12
- Views: 7884
- Mon Oct 18, 2004 1:21 pm
- Forum: newLISP in the real world
- Topic: newLisp Mode for emacs
- Replies: 12
- Views: 7884
I've only played with the scheme.el in emacs. I've used emacs for about 8 years but to be honest, I don't know anything about its inner workings. I discovered a few things by hunting them down on the Internet. I used the M[ key sequence and ran newLISP from the shell command line. I've never tried x...
- Sat Oct 16, 2004 8:17 pm
- Forum: Anything else we might add?
- Topic: Syntax Suggestions
- Replies: 13
- Views: 7950
I dont like typing much either. For non cgi programs, I've redone many of the commands by adding the following to my init.lsp. (constant (global 'const) constant) (constant (global 'df) define) (constant (global 'dm) define-macro) (constant (global 'ap) apply) (constant (global 'filt) filter) (const...
- Fri Oct 15, 2004 1:36 pm
- Forum: Anything else we might add?
- Topic: Are circular list possible?
- Replies: 5
- Views: 4225