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
* * * * * joe /home/joe/winny/winny.lsp
A line like the above would be fine in
* * * * * /home/joe/winny/winny.lsp
It's of course all nicely documented in
$ man cron
(define (digits n)
(let (x 0 m 1)
(while (!= n (add n m)) (inc x) (setf m (div m 10)))
x))
(define (P n) (format (string "%0." (digits n) "f") n))
(format "%0.1000f" -2.000000000000049e-07)
(define (merge lstA lstB op)
(let ((ciclo (fn (out lstA lstB)
(cond ((null? lstA) (extend (reverse out) lstB))
((null? lstB) (extend (reverse out) lstA))
((op (first lstB) (first lstA))
(ciclo (cons (first lstB) out) lstA (rest lstB)))
(true
(ciclo (cons (first lstA) out) (rest lstA) lstB))))
))
(ciclo '() lstA lstB)
))
(define (merge lstA lstB op) (sort (append lstA lstB) op))
(define (pairs-i1 a b)
(let ((out (list)) (x nil) (FX (* 2 3 5 7 11 13)) (M 0))
(for (y (if (odd? a) a (inc a)) b 2)
(if (if (< y FX) (1 (factor y))
(or (= (setf M (% y FX))) (if (factor M) (<= ($it 0) 13)) (1 (factor y))))
(setf y nil)
x (push (list x y) out -1))
(setf x y))
out))
(define (make-poly coeff)
(let ((rank (length coeff))
(polyterm (fn (k) (case (dec rank)
(0 k)
(1 (list 'mul 'x k))
(true (list 'mul (list 'pow 'x rank) k))))))
(push (cons 'add (reverse (map polyterm coeff))) (copy '(fn (x))) -1)))
Can newLISP be used to create a standalone http web app server?Quote
newlisp A.lsp
(println "n" template)
to serve the
(letex (l l) (let l (+ a b)))
and for a more regular need, I'd define me a macro like the following:
(define-macro (lett)
(if (list? (args 0)) (apply let (args))
(apply let (cons (eval (pop (args))) (args))) ))
(lett l (+ a b))
(set 'jsondata (lookup "products" (lookup "result" alie)))
it'll already have gone into the "products" value part, and therefore my suggested
(map raisins jsondata)
. And, completed with a println it might look like:
(println (join (map raisins jsondata) "n"))
(if (ref '(x ?) y match true) ($it 1) '())
picks and returns the value part, i.e. the second element, of the
(if R ($it 1) '())
serves the purpose of avoiding a bad error if the
(define (raisins jsonitem)
(format "<a href="%s">%s</a>n"<img src="%s">nn"
(string (if (ref '("productUrl" ?) jsonitem match true) ($it 1)))
(string (if (ref '("imageTitle" ?) jsonitem match true) ($it 1)))
(string (if (ref '("imageUrl" ?) jsonitem match true) ($it 1))) ))
(map raisins (if (ref '("producs" ?) jsondata match true) ($it 1) '())