Re: Jobs: Lisp and Python programmers wanted in the LA area

2007-02-27 Thread Wade Humeniuk
Tech HR wrote:
 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] wrote:
 
 On Feb 26, 6:32 am, Tech HR [EMAIL PROTECTED] wrote:
 Our
 website is currently a LAMP appication with P=Python. We are looking for
 bright motivated people who know or are willing to learn Python and/or
 Linux, Apache and MySQL system administration skills. (And if you want
 to convince us that we should switch over to Postgres, we're willing to
 listen.)
 This is more out of curiosity, but does it mean that you wouldn't be
 willing to listen about a switch from Python to Lisp?
 
 No, it doesn't mean that.  In fact, there is a significant faction in 
 the technical staff (including the CTO) who would like nothing better 
 than to be able to use Lisp instead of Python.

Who is the CTO?

Wade
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: merits of Lisp vs Python

2006-12-15 Thread Wade Humeniuk
Paul Rubin wrote:

 
 nif is even cleaner in Haskell, if I have this right:
 
 nif x p z n | (x  0) = n
 | (x == 0) = z
 | (x  0)  = p
 
 All Haskell evaluation is automatically lazy, so no lambdas etc. needed.

You can use that style in CL.

(defun nif (x p z n)
   (or (when ( x 0) n)
   (when (= x 0) z)
   (when ( x 0) p)))


Wade
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: merits of Lisp vs Python

2006-12-09 Thread Wade Humeniuk
tmh wrote:
 This is from the perspective of an aerospace engineer who passed
 through python several years ago on the way to lisp. Futhermore, this
 is a 2 glass of wine response.
 
snip

Thanks for the comments.  I think it is great that you took a harder
and less travelled way.  It may be that some people get to a point
where they are either tired or think they know everything. Or.. their
brains just harden up and they become old dogs.

There seems to be a recurring theme to many of the posts in this thread
about syntax and readability.  Some of it is If I can not instantly
read and understand what the code is doing then something is wrong
with it.  As if holding oneself as the standard of what is good and
correct is the only way.  If you see something and it
is not readily apparent what it is, then that is a sign than something
interesting may be going on.  I got into Lisp because when I
looked at it, I did not understand.  I did not think WTF! but thought
that something was  going on and maybe I was cheating myself if I
brushed it aside.

There is also some disdain expressed about badly written programs.
Why?  They may be that way for some very good reasons, it is folly
to think that programs have to be simple, obvious and elegant.  I find
interesting that a programmer got out their comfort zone and attempted
something.  Its better than the ones with the big egos who play it safe
so they do not appear to be a fool.

Wade
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: merits of Lisp vs Python

2006-12-09 Thread Wade Humeniuk
mystilleef wrote:

 
 People only contribute to things they understand and appreciate. More
 people would be writing Lisp libraries if it was worthwhile.
 Apparently, it doesn't seem to be. A few years ago, I tried to write an
 editor is Scheme. The experience was appalling. I was able to write a
 fully functional prototype editor in less than a week in Python.
 Shockingly, at the time, I had no experience in Python. Guess which
 community I was inclined to contribute to afterwards. I hear stories
 similar to mine time and again, yet the Lisp community won't take heed.
 They'd rather squeal about the superiority of macros and whine about
 their frustrations in Python news groups.
 

Hmm.. Here is my first prototype in Lisp.  It took 20 seconds
to write.

