Live data from Hacker News

ClojureScript 101

swannodette.github.io

31–40 of 45 posts

Re: ClojureScript 101

#31

Thank you for such a straightforward train I thought/workflow post. Would love to see something detailing how to deal with state in clojurescript. Use atoms? Pass the world in and return it modified? Dispatch within go funcs using symbols at the head of lists?

A nice suggestion, will think about it.

Re: ClojureScript 101

#32

Is there a maintained web page or cheat sheet somewhere that lists the functions and macros unique to ClojureScript? The API Overview[1] page for Clojure itself is great, and many of those facilities are 1-to-1 in cljs. For individual libs, like core.async, it's easy enough to go look in the cljs namespaces (i.e. the source code) to see what's available. But it seems there are at least several important facilities un…

For example: I'm aware of 'js*', but where is it defined? Where is it documented? Does it have any "gotchas" that are explained somewhere?

js* should not be used - it's an implementation detail. I agree we could do a better job documenting what's unique to ClojureScript over Clojure.

Re: ClojureScript 101

#33
Perfect intro to core.async in a web app - just enough of an example (jsonp within a click handler would require a nested callback).

It would be nice to update the tutorial with a final instruction on compiling with advanced mode so people can see that the end result is a reasonable sized js file.

Re: ClojureScript 101

#34

If there's something in the tutorial that trips anyone up or doesn't make sense please let me know and I will amend. I'm pretty excited about the latest release of ClojureScript that makes all this possible. With respect to speed of incremental compiles, code size, performance of generated code, and debugging we're finally in a good place (with of course many improvements planned in the near future). None of this wou…

Being totally new to Sublime I was actually got confused on configuring paredit and lispindent with Sublime 2.

    get sublime2 http://www.sublimetext.com/2
    package control https://sublime.wbond.net/installation#st2


	launch "sublime 2"
	ctrl-`
	paste in the package control script (from above link) 
	re-launch "sublime 2"

	⌘-shift-p # dialog comes up
	install ↓ 
	# up will pop a dialog after reading the package database
	paredit 
	⌘-shift-p
	install ↓ 
	lispindent 
The extra level of detail would cloudy the main flow of the tutorial so maybe have some supporting material links for the slower kids?

Re: ClojureScript 101

#35
post #5

It looks great, thanks! Here's another one I just saw: https://github.com/magomimmo/modern-cljs/blob/master/doc/tut... I got started with CLJS about a year ago but ran into performance issues with the specific application I was building, hopefully things have improved now.

ClojureScript has had performance escape hatches for some time. It's pretty much always possible to get the performance of hand written JS, important otherwise our data structures would be lame. We'll likely document these techniques in the future.

[deleted]

Re: ClojureScript 101

#36

Thank you for such a straightforward train I thought/workflow post. Would love to see something detailing how to deal with state in clojurescript. Use atoms? Pass the world in and return it modified? Dispatch within go funcs using symbols at the head of lists?

Jim Duey's protocol-monads[1] library is compatible with ClojureScript, and the State monad[2] can be a great for mechanism for "passing around the world". It's not always the best choice, but it's a good option to have in your toolbelt:

[1] https://github.com/jduey/protocol-monads

[2] https://github.com/jduey/protocol-monads/blob/master/src/clj...

Re: ClojureScript 101

#37

If there's something in the tutorial that trips anyone up or doesn't make sense please let me know and I will amend. I'm pretty excited about the latest release of ClojureScript that makes all this possible. With respect to speed of incremental compiles, code size, performance of generated code, and debugging we're finally in a good place (with of course many improvements planned in the near future). None of this wou…

If someone could provide a good pointer to better understand lisp syntax / Clojure I would appreciate it. Clojure is so confusing and hard to follow for the beginner!

Re: ClojureScript 101

#38
post #37

If there's something in the tutorial that trips anyone up or doesn't make sense please let me know and I will amend. I'm pretty excited about the latest release of ClojureScript that makes all this possible. With respect to speed of incremental compiles, code size, performance of generated code, and debugging we're finally in a good place (with of course many improvements planned in the near future). None of this wou…

If someone could provide a good pointer to better understand lisp syntax / Clojure I would appreciate it. Clojure is so confusing and hard to follow for the beginner!

The biggest difference is that functions go after the left-paren, not before. Commas are also unnecessary, they're just whitespace

    foo(bar, baz) => (foo bar baz)

    herp(bar, derp(baz)) => (herp bar (derp baz))
This might help as well: http://adambard.com/blog/clojure-in-15-minutes/

Re: ClojureScript 101

#39

If there's something in the tutorial that trips anyone up or doesn't make sense please let me know and I will amend. I'm pretty excited about the latest release of ClojureScript that makes all this possible. With respect to speed of incremental compiles, code size, performance of generated code, and debugging we're finally in a good place (with of course many improvements planned in the near future). None of this wou…

Suggestion: add a form around the input and button, and bind on its submit. That makes the application work when pressing [return] from the input field

(you'll have to include a (.preventDefault e) in the (listen) callback though)

Post reply on HN