<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>60576</integer>
    </number>
    <user>
      <string>asdf</string>
    </user>
    <title>
      <string>asdf</string>
    </title>
    <contents>
      <string>;; packages.lisp

(defpackage #:quicksort 
  (:use #:common-lisp #:iterate)
  (:export #:qsort))

(defpackage #:graphics
  (:use #:common-lisp #:iterate))

(defpackage #:netflix-data-loader
  (:use #:common-lisp #:split-sequence #:netflix-packed-data)
  (:export #:create-map-file #:map-file #:unmap-file))

(defpackage #:netflix-packed-data
  (:use #:common-lisp #:split-sequence)
  (:export #:*byte-specs* #:pack-date #:parse-and-pack-date #:user-id 
	   #:movie-id #:date #:stars #:year #:month #:day #:unpack-date 
	   #:unpack-rating))

(defpackage #:netflix
  (:use #:common-lisp #:netflix-data-loader #:netflix-packed-data 
	#:quicksort #:iterate))

(defpackage #:genres
  (:use #:common-lisp #:split-sequence #:iterate))
</string>
    </contents>
    <universal-time>
      <integer>3419481441</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string>Common Lisp</string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <keyword>TRUE</keyword>
    </is-unicode>
  </paste>
  <annotation>
    <number>
      <integer>2</integer>
    </number>
    <user>
      <string>asdf</string>
    </user>
    <title>
      <string>asdf</string>
    </title>
    <contents>
      <string>(in-package :netflix-packed-data)
	
(defvar *byte-specs* '(:user-id  (22 00)
		       :movie-id (15 22)
		       :stars    (03 37)
		       :date     (12 40)))

(defmacro user-id  (rating ) `(ldb (byte ,@(getf *byte-specs* :user-id))  ,rating))
(defmacro movie-id (rating)  `(ldb (byte ,@(getf *byte-specs* :movie-id)) ,rating))
(defmacro stars    (rating)  `(ldb (byte ,@(getf *byte-specs* :stars)) ,rating))
(defmacro date     (rating)  `(ldb (byte ,@(getf *byte-specs* :date)) ,rating)) 

(defmacro year  (date) `(ldb (byte 3 9) ,date))
(defmacro month (date) `(ldb (byte 4 5) ,date))
(defmacro day   (date) `(ldb (byte 5 0) ,date))

(defun unpack-date (date)
  (list (day date) (month date) (+ 1999 (year date))))

(defun unpack-rating (rating)
  (list :user-id (user-id rating)
	:movie-id (movie-id rating)
	:stars (stars rating)
	:date (unpack-date (date rating))))


(defun pack-date (year month day)
  (declare (fixnum year month day)
           (optimize (speed 3) (debug 0) (safety 0)))
  (let ((date 0))
    (declare (fixnum date))
    (setf (ldb (byte 5 0) date) day)
    (setf (ldb (byte 4 5) date) month)
    (setf (ldb (byte 3 9) date) (- year 1999))   
    date))

(defun parse-and-pack-date (string &amp;key start)
  (declare (optimize (speed 1)))
  (destructuring-bind (year month day)
      (mapcar #'parse-integer (split-sequence:split-sequence #\- string :start start))
    (pack-date year month day)))

</string>
    </contents>
    <universal-time>
      <integer>3419482226</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <keyword>TRUE</keyword>
    </is-unicode>
  </annotation>
  <annotation>
    <number>
      <integer>1</integer>
    </number>
    <user>
      <string>asdf</string>
    </user>
    <title>
      <string>asdf</string>
    </title>
    <contents>
      <string>(asdf:defsystem #:netflix 
  :depends-on (#:cl-ppcre #:iterate #:split-sequence #:cl-plplot)
  :components ((:file &quot;packages&quot;)
	       (:file &quot;netflix-packed-data&quot;
		      :depends-on (&quot;packages&quot;))
  	       (:file &quot;netflix-data-loader&quot;
		      :depends-on (&quot;packages&quot; &quot;netflix-packed-data&quot;))
	       (:file &quot;quicksort&quot;		  
		      :depends-on (&quot;packages&quot;))
	       (:file &quot;netflix&quot;
		      :depends-on (&quot;packages&quot; &quot;netflix-packed-data&quot; 
				   &quot;netflix-data-loader&quot; &quot;quicksort&quot;))
	       (:file &quot;genres&quot;
		      :depends-on (&quot;packages&quot;))
	       (:file &quot;graphics&quot;
		      :depends-on (&quot;packages&quot;))))</string>
    </contents>
    <universal-time>
      <integer>3419481478</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <keyword>TRUE</keyword>
    </is-unicode>
  </annotation>
</paste-with-annotations>