Similar Threads:
1.qsort optimized for brevity
Marco Antoniotti wrote:
> Using the SETL package
>
> (defun partition (list pivot)
> (values [x in list / (< x pivot)] [x in list / (> x pivot)]))
>
> And without using partition at all
>
> (defun qsort (list)
> (when list
> (append (qsort [x in list / (< x (first list))]) (list (first
> list)) (qsort [x in list / (> x (first list))]))))
This is I must honestly say: very cool. I will never deride Common Lisp
for the time coming.
By the way anyone care to comment whether such tricks are doable by
means of Scheme its srfi-1 library (I added comp.lang.scheme to the
header).
Sir Francis Drake
2.Antonym for optimize, sound-bite for de-optimize?
I can look up definitions for optimize and find things like:
1. make optimal; get the most out of; use best; "optimize your resources"
2. modify to achieve maximum efficiency in storage capacity or time or
cost; "optimize a computer program"
But there appear to be no real antonym for optimize. In the past it
appears there was no need for a word for the opposite of optimize but
today we have many champions of de-optimimization who have no word
in common use as an antonym for optimize. The best I could find
were:
blot, blotch, blur,
cheapen, contaminate, corrupt, corrode,
damage, debase, deface, denature, deteriorate, devalue, diminish,
expunge,
harm, hurt,
impair, intermix,
maim, make impure, mangle, mar,
pervert, phony up, pollute,
rot, ruin,
spoil, sully,
taint, tarnish, thin, twist,
warp, water, water down, weaken,
vitiate
I suppose some people will define optimize as
achieving maximum efficiency in maximizing costs
(of products) to maximize profit. I often hear that
maximizing for efficient use of human time, computer
time, computer memory, and human understanding are
simply counterproductive to maximizing efficiency
for profit. From that perspective the above list
of optimization antonyms can be seen as just other
forms of optimization, just optimization in a different
dimmension of the problem space.
What is an effective sound-bite to describe the need
for de-optimization?
Best Wishes
Dogbirt Forth:
"In pursuit of our mission to" mission-statement
"In such a way as to maximize" random-platitude
"and achieve" random-platitude
"The beautiful thing about" mission-statement
"is that it allows us to achive" random-platitude
Insert these phrases recursively along with the rest
of the Chroning phrases to any statement that expresses
meaning too efficiently or succinctly. The platitudes
to which we pay homage in the computer industry are code
reuse, portability, interopability, expandability, compatibility,
maintainability, standardization, forward looking, security, etc.
We just have to remember that people really refer to exactly the
opposite thing when they use those terms. Optimize marketing?
3.tinyclos brevity?
"damien.guichardwanadoo.fr" < XXXX@XXXXX.COM > writes:
<snip>
> (lambda (msg . arg-list)
> (define getter (eval msg (the-environment)))
> (if (procedure? getter)
> (apply getter arg-list)
> getter
> )
> )
> )
<snip>
Right, or another way to do it is with a "case" dispatch as per SICP
(though they use cond IIRC):
(lambda (msg . arg-list)
(case m
((val) val)
((inc) (inc (car arg-list)))))
etc etc.
Not as OOAO-y, but you don't have to expose all slots, and you can
provide special operations for some messages (which I use, I have a
has-a relationship that I just pass on the messages to).
4.Brevity vs. Lispicity
5.Why is qsort going into infinite recursion?
Qsort drops recurring elemtns int he below definition.
> (qsort '(12 3 34 12))
(3 12 34)
But when I try to fix it by doing:
(qsort (filter (lambda (x) (>= x middle)) xs))))))
it ends in infinite recursion. why?
(define (nth pos xs)
(if (< (length xs) pos)
'()
(if (> pos 0)
(nth (- pos 1) (cdr xs))
(car xs))))
(define (mid xs)
(nth (- (/ (length xs) 2) 1) xs))
(define (qsort xs)
(if (= (length xs) 0)
xs
(let ((middle (mid xs)))
(append
(qsort (filter (lambda (x) (< x middle)) xs))
(list middle)
(qsort (filter (lambda (x) (> x middle)) xs))))))
6. qsort needs one more argument
7. qsort
8. qsort wiht struct and pointers - GAL