#clojure log - Oct 21 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:22 ForSpareParts: Once I write some java code, tell lein about it, and do lein javac, it should be available to import within my project, right?

0:23 I've checked, and my classes were generated, but for some reason they're not found when I do an import.

0:38 So, now I've looked at the output of lein classpath: it seems that lein has not added [project-root]/classes to my classpath -- but I'm not sure how to force it to do that, or to shove the java classes in target/classes. Any ideas?

0:39 mikerose357: anyone tried to use drip with leiningen?

0:40 callen: Clojure needs a mascot. Ideas?

0:40 what about a cormorant?

0:41 Crow?

0:41 xeqi: ForSpareParts: do you set the :compile-path in the project? it should default to target/classes

0:41 ForSpareParts: I just tried setting that by hand to "target/classes" -- no dice.

0:42 xeqi: ForSpareParts: what `lein version`?

0:42 ForSpareParts: 2.0.0-preview10

0:53 callen: Cow.

0:57 tomoj: I just realized what datomic can do for automated testing

0:57 wow

1:13 callen: tomoj: I just realized how sweet it would be to have a Clojure Cow.

1:13 tomoj: also, fixtures serve the purpose you're thinking of.

1:13 tomoj: you dump and reload the database from fixtures for stateful tests.

1:14 tomoj: that's what I don't want to do

1:16 also nice to be able to run tests without even talking to something like a sql database

1:18 Sgeo: Clojure Cow?

1:18 Oh, as mascow

1:18 mascot

1:19 tomoj: is there an easier way to write #(apply vector (f (first %)) (rest %)) in core or useful?

1:22 callen: amalloy_: ^^ you're the one-liner hero.

1:22 Sgeo: or Crow!

1:24 Sgeo: Does destructuring count as easier?

1:25 Wait, no

1:25 Oh, just applying f to the first element?

1:35 callen: does anybody actually do arity-based dispatch in production code? I thought people just did it through let/destructuring.

1:37 tomoj: I do arity-based dispatch wherever I want

1:38 callen: I'm just wondering how applicable it is.

1:38 I don't have any real doubts that those present are capable of exhibiting volition and making the choice to use it.

1:38 I'm angling for a use-case.

1:39 tomoj: you mean a use case for (fn ([x]) ([x y])) over (fn [x & [y]]) ?

1:40 callen: yes.

1:40 tomoj: the latter is uglier (to me)

1:40 and has some overhead

1:41 performance overhead but also sometimes cognitive overhead, imo

1:41 that function also will accept and ignore more args after the second

1:43 also (fn foo ([x] (foo x 42)) ([x y])) looks better to me than, uh

1:43 well

1:43 impossible with destructuring, huh?

1:43 (fn [x & [y :as args]] (let [y (if (seq args) y 42)])) ?

1:44 callen: hrm.

1:44 I'm comparing it in my head to the pattern matching in erlang and haskell.

1:44 tomoj: [x & [y]] is convenient sometimes but it really seems weird to me

1:44 it says too much

1:45 since it's common it's not so bad, but then that's another cryptic thing you do

1:45 well, sometimes that might be pretty much exactly what you mean

1:47 * callen nods

1:52 callen: Does anybody know whether BSON, JSON, protocol buffers, or thrift tend to be the most compact?

1:55 amalloy: tomoj: #(update-in (vec %) [0] f)?

1:56 a wasteful vec call, but shorter code

1:56 tomoj: ah

1:57 (inc amalloy)

1:57 lazybot: ⇒ 32

1:57 ForSpareParts: What's the easiest way to get lein to add a few jars to the javac step if they're not available in Maven?

1:58 Frozenlo`: Send them to clojars? :p

1:58 callen: tomoj: I told you amalloy was the brevity champ.

1:59 ForSpareParts: It's for jogl -- the versions in Maven are way, way out of date. I've messed around with lein localrepo, but it's a bust so far.

2:01 * Apage43 has fixed all my fucked up transient abuse with tree-seq

2:02 callen: Apage43: you should chuck a before/after on refheap.

2:03 Apage43: callen: protobufs/thrift can wind up being more compact since you actually give them schema

2:03 callen: Apage43: erm, yes, I figured but I do need SCIENCE?! for this.

2:03 https://github.com/Raynes/refheap.el/blob/master/refheap.el does anyone know if this is stable/working?

2:03 Raynes: ^^

2:03 Apage43: but jackson SMILE, which the cheshire JSON lib will serialize to, is pretty compact

2:04 Raynes: callen: Yes.

2:04 callen: I maintain it.

2:04 No new commits because it hasn't broken yet. :p

2:04 callen: Raynes: much joy be upon you then. Thanks!

2:04 Apage43: it will collapse repeated strings and stuff

2:04 and unlike BSON can always be round-tripped with JSON

2:06 callen: Raynes: btw I used your code that you wrote refheap-the-site in to help me learn clojure web dev. Much thanks for githubbing that.

2:07 Apage43: callen: if your data fits a schema nicely and you don't have to attach some associative map "extra junk" structure, protobufs/thrift will still pretty much always be smaller than JSON, BSON, or SMILE though

2:07 callen: Apage43: well, more 'an likely, any dynamic extras are going to be a rolled-up hash-map assigned a meta field.

2:07 Raynes: callen: Cool! Happy you got some use out of it.

2:07 callen: Apage43: I'm trying to avoid over-relying on smushed clojure data.

2:07 Apage43: depends how big that is

2:08 if that's the -meat- of your data, then just use SMILE

2:08 callen: I would *like* to lift the clojure data up to the explicit level.

2:08 tomoj: nil is never a valid attribute value in datomic, right? :D

2:10 Raynes: callen: At least, refheap.el worked on my old computer. I'm having some issues getting it working on this new one. Tell me if you get it working so I know I'm not crazy.

2:11 callen: Raynes: I'm actually a good test-case for this. I have a portable Emacs env that gets auto-deployed to a lot of computers with mac and linux.

2:12 Raynes: bad news chief: https://www.refheap.com/paste/5998

2:12 Raynes: worked fine :P

2:12 Raynes: Try credentials. ;)

2:14 callen: non-credential'd private worked, moving onto user/token

2:14 tomoj: https://gist.github.com/05dce1cde5045996d8dc ?

2:15 Raynes: How dare you gist in my presence.

2:15 tomoj: habit

2:15 gist.el doesn't even work for me

2:15 so I should switch

2:15 amalloy: Raynes: https://gist.github.com/fd3fda4c707802740874

2:16 callen: I actually looked into refheap.el because gist.el is broken, hahahahaha

2:16 Raynes: something to keep in mind ^ ;)

2:16 tomoj: suppose you could just dissoc all the nil-valued keys (my gist has the bug where false disappears)

2:16 Raynes: As long as gist keeps breaking things I will be successful.

2:16 callen: It's actually a pattern. Rubeque uses refheap because gist broke the API for them somehow.

2:16 I'm okay with being second best. ;)

2:17 amalloy: 4clojure uses refheap because gist makes Raynes sad

2:17 callen: Raynes: worked.

2:17 Raynes: it auth'd successfully using customize'd user and token.

2:17 Raynes: Cool. I guess my computer's broken. :p

2:18 callen: Raynes: Emacs 24.1.1 + Mac, and I'm 100% positive it'll work on my thinkpad + ubuntu + xmonad too.

2:18 Raynes: what's your stack? Got an error/repro?

2:18 Raynes: I could look into it.

2:18 Raynes: callen: "Could not create connection to www.refheap.com:443

2:18 callen: oh cute.

2:19 Raynes: does it over and over?

2:19 Raynes: can you snag a debug stack?

2:19 Raynes: I have no clue how. I think the problem may be that I screwed up my credential stuff. I have some complex code that looks for creds in a file somewhere. Going to try nixing that and seeing if I can do an anon paste.

2:20 callen: Raynes: you may have brought this upon yourself.

2:20 Raynes: I'm a terrible person.

2:21 Nope. Wont do it even anonymous.

2:21 * callen cackles and walks off to get beer

2:21 Raynes: How do I get debug stuff?

2:21 callen: Raynes: debug-on-error

2:22 Raynes: Cool

2:23 https://www.refheap.com/paste/9ea29d38cac4a44a8a6f10755

2:23 Lot's of nils there.

2:24 callen: Raynes: url.el is ...not great.

2:32 Frozenlo`: Raynes: Personna on refheap? Well, now I don't have other choice than to try it :)

