Fork me on GitHub
#hoplon
<
2016-06-10
>
micha16:06:13

@thedavidmeister: hoplon webdriver tests are looking great

jumblerg16:06:22

@micha: thanks for the push!

dot_treo16:06:00

Hi there, I'm looking into building a toy application to learn about the full hoplon stack (i.e. client- and serverside). I see that there is some documentation to get started with the client side, but the page on castra just says "Hello World". Should I be able to find myself around with just the castra readme, or is there anything else what I should read first?

micha16:06:01

@dot_treo: documentation is sparse at the moment, the README here is probably okay to get started: https://github.com/hoplon/castra

alandipert16:06:44

@dot_treo: there's also a hoplon-Castra template that demos minimal app with server side

micha16:06:35

castra doesn't try to do much at all, so this diagram is maybe a good way to see what it's trying to do: https://github.com/hoplon/castra/raw/master/img/arch-full.png

dot_treo16:06:03

I'm not sure the diagram does much good without any additional commentary

micha16:06:36

the readme provides some explanation

micha16:06:41

along with the diagram

dot_treo16:06:53

Ok 🙂

micha16:06:05

i have to run, but i'll be around later if you have questions

micha16:06:22

well anyway everyone here is friendly so ask away 🙂

dot_treo16:06:50

will do, if I get stuck 🙂

mhr19:06:58

I want to map li to a cell with a vector. I get an error "is not ISeqable" if I do it this way (map li (cell= (state :past))) but it works if I do it this way (cell= (map li (state :past))). state is a cell defined as a dictionary with :past, :present, and :future. Why doesn't the former method work? (state :past) is a cell and cells aren't sequences, but what if that cell contains a sequence? I'm trying to make undo and redo.

mhr20:06:46

also, how could I make this more efficient? instead of re-rendering all the list items each time an item is added or removed from the vector?

alandipert21:06:23

@mhr: (ul (for-tpl [x (cell= (state :past))] (li x))) perhaps?

mhr22:06:49

alandipert: the for-tpl macro takes care of the re-rendering problem?

mhr22:06:56

it still seems to slow down when I call my undo function. I think it probably has more to do with how I wrote undo than the rendering. this is my undo function:

(defn undo! []
  (when (> (count (@state :past)) 0)
    ; move present to front of future
    (reset! state (assoc @state :future (vec (cons (@state :present) (@state :future)))))
    ; set present to final past item
    (reset! state (assoc @state :present (peek (@state :past))))
    ; remove final past item
    (reset! state (assoc @state :past (pop (@state :past))))))

mhr22:06:50

is resetting state an expensive operation?

mhr22:06:49

this is state's definition:

(def state (cell {:past [] :present 0 :future []}))

alandipert22:06:33

Can you post the whole page? I can take a look

alandipert22:06:39

Nothing sticks out as slow

mhr22:06:44

I've found that if I focus on any of the buttons and press enter so it continuously presses them, then it gets bogged down. if I press inc continuously, for instance, and present is incremented past 100, it gets slower. if I try to undo or redo continuously on a past or future of over 100 items, it also is slow. but on a past or future of about twenty items, it's still quick.

mhr23:06:20

oops, line 55 should have :future, not :past, I made a copy-paste error from your earlier suggestion