Skip to content

Instantly share code, notes, and snippets.

@rxacevedo
Created June 3, 2014 15:58
Show Gist options
  • Save rxacevedo/50af95e327567b43f7ef to your computer and use it in GitHub Desktop.
Save rxacevedo/50af95e327567b43f7ef to your computer and use it in GitHub Desktop.
Reify example
(let [is-dir (memfn isDirectory)
ff (reify java.io.FileFilter
(accept [this f]
(is-dir f)))]
(pprint
(seq
(.listFiles (java.io.File. "C:/") ff))))
;; (#<File C:\$Recycle.Bin>
;; #<File C:\apache-ant-1.7.1>
;; #<File C:\Applications>
;; #<File C:\appserver>
;; #<File C:\bin>
;; #<File C:\CC604>
;; #<File C:\cygdrive>
;; #<File C:\cygwin>
;; #<File C:\dell>
;; #<File C:\Documents and Settings>
;; #<File C:\dynatrace>
;; #<File C:\emacs-24.3>
;; #<File C:\Intel>
;; #<File C:\java>
;; #<File C:\jruby-1.7.2>
;; #<File C:\log>
;; #<File C:\MSOCache>
;; #<File C:\ORACLE>
;; #<File C:\P3>
;; #<File C:\PerfLogs>
;; #<File C:\Program Files>
;; #<File C:\ProgramData>
;; #<File C:\properties>
;; #<File C:\Recovery>
;; #<File C:\ruby-dev>
;; #<File C:\Ruby193>
;; #<File C:\sbx>
;; #<File C:\shared>
;; #<File C:\System Volume Information>
;; #<File C:\tmp>
;; #<File C:\Users>
;; #<File C:\Windows>)
;; => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment