Fork me on GitHub
#clojurescript
<
2015-08-15
>
rohit11:08:19

@jonas, this project wraps Material UI components to be used with reagent. https://github.com/tuhlmann/reagent-material

benzen11:08:44

do you see an error in the destructuring bing of this function ? (defn handle-opinion [app-state [:log-opinion {:type "opinion" :name name :parent parent :opinion op} :as opinion]] (update-in [:log] conj opinion))

benzen11:08:12

do you see an error in the destructuring bing of this function ?

`
(defn handle-opinion
 [app-state [:log-opinion {:type "opinion" :name name :parent parent :opinion op} :as opinion]]
  (update-in [:log] conj opinion))
`

benzen11:08:47

compiler says that parent and op var are used but never defined

benzen11:08:19

i assume I'm missing using destructuring binding, but i don't know what must be changed

dialelo11:08:39

@benzap: the :as opinion should be inside the map destructuring form and vars to be bound come before keys, {type :type name :name parent :parent op :opinion :as opinion} is what you want

dialelo12:08:09

note that binding type shadows the core type function but is not problematic in this example

benzen12:08:47

can i also enforce that the value associated with the :type key is "opinion"?

benzen12:08:24

oh no, uspported binding form

dialelo12:08:45

not with destructuring AFAIK, you should check it before passing in to handle-opinion or in its body

dialelo12:08:04

if you want to match values you can use core.match library

benzen12:08:14

another on in the same spirit

benzen12:08:06

why can't i use this [app-state [:update-login {login-value login-key}]] in a destrcuturating bing?

dialelo12:08:14

what is login-key in the example?

dialelo12:08:22

a var holding a keyword like this? (def login-key :some-key)

dialelo12:08:28

that should work in destructuring

benzen12:08:15

not quite sure to get what you say. what i want to pass as aregument to this func is something linke this

`
(my-func [:update-login {:username username}])
` or
(my-func [:update-login {:password password}])

benzen12:08:34

that's why i want to get the key and the value of this map

benzen12:08:45

is this kind of binding legal?

dialelo12:08:10

with (defn my-func [[_ {password :password}]] ...) you could extract the password value

dialelo12:08:49

to know all the options available

benzen12:08:05

thanks for the link

dialelo12:08:33

you're welcome, let me know if something is not clear in the book so we can fix it

benzen12:08:30

ok, so, destructuring has use fixed keys. Because if i where to pass a map with two key-value then there is no way to find what is expected the be binded

benzen12:08:30

surely there is a way with pattern matttching

meow14:08:52

Has anyone tried out @bhauman 's Devcards? It's got a lot going for it. I am really impressed.

tbrooke14:08:19

I am starting with reagent / re-frame - I assume s3 is the place to deploy - any workflow suggestions?

escherize14:08:45

I have a workflow here, I'd like to get some feedback around it though, @tbrooke.

escherize14:08:41

I was putting the completed artifacts using s3cmd sync, and now I use rsync to put it on a server. I'll post the script:

escherize14:08:36

#! bin/bash
cd ~/path/to/project
lein clean &&
lein minify-assets &&
lein with-profile prod cljsbuild once &&
rsync -avz -e "ssh" --progress ./resources/public/* me@my_server:/path/on/server

escherize14:08:06

I suspect it's a pretty naive approach, but it's worked for me so far.

meow14:08:33

@bhauman: I do think it would be a good idea to add "A knob to reset the state, a knob to turn on history, a knob to display the data in the atom."

escherize14:08:55

I have used Devcards, but not lately.

bhauman14:08:59

@meow: on the card ui itself right?

escherize14:08:06

I usually just mount whatever component I'm interested in checking out, and use figwheel for any experimentation

bhauman14:08:43

@escherize: the new devcards is way different than the old one. Setup is especially easy.

bhauman14:08:11

@escherize: testing is integrated into cljs.test

escherize14:08:27

Nice! I'll give 'er a new shot then!

escherize14:08:40

I was looking for something to do (it's saturday night here, hah)

meow14:08:44

I think it would be great to have more widgets on the header

bhauman14:08:10

Yeah I'm a gonna do it simple_smile

meow14:08:21

@escherize: I've only been using them recently but I'm really sold. I see so much potential for these things. Bruce has really created a solid platform.

meow14:08:24

@bhauman: Not to lay it on too thick, but you really have created something quite terrific with Devcards. I can see so much thought that has been put into it. You've really captured the essence of what this kind of tool needs to be, imo.

meow14:08:47

The one direction I'd like to go with it is to have support for canvas elements.

bhauman14:08:05

@meow: thanks, I spent 3 weeks worrying over the api.

meow14:08:51

I know this might not be a typical use-case, but canvas/webgl support would open up some really interesting possibilities.

escherize14:08:18

in fact there was a recent tweet about cljs+webgl

bhauman14:08:21

@meow: I really here you here. The dom-node is the base for things like that. At minimul you crate a function that invokes dom-node

meow14:08:45

The more I work with the api the more I find myself thinking "Yes!" that's how that choice should have been made.

bhauman14:08:53

@meow: at max you create a ReactClass

bhauman14:08:09

@meow: It's really great to hear you say this. Thank you very much

meow14:08:42

You're welcome. It really deserves to be praised. I mean, heck. You've got support for simple or complex cards, markdown, react, om, reagent, regular dom nodes. It looks great out of the box. The live reloading is snappy. It is so easy to have a directory of cards and an index of all the cards.

meow14:08:42

The card api is simple, but supports all kinds of use-cases. The api itself almost gently teaches proper functional setup for working with stateful objects.

meow14:08:12

I need to head out for a bit but would love to ask you about canvas support via dom-node. When I tried it out it didn't really work for me but I was also trying to make it work with my own request-animation-frame looping so it wasn't really a good trial.

bhauman14:08:48

@meow: yeah would love to chat. Hit me up.

tbrooke15:08:02

@escherize: thank s I'll give it a try

arohner18:08:49

arg. I just started seeing this in CI: WARNING: It appears your project does not contain a ClojureScript dependency. One will be provided for you by lein-cljsbuild, but it is strongly recommended that you add your own.

arohner18:08:07

I clearly have org.clojure/clojurescript 1.7.48 in my deps, and it works locally

arohner18:08:11

any ideas where to look?

meow18:08:20

@bhauman: ok, I have a very basic canvas example working inside a devcard, now I've got questions for you when you have a few minutes.

bhauman18:08:45

@meow: I'm available simple_smile

meow18:08:33

first question is more an organization one - I assume I need to create an index file like I have done here: https://github.com/decomplect/ive/blob/master/src/ive/index.cljs

meow18:08:04

There is no way to have devcards magically introspect a directory

arohner18:08:21

hrm, my issue appears to be caused by lein 2.5.2