Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Find-duplicate-files/PicoLisp/find-duplicate-files.l
Normal file
34
Task/Find-duplicate-files/PicoLisp/find-duplicate-files.l
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
`(== 64 64)
|
||||
(de mmap (L F)
|
||||
(native "@" "mmap" 'N 0 L 1 2 F 0) )
|
||||
(de munmap (A L)
|
||||
(native "@" "munmap" 'N A L) )
|
||||
(de xxh64 (M S)
|
||||
(let
|
||||
(R (native "libxxhash.so" "XXH64" 'N M S 0)
|
||||
P `(** 2 64) )
|
||||
(if (lt0 R)
|
||||
(& (+ R P) (dec P))
|
||||
R ) ) )
|
||||
(de walk (Dir)
|
||||
(recur (Dir)
|
||||
(for F (dir Dir)
|
||||
(let (Path (pack Dir "/" F) Info (info Path T))
|
||||
(when (car Info)
|
||||
(if (=T (car Info))
|
||||
(recurse Path)
|
||||
(if (lup D (car Info))
|
||||
(push (cdr @) Path)
|
||||
(idx 'D (list (car Info) (cons Path)) T) ) ) ) ) ) ) )
|
||||
(off D)
|
||||
(walk "/bin")
|
||||
(for Lst (filter cdadr (idx 'D))
|
||||
(let L
|
||||
(by
|
||||
'((F)
|
||||
(let (M (mmap (car Lst) (open F T))
|
||||
S (car Lst) )
|
||||
(prog1 (xxh64 M S) (munmap M S)) ) )
|
||||
group
|
||||
(cadr Lst) )
|
||||
(and (filter cdr L) (println (car Lst) @)) ) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue