You should be automatically redirected . If not, visit
and update your bookmarks.


What's new?

Things are a bit quiet around here at the moment. But I can at least mention a few newLISP-y things, to pass the time until I have something interesting to post...!

  • newLISP on Noodles is a new wiki dedicated to newLISP advocacy. There are quizzes, too, which is cool... :-)
  • visit Fanda's web site at Intricate Visions for some photography and programming
  • Seth Dillingham created a BBEdit Codeless Language Module for newLISP. You'll need version 8.5 of BBEdit to use it. He wrote an article about it at the Truer Words site, and you might be interested in his use of recursive back-reference grep patterns to match Lisp parentheses, even if you don't use BBEdit...
  • If you can understand Russian, you'll be interested in a new tutorial to newLISP to be found at Dmitry's EnFeauTec site.
  • There's lots of good newLISP code at terpri.
  • Both Intricate Visions and Terpri are wikis that use the newLISP wiki code, which you can get from the main newLISP site. One day I hope this blog will move to a newLISP-powered wiki.

I suppose I'd better post a bit of newLISP code. I had to produce some 2007 calendars the other day, and I used the following code to test some of the basic output routines. Here's a stand-alone version, which needs a PostScript interpreter of some kind to produce output.

(set 'buffer "")
(define (ps str)
	(write-line str buffer))
(define (render)
	  (& 0x7F (sys-info 7)) ; MacOS X...
		  (write-file (string (env "HOME") "")
				(string "%!PS-Adobe-3.1" "\n" "%%Creator: newLISP" "\n") 
					buffer "showpage" "\r\n")
	  	(exec (string "open "(env "HOME") "/Desktop/")))
	  ; other platforms
	  (write-file "" 
	  	(string "%!PS-Adobe-3.1" "\n" "%%Creator: newLISP" "\n") 
	  		buffer "showpage" "\r\n")))
(define (write-string s)
  (ps (format {%f %f moveto} x y))
  (ps (format {(%s) show} s))) ; x and y are unchanged
(define (weekday-format)
  (ps (format {/Eurostile findfont 8 scalefont setfont}))
  (ps (format {0 0 0 setrgbcolor})))
(define (weekend-format)
  (ps (format {/Eurostile findfont 8 scalefont setfont}))
  (ps (format {0 .3 .3 setrgbcolor})))
(define (month-format)
  (ps (format {/Eurostile findfont 12 scalefont setfont}))
  (ps (format {.7 0 0 setrgbcolor})))
(define (next-day)
  (if weekend
  (write-string day-number-text)
  (dec 'y row-height))
(define (new-week)
  (set 'y (- ruler month-day-space))
  (inc 'x column-width))
(define (new-month)
  (and (> x 450) 
		(set 'x left-margin)
		(dec 'ruler month-month-space)
		(dec 'y month-month-space))
		(swap y ruler)
		(inc 'x month-width-space)
		(write-string month-name)
		(swap y ruler)
		(ps (format {%f %f moveto} x y))
; start
(set 'x 10
	'y 750 
  'ruler y 
  'row-height 15 
  'left-margin 25 
  'column-width 15 
  'month-day-space 15 
  'month-month-space 160
  'month-width-space 30)
(ps (format 
	{0.1 setgray /Eurostile findfont 8 scalefont setfont}))
(ps (format 
	{%f %f moveto} x y))
(for (week 0 52)
  (for (day 0 6)
    (set 'date-val 
    	(+ (date-value 2007 1 1) 
    		 (* 24 60 60 (+ (+ (* 7 week) day)))))
    (set 'day-number (int (date date-val 0 {%d}) 0 10))
    (set 'month-name (date date-val 0 {%B}))
    (set 'day-name (date date-val 0 {%A}))
    (if (starts-with day-name "S") ; weekend, English :-) 
      (set 'weekend true)
      (set 'weekend nil))
    (if (= day-number 1) ; start of new month
    (set 'day-number-text 
    	(string (date date-val 0 {%d})))


Post a Comment

Links to this post:

Create a Link

<< Home