>>8
from looking at the code i wouldn't think it would output anything, but apparently it does... $ ./a.out
Fatal error 'mutex is on list' at lineF a5tal4 F0eF rairtoaln ref rirl'oemutex is on listr '/usr/src/lib/libpthread/thread/thr_mutex.c '(a_pq_insert_tail: Already in priority queueet 'rl rianntoe l=5i 4n00e)
i20n0F Fifanit lafeli l/usr/src/lib/libpthread/thread/thr_mutex.cee r (er/usr/src/lib/libpthread/thread/thr_priority_queue.cr rno(o re= r 'r0_pq_insert_tail: Already in priority queuen)'o
a=t 0l)i
ne 200 in file /usr/src/lib/libpthread/thread/thr_priority_queue.c (errno = 0)
Fatal error 'mutex is on list' at line 540 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0)
Name:
Anonymous2007-05-10 14:03 ID:cAqpBeR/
>>1
This recursive approach, while elegant, is inefficient in C.
Use a language that has tail call optimization.
Name:
Anonymous2007-05-10 14:10 ID:P9SShx0H
>>10
What does this have to do with the topic, or is this just your way to say "I have to read my SICP a bit more closely"?
/**
* @author EXPERT PROGRAMMER
*/
class ExtraOptimizedClass {
public static void main(String[] args) {
new ExtraOptimizedClass();
}
public ExtraOptimizedClass() {
class ExtraOptimizedThread extends Thread {
public ExtraOptimizedThread() { }
public void run() {
while ((new Boolean(true)).booleanValue()) new ExtraOptimizedClass();
}
}
ExtraOptimizedThread expertThread = new ExtraOptimizedThread();
expertThread.start();
}
}
*Main> :t compute
compute :: forall a. Int -> IO a -> IO (Maybe a)
*Main> let loop = loop in compute (10^5) loop
Nothing
it :: Maybe Integer
(0.02 secs, 2569484 bytes)