Hi all,
I put up what I can remember of the March meeting on our website: http://www.lisptoronto.org/past-meetings/2010-03-meeting (I also put up Abram's notes from February.)
Here's that (tongue-in-cheek, but fairly informative) article I mentioned, "Git is MacGyver, Mercurial is James Bond": http://importantshock.wordpress.com/2008/08/07/git-vs-mercurial/
In fact, I've been thinking about MacGyver'ing Git a little.. I'd like a tool that can verify a Git repository, by which I mean go through all the objects in the repo and make sure they still match their SHA1 hashes. That way, if a cosmic ray somehow flips a bit on my hard drive, I can just restore the corrupted object from a backup. It seems like a simple thing, which is why I figure there must be some way to do this already with the tools Git supplies. I found 'git-verify-pack' but that doesn't seem to be quite what I want. Any ideas?
If I don't find anything it should be pretty simple to MacGyver a solution, since the filesystem layout of a Git repository makes it pretty easy to iterate through all the objects.
- vish
On Sat, Mar 06, 2010 at 07:14:00PM -0500 or thereabouts, Vishvajit Singh wrote:
In fact, I've been thinking about MacGyver'ing Git a little.. I'd like a tool that can verify a Git repository, by which I mean go through all the objects in the repo and make sure they still match their SHA1 hashes. That way, if a cosmic ray somehow flips a bit on my hard drive, I can just restore the corrupted object from a backup.
I think you want git fsck --full? If there are corrupted objects it will display something like this:
$ git fsck --full fatal: object 004c3f812a836736c0faf9c1763d9a9fdb8f7c9c is corrupted
Hope this helps,
Doug
On Sat, Mar 06, 2010 at 07:14:00PM -0500 or thereabouts, Vishvajit Singh wrote:
I put up what I can remember of the March meeting on our website: http://www.lisptoronto.org/past-meetings/2010-03-meeting (I also put up Abram's notes from February.)
- Abram: Common Lisp doesn't have a function to copy an array?
Copy-seq works on arrays because arrays are sequences. Note that there is a special copy-list function which does a deep copy of the list (as opposed to the shallow copy done by copy-seq). There are lots of different notions of copying, just like there are lots of different types of equality.
Thanks Doug! git fsck appears to do exactly what I wanted. All praise to Torvalds and Git.
Abram's particular problem, I believe, was in copying multidimensional arrays. He ended up writing his own function to copy his Tron game board.
This seems to be a known "hole" in the Common Lisp spec.. e.g. a library called cl-utilities provides a function called COPY-ARRAY:
http://common-lisp.net/project/cl-utilities/doc/copy-array.html
The library bills itself as "things that everybody writes since they're not part of the official standard".
- vish
On Tue, Mar 9, 2010 at 6:13 PM, doug@hcsw.org wrote:
On Sat, Mar 06, 2010 at 07:14:00PM -0500 or thereabouts, Vishvajit Singh wrote:
I put up what I can remember of the March meeting on our website: http://www.lisptoronto.org/past-meetings/2010-03-meeting (I also put up Abram's notes from February.)
- Abram: Common Lisp doesn't have a function to copy an array?
Copy-seq works on arrays because arrays are sequences. Note that there is a special copy-list function which does a deep copy of the list (as opposed to the shallow copy done by copy-seq). There are lots of different notions of copying, just like there are lots of different types of equality.
toronto-lisp mailing list toronto-lisp@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
BTW I'm really sorry I missed the last meeting, especially the Mark's javascript scheme compiler.
On Tue, Mar 09, 2010 at 08:11:26PM -0500 or thereabouts, Vishvajit Singh wrote:
Thanks Doug! git fsck appears to do exactly what I wanted. All praise to Torvalds and Git.
Ya git is the best version control system I've ever used. It really opens up new possibilities you don't think of when using other systems.
Abram's particular problem, I believe, was in copying multidimensional arrays. He ended up writing his own function to copy his Tron game board.
Oops my bad.. Arrays are of course not sequences (vectors are). Also copy-list isn't the recursive copying function, copy-tree is.
This seems to be a known "hole" in the Common Lisp spec.. e.g. a library called cl-utilities provides a function called COPY-ARRAY:
Nice.. looks like it could be useful at times.
Well if I use copy-seq I get this error from sbcl:
unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD "initial thread" RUNNING {10026F2EC1}>: The value #2A((## ## ## ##) (## #\1 #\ ##) (## ## #\ ##) (## #\ #\ ##) (## #\2 ## ##) (## ## ## ##)) is not of type SEQUENCE.
(defun copy-array (array) ; (copy-seq array)) (let ((dims (array-dimensions array))) (adjust-array (make-array dims :displaced-to array) dims)))
Where as this does not.
Here's the code: http://github.com/abramhindle/csc-club-ai http://github.com/abramhindle/csc-club-ai/blob/master/common_lisp/Map.lisp
abram
doug@hcsw.org wrote:
On Sat, Mar 06, 2010 at 07:14:00PM -0500 or thereabouts, Vishvajit Singh wrote:
I put up what I can remember of the March meeting on our website: http://www.lisptoronto.org/past-meetings/2010-03-meeting (I also put up Abram's notes from February.)
- Abram: Common Lisp doesn't have a function to copy an array?
Copy-seq works on arrays because arrays are sequences. Note that there is a special copy-list function which does a deep copy of the list (as opposed to the shallow copy done by copy-seq). There are lots of different notions of copying, just like there are lots of different types of equality.
toronto-lisp mailing list toronto-lisp@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
On Tue, Mar 09, 2010 at 10:12:32PM -0500 or thereabouts, Abram Hindle wrote:
Well if I use copy-seq I get this error from sbcl:
unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD "initial thread" RUNNING {10026F2EC1}>: The value #2A((## ## ## ##) (## #\1 #\ ##) (## ## #\ ##) (## #\ #\ ##) (## #\2 ## ##) (## ## ## ##)) is not of type SEQUENCE.
Ya like I said in my last message that was my mistake. I meant to say vectors are sequences so can be copied with copy-seq. Arrays are not sequences.
(defun copy-array (array) ; (copy-seq array)) (let ((dims (array-dimensions array))) (adjust-array (make-array dims :displaced-to array) dims)))
Where as this does not.
Nice one though it might be a good idea to propagate the element type too so stuff like this doesn't happen:
* (make-array '(2 2) :element-type '(unsigned-byte 8))
#2A((0 0) (0 0))
* (copy-array *)
Error in function MAKE-ARRAY: One can't displace an array of type T into another of type (UNSIGNED-BYTE 8). [Condition of type SIMPLE-ERROR]
I think this is a bit better (but probably still isn't complete because of not copying fill pointers and whatnot):
(defun copy-array (array) (let ((dims (array-dimensions array))) (adjust-array (make-array dims :displaced-to array :element-type (array-element-type array)) dims)))
I found a (supposedly) complete version.. it's really a terrifying thing to behold..
http://www.cliki.net/SHALLOW-COPY-ARRAY
Preserves fill-pointer, element-type, adjustable-p, and displacement..
-vish
On Wed, Mar 10, 2010 at 10:31 PM, doug@hcsw.org wrote:
On Tue, Mar 09, 2010 at 10:12:32PM -0500 or thereabouts, Abram Hindle wrote:
Well if I use copy-seq I get this error from sbcl:
unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD "initial thread" RUNNING {10026F2EC1}>: The value #2A((## ## ## ##) (## #\1 #\ ##) (## ## #\ ##) (## #\ #\ ##) (## #\2 ## ##) (## ## ## ##)) is not of type SEQUENCE.
Ya like I said in my last message that was my mistake. I meant to say vectors are sequences so can be copied with copy-seq. Arrays are not sequences.
(defun copy-array (array) ; (copy-seq array)) (let ((dims (array-dimensions array))) (adjust-array (make-array dims :displaced-to array) dims)))
Where as this does not.
Nice one though it might be a good idea to propagate the element type too so stuff like this doesn't happen:
- (make-array '(2 2) :element-type '(unsigned-byte 8))
#2A((0 0) (0 0))
- (copy-array *)
Error in function MAKE-ARRAY: One can't displace an array of type T into another of type (UNSIGNED-BYTE 8). [Condition of type SIMPLE-ERROR]
I think this is a bit better (but probably still isn't complete because of not copying fill pointers and whatnot):
(defun copy-array (array) (let ((dims (array-dimensions array))) (adjust-array (make-array dims :displaced-to array :element-type (array-element-type array)) dims)))
toronto-lisp mailing list toronto-lisp@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp