Search found 294 matches

by eddier
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...
by eddier
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

Code: Select all

 (format "(define-macro (:%s) (format \"<%s%%s\" (<tag /> (args))))" 
Kill the space between "(<tab" and "/>"

I don't know how that got in there.

Eddie
by eddier
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 ...
by eddier
Mon Nov 15, 2004 7:45 pm
Forum: newLISP in the real world
Topic: html
Replies: 4
Views: 3696

OOPS! Use the following.

Code: Select all

(define (subs w)
  (replace "<%([^<%]+?)%>" w (string (eval-string $1)) 0)
  (if (> $0 0) (subs w) w))
Eddie
by eddier
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%> "<...
by eddier
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...
by eddier
Thu Nov 11, 2004 9:00 pm
Forum: Anything else we might add?
Topic: Making [text][/text] more convenient
Replies: 12
Views: 7389

Tradeoffs Tradeoffs Tradeoffs ... We like small size and efficiency so we can live with it.

Thanks Lutz!

Eddie
by eddier
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...
by eddier
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]."

Code: Select all

(print { \t\t\t ; white space
Content-type: text/html

<html>
.
.
.
</html>})
equals

Code: Select all

(print {Content-type: text/html

<html>
.
.
.
</html>})
I like it.

Eddie
by eddier
Wed Nov 10, 2004 7:39 pm
Forum: Anything else we might add?
Topic: Making [text][/text] more convenient
Replies: 12
Views: 7389

I wished [text][/text] was the {}.
Instead of "", [text][/text], and {} just have "" and {}.

Just my two cents.

Eddie
by eddier
Sat Nov 06, 2004 5:21 pm
Forum: newLISP in the real world
Topic: Passing FLOAT's
Replies: 24
Views: 13649

Yes, but doesn't newlisp use doubles internally and not floats?
in (float_print 1.2) the 1.2 is being passed as a double isn't it?

Eddie
by eddier
Sat Nov 06, 2004 4:40 pm
Forum: newLISP in the real world
Topic: Passing FLOAT's
Replies: 24
Views: 13649

I've seen this error (%f and double) or (%lf and float) many times in plain C. I bet if you change float to double you will have no problem.

Eddie
by eddier
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...
by eddier
Wed Nov 03, 2004 8:59 pm
Forum: newLISP in the real world
Topic: [text][/text]
Replies: 8
Views: 5151

Works the same way with 0 or 512.

Eddie
by eddier
Wed Nov 03, 2004 8:44 pm
Forum: newLISP in the real world
Topic: [text][/text]
Replies: 8
Views: 5151

Correction! Sometimes I do foolish things.
by eddier
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...
by eddier
Tue Nov 02, 2004 8:50 pm
Forum: newLISP in the real world
Topic: [text][/text]
Replies: 8
Views: 5151

Thanks Lutz! This will do fine if I change file-name to a string-var.

Eddie
by eddier
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...
by eddier
Mon Nov 01, 2004 1:55 pm
Forum: newLISP in the real world
Topic: let
Replies: 6
Views: 4599

Thanks Lutz :)

Eddie
by eddier
Mon Nov 01, 2004 1:47 pm
Forum: newLISP in the real world
Topic: let
Replies: 6
Views: 4599

I would use the (letrec more. What is the difference between let* and let?

Eddie
by eddier
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

Code: Select all

(let (x (car L) y (car x) ...)
This would reduce the amount of nested lets like

Code: Select all

(let (x (car L))
  (let (y (car x))
  ...
What do you think about this one?

Eddie
by eddier
Mon Oct 18, 2004 8:14 pm
Forum: newLISP in the real world
Topic: newLisp Mode for emacs
Replies: 12
Views: 7884

Ok, tommorrow I'll take a hack at your hack at quack and see what we can do.

Eddie
by eddier
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...
by eddier
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...
by eddier
Fri Oct 15, 2004 1:36 pm
Forum: Anything else we might add?
Topic: Are circular list possible?
Replies: 5
Views: 4225

Lutz,

Did you mean "no circular lists" instead of "now circular lists?"