Note that you could use mapv, to perform the map but return a vector
(filterv was also added at the same time).


On 16 April 2014 11:46, Kris Calabio <kriscala...@gmail.com> wrote:

> I'm not exactly sure, but I think it's the use of 'conj'. My entities get
> out of order if they are not vectors.
>
> All this might not matter though, because I've started rewriting my game
> from scratch since I'm using way too many mutable atoms than is necessary.
> James' screencast cleared a lot of things up for me, and I have a better
> understanding about how play-clj works.
>
> But just to clarify, when exactly does play-clj convert the entities back
> into a vector? Is it when the callback functions of the screen return?
>
>
>  On Tue, Apr 15, 2014 at 4:37 PM, Zach Oakes <zsoa...@gmail.com> wrote:
>
>>  I see. If your code requires a vector, I think you will have to coerce
>> the list each time as you are doing. Out of curiosity, what are you doing
>> that makes this necessary? Are you using something like get-in?
>>
>>
>> On Tuesday, April 15, 2014 7:11:56 PM UTC-4, Kris Calabio wrote:
>>
>>> In one of the callback functions in the defscreen I have a pipeline of
>>> functions that do something to the entities vector and return the resulting
>>> entities. I do something like this:
>>>
>>> (->> entities
>>>   (process-entities01)
>>>   (process-entities02)
>>>   (map (fn [entity]
>>>           (->> entity
>>>              (process-entity01)
>>>              (process-entity02)))
>>>   (process-entities03))
>>>
>>> And that does not work, because each of the 'process-entities' functions
>>> are written in a way that expect a vector as input. Likewise, they each
>>> output a LazySeq unless I convert them back to a vector before returning.
>>> But I can't do that for the map function in the pipeline. But this does
>>> work:
>>>
>>> (->> entities
>>>   (process-entities01)
>>>   vec
>>>   (process-entities02)
>>>    vec
>>>   (map (fn [entity]
>>>           (->> entity
>>>              (process-entity01)
>>>              (process-entity02)))
>>>   vec
>>>   (process-entities03)
>>>   vec)
>>>
>>>
>>>
>>>
>>> On Tue, Apr 15, 2014 at 3:34 PM, Zach Oakes <zso...@gmail.com> wrote:
>>>
>>>> Kris, the entities are automatically converted back into a vector by
>>>> play-clj after being returned by a given function. Can you elaborate on
>>>> what problem you believe is occurring when you don't change it back to a
>>>> vector?
>>>>
>>>>
>>>> On Tuesday, April 15, 2014 5:26:07 PM UTC-4, Kris Calabio wrote:
>>>>
>>>>> James, I have a question. I see this pattern a lot in the sample code
>>>>> and in your code as well, for example:
>>>>>
>>>>>
>>>>>
>>>>> (defn- move-player [entities]
>>>>>   (->> entities
>>>>>
>>>>>        (map (fn [entity]
>>>>>               (->> entity
>>>>>
>>>>>                    (update-player-position)
>>>>>                    (update-hit-box))))
>>>>>
>>>>>
>>>>>
>>>>>        (remove-touched-apples)))
>>>>>
>>>>>
>>>>> When the entities vector gets threaded through the map function, it
>>>>> comes out as a LazySeq. But don't we want to keep the entities as a 
>>>>> vector?
>>>>> This seems to be causing problems in my own code, and the only way to keep
>>>>> it working is to change it back to a vector every time I do this, which
>>>>> seems inelegant. Just wondering if I'm missing something.
>>>>> -Kris
>>>>>
>>>>>
>>>>> On Sun, Apr 13, 2014 at 3:13 PM, James Trunk <james...@gmail.com>wrote:
>>>>>
>>>>>> There's a link to a gist of 
>>>>>> core.clj<https://gist.github.com/Misophistful/9892203>in the video's 
>>>>>> description.
>>>>>>
>>>>>> Cheers,
>>>>>> James
>>>>>>
>>>>>>
>>>>>> On Monday, April 14, 2014 12:08:16 AM UTC+2, Kris Calabio wrote:
>>>>>>
>>>>>>> Actually, I thought it would be even more helpful if you had the
>>>>>>> source code available (for searching/skimming). Is that somewhere 
>>>>>>> online?
>>>>>>> -Kris
>>>>>>>
>>>>>>>
>>>>>>>  On Sun, Apr 13, 2014 at 2:47 PM, James Trunk <james...@gmail.com>wrote:
>>>>>>>
>>>>>>>>  Hi Kris,
>>>>>>>>
>>>>>>>> Thanks for your comment, and I'm very glad that you found the video
>>>>>>>> helpful.
>>>>>>>>
>>>>>>>> I started doing screencasts because I realised that I learn a new
>>>>>>>> concept fastest by watching someone else doing/explaining it - and I
>>>>>>>> figured I might not be the only one. Saying that, I know screencasts 
>>>>>>>> aren't
>>>>>>>> for everyone, and they have a few drawbacks compared to text (harder to
>>>>>>>> search, skim, or repeat sections). So positive comment like yours 
>>>>>>>> remind me
>>>>>>>> that I'm not the only auditory/visual learner around here, and inspire 
>>>>>>>> me
>>>>>>>> to keep going. Thanks!
>>>>>>>>
>>>>>>>> James
>>>>>>>>
>>>>>>>>
>>>>>>>> On Saturday, April 12, 2014 11:28:29 PM UTC+2, Kris Calabio wrote:
>>>>>>>>>
>>>>>>>>> Great video! I've looked through Zach's examples, and even started
>>>>>>>>> coding a game myself. But your screencast helped me have a better
>>>>>>>>> understanding of some of the concepts and code that I was having 
>>>>>>>>> trouble
>>>>>>>>> understanding just by looking at the example games. Thanks!
>>>>>>>>> -Kris
>>>>>>>>>
>>>>>>>>> On Thursday, March 27, 2014 10:07:21 AM UTC-7, James Trunk wrote:
>>>>>>>>>>
>>>>>>>>>> Hi everyone,
>>>>>>>>>>
>>>>>>>>>> I thought some of you might be interested to watch my screencast
>>>>>>>>>> about game development in Clojure with 
>>>>>>>>>> play-clj<https://www.youtube.com/watch?v=9ilUe7Re-RA>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> James
>>>>>>>>>>
>>>>>>>>>  --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Clojure" group.
>>>>>>>> To post to this group, send email to clo...@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+u...@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 a topic in
>>>>>>>> the Google Groups "Clojure" group.
>>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>>>>>>> topic/clojure/mR1IBJ_OomY/unsubscribe.
>>>>>>>>  To unsubscribe from this group and all its topics, send an email
>>>>>>>> to clojure+u...@googlegroups.com.
>>>>>>>>
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Clojure" group.
>>>>>> To post to this group, send email to clo...@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+u...@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 a topic in
>>>>>> the Google Groups "Clojure" group.
>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>>> pic/clojure/mR1IBJ_OomY/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> clojure+u...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clo...@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+u...@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 a topic in the
>>>> Google Groups "Clojure" group.
>>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>>> topic/clojure/mR1IBJ_OomY/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> clojure+u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>> 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 a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/mR1IBJ_OomY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to