Search found 294 matches

by eddier
Fri Feb 25, 2005 5:10 pm
Forum: newLISP in the real world
Topic: About parse and scannig
Replies: 7
Views: 4856

Yes, different ways of writing regular expressions can drastically change performance. Complex expressions involving a bunch of "|"s will obviously take longer.

Eddie
by eddier
Fri Feb 25, 2005 3:12 pm
Forum: newLISP in the real world
Topic: About parse and scannig
Replies: 7
Views: 4856

That's interesting. I use replace on regular expressions very often and I find that this operation is very fast. I would have thought that the time would go down drastically, like maybe to 1/100 of a second.

Eddie
by eddier
Fri Feb 18, 2005 5:24 pm
Forum: Anything else we might add?
Topic: Is it there a better way to read a file in a list ?
Replies: 4
Views: 3212

I'm always having to work with reports. A nice thing about newLISP is the fact I can read and parse a tab delimited file exported from Excel, Access, whatever in a one liner: (setq data (map (fn (x) (parse x "\t")) (replace "\r" (parse (read-file in-file) "\n")))) Note that with (replace "\r" (parse...
by eddier
Wed Feb 09, 2005 2:41 pm
Forum: newLISP in the real world
Topic: What's wrong with this ? (unexpected stack overflow)
Replies: 9
Views: 5740

I believe this is a good change since I have been miss-using the macro facility to define what should be functions that use multiple arguments. This of course has led to in some cases, a brick wall. I would rather change the macro definitions in my libraries than change all of my cgi programs. Thank...
by eddier
Mon Feb 07, 2005 6:46 pm
Forum: newLISP in the real world
Topic: What's wrong with this ? (unexpected stack overflow)
Replies: 9
Views: 5740

