#clojure logs

2012-08-19

00:01Frozenlockuvtc: do you have the link to the blog post?
00:06FrozenlockYay! http://blog.fogus.me/2012/03/27/compiling-clojure-to-javascript-pt-3-the-himera-model/
00:22FrozenlockUsing the browser repl might be more pratical than inferior-lisp, as it doesn't have completion and docs anyway.
00:39emezeskeREPL - E = cat
00:40eggsbyhah, hadn't thought of that emezeske
00:40FrozenlockI don't get it...
00:43eggsbyFrozenlock: cat is a process that reads input, prints it out, and loops doing that forever so long as the process runs :p
00:45FrozenlockOhhhh
00:46FrozenlockI was trying to see the link.. well you know, cat.... meow
00:47emezeske^_^
00:48FrozenlockHimera doesn't evaluate in the browser, does it?
00:48FrozenlockRather: does it send the data to heroku to be evaluated?
00:49eggsbythat's my understanding
01:09muhoocljs repl in inferior lisp seems a lot more reliabl than nrepl with piggieback so far
01:10Frozenlock...but still no autocomplete or docs!
01:10FrozenlockI can't stay like that!
03:40ethanishey folks, is there a separate clojurescript irc channel, or is this an appropriate place to ask cljs-related questions?
03:43antares_ethanis: cljs is discussed in here
03:44ethanisgreat, anyone have experience specifying externs so advanced compilation works with an existing javascript project?
03:44ethanisI'm writing an application that targets the facebook javascript sdk
03:45ethanisand I'm using leiningen with cljsbuild
03:45ethanisI've specified an externs file that I made by hand
03:45ethanisit looks like this: https://gist.github.com/3393401
03:46ethanislein cljsbuild is definitely hitting this file
03:46ethanisbut when it does so, during the compilation process, it emits a series of warnings in vein:
03:46ethanisWARNING - accessing name FB in externs has no effect
03:46ethanisFB = {};
03:46ethanis^
03:46ethanisWARNING - name FB is not undefined in the externs.
03:46ethanisFB.api = function(location, callback){};
03:46ethanisand so on
03:47ethanisand not only does it emit warnings, but it ends up renaming the FB variable to a gibberish string, making the outputted script dysfunctional
03:47ethanisSO, with all of that background in mind, my question is:
03:48ethanishow can I wrangle my externs file so that cljsbuild/the closure compiler will make proper use of it and avoid renaming the global FB object?
03:49ethanisI'm trying to use https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js as a model
03:49ethanisbut jquery only has *functions* defined in the global namespace, whereas FB is an *object*
03:50ethanisI've found a similar issue discussed in the clojure google group: https://groups.google.com/forum/?fromgroups#!topic/clojure/VN6YzyJIg2s%5B1-25%5D
03:51ethanisbut no clear solution emerged
03:57michaelr`hello
03:58amalloyethanis: you probably want to ask closure folks, not clojure folks. like, maybe someone here knows the answer, but probably everyone there does
03:58ethanisalright, that's a very good point, thanks amalloy
04:05ethanisfor posterity: http://code.google.com/p/closure-compiler/source/browse/trunk/contrib/externs/facebook_javascript_sdk.js?r=1000
04:05ethanishooray
04:30ebaxtin emacs, is there a way to ident only the 'defn' you are editing?
04:34amalloyM-q if you have paredit on
04:37ebaxtamalloy: thanks :)
04:37amalloyebaxt: in future, you can try C-h a indent RET
04:39ebaxtamalloy: future?
04:39amalloyebaxt: next time you're looking for a function
04:39ebaxtamalloy: nice :)
04:43michaelr`clojure.tools.trace is goooood..
04:44antifuchsamalloy: note that C-h a only searches for interactive functions; M-x apropos RET for non-interactive stuff/variables, too (:
04:45amalloyantifuchs: is that different from C-u C-h a?
04:46antifuchsamalloy: oho, I didn't know about that!
04:46antifuchsI don't think that was in emacs 21 back when I learned (:
04:46antifuchsso thanks (:
04:50michaelr`how do you guys usually debug hideous problems somewhere deep down the call graph? do you also use clojure.tools.trace?
04:51_ulisesmichaelr`: I use ghetto debugging techniques which I'm not too proud of, i.e. bunch of println all over the shop
04:53michaelr`_ulises: that was also my method, but right now i'm using libraries not written by me which also use other libraries.. etc etc
04:54michaelr`and it's not really clear what calls what since it's written in cps style
04:54_ulisesmichaelr`: indeed the approach doesn't scale; I think I kinda got ok at reading stacktraces so I generally can figure out what's happening from reading those
04:54_ulisesoh
04:55michaelr`anyways, i think i've found the problem I've been banging my head at for quiete some time now
04:55_ulisesmichaelr`: excellent then
04:55michaelr`it took 1/2 hour using the tracing tool
04:55michaelr`super cool
04:56_ulisesmichaelr`: by the way, there's a debugger for clojure I used some time ago, by george hajad (probably misspelt) which was rather nice when I tried it
04:56michaelr`i never managed to make it work.. some day maybe i'll try again :)
04:57_ulisesinteresting
04:57_ulisesit was fairly painless for me to set it up
04:57_ulisesI just never got into the flow of using it I guess
05:57firesofmayHi, how do you create a webdriver instance for a particular version/platform using clj-webdriver?
07:02RaynesIt's 6AM. Do you know where your Clojure is?
07:07cmelbyeHi! Are there any clojure web frameworks that make it easy to use straight up HTML views instead of having to write HTML using a clojure DSL?
07:13antares_cmelbye: Noir and Compojure can use Mustache templates, for example, or anything you want
07:13antares_Hiccup is not a requirement
07:13antares_I use Noir with Stencil (https://github.com/davidsantiago/stencil)
07:23cmelbyeantares_, oh that looks awesome! so if you don't mind sharing, how do you structure your project's directories? like where would you put mustache template files
07:26antares_cmelbye: I keep them in src/resources/templates
07:26antares_it can be anything on the classpath under a well named directory, basically
07:26antares_I put src/resources on classpath via project.clj
07:27antares_then during deployment, if you package everything in a single "far jar", templates will be included as well
07:34cmelbyeantares_, ah okay, awesome. I think I've tried stencil, but I got a little confused on how to load templates. how would you load and render a template in src/resources/templates?
07:35antares_cmelbye: https://gist.github.com/05b81f8ab565f95df001
07:37cmelbyeantares_, so that file would be src/resources/templates/events/tagged.mustache? why is it just "templates/..." and not "resources/templates/..."? (sorry for the questions, I'm still new to this haha)
07:38antares_cmelbye: because it has to be a relative path on the classpath
07:39antares_and I put src/resources to classpath with :resource-paths ["src/resources"] (lein2)
07:40cmelbyeohhh okay, that makes sense! thank you so much, I'm going to give mustache/stencil a try - hiccup drove me crazy :)
07:40raeknote that "resources/" is on the classpath by default
07:42cmelbyeraek, like without "src/"? just a "resources" directory in the root?
07:42antares_cmelbye: yes, in the same directory where project.clj is
07:43cmelbyeah, interesting
07:51nz-cmelbye: there is also enlive
10:12jballanchow would one go about conditionally require'ing a ns only if it exists?
10:19gfredericksoh I saw that the other day
10:19gfredericksI think clj-http does that with cheshire
10:20gfrederickshttps://github.com/dakrone/clj-http/blob/master/src/clj_http/client.clj#L18
10:29jballancheh...ok, try/catch as I feared :(
10:29jballanc(I was hoping there was a way to check the classpath without having to catch the load error)
11:00llasramjballanc: You actually *could* do it that way, using clojure.java.io/resource (or the backing implementation functions), but I think catching the load exception is the more typical cross-language pattern
11:14casion,(reduce * (range 5))
11:14clojurebot0
11:14casionwhy doesnt that work?
11:14Chousukebecause range starts from 0
11:14casionok
11:14casionthank you
11:15casionsimple enough to fix :)
11:15gfredericks,(reduce * (range 1 5))
11:15clojurebot24
11:15casionyeah
11:16wmealing_1http://hastebin.com/nopuhemuca.lisp <-- you'd expect this to run for a long time.. right ?
11:16wmealing_1i mean while true
11:16wmealing_1apparently it stops before forever .. see http://hastebin.com/kijolineni.xml
11:18wmealing_1can someone tell me what i'm doing wrong
11:19gfrederickswmealing_1: daemon threads don't keep the jvm running right?
11:19azmtable
11:19azmuses clojure
11:19azmso I joined
11:19gfredericksif you don't set it as a daemon will it run?
11:19wmealing_1testing now
11:19gfrederickswmealing_1: it sounds like setDaemon(true) is the exact opposite of what you want
11:20wmealing_1you're right
11:20wmealing_1it keeps running
11:20wmealing_1either I completely misunderstand what a daemon is
11:20wmealing_1or someone else got it wrong
11:25KvaksI'm doing a fresh installation of clojure. I've got the lein script, run it's self-install procedure and I've installed emacs24. Question: Which emacs-packages (from the new emacs package system) do I need?
11:28hyPiRionKvaks: have you added the marmalade-repo?
11:29KvaksYes, I have (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/&quot;))
11:29Kvaks in my .emacs
11:31hyPiRionhttps://github.com/ftravers/PublicDocumentation/blob/master/clojure-development-setup.md
11:32KvaksThanks.
13:03sayyestolifeLet's say I have a structure like this ({:name "foo" :value 1} {:name "baz" :value 2} {:name "foo" :value 3}) and I'd like to convert into something like ({:name "foo" :value 3} {:name ""baz" :value 2}). That is, I'd like to remove those who has a certain key (:name in this case) so that it only exists one per unique name.
13:04_ulisessayyestolife: see merge-with
13:04_ulises,(doc merge-with)
13:04clojurebot"([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
13:07sayyestolifeBut, I don't want to merge them all together, I'd still like to have them in separate maps in a list/vector
13:08sayyestolife_ulises: Isn't that one for merging together into a single hash-map?
13:08gfrederickssayyestolife: so you want to prefer the later ones when the :value matches?
13:09_ulisessayyestolife: indeed, that's for merging, that's what I thought you wanted
13:09_ulisessayyestolife: oh, I just re-read your question, I thought you wanted merging with +
13:09sayyestolifegfredericks: the :value doesn't matter, I want to have so that I don't have any duplicates of :name
13:10gfrederickssayyestolife: oh right sorry; but prefering the last one with any given name?
13:10sayyestolifeyea, gfredericks I think so¨
13:11gfredericks,((fn [recs] (vals (reduce #(assoc %1 (:name %2) %2) {} recs))) ({:name "foo" :value 1}
13:11gfredericks {:name "baz" :value 2} {:name "foo" :value 3}))
13:11clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
13:11gfredericks,((fn [recs] (vals (reduce #(assoc %1 (:name %2) %2) {} recs))) ({:name "foo" :value 1} {:name "baz" :value 2} {:name "foo" :value 3}))
13:11clojurebot([:value 3])
13:11gfrederickswell that's sure not what I meant
13:11gfredericksah right
13:12gfredericks,((fn [recs] (vals (reduce #(assoc %1 (:name %2) %2) {} recs))) [{:name "foo" :value 1} {:name "baz" :value 2} {:name "foo" :value 3}])
13:12clojurebot({:name "baz", :value 2} {:name "foo", :value 3})
13:12gfredericksso that one will return the results in an undefined order, so as long as you're okay with that
13:12llasramHuh. You could write a lazy `distinct-key` which would only emit the first and be v generic, but I think doing the last with a particular key-value is like a highly-specific-business-rule sort of thing
13:12sayyestolifegfredericks: thanks!
13:13gfredericksnp
13:24casion,(mod -4 3)
13:24clojurebot2
13:24casionthat… that is confusing
13:24llasram,(rem -4 3)
13:24clojurebot-1
13:25casionwhat's the point of having mod work like that?
13:25danlarkin(doc mod)
13:25clojurebot"([num div]); Modulus of num and div. Truncates toward negative infinity."
13:25danlarkin(doc rem)
13:25clojurebot"([num div]); remainder of dividing numerator by denominator."
13:26Peregrinetruncates towards 0 would seem more logical but it's current behaviour is documented
13:28llasram&(map #(mod % 3) (range -3 4))
13:28lazybot⇒ (0 1 2 0 1 2 0)
13:28llasramcasion: That's why
13:29llasram&(map #(rem % 3) (range -3 4))
13:29lazybot⇒ (0 -2 -1 0 1 2 0)
13:29casionthat does not make sense to me
13:30llasram*shrug* It matches the formal definition of modulus
13:31gfredericksthere are two ways you might want it to work and there is a function for each
13:31PeregrineWhich formal definition of the modulus operator.
13:31PeregrineI've never seen a formal definition and there are 2 logical ways truncated towards 0 or truncated towards negative infinity
13:31gfredericksjust making one up on the spot, (mod x n) returns a number in (range n) such that (- x (mod x n)) is divisible by n
13:31casionPeregrine: ditto
13:32gfrederickswell I guess the other one works for that too
13:32casion-4 % 3 gives -1 in C, which I'd expect
13:32casionand it seems most languages give -1
13:32PeregrineAs far as I recall most programming languages I have used truncate towards 0.
13:32gfredericksno wait it doesn't
13:32gfredericksin modular arithmetic you want things to be in (range n)
13:33gfredericksso returning a negative wouldn't make sense
13:33PeregrineIt's an arbitrary decision though whether you should truncate towards 0 or negative infinity
13:35llasramExactly, gfredericks. In modular arithmetic, -1 is congruent to 2. So that's what `mod` returs
13:35llasramer, -1 congruent to 2 (mod 3), that is
13:35gfredericksif you're not doing modular arithmetic, then you might want some other behavior; like never returning a larger number
13:35PeregrineYes, I know wikipedia and all but I don't want to search for actual references http://en.wikipedia.org/wiki/Modulo_operation
13:36PeregrineThe method clojure uses should more accurately be described as floored division not truncated division
13:38Peregrineerr wait clojure uses the euclidian definition.
13:39PeregrineIt's easy enough to define a modulo operation that behaves where it truncates towards 0 but the answer is there are lots of definitions of modulo and any of them are valid.
13:40PeregrineIf i didn't have to search boxes for it I would look to see what Knuth says.
13:42gfrederickshe says "Who are you and how did you get into my house?"
13:42llasramHuh. The Wikipedia Knuth citation on the page you linked to doesn't include a page or even volume number!
13:43Peregrinegfredericks, likely so but luckily he's written about it apparently although it's a horrible citation on wikipedia
13:45PeregrineAhh indeed Knuth uses floored divisio. According to Knuth (mod -4 3) is -2
13:48PeregrineErr no (mod -4 3) is 2 according to Knuth. The result has the sign of the divisor.
13:48gfredericksI guess (range n) doesn't mean much when n is negative
13:48Peregrine,(mod -4 -3)
13:48clojurebot-1
13:48Peregrine,(mod 4 -3)
13:48clojurebot-2
13:49llasram&(map #(mod % -3) (range -3 4))
13:49lazybot⇒ (0 -2 -1 0 -2 -1 0)
13:57FrozenlockIs there a cljs wrapper for http://code.google.com/p/flot/ ? (I don't think so... but better to ask anyway)
14:05casion,(map #(mod % 12) (range -40 40 12))
14:05clojurebot(8 8 8 8 8 ...)
14:05casionok, that makes sense then
14:19FrozenlockNvm that, I'd rather have this one http://www.filamentgroup.com/examples/jqueryui-visualize/ It uses the data from an html table, so it's still available for those with screen readers!
14:43TimMcPeregrine: All I know is that I'm happy that Clojure chose the modulo they did.
14:47TimMc&(range -5)
14:47lazybot⇒ ()
14:47jballanchas anyone come up with a way to deal with "fold" if you don't have reducers?
14:47jballanci.e. write something compatible with 1.4 and 1.5
14:47jballancso far, this is what I have: https://gist.github.com/3396985
14:54PeregrineTimMc, it's easy enough to write a round towards 0 modulo with what clojure has so it's fine the way it is
15:00TimMcPeregrine: rem doesn't do what you want?
15:01PeregrineI wasn't the original person confused about modulo so I haven't explored if rem does what I would expect with regards to modulo truncating towards zero.
15:02PeregrineI'm just saying if I needed modulo truncating towards zero instead of towards negative infinity I can see an easy way to write it with the existing mod
15:04PeregrineAnd that claiming that clojures mod follows the formal definition of modulus is odd since I'm unaware of a formal definition and I've found at least 3 formal definitions of the modulus operator.
15:06jasonjcknWhat clojure debugger options do I have which have step in, step out, step over, etc, type debugging. I'm going to try jswat right now. That's the only one i'm aware of.
15:08PeregrineInterestingly according to wikipedia clojure's mod differs from javas % operator.
15:20casionPeregrine: from what I can tell, C/java, clojure/haskell, and python/ruby all handle modulo differently
15:20casionwhich is why I was confused
15:20casionfrom what I understand now, mod in clojure is modular division, not modulo
15:21casion% in C/java is euclidian modulo
15:21casionand python/ruby have different operators for the different concepts
15:25jasonjcknis anyone working on a debugger for clojure?
15:25jasonjcknjswat is really bad but all the pieces are there
15:27xeqijasonjckn: hugod has been working on https://github.com/pallet/ritz
15:27xeqitheres also cdt
16:04jasonjcknxeqi: intellij actually has a great debugger, playing with it now
16:04jasonjcknritz looks amazing too, i'd rather stay in emacs
16:14bosieusing leiningen, shouldn't putting this http://pastebin.com/90ccMpRh in my ~/.lein/profiles.clj file and then doing "lein repl" give me access to the plugin?
16:34FrozenlockI'm a little confused.. how can I add an external JS library? (not from google closure)
16:36eggsbyFrozenlock: couldn't you just include it and use it's globals via js/jQuery or w/e
16:37_ulisesFrozenlock: don't have much experience with CLJS but I reckon you have to include it in your html and then access it via js/*
16:37_ulisesFrozenlock: what eggsby said
16:38FrozenlockSo something like that? (ns my-namespace (:require [jquery.flot.js :as flot]))
16:38FrozenlockWith (include-js "path to my js") in my common html wrapper?
16:39bosieok found a way
16:40bosiehttp://pastebin.com/7UPVy3X3
16:40bosiethats the same?
16:44Frozenlockgoog.require could not find: jquery.flot.js :(
16:46eggsbyFrozenlock: :require is for things registered as closure models iirc, instead you'd just have the <script src="lib.js"> before your cljs.js file and call it via (.someMethod js/lib my-args) afaik
16:48eggsbys/model/module
17:04bosiecould someone please tell me how i can get this going: https://github.com/mmcgrana/clj-stacktrace
17:06llasrambosie: Easiest way is probably to switch to lein 2.x -- it's integrated into the `lein repl` REPL in 2.x
17:07bosiellasram: i am on lein
17:07llasramVersion 2 or 1?
17:07bosie2
17:07bosiehttp://pastebin.com/S0AtTh1L
17:07llasramThen you've already got it
17:07llasramHmm
17:08llasramOk, maybe I'm mistaken and am just sowing confusion. I use SLIME, so don't have direct experience
17:09llasramOh, looks like I might have been wrong? Weird. That never happens :-)
17:09bosiehaha
17:09llasramAnyway, doesn't the clj-stacktrace README have a copy-paste example of how to integrate with lein 2 ?
17:10bosiellasram: thats what i did
17:10bosiellasram: i did the first thing for leiningen 2.x https://github.com/mmcgrana/clj-stacktrace#leiningen
17:11llasramHmmm
17:17xeqithat dependency map looks weird, not sure if it would work
17:17FrozenlockI guessed I should use :foreign-libs in my project.clj... but now `lein cljsbuild auto' just hangs...
17:17llasramHuh. I didn't even notice that. It does work, but I agree not for good-seeming reasons
17:18bosiexeqi: its straight from the author's github
17:18bosiexeqi: how should it look/
17:18bosie?
17:19xeqi[[clj-stacktrace "0.2.4"]]
17:20bosielike this: {:user {:plugins [[clj-stacktrace "0.2.4"]]}} ?
17:20xeqino, :plugins is not the same as :dependency
17:20xeqi* :dependencies
17:20bosiek
17:21bosiei added {:user {:dependencies [[clj-stacktrace "0.2.4"]]}}
17:21bosiesame error
17:21llasrambosie: What effect do you expect to see?
17:22llasramOr want to see, I supose
17:22bosiellasram: not an error when i do (use 'cli-stacktrace.repl) for starters
17:22bosieand a formatted stack trace like this: https://github.com/mmcgrana/clj-stacktrace#leiningen
17:22bosiehttps://github.com/mmcgrana/clj-stacktrace#clj-stacktrace
17:22xeqido you have the :injections lines as well?
17:23bosiexeqi: no, removed them
17:23bosieadded them now
17:24llasramIt seems not to be working with nrepl... That's the issue. You're getting clojure.repl already `used`d, and the injections aren't having the expected effect
17:24bosiellasram: hm
17:25bosiegreat
17:28llasramlol. comment in nrepl "TODO customizable exception prints"
17:29bosieis this normally the way clojure libs are?
17:29bosiewrongly documented?
17:29llasramNo
17:29antifuchss/ clojure// (-:
17:29bosieantifuchs: coming from ruby i am used to it ;)
17:30antifuchshah, yeah, same
17:30llasramHaha. The REPL stuff is undergoing faster-than-normal evolution, and the majority of Clojure users have been using SLIME, which skips much of this stuff
17:30bosiellasram: as an ide user i feel alienated anyways :/
17:31llasramBut now that nrepl.el is getting stable, the Emacs community will probably switch, which should stablize things
17:31llasramSwitch to emacs!
17:31bosiellasram: no way, i am a vim user
17:32llasramvim is an IDE?
17:32bosiellasram: no but intellij is
17:32llasramAnyway, I have an apparent solution for you
17:32bosiellasram: but if i have to use a non-ide its vim
17:32RaynesI've been pretty satisfied with Emacs and evil-mode.
17:33llasramIn the example :injections form, change switching out clojure.stacktrace/print-cause-trace to clojure.main/repl-caught
17:33llasramThen you'll get a pretty stack trace on exceptions
17:33llasramFor certain values of "pretty" :-)
17:34FrozenlockAre libraries automatically available when doing `<script type="text/javascript" src="...'?
17:35bosiellasram: no idea what you mean so i figure i have to learn more clojure before i get pretty ;)
17:36bosieRaynes: how does evil-mode handle the keyboard shortcuts?
17:37bosieRaynes: or do you have to rebind everything manually?
17:38Raynesevil-mode doesn't replace Emacs's keybindings.
17:38RaynesIt adds Vim stuff on top of it all.
17:38RaynesYou still need to learn some Emacs.
17:38bosieRaynes: yes but vim stuff is also keybindings, so you never leave homerow
17:38llasrambosie: Try this: https://www.refheap.com/paste/4492
17:38RaynesCan't help you there. I don't understand the fascination with homerow everyone has.
17:39llasramI use a chording keyboard that only has a home row
17:39llasram(jk)
17:39bosieRaynes: efficiency, speed, prevents CTS
17:39RaynesOh thanks, I understand now. ;)
17:40bosieRaynes: i wasn't joking, at least for me its the case
17:40bosiellasram: right
17:40RaynesOkay.
17:40bosiellasram: starting repl with lein repl
17:41bosiellasram: first thing i do ("f") doesn't give me a full stacktrace
17:41llasramReally?
17:41bosieyes
17:41bosiegives me one line
17:41llasramDoes for me :-()
17:41bosiemeh
17:41llasram:-( even
17:41llasramWell, I tried
17:41bosieexactly. thank you very much
17:41llasramWhat version of Clojure in the projcet, OOC?
17:42bosieproject?
17:42clojurebotproject euler is http://ProjectEuler.net
17:42bosiellasram: no project
17:42arrdemcan I get some help with `lein uberjar`? I'm trying to actually package and deploy a project for the first time and when I run the generated jar I get an error that the .core class is not found. ideas?
17:43llasrambosie: Oh, wow. This looks like a lein bug, but I'm not seeing the :user profile applied if I launch lein repl outside of a project
17:43llasramTry doing it w/in a project directory
17:43bosiesec
17:43llasram(most people seem to keep a scratch project sitting around for this sort of thing)
17:45bosiellasram: started
17:45bosieOMG
17:45bosiellasram high five
17:45llasramyay!
17:45llasramMy work here is done :-)
17:45bosievery pretty indeed
17:45bosiethank you very much indeed
17:48dnolenFrozenlock: I take it you haven't done much JS :) the order of script tags matters - but yes.
17:49Frozenlockdnolen: I haven't done any at all, which is why I find it so aggravating... EVERY article/blog post about cljs assumes the user knows about JS :(
17:50dnolenFrozenlock: I imagine that will always be the case. Perhaps higher levels frameworks / tools can hide more of that one day.
17:51FrozenlockO-M-G I just did it
17:52Frozenlock(used the library I wanted, that is)
17:52FrozenlockNow, I must never close my REPL again...
18:03FrozenlockHow does the js data translate to cljs? The tutorial I'm following says `{ label: "Foo", data: [ [10, 1], [17, -14], [30, 5] ] }'... this would be {:label "Foo" :data [[10 1] [17 -14] [30 5]]} ?
18:08arrdem\exit
18:18gfredericksFrozenlock: if you're interoping with something JSy, then those are not interchangeable no
18:19gfredericksin the same way that if you want to use a jave method that wants a j.u.HashMap you cannot give it {}
18:19FrozenlockI see..
18:19FrozenlockI've found this http://stackoverflow.com/questions/10157447/how-do-i-create-a-json-in-clojurescript?rq=1, is there an equivalent function now in cljs.core?
18:20Raynesgfredericks doesn't know anything.
18:26gfredericksFrozenlock: I'm using Raphael to good effect in cljs
18:27FrozenlockYeah this looks very nice, especially the fact that it's using svg!
18:28FrozenlockDo you have any online stuff?
18:29gfredericksI suppose not with that combination
18:29gfredericksI might put it online in a month or so
18:36FrozenlockExcept apogee, is there other cljs svg libraries?
18:48lynaghkFrozenlock: most of the data visualization stuff we do is SVG in cljs via the C2 library
18:52nkoza2the algorithmic complexity for (concat mylist '(3)) is O(n) or O(1) ? Do the lists keep a reference to his tail?
18:53gfredericksultimately O(n), but it returns a lazy seq
18:54gfredericksso it'll be amortized over the length of your seq
18:54nkoza2can you append a element to the end of a list in O(1) time?
18:54gfredericksnot a list, no
18:54gfredericksa vector yes
19:04amalloyand a lazy-seq in O(1) time, sort of
19:04Frozenlocklynaghk: thanks!
19:05amalloynkoza2: the point is that laziness makes algorithmic analysis more complicated. concat returns in constant time, but adds a small amount of overhead to each access of the first list, so in that sense it's O(n)
19:06nkoza2concat is wrapping the original list in a lazy-seq structure that knows when to jump to the appended element?
19:06amalloyinterestingly, unless i'm mistaken, the relevant N there is the size of the first collection, not the second, so (concat [1] coll) is O(1) in every interesting sense, whereas (into [1] coll) takes linear time in the size of coll
19:07amalloynkoza2: yes
19:07nkoza2ahh, I see, thanks
19:08nkoza2because this the [insert-at-the-front + reverse when all items inserted] idiom seen in other languages (as Erlang) is no so common in Clojure, right?
19:09gfrederickswell clojure has other data structures
19:09gfredericksso if you want to build something up starting at the left, vectors are great for that
19:10amalloygfredericks: yes, but i'd say lazy sequences are a more relevant reason
19:10amalloylike, you can take a cons+reverse algorithm and make it a vector+conj alforithm, but lazy sequences make more sense since we deal with so many infinite sequences
19:10gfrederickswell you wouldn't want to use concat to build something up from the left
19:10gfredericksthat would be O(n^2)
19:10gfredericksif you use it for each item
19:11amalloyand also blow the stack
19:11gfredericksthat sounds familiar
19:11amalloy&(first (reduce concat (range 10000) []))
19:11lazybot⇒ 0
19:11amalloyerrrr
19:11amalloy&(first (reduce concat [] (range 10000)))
19:11lazybotjava.lang.StackOverflowError
19:11gfredericks&(concat [] 3)
19:11lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
19:12gfrederickswhy did that first one return 0?
19:12amalloygfredericks: because it starts with (range 10000) and reduces 0 elements into it
19:12gfredericksoh right
19:12amalloy(= n (reduce f n []))
19:12gfredericksI misorderead the args
19:12nkoza2the reduce order of application is ensured?
19:13gfredericksyep
19:13amalloyreduce is foldl
19:17nkoza2ok, thanks
19:36Frozenlo`lynaghk: My brain just melted because of your cljx
19:41splunkmutt
19:41splunkoops
19:43qmx|brbdoes the amotoen creator hangs around here?
20:04lynaghkFrozenlo`: yeah, I have mixed feelings about that project. It does what I need it to, though.
22:20kendruI'm coming to Clojure from a background of primarily PHP and Ruby (no Java), and I was wondering if it would be worthwhile trying to learn the Java libraries first or to just jump right into Clojure
22:20amalloykendru: you should probably stay away from java until you find a need for it
22:21gfredericksnot to mention "the java libraries" ... well there are a lot of them.
22:21gfredericksand they're not annotated with "useful for clojure" and "not useful for clojure"
22:21amalloysome stuff leaks through for sure, but you can do a lot with very little knowledge of java. the most-common functions on java.lang.String are probably the first you'll need java for
22:22kendruamalloy: Thanks, the String functions are the ones that I have seen most often in sample code.
22:22gfredericksman I almost never use those
22:22gfredericksprobably because I forget they are there
22:23kendruit's good to know that clojure is mature enough that i won't be needing java interop at every turn.
22:25jkkrameramalloy: just sent you (flatland) a fix for ordered-map FYI
22:28amalloyjkkramer: thanks for the notice. i apparently don't have that repo Watched since github's notification changes
22:28amalloywas it throwing an exception? the code you replaced looks like it wouldn't work at all
22:29jkkrameryeah it was
22:30jkkramerClassCastException for the erroneous type hint
22:31amalloyjkkramer: 1.3.2 is on clojars
22:33jkkrameramalloy: awesome thanks. everything working as expected now
22:34amalloythat's good, cause i didn't run any tests. took travis's word for it (thanks antares & Raynes!)
22:35jkkramerheh
23:43Gnosis-I added -Xmx128m to LEIN_JAVA_CMD in the lein shell script. Is this a bad idea?
23:56amalloyi'm surprised so many people want ordered maps. i wrote ordered just to demonstrate clojure has matured enough to make it possible without writing any java; i don't see them as being that useful very often