Hi,

In the quoted example the `recur` call is *inside* the `when` which is a 
huge difference because there is in this case an halting condition to get 
out of the loop ;)

regards
Laurent
Le dimanche 26 décembre 2021 à 14:41:15 UTC+1, hank....@gmail.com a écrit :

> 2021-12-25, 21:11:46 UTC-3, LaurentJ wrote:
> "Hi,
>
> Your loop/recur usage is wrong, your error may be because your loop has no 
> halting condition."
>
> Hi Laurent --
> I actually took inspiration from one of the sources you posted:
> (import '(javax.sound.sampled AudioSystem AudioFormat$Encoding))
>
> (let [mp3-file (java.io.File. "tryout.mp3")
>       audio-in (AudioSystem/getAudioInputStream mp3-file)
>       audio-decoded-in (AudioSystem/getAudioInputStream 
> AudioFormat$Encoding/PCM_SIGNED audio-in)
>       buffer (make-array Byte/TYPE 1024)]
>   (loop []
>     (let [size (.read audio-decoded-in buffer)]
>       (when (> size 0)
>         ;do something with PCM data
>         (recur)))))
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/93ed9e36-bd43-4592-b5c3-89187304d75cn%40googlegroups.com.

Reply via email to