I thought about using the second possibility you gave. Unfortunately, I would have to rewrite many of my current cgi programs to take (:a '(href="blahblah" style="blahblah") "blahblah"). Not bad notation, but I don't want to rewrite my cgi programs. I should have used this as the solution in the fir...
by eddier
Mon Feb 07, 2005 5:15 pm
Forum: newLISP in the real world
Topic: What's wrong with this ? (unexpected stack overflow)
Replies: 9
Views: 5740

I discovered this accidently Lutz. I have a bunch of html macros that can take any number of arguments of the sort (a href="blahblah" style="blahblah" "Goto blahblah"). I wanted to embed these in some more macros for auto generating documentation. SHEEZE! I gave up on it. I was able to do something ...
by eddier
Mon Feb 07, 2005 5:07 pm
Forum: newLISP newS
Topic: Newlisp editor mode for (X)Emacs - vim too
Replies: 2
Views: 2943

Thanks a million. You've done quite a good job!

Eddie
by eddier
Fri Feb 04, 2005 10:27 pm
Forum: Anything else we might add?
Topic: Extending dolist
Replies: 1
Views: 2037

I use map for those occasions.

(map (fn (x y) (whatever with x and y))
X Y)

eddie
by eddier
Fri Jan 21, 2005 2:45 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

I kind of got the impression that older versions of sendmail had to have the "." but I'm not sure.

Eddie
by eddier
Thu Jan 20, 2005 7:23 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

Thanks! Oh by the way, If you wanted to update your SMTP library. I don't know if you should, but on Linux/Unix boxes, you could add cc and other fields if you need. (define (sendmail to from subject body) (string (exec "/usr/bin/sendmail -t" (format "To: %s\nFrom: %s\nSubject: %s\n\n%s." to from su...
by eddier
Thu Jan 20, 2005 6:18 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

Thanks Lutz!

I looked at error-event, but it was not what I was looking for. I see now that the throw catch is to be used as "break" and/or "return" in "C." Right?

Eddie
by eddier
Thu Jan 20, 2005 6:01 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

I think I'm confussing "error-event" and the "throw catch" for the same thing. This is a bit confussing to me. It seems like if a throw occured, then it would signal an error. How can I make a user defined error it would work like throw in C++, Java, Python, Perl, etc, use throw. I would like to cat...
by eddier
Thu Jan 20, 2005 5:15 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

I'm not sure I understand? Notice that catch returned true in both of the circumstances above. If this is normal behaviour, how do I force throw to thrown an error condition? Shouldn't the throw clause force an error condition for catch? Otherwise, how is this useful for catching user defined errors...
by eddier
Thu Jan 20, 2005 4:27 pm
Forum: newLISP in the real world
Topic: catch is broken
Replies: 10
Views: 6096

catch is broken

Code: Select all

(define (f x y)
 (if (= 0 x)
  (throw "x can't be zero")
  (+ x y)))

> (catch (f 0 2) 'result)
true
>result
"x can't be zero"
> (catch (f 1 1) 'result)
true
> result
2
catch is always returning true.

Eddie
by eddier
Wed Jan 19, 2005 4:21 pm
Forum: Whither newLISP?
Topic: Questions on Syntax from a newLisp Newbie
Replies: 12
Views: 9533

Oops. Yes I made a mistake. (join ("hello" "world") ":") => "hello:world" Also, Lutz, I think there should be a "->[ ]" after the "[*]->[4]->[3]" correct? After looking at a bunch of Lisp dialects, schemes, goo, and NEWLisp, I'm finding things I like about all of the different dialects and language ...
by eddier
Wed Jan 19, 2005 2:42 pm
Forum: Whither newLISP?
Topic: Questions on Syntax from a newLisp Newbie
Replies: 12
Views: 9533

Sorry, I couldn't get the down links to line up correctly, in the linked list code above the down arrow should be below the [ : nil] not the middle part of [3 : ].
Eddie
by eddier
Wed Jan 19, 2005 2:39 pm
Forum: Whither newLISP?
Topic: Questions on Syntax from a newLisp Newbie
Replies: 12
Views: 9533

Nice tutorial. Coming from the imperative side of things, I also faced such challenges. The biggest one for me was (f x0 x1 ... xn) in Lisp == f(x0, x1, ..., xn) in Python, Perl, C, Java, etc,... Once I figured out that the first thing after the beginning "(" was an operation that operated on everyt...
by eddier
Mon Jan 10, 2005 3:38 pm
Forum: Anything else we might add?
Topic: String Lists
Replies: 4
Views: 3168

I know Perl uses:

Code: Select all

qw/cat dog rat bat/
Just curious, what is it in Python
by eddier
Wed Jan 05, 2005 2:00 pm
Forum: newLISP in the real world
Topic: an empty problem...
Replies: 12
Views: 7344

Oops, in my code, I assumed he wanted to return the file contents if is wasn't empty. My bad.

Eddie
by eddier
Wed Jan 05, 2005 1:50 pm
Forum: newLISP in the real world
Topic: an empty problem...
Replies: 12
Views: 7344

I'm not sure what the stamped-name means but here is my shot at it.

Code: Select all

(let (file-content (read-file (append notespath note)))
  (if (empty? file-content)
    (write-file (append notespath stamped-name))
    file-content))
Eddie
by eddier
Fri Dec 17, 2004 5:28 pm
Forum: newLISP in the real world
Topic: max
Replies: 7
Views: 4893

The input file is a tab delimited file generated from ODBC through our database. I have no choice about the date values. There are quite a number of things that I have to apply a rule base or calculate. Your solution of converting dates to numerical format and then using max is a good one. Then, I h...
by eddier
Fri Dec 17, 2004 2:08 pm
Forum: newLISP in the real world
Topic: max
Replies: 7
Views: 4893

I was looking for (define-macro (_max) (first (sort (args) '>))) or (define-macro(_max) (last (sort (args))) I know Python has this function because I have used it before. I have a list of dates in Y/M/D order as strings and I needed to get the latest. And so, I did the above. I assume the sort is p...
by eddier
Thu Dec 16, 2004 5:21 pm
Forum: newLISP in the real world
Topic: max
Replies: 7
Views: 4893

max

Would be nice if max and min worked with strings or is this a bad idea?

(max "a" "A" "B" "b" "C") => "b"

Eddie
by eddier
Fri Dec 10, 2004 8:25 pm
Forum: Whither newLISP?
Topic: expand and define-macro
Replies: 5
Views: 5165

Thanks lutz for all of your good work.

Eddie
by eddier
Fri Dec 10, 2004 1:46 pm
Forum: Whither newLISP?
Topic: expand and define-macro
Replies: 5
Views: 5165

Thanks Lutz!

Is this a regular function definition or macro?

Eddie