Code Select
(define (f n)
(if (= n) 0 (> n)
(if (odd? n) (inc n) (- (dec n)))
(if (odd? n) (dec n) (- (inc n)))))
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
(define (f n)
(if (= n) 0 (> n)
(if (odd? n) (inc n) (- (dec n)))
(if (odd? n) (dec n) (- (inc n)))))
; Compute "bits" for bigint and int
(constant 'MAXINT (pow 2 62))
(define (prep s) (string (dup "0" (- 62 (length s))) s))
(define (bitsL n)
(if (<= n MAXINT) (bits (int n))
(string (bitsL (/ n MAXINT))
(prep (bits (int (% n MAXINT)))))))
but then I'm less sure about the gain in speed.
(nil? (find "1" (1 (bits n))))
(define (run2 program start step)
(dotimes (x step)
(let (b (bits x))
(or (find "1" (1 b)) (print (dec (length b)) ", ")))
(setq start (fractran program start)))
'stop)
#!/usr/local/bin/newlisp
(append-file "ltcbtc.txt" (println pairs (date (date-value) 0 "%y%m%d%H%M%S")))
if you have installed newlisp at there.
$ newlisp -x winny.lsp herbie ; chmod a+x herbie
and then use that in crontab.
* * * * * /home/joe/winny/herbie
.
* * * * * 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