9,428 karma · joined Jul 10, 2015 (11y ago) · 3,276 submissions
comment 9y ago · link · parent
comment 9y ago · link · parent
Closure Advanced has many benefits so it's really nice to support it, especially if you're writing a whole site app of decent size all in one codebase.
comment 9y ago · link · parent
comment 9y ago · link · parent
I've read that it has both List and Array, yet neither appears to be ideal for proper functional programming; List, as you say, is a linked list, yet it is recommended [0] over Array for functional operations like map, fold, etc -- but you wouldn't normally want linked lists for that sort of thing, esp. if your maps and folds were part of a larger data transformation of composed functions. Does Elm offer anything similar to the structure of ClojureScript's persistent vector?
I have learned that FP without the guts of serious persistent structures is not so good in practice.
[0] https://stackoverflow.com/questions/37707577/array-vs-list-i...
comment 9y ago · link · parent
1) It is not compatible with advanced optimizations in Google Closure's compilation process.
2) I've been burned by less than ideal implementations of immutable data structures for functional programming in the past, particularly in Elm. I haven't done enough with Immutable-Re to know if it has similar issues, but all functional data structures are not created the same. I'm spoiled by ClojureScript's implementation which has never thrown a stack overflow error for me, unlike Elm. In Elm, if you have a list that gets too large, you have to manually break it up into different lists and do weird concatenation stuff that is quite clunky because somehow it's not doing structural sharing quite right to ensure these things are transparent under the hood. Experienced Elm users helped explain this to me, and it's not something I like to think about when writing in a functional style.
So I've been a bit hesitant to embrace just any functional programming language for serious enterprise work. But I'm very intrigued by Reason and Bucklescript and am keeping a very close eye on them. I probably won't do more than toy projects in them any time soon, but it would be great to someday.
comment 9y ago · link · parent
http://www.dutchnews.nl/news/archives/2017/06/electric-car-s...
comment 9y ago · link · parent
Interesting. When I toured several companies in Singapore, including Google, most of the staff were from Europe or the States. If Singaporeans are indeed doing well in their own schools, my guess is many are still leaving to work elsewhere. I frequently attended programming meetups where about 90% of the attendees were non-Singaporean.
But then, most of the Singaporeans I've known were quite happy to live and work in a Western country; I lived there briefly and was frequently asked by locals, "why would you want to live here, it's so small."
Regarding pollution, it was actually Singapore's air pollution that caused me to leave. I think I'm not alone with that sentiment.
comment 9y ago · link · parent
I too hate the iOS music app and any other app that attempts to improve the GUI nature of finding and exploring a music collection. I just want my tracks listed and easily jump between them. This app in this thread would seem to increase the amount of time I'd need to find a track; I don't care about all the fancy visuals, I just want to listen to music.
comment 9y ago · link · parent
With regards to tooling, the windows visual studio experience for C++ is widely counted as one of the best development setups in the industry for any language. I know lots of people working in other languages that envy what C++ developers get.
comment 9y ago · link · parent
If someone doesn't want to use it for this reason or that, it's their loss not ours. Those who need to find Clojure eventually will, because there is nothing else like it.
comment 9y ago · link · parent
You wouldn't want Clojure, Java or any languauge with GC running in a pacemaker either. Those are all also very important distinctions.
comment 9y ago · link · parent
If you instead want to compare or sort other values, Clojure offers other functions for that purpose where you can specify in great detail how things should be compared. If > could operate on strings, for example, what would be the expected result? The shorter the string, the "lesser" the value, or the string that starts with the "lower" letter, etc... it's quite ambiguous. You need more than < or > for that kind of comparison.
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
(defn foo [a b] :hi)
(defn bar [] (foo 1 2 3))
WARNING: Wrong number of args (3) passed to prepost.core/foo at line 25 src/cljs/prepost/core.cljs
WARNING: foo at line 24 is being replaced at line 48 src/cljs/prepost/core.cljs
It's a compile-time warning even when the app is not running, but ClojureScript goes through a different compilation step than JVM Clojure. Perhaps I was mistaken in the JVM case, or someone else can chime in.comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
Because these are not actual static types, you can get a lot of control and say things like "this function accepts three arguments, all integers between 5 and 50, but in increasing order, and the output must be a float between 0 and 1", and then have that checked on the function before the program ever runs. At run time, you can then verify that you are passing in valid arguments.
Spec is relatively new, and there are experiments in the community to do things more like traditional static type checking also. The future is an interesting place.
comment 9y ago · link · parent
or, put another way, the arguments must be in descending order
It's like instead of writing 1 + 2 + 3 + 4 in Clojure, you write:
(+ 1 2 3 4)
Less characters to type. Because operators are functions, which are always first in a list, normal binary operators like + can take many arguments.Another benefit of this is function application. If you have a vector/array of numbers and you want to add them all up, just apply them as arguments to +:
(apply + [1 2 3 4 5 6 ...])
If you had an array some-array that had hundreds of numbers, this would be trivial without doing anything other than using the same basic + function: (apply + some-array)
And since you are expressing the arguments as a single piece of data here, and you can have functions that are much more interesting than +, you can see where this leads.... building up arguments as data, using them in function application. It gets very interesting very fast and the language unlocks a lot of ideas you just don't get in other languages.