(defun display-editor ()
   (capi:contain (make-instance 'capi:editor-pane)))

CL-USER 1  (display-editor)
#CAPI:EDITOR-PANE  2069F40C

CL-USER 2 


W



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: merits of Lisp vs Python

2006-12-08 Thread Wade Humeniuk
Mark Tarver wrote:
 How do you compare Python to Lisp?  What specific advantages do you
 think that one has over the other?
 

Since the late 1950's Lisp has participated in the development of
modern (present day) programming practises.  It has shaped and been
shaped by the minds of just not programmers, but people involved
in dealing with the larger impacts and possibilities.
Its been there, is here, and will continue to be there in the future.
Lisp is a human construct that is a force to be reckoned with.  Its
construction reflects something very deep and fundamental about
computing.  So, it depends on what you want.

What do you want?

W
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-16 Thread Wade Humeniuk
Without much testing.  Common Lisp

Pattern exclusions are made lispy.


(defun all-lists (list length)
   (unless (zerop length)
 (if (= length 1) (mapcar #'list list)
   (loop for elt in list
 nconc
 (mapcar (lambda (rest)
   (cons elt rest))
 (loop for rest on list
   nconc (all-lists rest (1- length

(defun cp-without-wc (source-list rest patterns)
   (let* ((length (length (first patterns)))
  (all-lists (all-lists source-list length)))
 (dolist (pattern patterns)
   (setf all-lists
 (set-difference all-lists
 (mapcar (lambda (insertion)
   (let ((cp (copy-list pattern)))
 (loop for place on cp
   when (eql :any (car place)) do
   (setf (car place) (pop 
insertion)))
 cp))
 (all-lists source-list (count :any 
pattern)))
 :test #'equal)))
 (remove-duplicates all-lists :test #'equal)))

CL-USER 22  (cp-without-wc '(a b) '(a :any b) '(b :any a))
((A A A) (A B A) (B A B) (B B B))

CL-USER 23  (cp-without-wc '(abc xyz) '(abc :any xyz))
((XYZ XYZ XYZ) (XYZ XYZ ABC) (XYZ ABC XYZ) (XYZ ABC ABC) (ABC XYZ ABC) (ABC ABC 
ABC))

CL-USER 24  (cp-without-wc '(a b) '(a :any :any))
((B B B) (B B A) (B A B) (B A A))

CL-USER 25  (cp-without-wc '(a b) '(a :any :any) '(b :any :any))
NIL

CL-USER 26  (cp-without-wc '(a b) '(:any :any b))
((B B A) (B A A) (A B A) (A A A))

CL-USER 27 

Wade
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-16 Thread Wade Humeniuk
[EMAIL PROTECTED] wrote:
 What I have in mind is the efficient, enumerated generation of the
 complement S^n/WC(S^n). A good program should initialize, generate, and
 terminate.
 
 T=cartprodex(S,n,WC); //initialize
 for all i in T do
   what you want with i
   test to see if any more
   terminate if not
 
 and it should do this without explicitly generating WC and then
 complementing. For example, if the cardinality of S is m, and the WC is
 just '*a*b*', with a != b, then EX(S^n):=S^n\WC(S^n) has cardinality
 (m-1)^(n-1)*(m+n-1). Specifically, if m=5 and n=10, then |EX|=3670016
 while |S^10|=9765625, so that |EX|/|S^10| is about 0.3758. In general
 the program should directly generate EX from arbitrary WC. Of course,
 in practice the WC should themselves occur in a logically consistent
 manner, but let's just assume they're a given.
 

Another attempt.  I have made no special attempt to create an
exclusion language, just used an anonymous lambda predicate.


;; Wade Humeniuk

(defclass odometer ()
   ((base :initform 0 :accessor base)
(meter :initform nil :accessor meter)
(n-digits :initarg :n-digits :accessor n-digits)
(digit-set :initarg :digit-set :accessor digit-set)))

(defmethod initialize-instance :after ((obj odometer) rest initargs)
   (setf (base obj) (length (digit-set obj))
 (meter obj) (make-array (n-digits obj) :initial-element 0)
 (digit-set obj) (coerce (digit-set obj) 'vector)))

(defun inc-odometer (odometer)
   (loop with carry = 1
 for i from (1- (n-digits odometer)) downto 0
 for digit = (incf (aref (meter odometer) i) carry)
 if (= digit (base odometer)) do
   (setf (aref (meter odometer) i) 0)
   (setf carry 1)
 else do
   (setf carry 0)
 while (not (zerop carry

(defun zero-meter-p (odometer)
   (every #'zerop (meter odometer)))

(defmethod next-set ((obj odometer))
   (prog1 (map 'list (lambda (digit)
   (aref (digit-set obj) digit))
   (meter obj))
 (inc-odometer obj)))

(defclass cs-with-wc (odometer)
   ((exclusion :initarg :exclusion :accessor exclusion)
(at-end :initform nil :accessor at-end)))

(defmethod next-set ((obj odometer))
   (tagbody
:next
(unless (at-end obj)
  (let ((set (call-next-method)))
(when (zero-meter-p obj) (setf (at-end obj) t))
(if (not (funcall (exclusion obj) set))
(return-from next-set set)
  (go :next))

(defun print-all-cs (set length exclusion)
   (let ((cs-with-wc (make-instance 'cs-with-wc :n-digits length :digit-set set
:exclusion exclusion)))
 (loop for set = (next-set cs-with-wc)
   while set do (print set

CL-USER 134  (cs-with-wc '(a b) 3 (lambda (set)
  (destructuring-bind (x y z)
  set
(or (and (eql x 'a) (eql z 'b))
(and (eql x 'b) (eql z 'a))

(A A A)
(A B A)
(B A B)
(B B B)
NIL

CL-USER 135  (cs-with-wc '(a b) 3 (lambda (set)
  (eql (second set) 'a)))

(A B A)
(A B B)
(B B A)
(B B B)
NIL

CL-USER 136  (cs-with-wc '(abc xyz) 3 (lambda (set)
  (and (eql (first set) 'abc)
   (eql (third set) 'xyz

(ABC ABC ABC)
(ABC XYZ ABC)
(XYZ ABC ABC)
(XYZ ABC XYZ)
(XYZ XYZ ABC)
(XYZ XYZ XYZ)
NIL
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-16 Thread Wade Humeniuk
Oops, problems cutting an pasting, should be,

;; Wade Humeniuk

(defclass odometer ()
   ((base :initform 0 :accessor base)
(meter :initform nil :accessor meter)
(n-digits :initarg :n-digits :accessor n-digits)
(digit-set :initarg :digit-set :accessor digit-set)))

(defmethod initialize-instance :after ((obj odometer) rest initargs)
   (setf (base obj) (length (digit-set obj))
 (meter obj) (make-array (n-digits obj) :initial-element 0)
 (digit-set obj) (coerce (digit-set obj) 'vector)))

(defun inc-odometer (odometer)
   (loop with carry = 1
 for i from (1- (n-digits odometer)) downto 0
 for digit = (incf (aref (meter odometer) i) carry)
 if (= digit (base odometer)) do
   (setf (aref (meter odometer) i) 0)
   (setf carry 1)
 else do
   (setf carry 0)
 while (not (zerop carry

(defun zero-meter-p (odometer)
   (every #'zerop (meter odometer)))

(defmethod next-set ((obj odometer))
   (prog1 (map 'list (lambda (digit)
   (aref (digit-set obj) digit))
   (meter obj))
 (inc-odometer obj)))

(defclass cs-with-wc (odometer)
   ((exclusion :initarg :exclusion :accessor exclusion)
(at-end :initform nil :accessor at-end)))

(defmethod next-set ((obj cs-with-wc))
   (tagbody
:next
(unless (at-end obj)
  (let ((set (call-next-method)))
(when (zero-meter-p obj) (setf (at-end obj) t))
(if (not (funcall (exclusion obj) set))
(return-from next-set set)
  (go :next))

(defun print-all-cs (set length exclusion)
   (let ((cs-with-wc (make-instance 'cs-with-wc :n-digits length :digit-set set
:exclusion exclusion)))
 (loop for set = (next-set cs-with-wc)
   while set do (print set

CL-USER 7  (print-all-cs '(a b) 3 (lambda (set)
  (destructuring-bind (x y z)
  set
(or (and (eql x 'a) (eql z 'b))
(and (eql x 'b) (eql z 'a))

(A A A)
(A B A)
(B A B)
(B B B)
NIL

CL-USER 8  (print-all-cs '(abc xyz) 3 (lambda (set)
  (and (eql (first set) 'abc)
   (eql (third set) 'xyz

(ABC ABC ABC)
(ABC XYZ ABC)
(XYZ ABC ABC)
(XYZ ABC XYZ)
(XYZ XYZ ABC)
(XYZ XYZ XYZ)
NIL

CL-USER 9 
-- 
http://mail.python.org/mailman/listinfo/python-list