>>7
There were no mentions of maintenance in this thread, what are you doing?
Name:
Anonymous2009-08-02 15:32
>>9
Scheduled maintenance to be performed tonight (7/29) and tomorrow (7/30). Total downtime should not exceed more than a few hours.2:12 PM Jul 29th from web http://twitter.com/4chan
__________________________________________ http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
There are two kinds of scientific progress: the methodical experimentation and categorization which gradually extend the boundaries of knowledge, and the revolutionary leap of genius which redefines and transcends those boundaries. Acknowledging our debt to the former, we yearn, nonetheless, for the latter.
Name:
Anonymous2009-08-02 20:43
I was so happy to see /prog/ back that I wrote a fibs. I hope you like it :).
module Fibs where
import Data.Function
import Control.Arrow
I have been thinking of learning javascript actually, I know a little but getting a firm grip of it could really help my web dev skills!
Name:
Anonymous2009-08-02 22:02
Here's my go at some fibs in CL:
Start off with the most basic version:
(defun fibs (n)
(case n
(0 0)
(1 1)
(2 1)
(t (+ (fibs (- n 2)) (fibs (- n 1))))))
(fibs 35);=>9227465
(time (fibs 35))
;Evaluation took:
; 0.328 seconds of real time
; 0.328125 seconds of total run time (0.328125 user, 0.000000 system)
; 100.00% CPU
; 785,917,755 processor cycles
; 4,096 bytes consed
Works, but it's inefficient as hell since previous needed values get evaluated repeatedly.
Let's try some memoization:
;;; PG's memoize function. It's very simple, has some shortfalls, but enough for this example.
(defun memoize (fn)
(let ((cache (make-hash-table :test #'equal)))
#'(lambda (&rest args)
(multiple-value-bind (val win) (gethash args cache)
(if win
val
(setf (gethash args cache)
(apply fn args)))))))
;;; With this line I redefine fibs into a memoizing function, as the symbol name isn't changed, it can also call its own memoized version.
(setf (symbol-function 'fibs) (memoize #'fibs))
;;; Let's see how it performs for a large value of n, value that would take unrealistic amounts of time to compute otherwise:
(time (fibs 300))
;Evaluation took:
; 0.000 seconds of real time
; 0.000000 seconds of total run time (0.000000 user, 0.000000 system)
; 100.00% CPU
; 549,234 processor cycles
; 28,480 bytes consed
(fibs 300) ; => 222232244629420445529739893461909967206666939096499764990979600
Not as fancy as Haskell's lazy lists, but being able to turn pure functions into memoizing functions with one command sure is awesome.
Name:
Anonymous2010-12-17 1:37
Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?
If you answered "Yes" to all of the above questions, then GNAA(GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!