Search found 26 matches

by jsmall
Fri Nov 05, 2004 7:23 pm
Forum: newLISP newS
Topic: development release newLISP v.8.2.4
Replies: 7
Views: 9254

cgi.lsp obsolete?

Has cgi.lsp been eliminated or folded into some
other module/example?

How will wiki and blog be affected if at all?
by jsmall
Tue Oct 19, 2004 9:49 pm
Forum: newLISP newS
Topic: newLISP now on Graham's list
Replies: 55
Views: 76812

I can work with s-expressions in newLISP - I'm happy

And I can write (cons 1 '(2 3)) and get (1 2 3).
This looks okay to me.
by jsmall
Fri Oct 15, 2004 10:31 pm
Forum: Anything else we might add?
Topic: Timezone and daylight savings time
Replies: 2
Views: 4156

I solved my problem on the daylight-corrected-timezone

Lutz, I did a work around in the cron.lsp so that it corrects for the timezone adjusted for daylight savings time if the computer adjusts the clock. That way crontab entries are good to go. The cron.lsp utility will automatically adjust when we go on/off daylight savings time without restarting. (If...
by jsmall
Fri Oct 15, 2004 4:07 pm
Forum: newLISP newS
Topic: compile.lsp
Replies: 0
Views: 3638

compile.lsp

;; usage: newlisp compile.lsp executable source.lsp ;; Note: requires link.lsp in the same directory. ;; To compile.lsp rename this file to cnl.lsp ;; and copy and paste "link.lsp" inline replacing ;; (load "link.lsp") below with this inline copy. ;; Now you can compile cnl.lsp with: ;; ;; newlisp ...
by jsmall
Thu Oct 14, 2004 7:30 pm
Forum: newLISP and the O.S.
Topic: A Unix like cron scheduler for windows
Replies: 3
Views: 5523

deleted

see first cron.lsp which has been corrected
by jsmall
Thu Oct 14, 2004 6:39 pm
Forum: Anything else we might add?
Topic: Timezone and daylight savings time
Replies: 2
Views: 4156

Timezone and daylight savings time

    (now) returns UTC while     (date (apply date-value (now)) returns the proper timezone corrected for daylight savings time if the computer clock is set to daylight savings time. Without parsing the output of     (date (apply date-value (now)) is there a way to determine wether or not daylight sa...
by jsmall
Thu Oct 14, 2004 6:17 pm
Forum: newLISP and the O.S.
Topic: A Unix like cron scheduler for windows
Replies: 3
Views: 5523

deleted

see first cron.lsp which has been corrected
by jsmall
Thu Oct 14, 2004 1:25 am
Forum: newLISP and the O.S.
Topic: A Unix like cron scheduler for windows
Replies: 3
Views: 5523

A Unix like cron scheduler for windows

Currently this is single threaded so that a long running task could overshadow an adjacent alarm if it runs past its trigger time. ;; A Unix like cron scheduler for Windows. ;; by John W. Small ;; usage: newlisp cron.lsp [crontab] ;; crontab file: ;; ;; # This is a comment! ;; ;; # Fields: ;; ;; # m...
by jsmall
Wed Oct 13, 2004 8:58 pm
Forum: Anything else we might add?
Topic: Question on (parse ...
Replies: 1
Views: 3466

Question on (parse ...

If I try to parse:

Code: Select all

   > (parse "Hello    World" {\s+} 0)
   ("Hello" "World")

;; it works!  And

   > (parse "" {\s+} 0)
   ()

;; it also works.  But then

   > (parse "    "  {\s+} 0)
   ("" "")

;; Is this right?  I want to get back an empty list.
by jsmall
Sun Oct 10, 2004 9:45 pm
Forum: newLISP newS
Topic: list and association list cracking macros
Replies: 0
Views: 3398

list and association list cracking macros

I find the following macros useful for working with symbolic data structures. The "list-let" macro below allows you to map the elements of a list to "let" bindings. (define-macro (list-let _values _vars) (let ((bindings (map (fn (_var _value) (list _var _value)) _vars (eval _values))) (body (rest (r...
by jsmall
Fri Oct 08, 2004 12:55 pm
Forum: Anything else we might add?
Topic: newLISP for PDA's and Pocket PC's
Replies: 1
Views: 3458

newLISP for PDA's and Pocket PC's

Is anyone contemplating on porting newLISP onto
mobile platforms?
by jsmall
Fri Oct 01, 2004 6:51 pm
Forum: newLISP newS
Topic: lexical lambda's where ever you want them
Replies: 0
Views: 3642

lexical lambda's where ever you want them

NewLisp has a convenient way of synthesizing lexical scope behavior whenever you need it. (define z 3) (define foo (let ((y 2)) (expand (lambda (x) (list x y z)) 'y 'z))) (foo 1) ;; ==> (1 2 3) The "expand" built-in function takes its first argument, e.g. the lambda expression here, and expands all ...
by jsmall
Fri Oct 01, 2004 6:32 pm
Forum: newLISP newS
Topic: func-lettes, currying and other useful macros
Replies: 2
Views: 5181

func-lettes, currying and other useful macros

Below is a generic way to curry arguments for user defined functions. For example (define (foo x y) (+ x y)) > (fn-let foo (x 1)) (lambda (y) (let ((x 1)) (+ x y))) fn-let creates a new lambda list with the curried arguments moved into the internalize let expression. (define-macro (fn-let _f ) (let ...
by jsmall
Tue Sep 28, 2004 1:48 pm
Forum: Anything else we might add?
Topic: lambda(-macro) ideas
Replies: 0
Views: 3358

lambda(-macro) ideas

Suppose that lambda and lambda-macro were identical except that the former had strict evaluation of actual arguments and the latter lazy evaluation of actual arguments. Make this the default behavior (which it is now). But suppose newlisp had atomatized behavior like this: <pre> (lambda (x ~y) ....)...
by jsmall
Tue Sep 28, 2004 1:43 pm
Forum: Anything else we might add?
Topic: a quasiquote implementation in newLisp
Replies: 3
Views: 5759

quasiquote and ref

I've been working on the uq and uq@ using your code example: (define-macro (qq s-exp) (while (set 'idx (chop (ref 'uq s-exp))) (set 'qx (pop s-exp idx)) (push (eval (first (rest qx))) s-exp idx)) s-exp) ;; now use it (set 'x 'hello) (qq ( (uq (+ 1 2)) ((uq (+ 3 4)) (uq x)))) => (3 (7 hello)) ;; some...
by jsmall
Tue Sep 28, 2004 12:05 pm
Forum: newLISP newS
Topic: newLISP now on Graham's list
Replies: 55
Views: 76812

No one kicks a dead dog

If newLisp is such a dog and dead (in the grave long ago) why kick it? Several things the detractors miss about newLisp. 1. It's small foot print and convenience. Perhaps they didn't miss this at all. Perhaps it is admitting "common folk" to the exclusive Lisp country club that gets their goat as if...
by jsmall
Sun Sep 26, 2004 7:10 pm
Forum: Anything else we might add?
Topic: a quasiquote implementation in newLisp
Replies: 3
Views: 5759

a quasiquote implementation in newLisp

The following macro and function define a quasiquote / unquote mechanism in newlisp. Note the use of uq and uq@. ;; usage: (qq (x y (uq (+ 1 2)) (uq@ (list 1 2 3)))) ;; ==> (x y 3 1 2 3) (define-macro (qq s-expr) (qq-eval s-expr)) ;; Since qq is a macro you can't use (args) within. ;; Use qq-eval in...
by jsmall
Sun Sep 26, 2004 2:40 am
Forum: Whither newLISP?
Topic: modified expand-let and other macros
Replies: 0
Views: 3780

modified expand-let and other macros

I'm hoping something is gained execution wise over the previous two definitions of expand-let. This is Lutz's version slightly edited. (define-macro (expand-let ) (eval (cons 'let (cons (rest (args)) (list (cons 'expand (cons (first (args)) (map (fn (arg) (apply quote (list (first arg)))) (rest (arg...
by jsmall
Fri Sep 24, 2004 7:49 pm
Forum: Whither newLISP?
Topic: Macros and expand
Replies: 1
Views: 4229

Macros and expand

I'm trying to understand the proper use of expand with macros. So I define the macro "expand-let" with the following semantics. (expand-let '(x y z) (x 1) (y 2) (z 3)) "expands" to the equivalent of (let ((x 1)(y 2)(z 3)) (expand '(x y z) 'x 'y 'z)) returning (1 2 3) The following is my implementati...
by jsmall
Fri Sep 24, 2004 2:49 pm
Forum: Whither newLISP?
Topic: Struggling to grasp newlisp macros
Replies: 3
Views: 6429

(expand ...) in lambda-macros "lists"

You can also have variable expansion in macros using the newLISP function 'expand' Lutz So the following would define bar as interned in the first email of this thread: > (define-macro (bar _x _y) (expand (fn () (list _x _y) '_x '_y)) > (foo 1 2) (lambda () (list 1 2)) I'm beginning to appreciate t...
by jsmall
Fri Sep 24, 2004 11:28 am
Forum: Whither newLISP?
Topic: Struggling to grasp newlisp macros
Replies: 3
Views: 6429

Eureka - I understand - lambda-macro is really lambda-lazy

define-macro is really define-lazy and not a macro at all. Thus > (define-lazy (bar _x _y) (fn () (list _x _y))) (lambda-lazy (_x _y) (lambda-strict () _x _y)) and > (bar a b) > ((lambda-lazy (_x _y) (lambda-strict () _x _y)) 'a 'b) (lambda-strict() _x _y) which models the behavior of define-macro p...
by jsmall
Fri Sep 24, 2004 3:19 am
Forum: Whither newLISP?
Topic: Struggling to grasp newlisp macros
Replies: 3
Views: 6429

Struggling to grasp newlisp macros

I'm trying to come up with a conceptual model of how define-macro works. >(define-macro (foo _x _x) (list _x _y)) (lambda-macro (_x _y) (list _x _y)) > (foo 1 2) (1 2) > (foo a b) (a b) So far so good. Conceptually I'm thinking the macro invocation is a two step process. > (foo a b) ((lambda-macro (...
by jsmall
Wed Sep 22, 2004 2:12 am
Forum: Whither newLISP?
Topic: variable length argument lists
Replies: 1
Views: 4181

variable length argument lists

Without resorting to define-macro and (args) what is the preferred idiom for specifying a function taking a variable number of arguments? Do you simply have to anticipate these optional arguments? (define (foo x y z) ...) But if this is the case than passing this variable number of arguments onto an...
by jsmall
Tue Sep 21, 2004 9:08 pm
Forum: newLISP and the O.S.
Topic: newlisp-tk on windows
Replies: 4
Views: 6462

newlisp-tk on windows

I installed the newlisp 8.2 on windows. When I start the IDE I get this error message which doesn't seem to effective anything else negatively. Error sourcing /freewrap/newlisp-tk.tcl: couldn't change working directory to "c:/newlisp/": no such file or directory I installed newlisp in a directory di...
by jsmall
Mon Sep 20, 2004 3:40 am
Forum: Whither newLISP?
Topic: quasiquote and unqoute
Replies: 3
Views: 6044

can do: eval of a list of elements > (map 'eval '(1 (+ 2 3))) (1 5) > Nigel Clever - Thanks! I was hoping to do something like `(html (body (@ (text blue) ...) ...) and have unquoted expressiion to fill in. I know I can use the cgi module instead and embed newlisp code instead as the dual of this a...