This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-23
Channels
- # admin-announcements (11)
- # announcements (1)
- # beginners (80)
- # boot (152)
- # cider (22)
- # clojure (141)
- # clojure-berlin (57)
- # clojure-india (2)
- # clojure-italy (18)
- # clojure-japan (4)
- # clojure-russia (27)
- # clojurescript (96)
- # datomic (6)
- # dunaj (29)
- # editors (1)
- # euroclojure (63)
- # instaparse (2)
- # ldnclj (28)
- # off-topic (36)
- # onyx (4)
- # overtone (1)
- # reagent (8)
@gary: I admit, that coupling is bad, didn't think of that one, I am too often to pragmatic
Did you see that the selmer "for" tag adds variables like "counter" "counter0" to the context? You may add an if statement on them and insert a row conditionally if it mod = 0
@sveri well it works for now so I guess it's just a little technical debt I'll have to pay back later.
@gary: I know that feeling, I'd do this too, if it was a hobby project, but for a "serious" one that you want to deliver or go to production, fix it now 😉
Btw.you may make that partition-all approach configurable of course, by passing in a parameter for n
You could show people who are resistant to using hiccup http://hiccup.space
@escherize: nice one
@escherize: that's a nice comparison but it's not fair... HTML is not indented, so it looks really ugly; do the same to clojure and you'll get a similar result
still not a fair comparison - clojure source code is string too, and (X)HTML can be considered to be XML and be structured too.
Sure, so i guess it comes down to the differences regarding difficulties of reasoning and manipulation
I think it's more expressive and simpler, even though afterall it's just another DSL
Guys how do you fiddle w/ your code?
I instantly throw-away workflow edit code, save, rebuild, inspect result by (println)
Now I'm using LightTable w/ instarepl, thats OK.
But I feel that best for me will be REPL in console with some kind of watcher/auto-rebuild after I save the file in the editor.
ok, so, for trying things out I would stick with lighttable and it's insta REPL, I found this to be the most helpful IDE when I was starting out with clojure
OK, thanks. I was so pleased with watcher of clojure-script, so I wanted same thing with clojure.
There are similar things, depending on the context, but why make it more complicated when it can be as easy as using LightTable
@escherize, any reason why you’re using a threading macro for just one function call?
i really love ->
since if you have some gnarly data like
{:a [1 2 "i break addition" 4]}
you can do (-> *gnar :a (filter number?))
or something like access the string with (-> *gnar :a (nth 2)
as I'm sure you're awareoh yeah, I'm with you if you're saying for a single function it's better to ditch the threading macro
The time when I do use it is in the repl, when exploring some bizarre response, like the kind Australia Post sends back when you try to request a shipment
(-> *auspost-sucks :packages)
';;=> map with way too many packages to read
(-> *auspost-sucks :packages count)
';;=> 5
(-> *auspost-sucks :packages keys)
';; => [:some :useful :keys :in here]
(-> *auspost-sucks :packages :some)
';; => the thing i actually wanted
@sveri: https://gist.github.com/gdeer81/1a87b20b628b9becd7c8 here is the latest version
it's also nice since (partition-all 4 [1 2 3 4 5 6]) => [(1 2 3 4) (5 6)] I don't have to worry about having the number of products hardcoded
before I had the inner for loop I was doing {% for p1,p2,p3,p4 in partitioned-products %}
so when I got a list that didn't have 4 products I would just get blanks and I had to do some if statements and it was gross
yes, it's a shame you couldn't use map so that the number of items didn't matter. Though the way you did it acheives the same thing
I just had a funny duh! moment when I changed some code from #(inc %)
to just inc
-- doh!!!
OO and inheritance ain't all bad, there are some problems it solves nicely. Unbounded mutation and inherited mutability... that gets messy 😛
yea, no question. I am thinking of other things here...like a lot of developers "can" handle OO which makes it so widely used