2:32 Raynes: I used browserid before it was cool.

2:33 Frozenlo`: I would argue that it was always cool.

2:33 I was just too lazy to try it -_-

2:37 michaelr525: how is persona different from the sign with (google|facebook|..) button?

2:39 Raynes: michaelr525: It doesn't use either of those things.

2:40 The only reason I used persona is because they had documentation that let me implement it quickly and easily and I didn't want to spend any time at all on authentication crap.

2:42 Turns out that it's also really nice.

2:42 callen: Persona is a lot nicer than the alternatives. It's still kinda weird.

2:42 also, Mozilla is closer to a proper neutral party re: auth

2:43 I don't really trust Google/Facebook to handle identity.

2:44 Frozenlo`: But then you'll use gmail with persona... no?

2:45 callen: Frozenlo`: not a safe assumption.

2:45 Apage43: if you have your own domain you have the option to decide not to trust gmail at one point

2:46 Frozenlo`: indeed

4:25 AtKaaZ: ,(dorun (map println '(1)) nil)

4:25 clojurebot: nil

4:25 AtKaaZ: ,(dorun (map println '(1)))

4:25 clojurebot: 1

4:26 AtKaaZ: ,(dorun 12 (map println '(1)))

4:26 clojurebot: 1

4:27 AtKaaZ: ,(dorun 12 (map println '(1 2 3)))

4:27 clojurebot: 1

4:27 2

4:27 3

4:29 AtKaaZ: what do you call this, in the case of the first one being no error, something like optimistic something?

4:29 based on dynamic typing maybe?

4:30 anyway, to the list with it :)) https://gist.github.com/3895312

4:40 tomoj: ,(dorun (java.util.Date.) '())

4:40 clojurebot: nil

4:41 ForSpareParts: Is it conventional to have a core.clj in every namespace?

4:42 Lein generates the initial namespace that way, but I'm not sure what the broad conventions are.

4:42 arrdem: ForSpareParts: it seems to be, but you are by no means required to keep it so

4:43 ForSpareParts: arrdem, OK.

4:47 Raynes: ForSpareParts: That's what lein generates and what most people do, but it's generally accepted that it is better if you come up with more meaningful namespaces.

4:49 tomoj: I think the reason is that you shouldn't have a single-segment namespace

4:49 so if your library is called foo, you have to come with foo.something

4:49 maybe

4:49 like (use 'clojure) would be cool, but..

4:52 ForSpareParts: Thanks, guys.

5:53 alex_baranosky: is there something I should be doing to my ClojueScript data structures before passing them to JS libraries as inputs?

5:54 maybe apply a ->js function like this one? … (defn ->js [v] (.-strobj v))

5:55 tomoj: there is a clj->js floating around

5:55 alex_baranosky: tomoj: does it work recursively?

5:56 yeah here's one that is recursive: http://mmcgrana.github.com/2011/09/clojurescript-nodejs.html

6:23 brainopia: is there a function which returns always true for any arguments :)

6:26 AtKaaZ: ,(fn [& _] true)

6:26 clojurebot: #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@f0622e6>

6:26 AtKaaZ: ,((fn [& _] true) )

6:26 clojurebot: true

6:26 AtKaaZ: ,((fn [& _] true) 1 2)

6:26 clojurebot: true

6:27 brainopia: AtKaaZ: so, nothing built-in?

6:27 at least for one argument?

6:27 AtKaaZ: ,(#(do true #_%&) 1 2)

6:27 clojurebot: true

6:27 AtKaaZ: brainopia, no idea to be hones:)

6:27 mindbender1: ,(constantly true)

6:27 clojurebot: #<core$constantly$fn__2351 clojure.core$constantly$fn__2351@e13b3d1>

6:27 AtKaaZ: $find-fn 1 2 3

6:28 thanks mindbender1

6:28 mindbender1: np

6:28 brainopia: mindbender1: awesome

6:29 AtKaaZ: ,((constantly 1) 2 3)

6:29 clojurebot: 1

6:29 AtKaaZ: $find-fn true true

6:30 $findfn true true

6:30 lazybot: [clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/== clojure.core/time clojure.core/dosync clojure.core/true? clojure.core/distinct? clojure.core/boolean clojure.core/doto clojure.core/macroexpand-1 clojure.core/or clojure.core/comp... https://www.refheap.com/paste/6004

6:31 AtKaaZ: it didn't find it:))

6:31 oh right, because it returns a function

6:32 wonder what $findfn would find constantly, if possible

8:21 wingy: i have a number and want to build a sequence that has that many elements as the nr

8:21 as many elements as the nr

8:21 AtKaaZ: ,(repeat '1)

8:22 clojurebot: (1 1 1 1 1 ...)

8:22 wingy: thx

8:26 AtKaaZ: np, ignore the ' though:)

8:57 tgoossens: hi

8:58 about 15 hours ago (for me yesterday evening) I ran into a problem with string escaping

8:58 I described the problem in a blogpost http://tgoossens.wordpress.com/2012/10/20/funix-enhancing-the-linux-terminal-by-thinking-functional/

8:58 someone of this irc channel suggested

8:58 prn

8:58 but that doesn't seem to work

9:05 AdmiralBumbleBee: tgoossens: pretty sure the problem is not string escaping

9:05 since that outputs the correct string

9:06 tgoossens: so you get what i want to do right? (grep "test" (ls -la)) must be printed as ls -la | grep "test"

9:06 AdmiralBumbleBee: yep

9:06 tgoossens: also i got problems with things like

9:06 (ls Documents/)

9:06 (ls ~)

9:07 i guess i'll have to encode those symbols in some way

9:07 en decode them at the very end

9:08 or do you have other suggestions?

9:08 AdmiralBumbleBee: I'm trying to figure out your code atm

9:08 tgoossens: ok thanks :)

9:08 (ps do you like the concept? :p )

9:09 AdmiralBumbleBee: it's ok I guess

9:09 I never thought it was a problem that needed solving, but it's a neat idea

9:10 tgoossens: i'm still not sure whether people would event want to do that. But i just saw it as a great exercise for myself (after playing around with clojure for one month)

9:11 i'm starting to think that the ref i used isn't necessary

9:11 AdmiralBumbleBee: it's not

9:11 that's what's making me wonder if I'm not understanding the code, or if it's really goofy

9:11 I'm leaning towards goofy

9:11 tgoossens: what do you mean with goofy?

9:11 AdmiralBumbleBee: I see no reason to use a ref

9:11 tgoossens: me neither anymore

9:12 i'll change that in the future. but it's not the main concern :D

9:13 still exercising to minimize necessity of refs :)

9:13 AdmiralBumbleBee: string-to-stack should just return a new stack

9:13 that's all

9:13 no need for the ref

9:14 tgoossens: you are absolutely right

9:14 AdmiralBumbleBee: err, list-to-stack

9:14 both actually

9:16 tgoossens: for the rest? is the code a bit clean? i'm curious on how to do this better

9:16 AdmiralBumbleBee: it looks like python with parenthesis to me

9:17 tgoossens: never wrote python before :D

9:17 AdmiralBumbleBee: i'm pretty sure there's a much more succint way to write list-to-stack

9:18 tgoossens: if i strip off the ref stuff then it is already much cleaner no ?

9:18 AdmiralBumbleBee: yep

9:19 tgoossens: done :)

9:36 wingy: AntelopeSalad: learning how to deploy it to Heroku now

10:04 antares_: wingy: heya

10:04 wingy: antares_: hey

10:05 antares_: wingy: do you have 10 minutes or so?

10:05 wingy: antares_: sure

10:05 antares_: wingy: you came to Clojure from JS, right?

10:06 wingy: do you mind reading http://clojure-doc.org/articles/language/concurrency_and_parallelism.html and telling me how much sense it makes to you? Especially the identity/values separation part.

10:06 wingy: sure

10:09 antares_: you want feedback on what could be more explanatory?

10:09 antares_: wingy: yes, anything you did not understand or find not explanatory enough

10:09 of missing

10:09 (missing in the structure, we obviously have TBD sections)

10:52 wingy: antares_: https://gist.github.com/3927167

10:54 antares_: wingy: I added a couple of pictures, refresh

10:55 wingy: antares_: i updated as well .. refersh .. easier to read

10:55 hyPiRion: Is there any preferred way to convert a record to a map?

10:56 antares_: wingy: several points are covered by earlier guides

10:56 wingy: i c

10:56 antares_: wingy: some others I will try to expand. I don't know if we can turn it into a generic concurrency tutorial, at least some basic understanding is probably necessary.

10:56 hyPiRion: Or well, I suppose a record is a map.

10:56 wingy: antares_: the picture is great

10:56 i understand it even more now :)

10:56 one picture is better than 1000 words

10:57 more pics!

10:57 hyPiRion: 1001 words are better than one picture.

10:57 AtKaaZ: lol

10:58 antares_: wingy: we will add more, for sure

10:58 wingy: and for functions such as map, filter, remove, too

10:58 wingy: wow that would be cool

11:04 thats why i love head first series

11:04 they have a lot of pictures

11:10 Scorchin: Anyone with any experience of using the betamax mocking library around? https://github.com/wjlroe/betamax/

11:10 Currently getting the following exceptin: actual: java.lang.Exception: No track in cassette: example.com matches required url, method and request

11:10 (betamax/with-cassette "example.com"

11:10 (is (= nil

11:10 (:request (get-json "http://example.com")))))

11:10 that's ^ the code I'm using that causes the exception

11:11 and I have an example.com file in resources/cassettes. Really not sure what's going on. All I want to do is mock out clj-http requests

11:11 AtKaaZ: ,(nil? nil)

11:11 clojurebot: true

11:11 AtKaaZ: ,(nil? 1)

11:11 clojurebot: false

11:12 madsy: ,(nil? '())

11:12 clojurebot: false

11:12 AtKaaZ: ,(empty? '())

11:12 clojurebot: true

11:12 AtKaaZ: ,(empty? nil)

11:12 clojurebot: true

11:13 AtKaaZ: ,is

11:13 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: is in this context, compiling:(NO_SOURCE_PATH:0)>

11:50 antares_: wingy: better now? http://clojure-doc.org/articles/language/concurrency_and_parallelism.html

11:50 wingy: we probably don't want to turn this guide into a book about concurrency but I find it helpful to cover most commonly used terms. I want to heavily focus on examples, though.

11:50 wingy: antares_: big W on description to Concurrency :)

11:50 yeah

11:50 antares_: W for win?

11:51 wingy: when multiple are making progress, whether it is via time-slicing or parallelism

11:51 antares_: ah, it is not capitalized

11:51 corrected

11:51 wingy: yeah short descriptions are very iseful

11:52 When multiple are making progress, whether it is via time-slicing or parallelism

11:52 multiple what?

11:52 threads?

11:53 antares_: corrected

11:58 wingy: so you think this is an improvement over what we had?

11:58 wingy: antares_: yeah

11:59 its definitely good to know the words that are being used

11:59 i personally find it distracting to have to lookup every word in a new tab

12:03 antares_: wingy: ok, cool

12:19 jasonleaf: Hi, what's the best way to print the current executing function name?

12:22 gfredericks: there is no easy way to do that

12:23 * gfredericks starts imagining a function that hooks around all vars in the system...

12:24 wingy: how do i wrap the prices in a <strong> in this hiccup template [:li {:data-role "list-divider"} "Buffet 85:- Take-away 75:-"]

12:26 [:li {:data-role "list-divider"} "Buffet <strong>85:-</strong> Take-away <strong>75:-</strong>"]

12:26 or is there an idiomatic way?

12:27 mpenet: wingy: a span with a class and change the style there, it is more flexible imo

12:27 gfredericks: "Buffet " [:strong "85:-"] " Take-away " [:strong "75:-"]

12:27 wingy: cool

13:17 goracio: hi trying to call function in clojurescript something like this - service.store(data, {:width 80 :fit "scale"},callback) and seems like {} thing doesn't convert properly, i get an error

13:19 in js code i see cljs.core.ObjMap.fromObject(["\ufdd0'width", "\ufdd0'fit"], {"\ufdd0'width":80, "\ufdd0'fit":"scale"}) wich converts to cljs.core.ObjMap not {}

13:19 so how to send js object properly ?

13:20 octagon: goracio: https://github.com/ibdknox/jayq/blob/master/src/jayq/util.cljs is that what you mean?

13:21 goracio: i meant https://github.com/ibdknox/jayq/blob/master/src/jayq/util.cljs#L18

13:21 goracio: clj -> js ?

13:21 octagon: goracio: you want to pass a js object there, but you have a cljs map, right?

13:22 goracio: octagon: exactly

13:22 octagon: goracio: so you can do (clj->js {:foo "bar"})

13:22 goracio: ok will try :)

13:22 octagon: to obtain a js object {foo: "bar"}

13:23 frozenlock: I'm still baffled by the fact that this isn't in cljs by default. Apparently there's cases where it doesn't work.

13:23 zoldar: ,(-> {:latitude 1 :longitude 2} ((juxt :latitude :longitude)))

13:23 clojurebot: [1 2]

13:23 zoldar: ,(-> {:latitude 1 :longitude 2} (juxt :latitude :longitude))

13:23 clojurebot: #<core$juxt$fn__2474 clojure.core$juxt$fn__2474@7f81c084>

13:23 frozenlock: /s/is/are

13:24 zoldar: ... I'm probably missing on something obvious but why the second form returns the function itself?

13:24 octagon: frozenlock: i've heard this also, but i don't know what the details are

13:24 hyPiRion: zoldar: Look at how it expands

13:25 ,(macroexpand-1 '(-> {:lat 1 :long 2} (juxt :lat :long)))

13:25 clojurebot: (juxt {:lat 1, :long 2} :lat :long)

13:25 hyPiRion: ,(-> {:lat 1 :long 2} #(juxt :lat :long)) ; should solve it

13:25 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.ISeq, compiling:(NO_SOURCE_PATH:0)>

13:25 hyPiRion: er.

13:25 ,(-> {:lat 1 :long 2} ((juxt :lat :long)))

13:25 clojurebot: [1 2]

13:26 zoldar: hyPiRion: ok, thanks for clarifying

13:27 gfredericks: -> is all syntactic so it can't tell whether or not you're using an HOF

13:35 octagon: is there a document that describes the model for how metadata is treated in clj?

13:35 i mean like under which operations should metadata be preserved, and which not?

13:37 also i was looking at the source for clojure.zipper, and i see that the zipper data structure is storing its information as metadata on a vector. i haven't seen this approach anywhere else in clj so far, and i'm curious about it

13:37 gfredericks: ,(meta (-> [2 3] (with-meta {:foo :bar})))

13:37 clojurebot: {:foo :bar}

13:37 gfredericks: ,(meta (-> [2 3] (with-meta {:foo :bar}) (conj 8)))

13:37 clojurebot: {:foo :bar}

13:37 gfredericks: ,(meta (-> [2 3] (with-meta {:foo :bar}) (conj 8) (empty)))

13:37 clojurebot: {:foo :bar}

13:37 gfredericks: fascinating

13:37 hyPiRion: ,(meta (-> 2 (with-meta {:foo :bar})))

13:37 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IObj>

13:38 hyPiRion: careful though.

13:38 ,(meta (-> #"foo" (with-meta {:foo :bar})))

13:38 clojurebot: #<ClassCastException java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to clojure.lang.IObj>

13:38 octagon: i'm implementing my own deftype as an immutable thing, and i want to make sure i deal correctly with metadata

13:39 gfredericks: ,(let [meta-m (fn [x] (with-meta {x x} {x x}))] (meta (merge (meta-m :foo) (meta-m :bar))))

13:39 clojurebot: {:foo :foo}

13:41 octagon: as i understand it, the purpose of metadata is data that can be associated with a thing without altering the identity of the thing

13:41 hyPiRion: gfredericks: That's probably how merge operates.

13:41 &(source merge)

13:41 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

13:41 hyPiRion: ,(source merge)

13:41 clojurebot: Source not found

13:41 hyPiRion: bleh.

13:42 gfredericks: hyPiRion: I was just experimenting with a function of two objects that is conceptually somewhat symmetric

13:42 chouser: Does anyone know how to set a jira ticket's status? I need to set a ticket to "Ready for Screening" but can't find any such field after clicking "edit"

13:44 octagon: also why would zipper be implemented using metadata to store properties instead of as a set of protocols?

13:44 chouser: octagon: zippers predates protocols

13:46 octagon: chouser: interesting, so it could have been done using protocols if they had existed?

13:46 chouser: I haven't thought about it. It's an interesting question.

13:49 octagon: i have a deftype that is essentially zipperlike, and i'd like to just prepopulate the metadata in my constructor to make it a zipper, but i don't really understand the rules for when metadata is preserved (like if an operation on an immutable object produces a new object, under which conditions should metadata be preserved?)

13:54 muhoo: i wouldn't want to mess around with implementation details of zippers

14:02 chrix: Hi, does anyone know how I can use seq-utils with Clojure 1.4? I'd like to use the seq-utils/find-first but I don't find it with the new contrib hierarchy :/

14:05 gfredericks: is find-first just (comp first filter)?

14:07 chrix: It's the function that returns the first found item in a list.

14:12 gfredericks: by that description it sounds identical to first

14:12 anyhow I bet (comp first filter) does the same thing

14:13 chrix: thanks gfredericks, our messages passed each other :)

14:13 gfredericks: ah

14:45 antares_: 2nd progress report from our Clojure documentation project (http://clojure-doc.org): http://t.co/0dkLj2uw

14:45 Sgeo: Oh hey antares_, what was your Haskell question?

14:45 If you didn't already get an answer.

14:45 antares_: Sgeo: it turned out to be a bug in Aeson :/

14:46 which there is a pull request for but the maintainer is shy from pulling it in until some other guy gives it a look. But that guy does not care.

14:46 So I just implemented what I needed in something other than Haskell :)

14:46 Sgeo: Ah. Well, I haven't even heard of Aeson until now

14:46 Oh, JSON processing

14:47 antares_: Sgeo: thanks for remembering, though

14:47 Sgeo: yw

14:58 edlich: Close

14:59 ks`: What can I do with clojure script is the same as what can I do whith java-script, or just a part of possibilities?

15:13 ForSpareParts: What does a variable preceded by an ampersand (no space) in a function definition indicate?

15:13 i.e. (fn [a &b] ...)

15:13 metellus: it means that the function can take 2 or more args

15:14 and every arg after the first will be in a vector

15:14 ForSpareParts: metellus, I thought that was for [a & b]

15:15 metellus: the space doesn't make a difference

15:15 ForSpareParts: I was looking at the source for defn and saw this: [&form &env name & fdecl]

15:16 ks`: (do (fn aga [x] (reverse (first x))) aga '(1 2 3)) # returns (1 2 3) - what I do wrong ?

15:17 ForSpareParts: That might not actually be the args list for defn itself, I'm still not great at reading this stuff, but it can't mean "the rest" in that context, can it? For &form and &env, I mean.

15:18 metellus: ForSpareParts: I don't know, sorry

15:20 Sgeo: ks_ks, your function does three things, (reverse (first x)) which is a value that gets ignored, because it's not the last value or used somewhere etc.. Then, free floating aga, whcih gets ignored for the same reason. Then, '(1 2 3), which is the last value so is the return value.

15:21 ForSpareParts, &form and &env are usable in macros

15:22 &form is the s-expr of the macro call, and &env is the lexical environment, a map of symbols to ... stuff. Lexical environment, as in when you're in a let form

15:22 lazybot: java.lang.RuntimeException: Unable to resolve symbol: form in this context

15:22 * Sgeo shooshpaps lazybot

15:23 ForSpareParts: Sgeo, Ah, okay.

15:25 Sgeo: http://ideone.com/z6MTLx

15:25 ks_ks: Sgeo, thanks!

15:25 Sgeo: ks_ks, you're welcome

15:27 ks_ks: Sgeo, but if i do (do (defn aga [x] (first (reverse x))) aga '(1 2 3)) I'm getting the same result.

15:27 I think arg [x] = '(1 2 3), then it should be reversed

15:27 Sgeo: You're defining a function aga which returns '(1 2 3)

15:27 ks_ks: clj.core> (reverse '(1 2 3))

15:27 (3 2 1)


15:28 Sgeo: You're not even calling aga again in the function, if that's what you meant to do

15:29 ks_ks: I want just get 3 as a result

15:29 Sgeo: You're parenthesizing wrong, I think

15:29 The (fn...) or (defn...) needs to be contained in a a set of... oh, I misread

15:30 You call functions like this (aga '(1 2 3)) not like aga '(1 2 3)

15:30 ks_ks: Sgeo, got it :0

15:31 Sgeo: Oh, I also misread your first example

15:31 ks_ks: :)

15:31 Sgeo: Cool

15:31 ks_ks: (do (defn aga [x] (first (reverse x))) (aga '(1 2 3)))

15:31 Sgeo: ,((fn [x] (first (reverse x))) '(1 2 3))

15:31 clojurebot: 3

15:32 ks_ks: or like that

15:33 what does it mean ',' before list ?

15:34 Sgeo: ks_ks, just tells clojurebot to do it

15:34 ks_ks: hm

15:34 Sgeo: ,(println , , , , "Although, note that in Clojure, , are whitespace" , , , ,,,,,,, , , ,)

15:34 clojurebot: Although, note that in Clojure, , are whitespace

15:35 ks_ks: :D

15:36 I think so not only

15:36 Sgeo: &(println "There's also lazybot")

15:36 lazybot: ⇒ There's also lazybot nil

15:36 ks_ks: clj.core> ,((fn [x] (first (reverse x))) '(1 2 3))

15:36 3

15:36 clj.core> (do (fn [x] (first (reverse x))) '(1 2 3))

15:36 (1 2 3)

15:36 clj.core> (do ((fn [x] (first (reverse x))) '(1 2 3)))

15:36 3


15:36 Sgeo: And you can trigger ##(println "lazybot from within a line of chat.")

15:36 lazybot: ⇒ lazybot from within a line of chat. nil

15:36 ks_ks: Oh, my head.. )

15:37 Sgeo: ks_ks, the second one makes the function but does nothing with it

15:37 All that do does is group statements together

15:37 ks_ks: yep

15:37 Sgeo: ,(do (println "Hello") (println "There"))

15:37 clojurebot: Hello

15:37 There

15:37 ks_ks: third and first variant of decision different by a couple of commas

15:38 strange syntax Clojure after python usage :)

15:38 so many constructions

15:39 Sgeo: There's a good reason for it

15:39 Code is data

15:40 (+ 1 2) will evaluate to 2, but it's also a list of the symbol + the number 1 and the number 2

15:40 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "+">

15:40 Sgeo: ?

15:40 ForSpareParts: I'm trying to wrap my head around defmacro and macroexpand -- could someone explain where I've gone wrong here? https://gist.github.com/3928201

15:40 Sgeo: Because of this, you can write macros, which will take as arguments your code

15:40 And return new code

15:41 ks_ks: yep it's great .. but I can understand this may be in 2014 :)

15:41 Sgeo: ForSpareParts, looks like test-macro will try to call 'a with the argument s

15:41 You need to return a list, not do a list

15:41 You might write (defmacro test-macro [s] `(a ~s))

15:42 But that won't give you what you expect because of something interesting that happens with `

15:42 ForSpareParts, try this:

15:42 (defmacro test-macro [s] (list 'a s))

15:42 I think that what that does should be sufficiently clear

15:43 ForSpareParts: Sgeo, Yep, that's perfect. Two questions:

15:43 Is there a difference between ' and `?

15:43 and

15:43 What does ~ do, in the context of the other code you suggested?

15:44 Sgeo: Both questions are related

15:44 ` is quasiquote, which is like ` except it allows you to actually call code within it

15:44 ,`(a b c ,(+ 1 2) (+ 1 2))

15:44 clojurebot: (sandbox/a sandbox/b sandbox/c (clojure.core/+ 1 2) (clojure.core/+ 1 2))

15:44 Sgeo: oops

15:44 ,`(a b c ~(+ 1 2) (+ 1 2))

15:44 clojurebot: (sandbox/a sandbox/b sandbox/c 3 (clojure.core/+ 1 2))

15:44 Sgeo: The ~ within the ` allows you to evaluate the code

15:45 ForSpareParts: Ah, cool!

15:45 Thanks!

15:45 Sgeo: Another thing that ` does is stick the namespace name on all the symbols

15:45 There is also

15:45 ForSpareParts: Is that good? Do I want it to do that?

15:45 Sgeo: Often, yes, but there might be exceptions. You could use something like ~'foo in that case

15:46 ForSpareParts: OK.

15:46 Sgeo: Having ` stick the namespace in front helps prevent collisions between symbols in the expanded result and lexically defined symbols in the code

15:46 (let [a 1 b 2] ... )

15:46 a and b are not namespaced.

15:47 Note that there are considerations you need to take in mind when writing macros

15:47 I think this feature actually prevents one possible hygiene issue by yelling at you if you try it, but let me check

15:48 Awesome, it does

15:48 http://ideone.com/PgiIQd

15:49 dsop: is it just me or is java.jdbc not handlign escaping of tablenames, etc correctly?

15:50 ForSpareParts: Sgeo, So, I can see it prevents you from using a in a let binding (and based on that, I can imagine some other things it would probably yell at you for), but would it be bad to force that let binding with 'a?

15:50 I ask because I intended to use the macros I want to write inside of functions with some arg naming conventions, to make my code more readable/writable

15:51 Sgeo: ForSpareParts, yes. What happens if the macro gets expanded inside something else that's (let [a ...])?

15:51 ForSpareParts: Ah.

15:51 Sgeo: ,`(let [a# 5] a#)

15:51 clojurebot: (clojure.core/let [a__105__auto__ 5] a__105__auto__)

15:51 Sgeo: Do something like that

15:52 Or, if you can't, because you need the same symbol across different `, do something like

15:52 ,(let [a-var (gensym)] `(let [~a-var 5] ~a-var))

15:52 clojurebot: (clojure.core/let [G__134 5] G__134)

15:53 Sgeo: There's another pitfall I need to show you, hold on

15:56 ForSpareParts, http://ideone.com/S9NlWq

15:57 Although, of course, note that you wouldn't use a macro for doubling stuff

15:57 ForSpareParts: Right.

15:57 Does # mean something special in these contexts? Or is it just something you tack on to keep names unique...?

15:58 Sgeo: It means something special in the context of `

15:58 blah# expands in a ` to a unique symbol which is the same for all blah# within the `

15:59 (Unless you're nesting ` I think)

15:59 ,`hello

15:59 clojurebot: sandbox/hello

15:59 Sgeo: ,`hello#

15:59 clojurebot: hello__53__auto__

15:59 Sgeo: ,`hello#

15:59 clojurebot: hello__80__auto__

15:59 Sgeo: ,`[hello# hello#]

15:59 clojurebot: [hello__107__auto__ hello__107__auto__]

15:59 TimMc: ,`[`a `a]

15:59 clojurebot: [(quote sandbox/a) (quote sandbox/a)]

15:59 ForSpareParts: Alright. Hm.

15:59 TimMc: heh

16:00 ivan`: does Clojure on Android still require sattvik's fork? and is there a patchset that I can apply to clojure master?

16:03 * ivan` finds the mega-commit that adds support

16:16 Sgeo: ForSpareParts, ##(`(1 2 ~(list 3 4 5) 6))

16:16 lazybot: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IFn

16:16 Sgeo: erm

16:16 ForSpareParts, ##`(1 2 ~(list 3 4 5) 6)

16:16 lazybot: ⇒ (1 2 (3 4 5) 6)

16:17 Sgeo: ForSpareParts, ##`(1 2 ~@(list 3 4 5) 6)

16:17 lazybot: ⇒ (1 2 3 4 5 6)

16:17 Sgeo: Also, the way to force an un-namespaced symbol through (be careful with this) ##`~'a

16:17 lazybot: ⇒ a

16:17 Sgeo: ##`(~'a 'a a)

16:17 lazybot: ⇒ (a (quote clojure.core/a) clojure.core/a)

16:17 ForSpareParts: Sgeo, ## means evaluate here?

16:18 Sorry, I'm a little lost...

16:18 Sgeo: ForSpareParts, yeah, it's just a thing that lazybot will recognize in the middle of a line

16:18 ForSpareParts: Oh, ok.

16:18 Sgeo: Nothing to do with Clojure itself

16:18 ForSpareParts: And @? I thought that was for deref...?

16:19 Sgeo: ~@ is different from ~ and different from @

16:19 clojurebot: Alles klar

16:19 hyPiRion: Hm, did out bot just learn that

16:19 ~@

16:19 clojurebot: @ is splicing unquote

16:19 ForSpareParts: OK.

16:19 Sgeo: Hmm, that does raise the point of absentmindedly doing ~@blah when you wanted ~(deref blah)

16:20 ForSpareParts: Something else I'm having trouble googling: is there a version of map I can use on a vector to get back a vector?

16:20 Sgeo: ,(into {} (map inc [1 2 3 4 5]))

16:20 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

16:20 Sgeo: ,(into [] (map inc [1 2 3 4 5]))

16:20 clojurebot: [2 3 4 5 6]

16:21 hyPiRion: ,(mapv inc [1 2 3 4 5]) ; usually turns out the same

16:21 clojurebot: [2 3 4 5 6]

16:21 Sgeo: (doc mapv)

16:21 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

16:21 Sgeo: $findfn inc [1 2 3] [2 3 4]

16:22 lazybot: []

16:22 ForSpareParts: Is there a situation in which the two aren't equivalent? Something to do with order...?

16:22 hyPiRion: ForSpareParts: mapv can take in anything, but spits out a vector.

16:22 Sgeo: ,(mapv inc {1 2 3 4})

16:22 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Number>

16:23 ForSpareParts: Alright.

16:23 hyPiRion: So the difference between map and mapv is essentially this: map is lazy, mapv is not. map returns a seq, mapv returns a vector. Both can take in any collection.

16:24 Both spits out the same result, but with different data structures.

16:35 ForSpareParts: So, I've been trying to string together this stuff to write a macro I need, and I've hit another wall -- hard to describe without showing the code. Would you guys mind taking a quick look at this? https://gist.github.com/3928404

16:35 hyPiRion: I'll have a peek

16:36 ForSpareParts: Thanks!

16:36 Right now, out-path is ignored -- I'm going to do something with it once I've got this version working.

16:36 hyPiRion: So, first of all, what are you trying to achieve?

16:38 ForSpareParts: One sec, I'll make a pretend thing that calls it -- I think it'll make more sense than trying to write it out here.

16:38 hyPiRion: ok

16:44 ForSpareParts: https://gist.github.com/3928414

16:44 Basically, I want to generate a function that will take a state and return a transformed version of the state, based on the behaviors provided in defsignal

16:45 actually, I guess the :a argument to defsignal should be [:a], because it could be a chain.

16:46 (e.g. [:a :b :c] to get {:a {:b {:c result}}}

16:46 )

16:46 Er, where states are maps. I should've said that before.

16:46 hyPiRion: Yeah, gotcha.

16:47 ForSpareParts: I'm trying to hack together a FRP system. Which is way the hell over my head, but, well, this is how we learn, right?

16:47 hyPiRion: One thing I wonder about. Why the multiple :a's in your example?

16:47 And yeah, that's how I work at least.

16:48 ForSpareParts: multiple :a's? You mean in my call to defsignal, or...?

16:48 hyPiRion: yeah

16:48 (defsignal inc-a [a [:a]] [:a] (I would assume, for chaining reasons.)

16:49 So I suspect that the first is the input variable, and that the second is the output variable. Right?

16:49 "variable"

16:49 ForSpareParts: The first is a set of input bindings, because there could be more than one. The second is a path to an output in the resultant map.

16:49 hyPiRion: okay, got you.

16:50 ForSpareParts: And yeah, that was another derp on my part. Should've been [a [:a]], like you said.

16:52 So, as far as I can tell, my problem right now is that I can't grab state# in the middle of evaluating the map that transforms my input bindings.

16:52 (which I need in order to make the closure for map)

16:52 Sgeo: Hmm

16:53 There's a way to do let stuff safely without #

16:53 If that helps

16:53 hyPiRion: gensym can do it.

16:53 Sgeo: In fact, Common Lisp doesn't have # (although there are macros to add similar features)

16:53 hyPiRion: second.

16:54 Sgeo: ,(let [state-sym (gensym)] `(let [~state-sym (make-a-state)] blahblahblah))

16:54 clojurebot: (clojure.core/let [G__29 (sandbox/make-a-state)] sandbox/blahblahblah)

16:55 ForSpareParts: So I wrap the whole function definition in a let that defines the symbol I want?

16:55 Using (gensym)?

16:56 Sgeo: The let that uses gensym should not be resulting code, but executed by the macro

16:56 Look again at my line. It executes a let form, and returns a let form

16:56 ForSpareParts: Right, that's what I thought.

16:57 But in my case, I'd execute a let form and return a defn form, right?

16:57 Sgeo: I haven't been paying close attention, but that sounds about right

16:59 hyPiRion: https://gist.github.com/3928475

16:59 ForSpareParts: Look at that, it expands from what I can see correctly.

17:01 ForSpareParts: hyPiRion, Still not totally clear on what ~@ does

17:01 Sgeo: ForSpareParts, it splices a lis

17:01 list in

17:01 So effectly instead of bringing in a list, it ...

17:02 ,`(a ~@'(b c d) e)

17:02 clojurebot: (sandbox/a b c d sandbox/e)

17:02 hyPiRion: It removes a set of parens from the part after ~@.

17:02 or brackets.

17:02 ([])

17:04 xeqi: https://www.refheap.com/paste/6012 is what I came up with

17:04 ForSpareParts: OK. I'm still parsing what you did in your gist, but I'm learning a lot in the process.

17:04 Er, that was directed at hyPiRion.

17:04 hyPiRion: ForSpareParts: Wish I would've time to explain. Unfortunately I have a deadline I have to reach =/

17:04 ForSpareParts: hyPiRion, Not a problem at all! You've been super helpful!

17:05 hyPiRion: ForSpareParts: Hopefully you've got something to digest :)

17:05 ForSpareParts: Absolutely : D

17:09 Sgeo: Is that namespaced inc-a acceptable in a defn?

17:11 ForSpareParts: xeqi, would your solution work if there were multiple input bindings, i.e. [a [:a] other-binding [:b :c]]? It seems like it would only handle the one.

17:11 xeqi: it was limited to one

17:12 ForSpareParts: OK.

17:12 xeqi: would end up with a partition similar to hyPiRion's

17:12 ForSpareParts: Right.

17:15 frozenlock: I have an installation wrapper asking me for the main class of my ubejar. I assumed it was my_app.core, but it throws an error. Am I missing something?

17:35 kmicu: , (+ nil 1)

17:35 clojurebot: #<NullPointerException java.lang.NullPointerException>

17:38 S11001001: ,(do (use 'clojure.core.incubator) (doc -?>))

17:38 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/core/incubator__init.class or clojure/core/incubator.clj on classpath: >

18:04 ivan`: I typed (range) in nrepl.el, hit ctrl-c ctrl-b to interrupt, and now Emacs is permanently locked up

18:05 oh fixed after I killed java

18:08 Sgeo: Killing Java is always the best idea :D

18:18 ivan`: appears to be fixed in 0.1.6-preview

18:35 Sgeo: ,`do

18:35 ivan`: anyone know what stopped vanilla clojure from supporting Android? doesn't look like a lot of changes, other than the com.android.dx import

18:35 clojurebot: do

18:35 Sgeo: hmm

18:35 ,(clojure.core/do 1 2)

18:35 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: clojure.core/do, compiling:(NO_SOURCE_PATH:0)>

18:35 Sgeo: Hmm.

18:35 I don't like this

18:36 ivan`: &(do #())

18:36 Sgeo: No complains about (def do 5) under ideone.com

18:36 lazybot: ⇒ #<sandbox7657$eval318214$fn__318215 sandbox7657$eval318214$fn__318215@47a729>

18:36 Sgeo: But how do I get back to the old do?

18:37 Oh, apparently, I simply can't refer to my custom do directly

18:37 ivan`: you want to remove `do` from your namespace?

18:37 oh

18:38 Sgeo: If I :refer-cloure :exclude [+], I can have my own + in the namespace. I don't think do and other special forms work by the normal rules

18:39 amalloy: Sgeo: they don't

18:39 gfredericks: special forms are special

18:40 Sgeo: If I'm doing code-rewriting, and see a do symbol, I can assume that it's actually the special form?

18:40 And is there a function to ... get the namespace that a symbol resolves in?

18:40 gfredericks: as long as it's at the beginning of a list

18:40 ivan`: gah

18:40 gfredericks: ,(namespace (resolve 'first))

18:40 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>

18:40 gfredericks: ,(.namespace (resolve 'first))

18:40 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: namespace for class clojure.lang.Var>

18:40 gfredericks: ,(.getNamespace (resolve 'first))

18:40 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getNamespace for class clojure.lang.Var>

18:40 gfredericks: well I'm sure there's something like that.

18:40 amalloy: /ban gfredericks

18:41 &(keys (meta #'first))

18:41 lazybot: ⇒ (:ns :name :arglists :added :static :doc :line :file)

18:41 * gfredericks was trying to helps

18:41 Sgeo: Aha.

18:41 Neat

18:41 gfredericks: doesn't being interned imply more than just some metadata?

18:42 or is that not from the var's perspective?

18:42 Sgeo: Means namespace contains it, I think

18:42 * gfredericks goes shopping

18:42 Sgeo: ,(keys *ns*)

18:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Namespace>

18:42 ivan`: (remove-ns 'user) ; fun times after doing this

18:44 Sgeo: I take it clojurebot will block (remove-ns 'sandbox)

18:44 ,(remove-ns 'sandbox)

18:44 clojurebot: #<Namespace sandbox>

18:44 Sgeo: ..?

18:44 ,(+ 1 1)

18:44 clojurebot: 2

18:44 Sgeo: (doc remove-ns)

18:44 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

18:44 Sgeo: ,*ns*

18:44 clojurebot: #<Namespace sandbox>

18:45 Sgeo: ,(remove-ns 'user)

18:45 clojurebot: #<Namespace user>

18:45 Sgeo: ,(remove-ns 'asdf-is-a-common-lisp-thing)

18:45 clojurebot: nil

19:02 tomoj: so suppose (= 10 (let [[a b (c :or 10)] [1 2]] c))

19:03 can has (nil? ((fn [x (y :or nil)] y) 42)) ?

19:03 amalloy: ^ (s/:or// for your proposal)

19:04 amalloy: tomoj: i doubt the function one will happen

19:04 tomoj: it would require changes to fn, I think?

19:05 but you could have (fn [x & [(y :or nil)]]) with no changes :/

19:07 amalloy: tomoj: the changes to fn you could do yourself easily enoguh, and add, say, fn+. changing the rules of destructuring at all (other) destructure points needs help from core

19:08 and i don't think :or would appear in function signatures even if it appeared in other places, just like :as isn't allowed to bind all the function args

19:12 tomoj: doesn't seem worth it to get it in fn

19:12 or to write fn+

19:12 but nice to have it in all non-root binding forms

19:14 amalloy: i'm not sure it really belongs in vectors either

19:15 (let [[a (b :or 5)] x] [a b]): what does this return when x is nil? or when it's '[foo nil]?

19:16 tomoj: respectively [nil 5], '[foo nil]

19:16 I'd think

19:19 amalloy: agreed, and yet you can't really get that without changing how vectors are destructured. right now it's with nthnext/nth, which doesn't have a not-found argument

19:20 * Sgeo wrote a quick demo of a difference between Common Lisp macros and Clojure macros due to use of `

19:20 tomoj: nthnext doesn't, that's a problem?

19:21 nth does

19:21 Sgeo: Common Lisp: http://ideone.com/jpMzYT

19:21 Clojure: http://ideone.com/48IlsM

19:21 tomoj: nthnext just returns nil if the index is too big

19:21 doesn't seem like a problem to me, but I haven't thought about what you'd have to change

19:23 Sgeo: wow, how do you fix that bug in cl?

19:24 antoineB: Sgeo: what is the difference?

19:24 Sgeo: Within a package, avoid fletting a name that is used by a function in the package, I think

19:26 In Common Lisp, the reader gives all symbols a package name (what Clojurists would call a namespace) (I might be wrong about terminology). In Clojure, symbols are only namespaced if explicitely namespaced

19:26 But in Clojure, ` namespaces all the symbols it sees.

19:27 antoineB: ok

19:27 Sgeo: So, in Clojure, in the letfn, f is the symbol that the letfn sees and exposes, but f-macro emits code referring to user/f (or whatever the current namespace is)

19:28 In Common Lisp, the package is the same for both fs, so the flet overwrites the visible f lexically.

19:28 I'm not entirely certain that that's a perfect and perfectly accurate explanation, but it is my understanding.

19:28 tomoj: so that bug won't happen for users of your library, since their locals have a different package

19:29 Sgeo: Yes.

19:29 Also, when I first tried to write it, I used let, but that was a mistake, because functions are in a different namespace from other things. (f f) in Common Lisp refers to two different fs. The f function, then the f value.

19:30 Since flets and labels aren't used as often as let, that probably helps ameliorate the problem.

19:30 And is in fact the reason that some people believe that CL-style macros are only acceptable in a Lisp-2.

19:33 * Sgeo wonders if there are examples where Common Lisp style is better than Clojure style

19:33 Sgeo: I vaguely remember seeing an SO question where someone porting a CL macro stumbled upon the issue

19:34 I have to admit, I initially hated the way Clojure did things, but it makes far more sense to me now

19:34 Baldanders`: There's a semi-famous c.l.l Erik Naggum rant on the subject of hygiene and Lisp-Xs. He coul be a bit strong n how he put things, but it's interesting reading, IMHO. Of course this predated Clojure by a bit.

19:35 tomoj: does clojure satisfy his concerns?

19:36 Baldanders`: I think it does so a lot better than Scheme does, if I understand what Clojure does correctly.

19:37 But I am still learning Clojure. And I wouldn't presume to know what Erik would say about it ;).

19:37 Sgeo: Baldanders`, Scheme side-steps the issue entirely by not having CL-style macros, but its own thing which I don't understand at all.

19:38 Which apparently gives perfect hygiene but ... is harder to understand.

19:38 Baldanders`: Well, a lot of Schemes do have CL-style macros alongside hygienic macros.

19:42 tomoj: I hope someone implements expansion-passing style for clojure

19:42 Sgeo: expansion-passing style?

19:42 tomoj: (then I won't have to try to understand the paper..)

19:43 google has the correct results on top

20:41 amalloy: Sgeo: i read http://www.nhplace.com/kent/Papers/Technical-Issues.html a few weeks ago. long paper about the tradeoffs between lisp-1 and lisp-2. (a) it exposed me to some dangers i hadn't thought about in lisp-1, and (b) helped me see how clojure's model addresses a lot of the lisp-1 problems

20:43 unnali: Sgeo, tomoj: late to this party, but to get the equivalent of the CL code: http://ideone.com/zdcQOo

20:43 (i.e. just don't use syntax-quote due to the fact that it puts in namespaces)

20:44 Sgeo: unnali, `(~'f ~x) should also work, I think

20:44 unnali: true!

20:44 Sgeo: But I feel like 11 is the more correct answer

20:44 unnali: I'd be inclined to agree.

20:57 frozenlo`: Is there a way to make 'spit' create directories on the fly?

20:57 amalloy: $javadoc java.io.File

20:57 lazybot: http://docs.oracle.com/javase/6/docs/api/java/io/File.html

20:58 amalloy: hm, i thought there was a method to create parents, like mkdir -p

21:09 frozenlo`: Well at least I can create a directory with (.mkdir (clojure.java.io/file <some-path>...

21:10 amalloy: oh, mkdirs

21:11 frozenlo`: Wait, I think make-parents in clojure.java.io could do it.

21:11 Yup it works :)

21:11 Thanks for the hints!

21:30 ivan: can I monkeypatch something in a namespace before it loads?

21:31 it's too late after it loads; a bunch of functions then reference the old function

21:31 (also does anyone else use Windows and never want to see \r\n printed anywhere?)

21:36 Sgeo: ivan, I _think_ in newer Clojure you actually can change the function

21:36 After other things use it

21:36 I'm not sure

21:36 Unless it's actually called upon loading the namespace, of course

21:36 (doc alter-var-root)

21:36 clojurebot: "([v f & args]); Atomically alters the root binding of var v by applying f to its current value plus any args"

21:36 ivan: oh, thank you

21:36 Sgeo: yw

21:36 I might be wrong though. And/or it might be newer versions of Clojure.

21:38 Raynes: ivan: The idea is that usually you don't refer to the thing inside the var, but the var itself which is mutable. You can use binding to change explicitly dynamic vars, and with-redefs and alter-var-root to change all of them.

21:38 danlarkin: please don't go "monkeypatching" namespaces

21:39 you're going down the wrong path if you think you have to do that

21:39 Sgeo: I take it not a fan of Smalltalk or Ruby?

21:39 Raynes: I'm sure there are a interesting places where that'd be useful. Especially for experimentation and such.

21:40 Monkeypatching-like things have been useful for me for sandboxing and such.

21:40 ivan: maybe someone should not have implemented OS-inconsistent printing behaviors then

21:40 Raynes: There are usecases for this sort of thing. Not sure that is one of them.

21:40 TimMc: ivan: What's the specific problem?

21:41 danlarkin: there's like one or two usecases

21:41 and I'm gonna assume if he doesn't know about alter-var-root he's not tackling them

21:41 Raynes: I think it's better if he just explains his problem and let's people help him with a solution.

21:42 ivan: TimMc: nREPL in Emacs showing ^M (and I want to see ^M in files); files created with \r\n

21:42 but I should have my own printing functions and fix everyone's bugs, sure

21:42 TimMc: And it's doing this because you're on Windows?

21:42 danlarkin: no, you should submit a bug report

21:42 ivan: TimMc: yeah

21:43 danlarkin: not going to some assbackwards function injection nonsense

21:43 ivan: it's just for playing around until I find a better solution

21:43 TimMc: Sounds fine for your REPL, I guess.

21:44 danlarkin: if you solve it with hackery then it's solved for you, but if you submit a bug report (or better yet a patch) then it's fixed for everyone

21:44 TimMc: Why not both?

21:44 danlarkin: because monkeypatching is stupid and wrong

21:44 Raynes: Wow.

21:45 danlarkin: hahah

21:45 Raynes: Rawr.

21:45 TimMc: danlarkin: Look, if he's not shipping it...

21:46 Sgeo: I should make a language where monkeypatching is the ONLY way to do things

21:46 danlarkin: TimMc: that's how it starts..

21:46 TimMc: (I assume "he", because "ivan".)

21:46 danlarkin: slippery slope!

21:46 ivan: monkeypatch main to get started

21:46 TimMc: Sgeo: JS? Ruby?

21:46 Sgeo: TimMc, more extreme

21:49 Along the lines of monkeypatching main, yeah

22:02 yedi: is prismatic's graph library theoretically similar to using promises

22:10 ivan: yedi: I think it's far more advanced

22:10 yedi: their graph library also implies a global view everything, not necessarily the case with promises

22:10 though maybe they support working on a graph with unknown subgraphs, I dunno

22:14 yedi: I think of promises as going in the reverse direction of Graph, with a lot less global knowledge

22:37 tomoj: prismatic's graph library is released?

22:37 or just described?

22:42 ivan: just described

22:44 https://www.youtube.com/watch?v=A7de6pC-tnU I hope Christopher Petrilli is going to the conj as the official conj bootlegger

22:53 ynniv: is there a quickstart for clojurescript that gets me from clojure forms to a JavaScript string without all the tooling?

22:53 starting off with a command line invocation of a compiler that relies on an environment variable to a checked out repository seems… a little heavyweight

22:55 ivan: ynniv: https://github.com/emezeske/lein-cljsbuild

22:55 ynniv: maybe parenscript has spoiled me, but anything involving "lein" is not what I'm looking for

22:56 ivan: well, it can recompile your code in the background

22:56 ynniv: I'm at the repl. I have clojure forms. I would like a JavaScript string. go.

22:57 I don't want to manage external tooling, and I'm serving pages out of compojure

22:57 xeqi: how are you getting the compojure dep?

22:58 ynniv: lein deps? I don't understand your question.

22:58 xeqi: I misread - anything involving "lein" is not what I'm looking for as - not using lein

23:00 ynniv: oh, no. I mean, I want to load a library, pass it some forms, and get a string. I don't want to interact with an external process, or pre-compile js files.

23:00 xeqi: from a repl, the closest might be https://github.com/cemerick/piggieback

23:00 though thats still not quite what you want

23:00 ivan: I don't think ynniv wants a CLJS REPL, just a function to compile forms

23:01 ynniv: ivan: *nod*

23:06 ivan: ynniv: you might not like the size of the output before it's run through Closure Compiler's advanced_optimizations passes

23:06 I can't find the function you're looking for compiler.clj

23:06 perhaps because ClojureScript participates in Closure's multi-file goog.require/goog.provides system

23:08 ynniv: yeah, reading the source keeps going in circles involving shell outs. this looks far more tangled than I was hoping

23:09 xeqi: wonder if (partial cljs-eval (rhino-repl-env)) ; https://github.com/cemerick/piggieback/blob/master/src/cemerick/piggieback.clj#L77

23:10 * wonder if ... could do whats desired

23:11 ynniv: yeah, that calls cljs.repl/evaluate-form

Logging service provided by n01se.net