Am Freitag, 14. Juni 2013 08:40:51 UTC+2 schrieb Josh Kamau:
> Thanks Meikel. That works exactly as i wanted. Now, how can i put all the
> "names" in a vector ?
>
By switching from doseq to for:
(vec (for [entry repeatedly #(.getNextEntry stream) :while entry] (.getName
entry)))
or
(->> (rep
I figured it out... with a for loop.
THanks
Josh
On Fri, Jun 14, 2013 at 9:40 AM, Josh Kamau wrote:
> Thanks Meikel. That works exactly as i wanted. Now, how can i put all the
> "names" in a vector ?
>
>
> On Fri, Jun 14, 2013 at 9:19 AM, Meikel Brandmeyer (kotarak)
> wrote:
>
>> Hi,
>>
>> an
Thanks Meikel. That works exactly as i wanted. Now, how can i put all the
"names" in a vector ?
On Fri, Jun 14, 2013 at 9:19 AM, Meikel Brandmeyer (kotarak)
wrote:
> Hi,
>
> another way if it's not an enumeration or the like:
>
> (doseq [entry (repeatedly #(.getNextEntry stream)) :while entry]
Hi,
another way if it's not an enumeration or the like:
(doseq [entry (repeatedly #(.getNextEntry stream)) :while entry]
(println (.getName entry)))
Kind regards
Meikel
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, se
Thanks guys i have now have a bunch of solutions to try out ;)
Josh
On Thu, Jun 13, 2013 at 8:57 PM, Aaron Cohen wrote:
> I like the StackOverflow answer for this:
>
>
> http://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file
>
> (defn entries [zipfile]
>
I like the StackOverflow answer for this:
http://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file
(defn entries [zipfile]
(enumeration-seq (.entries zipfile)))
(defn walkzip [fileName]
(with-open [z (java.util.zip.ZipFile. fileName)]
(doseq [e (ent
Yeah, Clojure's while construct isn't really good at stuff like that. A
loop is the basic thing I reach for, and I'd probably write it as:
(loop []
(when-let [entry (.getNextEntry stream)]
(println entry)
(recur)))
On Thursday, June 13, 2013 10:20:22 AM UTC-7, Josh Kamau wrote:
>
> Hi
I would use loop/recur
something like this:
(loop [item (get-next-entry)]
(when item
(do
(do-something)
(recur (get-next-entry
On Thu, Jun 13, 2013 at 2:20 PM, Josh Kamau wrote:
> Hi there ;
>
> How do i implement the following in clojure
>
> while((entry
Hi there ;
How do i implement the following in clojure
while((entry = stream.getNextEntry())!=null) {
System.out.println(entry.getName());
}
NOTE: calling getNextEntry moves the curse to the next entry.
CONTEXT: I am trying to list the contents of a .zip file using
http://docs.