#clojure logs

2012-05-27

00:10emezeskelynaghk`: All you should have to do is clone it and then run bin/test-install.sh
00:10emezeskelynaghk`: It might complain at the end if you don't have phantomjs installed, but that's no biggie
00:11emezeskelynaghk`: I've gotta reboot into windows for some diablo; I'll probably be back tomorrow sometime
00:16lynaghk`emezeske: okay, rad
00:28amalloy$mail emezeske have you tried vmware? it's a lot more convenient than dual-booting
00:28lazybotMessage saved.
00:28Raynesamalloy: Yeah, but doesn't that have a significant impact on performance?
00:29amalloyyou don't need a ton of CPU and RAM to run emacs, dude
00:29RaynesOh, you run Ubuntu from Windows?
00:30RaynesThat's evil and sick.
00:30amalloyyes
00:30muhooalmost, but the :tr's are lists not vectors: https://www.refheap.com/paste/2884
00:30RaynesYou're not worthy of your computer nor your monitor.
00:31muhoorunning ubuntu from windows is fairly common. if you need windoze for games, but ubuntu for work, bob's yer uncle
00:31gfredericksI run ubuntu vm from a macbook pro at work; it's plenty fast
00:31amalloywhat in...muhoo, what the hell is that
00:32muhooamalloy: brain fart, after reading that little table thing above
00:32muhoogive it a vector of vectors, and get an html table. maybe.
00:32scottjcan you guys move windows on linux guest w/o redraw lag?
00:32Raynesmuhoo: I don't think you're calling vector enough.
00:32amalloyscottj: yeah
00:32muhooamalloy: is there a less ugly way to force everything to be dam vector, not a list?
00:33amalloyi run it in seamless mode with no problem
00:33amalloy(defn tablify [head vv] [:table [:th head] (for [r vv] [:tr [:td r]])])?
00:33Raynesamalloy: I guess if you run it full screen, you can't really tell you're in Windows?
00:33gfredericksscottj: I use xmonad so the question doesn't really apply
00:33Raynesamalloy: Don't you mean (vec (for ..))?
00:34amalloyno, i don't because that would be incorrect
00:34RaynesBut why do you need a vector all over the place?
00:34muhoointo maybe
00:34amalloyyou want that to absolutely NOT be a vector, which is why muhoo's snippet is so bizarre
00:34muhooamalloy: that's it
00:35muhooamalloy: no, actually that's wrong
00:35muhooalmost. i need each item to be it's own td, is how i ended up with that bizarre mess
00:36gfredericksso just one tr?
00:36scottjamalloy: do you have a regular integrated video card?
00:36amalloyscottj: no, i have a recent gaming card
00:36amalloythough until recently i had a three-year-old gaming card and that was fine too
00:37scottjamalloy: ahh, cause I tried it on a brand new pretty good laptop with integrated card recently and wasn't able to get it to be smooth
00:37amalloymuhoo: the point is to only use vectors to denote new tags
00:37amalloyuse lists to group content inside of existing tags
00:37Raynesamalloy: It doesn't need to be a vector, but puppies will continue to live it is one. You confused me when you implied that it wouldn't work at all if it was a vector.
00:38RaynesIt *would*, indeed, continue to work if it was a vector, right?
00:38amalloyno
00:38RaynesWhat are we working with here? Hiccup?
00:38muhoo&&(let [vv [[1 2] [3 4] [5 6]]] [:table [:th "head"] (for [r vv] [:tr (for [i r] [:td i])])])
00:38lazybotjava.lang.RuntimeException: Unable to resolve symbol: & in this context
00:38muhoo&(let [vv [[1 2] [3 4] [5 6]]] [:table [:th "head"] (for [r vv] [:tr (for [i r] [:td i])])])
00:38lazybot⇒ [:table [:th "head"] ([:tr ([:td 1] [:td 2])] [:tr ([:td 3] [:td 4])] [:tr ([:td 5] [:td 6])])]
00:38muhoohiccup
00:38RaynesI guess I don't know how hiccup works then.
00:38amalloy[:table [[:tr ...] [:tr ...]]] is incorrect hiccup markup
00:39muhooright, it should be [:table [:tr [:td 1] [:td 2]] ..
00:39amalloymuhoo: looks fine
00:39muhoonot [:table ([:tr ([:td 1....
00:39amalloymuhoo: doesn't matter
00:40amalloytry it
00:40muhoohaha, great, you're right! thanks!
00:41amalloyif you like, you can imagine that hiccup throws away all the ()s in the forms before rendering thme
00:41muhoothat's very helpful, thanks, did not know that
00:41omasanoriscottj: I'm using Core i3 (probably SandyBridge) laptop with Ubuntu guest on VirtualBox w/o (almost) lag
00:44hiredmansomething about 20,000
01:25muhoois this clever or insane: https://www.refheap.com/paste/2885
01:42serpent223hi
01:43serpent223can't get this example to run: http://pastebin.com/ae1dHJTS
01:43serpent223error is ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IRef for the defmulti
01:43serpent223any idea?
01:44serpent223tried clojure 1.[2-4].0
01:44muhooit wants an atom
01:45muhooor something that can be dereferenced, a var maybe?
01:46serpent223would probably make sense to store the hierarchy in an atom...
01:48serpent223yes, does work with an atom -- thx!
01:48serpent223a hint in the docs would be nice though... :)
03:14amalloymuhoo: it's a clever approach, but surely just using an atom would be easier than repeatedly def-ing stuff
03:16amalloy(defn reloader [f] (let [srv (atom nil)] (fn [] (when @srv (.stop @srv)) (reset! srv (f)))))...(def reload (reloader -main)) (reload) (reload)...
03:18amalloynot actually a threadsafe use of an atom, but since you're just doing it at the repl it should be fine
04:45PKHGhallo, new to clojure and esp. lein on Vista, some help needed to be able to start ;-)
04:47PKHG... going to coffee .. ==> afk for a while
05:01`rand`pkhg_afk: you'll enjoy playing with Clojure--and Leiningen is a great build tool. Are you using Emacs?
05:04PKHGrand: back and thanks for giving a sign of life... yes Emacs user I am ..
05:05`rand`Great! Do you have swank-clojure installed?
05:06PKHGyes it worked ... if I use Mx slime
05:07PKHGclojure ? no not swank-clojure
05:07PKHGslime use SBCL (steel commen lisp or so)
05:08PKHGso how to use clojure in Emacs?
05:08scottjPKHG: M-x clojure-jack-in or lein swank and then M-x slime-connect
05:09PKHGhmm can try clojure-jack-in but do not know if emacs does know ...
05:09`rand`pkhg: Install swank-clojure by typing lein plugin install swank-clojure 1.3.4, then what scottj said. :)
05:10Dvyjonesclojure-jack-in made learning emacs worth it by itself.
05:10PKHGbut LEIN does not yet work nice on Vista (I am not Linux) ..
05:10`rand`er, 1.4.2
05:11`rand`Ugh--install Virtualbox.
05:12RaynesAnd why would you use Vista?
05:12PKHGtoo slow ... (have Ubuntu, but that behaves not good either ... sometimes it does something without seeing what and why and how long)
05:12RaynesThat's like the antiOS, isn't it?
05:12raekPKHG: do you get an error when you try to install it?
05:12PKHGRaynes: don't let us talk about that ;-)
05:13`rand`try Arch or Mint.
05:15PKHGTC:\Astro_PKHG>lein.bat install swank-clojure
05:15PKHGWrong number of arguments to install task.
05:15PKHGExpected ([project] [project-name version])
05:15raek(whether you are using Emacs or not you need Leiningen)
05:15`rand`lein plugin install swank-clojure 1.4.2
05:15DvyjonesPKHG: lein.bat plugin install swank=clojure 1.4.2
05:15DvyjonesPKHG: Remember the "plugin".
05:15DvyjonesAlso, s/=/-/ :P
05:16PKHGtrying ...
05:16raekif you use lein2, you install plugins in another way
05:16raekPKHG: are you using 1.x or 2 preview?
05:16PKHGseems I need maven Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
05:17PKHG??? no idea waht 1.x or 2 meand (newbie: clojure since this morning )
05:17`rand`ah--have you run self-install yet?
05:17PKHGI think I have to install maven first ...
05:18DvyjonesPKHG: Try lein.bat self-install
05:18PKHGC:\Astro_PKHG>lein.bat self-install
05:18PKHG"C:\Users\Peter\.lein\self-installs\leiningen-1.7.1-standalone.jar" already exists. Delete and retry.
05:18PKHGC:\Astro_PKHG>
05:18PKHGreally delete?
05:18PKHGoh will rename ..
05:18raekit looks like you have already done that step
05:19`rand`lein deps, maybe?
05:19raekPKHG: can you run "lein repl" and get a repl?
05:19PKHGmoment
05:19PKHGyes ;-)
05:19PKHGand (exit) works too ;-)
05:20raekalso, the "Unable to download the artifact from any repository" message could be cause by a typo. are you sure you typed "lein plugin install swank-clojure 1.4.2" exactly like that?
05:20PKHGI think exact ...
05:20raekPKHG: ok, then lein 1.7.1 shold be installed ok
05:20PKHGbut I do not have maven yet
05:20raekI think those part is included in lein's jar file
05:20raekbut I'm not 100% sure on that
05:21`rand`part: you do, thus the error.
05:21`rand`er, pkhg
05:21PKHGconfused ...
05:22PKHGhm you mean in the jar maven is included?
05:22raekyes
05:22PKHGok good to know ...
05:22raekthe exception comes from "org.apache.maven.wagon.ResourceDoesNotExistException". thus it must be somewhere on your computer
05:22PKHGso I have some lein working (the one with cloned with git does not work) ..
05:23raekdon't use the bleeding edge development version if you are just going to use it
05:23raekyou also need lein ro build it... :-)
05:23raek*to
05:24PKHGoh maybe I had a typing error swanj-cloure-1.4.2.jar is created ... (tried again lein plugin install swank-clojure 1.4.2)
05:24PKHGso now I do what in emacs?
05:24PKHGand have to find it first where that jar lives ... moment
05:25raekPKHG: you only need to install one emacs package: clojure-mode
05:25`rand`M-x clojure-jack-in
05:25PKHGclojure-mode needs el files ... searching or do you have a link raek?
05:26raekPKHG: do you have emacs-starter-kit, ELPA or some other package.el?
05:26`rand`M-x package-list-packages
05:26PKHGnever used start kit (so I do no know)
05:26raekif you have, all you need to do is M-x package-install RET clojure-mode RET
05:26PKHGwill look for list-packages ... moment
05:27raekif not, install package.el using these instructions: http://marmalade-repo.org/
05:27PKHGno Mx pac gives nothing ...
05:27PKHGok ... looking (trying) ... takes some time
05:28madsyPKHG: Novice-tip for SLIME: C-c C-c interrupts swank if the REPL hangs up. C-c M-o clears the REPL history.
05:28madsyAnd set *print-length* to something sensible so you don't get spammed :-)
05:29PKHGpackag-list-packages works! ... so now (reading advice ... moment)
05:30`rand`I on clojure-mode, then x
05:31raeka buffer with compilation errors may pop up when you install clojure-mode. this is normal
05:31PKHGraek: install package does not know about clojure ;-( so more help needed ;-)
05:32`rand`C-c C-o clears just the last output, which can be useful.
05:32raekbrb 5 mins
05:32PKHGbrb = ... (going to coffee?)
05:32`rand`pkhg: clojure-mode isn't listed?
05:33PKHGno
05:33`rand`argh!
05:33PKHGyes but will be solved ... ;-)
05:33PKHGsooner or later ...
05:33`rand`try M-x package-install, as raek suggested
05:34PKHGhttps://github.com/jochu/clojure-mode a good link/
05:34PKHG?
05:35`rand`M-x package-install RET clojure-mode
05:35`rand` RET
05:36PKHGrand: will try your suggestion ... with RET
05:36PKHGno match ...
05:37`rand`You could clone that repo and add it to your load path--not sure where that is on Windows.
05:37`rand`What's in your .emacs?
05:38PKHGcd c:/Users/Peter/AppData/Roaming/test && lein jack-in 1187: exited abnormally with code 1. so it is directory problem
05:38PKHGcd c:/Users/Peter/AppData/Roaming/test && lein jack-in 1187: exited abnormally with code 1. directory problems
05:39PKHGsorry for twice ..
05:39`rand`np
05:40PKHGrand: What's in your emacs? do not understand what you mean with this question ...
05:40PKHGcoming closer ;-)
05:40`rand`Were you in a clojure buffer when you ran clojure-jack-in?
05:41PKHGprobably not ...
05:41`rand`.emacs is the emacs config file
05:41PKHGHow to do ..
05:41`rand`Is Roaming a lein project?
05:42`rand`e.g., lein new Roaming
05:42PKHGhmm ?? I have a running lime.bat using /users/peter/.lime but emacs uses */Appdata/Roaming .. I think that is the problem .. how to tell emacs to use as home /users/Peter ???
05:42lazybotPKHG: Yes, 100% for sure.
05:43`rand`Vista uses AppData/
05:44PKHGyes and no ...
05:45PKHGdepends on software ...
05:46`rand`Modify your Emacs shortcut, change the Start in folder.
05:48raekPKHG: I think you need to set your emacs exec-path so it can find lein
05:48PKHGyes sound good ...
05:49PKHGtrying to save this chat file ... for your advices ;-) (not yet succeeded)
05:49PKHGsucces ;-)
05:50PKHGthanks guys ... I am close and will report later ;-)
05:51PKHG(by the way am 70+ retired mathatician ;-)
05:51PKHG_afk...
05:51`rand`Cool--I'm using Clojure right now for math. ^_^
05:52aperiodicPKHG_afk: what did you focus in?
05:52PKHGrand: and I am on a course 'machine-learning' of Stanford U ;-)
05:52PKHGBlender
05:53`rand`Very cool--love OCW.
05:53PKHGnot stirring eating things but the 3D Blender ...
05:54PKHGrand: translate for me OCW = ???
05:54lazybotPKHG: Oh, absolutely.
05:56`rand`Open Courseware
05:57`rand`the Stanford course is OCW, I think
05:57progoalways loved the pun :)
05:58PKHGahh yes, by the way, if one has no know how about matrics and vectors it is rather difficult (it was not for me ;-) as you can guess)
05:58PKHGit is ocw but started already ... and is near the finish
05:59PKHGprogramming tasks ==> 100% up to now ... questions between 50 5 and 95 % ;-)
05:59PKHG5 = %
05:59`rand`MIT has a ton of good OCW courses
06:00PKHGwill have a look too ;-) (good for old brain ...)
06:00`rand`...and check Yale
06:00PKHGhttp://ocw.mit.edu/index.htm
06:01`rand`That's it.
06:01PKHGYale too? oooo soooo muccch to learn ...
06:01`rand`Harvard may have some as well.
06:03PKHG... ok ... will first see how to persuade emacs to use clojure ... ;-) bye and see you later (I think ...)
06:03raekPKHG: when the path is set up correctly, you should be able to do "M-! lein version RET" and get the version info in the echo area
06:04raekhttp://emacswiki.org/emacs/ExecPath
06:04`rand`good luck!
06:04PKHG... fine (looking at ExecPaht .._ thanks raek!!!_
06:04raekPKHG: after that you need to create a clojure project using "lein new tinkering" (where "tinkering") is your project name
06:05raekyou always do everything in a project
06:05PKHG... clear ...
06:05raekthen you visit a file in the tinkering/ directory (for example tinkering/src/tinkering/core.clj)
06:05raekand do M-x clojure-jack-in
06:06raekyou should then get a repl that can use any source files in the project and any libraries you have declared in the project.clj file
06:07raek(also, "RET" stands for the return key)
06:08PKHGbye guys leaving ...
07:36alexyakushevCould someone please help? I have macro called `with-activity` that binds the dynamic var *activity*. Then I have another macro called `do-ui` that executes it's body on the UI thread.
07:36alexyakushevSo when I call (do-ui (with-activity foo ....)) all is well.
07:37alexyakushevBut when I call (with-activity foo (do-ui .....)) the *activity* is unbound
07:38alexyakushevAny way to solve this?
07:39alexyakushevOh, I understand now. Because dynamic scope is thread-local, so the *activity* is not authomatically transfered to the other thread. Am I right?
07:49ivanalexyakushev: that or the bindings were not captured
08:01alexyakushevI've solved this by grabbing *activity* to the lexical scope (by let'ting it in the beginning of `do-ui` macro) and then binding it again to the dynamic scope at the beginning of the new thread
08:26mittchelIs it possible to use clojure color codes in a word document?;o
08:38mittchelIs there an easy way to obtain the last item in a list?
08:38progolast
08:38scottj&(last '(1 2))
08:38lazybot⇒ 2
08:38mittchelisn't that for sequences only?
08:39progowhat is a list then :)
08:39mittchelWhere is that ' for?
08:39scottjmittchel: so it doesn't think 1 is a function
08:39mittchelWhen I'm not using that it gives me an error. Cause I've tried last without '
08:39mittchelahh
08:40mittchelhe doesn't evaluate right?
08:40scottjhe?
08:41scottj&(quote (1 2 3))
08:41lazybot⇒ (1 2 3)
08:41scottj&(1 2 3)
08:41lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
08:41mittchelah
08:41mittchelI'm still confused.. () is list and [] is sequences right?
08:41scottj[] is a vector
08:42scottjyou can make sequences out of many things, including lists and vectors
08:42mittchelah
08:42scottjyou can quote many things too
08:42scottj&foo
08:42lazybotjava.lang.RuntimeException: Unable to resolve symbol: foo in this context
08:42scottj&'foo
08:42lazybot⇒ foo
08:42mittchelhmm thanks scottj
08:43scottjmittchel: I take it you haven't gotten to macros yet?
08:43mittchelBy the way, is destructuring only possible on vectors?
08:43scottjno, lists and maps are supported too
08:43mittchelscottj: Very basic.. going to do that in a sec.. studying my course got an exam about clojure soon ;D
08:43scottj&(let [{:a a} {:a 1}] a)
08:43lazybotjava.lang.Exception: Unsupported binding form: :a
08:43scottj&(let [{a :a} {:a 1}] a)
08:43lazybot⇒ 1
08:44mittchel(defn myfun [[x y]] (print x) (print y))
08:44mittchelthis is restructuring too right?
08:44scottj&(let [[a b] '(1 2 3)] a)
08:44lazybot⇒ 1
08:44mittchelde*
08:44mittchelbut on a vector
08:44scottjits destructuring on a sequence. in destructing [] means sequence not vector
08:45mittchelalright
08:45mittchelLEts say I want the same function to work with a list.. how should it be then?
08:46scottjyou just going down your list of homework problems?
08:46scottj(myfun '(1 2))
08:46scottjor (myfun (list 1 2))
08:47scottjyou should figure out the difference between those two
08:47mittchelNo it just describes sequences and I wanted to find out on lists too but had to be sure since I'm writing myself a summary
08:47mittchelYea but when I use this: (defn myfun [[x y]] (print x) (print y)) can i call it by: (my fun '(1 2))? since you use [] inside the defn
08:48mittchelThat's the only issue I've problems with to be honest.. I thought when you use [] you can only use vectors/sequences since thats the format for a vector (with destructuring a sequence)
08:50mittchelHm got it now :P found it out thanks
08:51Vinzentmittchel, it doesn't matter whether the argument is a list or a vector or something else; clojure has the sequence abstraction which hide differences between them. Thus, you can use your [[x y]] destructing for any seqable thing
08:52mittchelVinzent: Thanks :D that really helped me lol I think I'm used to Java since they are strict in this
08:52mittchelA string is a string and nothing else
08:52scottjVinzent: almost, I think. anything that's sequential, not that you can call seq on.
08:53scottj&(map seq [[1] '(1) {:a 1} "foo"])
08:53lazybot⇒ ((1) (1) ([:a 1]) (\f \o \o))
08:53scottj&(map sequential? [[1] '(1) {:a 1} "foo"])
08:53lazybot⇒ (true true false false)
08:53scottj[] destructuring will only work on sequential? things I think
08:54Vinzentit works on strings
08:54scottjahh, apologies
08:55Vinzent,(let [[[k v] entry] {:a 1 :b 2}] [k v entry])
08:55clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap>
08:55Vinzenthah, but not on maps
09:53serpent213hi
09:53serpent213where did clojure.contrib.ns-utils/immigrate go?
09:53serpent213i try to write a simple wrapper...
09:55kmicuserpent213: http://clojure.github.com/clojure-contrib/ns-utils-api.html
09:57serpent213is this still valid for clojure >= 1.3?
10:00kmicuserpent213: from clojure-contrib readme file
10:00kmicu= Clojure-contrib Versions = Versions of clojure-contrib are matched to versions of Clojure. If you are using Clojure 1.0, use clojure-contrib 1.0.* If you are using Clojure 1.1, use clojure-contrib 1.1.* If you are using Clojure from the "master" branch on Github, use clojure-contrib from the "master" branch on Github. If you are using Clojure from the "new" branch on Github, use clojure-contrib from the "new" branch on Github.
10:01scottjserpent213: I don't think that contrib was migrated to new contrib. that function may happen to work though. I suspect it won't be.
10:01scottjwon't be migrated, since I think some people disapproved of immigrate
10:02kmicuserpent213: it exists in 1.3.0-alpha
10:03scottjit was written for compojure which I don't think uses it since migration to ring
10:06serpent213hmmm... i'm trying something like: http://pastie.org/3976825
10:06serpent213maybe immigrate is not the right way...?
10:07serpent213i would like to use my http-client instead of clj-http.client, as a drop in
10:14scottjclj-http has middleware for this kind of thing, I'm not sure exactly how to use it though
10:20scottjserpent213: something like http://jaderholm.com/paste/wrap-user-agent.clj.html
10:22borkdude,(type (list* 1 2 3))
10:22clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:22borkdude,(doc list*)
10:22clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
10:22scottjserpent213: scratch that, that doesn't help with the other request methods. clj-oauth2/client.clj has a macro and redefines get/post/etc
10:24borkdude,(type (list* 1 2 3 nil))
10:24clojurebotclojure.lang.Cons
10:24borkdude,(type (cons 1 nil))
10:24clojurebotclojure.lang.PersistentList
10:24borkdude,(type (cons 1 (range 10)))
10:24clojurebotclojure.lang.Cons
10:24borkdude??
10:24lazybotborkdude: What are you, crazy? Of course not!
10:25serpent213scottj: thanks, i'll have a look! :)
10:25borkdudecemerick I'm rading your book about cons and list* now
10:25borkdudecemerick I don't totally get what you mean with "creating a seq" directly
10:26borkdudecemerick (or one of the other authors, I don't know who wrote what of course)
10:28borkdude,(type (rest (cons 1 (range 10))))
10:28clojurebotclojure.lang.LazySeq
10:29borkdude,(type (cons 1 (range 10)))
10:29clojurebotclojure.lang.Cons
10:29borkdudeok
10:30borkdudeso why does (cons 1 nil) return a persistentlist?
10:33AimHere,(rest '())
10:33clojurebot()
10:35AimHere,(concat nil nil)
10:35clojurebot()
10:35AimHerenil seems to standin for the empty list sometimes
10:35pandeirothe other day i asked if there was a way to emulate a 'for x in obj...' loop in cljs - anyone know?
10:35borkdude,(type (cons 1 '()))
10:35clojurebotclojure.lang.Cons
10:35borkdude,(type (cons 1 nil))
10:35clojurebotclojure.lang.PersistentList
10:36borkdudepandeiro I wrote a macro for it
10:36borkdudepandeiro you can easily define your own, using for and range
10:36borkdudepandeiro o wait, for is already that
10:36pandeiroborkdude: cool, but working with js objects right, not maps?
10:37borkdudepandeiro ah.. wait.. cljs...
10:37borkdudepandeiro I don't know about cljs, but if the obj is seqable it should work I think
10:37pandeiroborkdude: not seqable
10:37pandeiroat least not by default
10:37borkdudepandeiro then extend-type it?
10:38pandeiroborkdude: it's time i learned how to do that, you're right :)
10:38pandeiroi'm still not sure how one would implement it
10:38pandeirobeyond just the clojure extend-type semantics, i don't know what if anything implements the 'in' special form of js
10:38cemerickBorkdude: I don't have a PDF in front of me right now.
10:39cemerickBut, cons creates a seq, list* creates a list.
10:39cemerickThe fact that lists are themselves seqs, and that cons sometimes returns lists is an implementation detail fundamentally.
10:41borkdudecemerick I'm slightly confused by the sentence "there are two ways to <it>create</it> a seq: <tt>cons</tt> and <tt>list*</tt>
10:41borkdude"
10:41borkdudecemerick create as in, from scratch?
10:42borkdudecemerick nm, I'll read on ;)
10:44cemerick"from scratch" is a bit ambiguous :-)
10:45borkdudecemerick create as in "the most fundamental seq using only scalar values and not other collections" ?
10:46cemerickThere is no "most fundamental seq"
10:46cemerickthat is, there is no ground or base case
10:47gfredericks,(time (first (cons a (range 100000))))
10:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0)>
10:47gfredericks,(time (first (cons :a (range 100000))))
10:47clojurebot"Elapsed time: 0.099 msecs"
10:47clojurebot:a
10:47gfredericks,(time (first (list* :a (range 100000))))
10:47clojurebot"Elapsed time: 0.105 msecs"
10:47clojurebot:a
10:48gfrederickscemerick: doesn't "creating a list" imply that the rest has to be realized?
10:48gfredericks,(type (list* :a (range 1000000)))
10:48clojurebotclojure.lang.Cons
10:48gfredericks,(type (cons :a (range 1000000)))
10:48clojurebotclojure.lang.Cons
10:48borkdudea footnote on page 93 says list* does *not* return a list
10:49gfredericksI've always thought of list* as just a generalization of cons
10:49borkdudecemerick the text seems to make a distinction between "producing" and "creating" seqs and for the latter there are only two ways: cons and list*
10:51borkdude"you can think of cons always 'prepending' to the tail collection's sequence' ..
10:51borkdudetail collection?
10:52borkdudethe tail meaning, the future tail right?
10:53borkdudenm… I think I understand most of it
10:53gfredericks,(type (apply list (range 100000)))
10:53clojurebotclojure.lang.PersistentList
10:55borkdudeThe book says cons has little to do with other Lisps cons cells
10:55borkdudebut is Cons.java not what a cons cell really is all about: a value and a tail?
10:56borkdudethe only difference is that the tail always has to be a seq
11:01cemerickBorkdude: I think it's fair to distinguish between creation and production, where the latter more accurately characterizes lazy seqs.
11:01cemerickgfredericks: yes
11:02cemerickBorkdude: AFAIK, if you can't create a dotted pair, it's not a cons cell.
11:02cemerickbut, I'm by no means a CL expert.
11:02borkdudecemerick "it has little to nothing to do with it", of course it has to do with it ;)
11:04cemerickIn terms of heritage, sure.
11:04borkdudecemerick "you can create a lazy sequence" p93
11:06hyPiRionWell, a main difference is that you can represent leaves in a CL cons, but cannot in Clojure.
11:06borkdudehyPiRion that's basically the main difference yes
11:06hyPiRionAnd, of course, you cannot change the values, but in CL, you can.
11:08borkdudecemerick I'm just dealing with details here, don't worry
11:09borkdudecemerick I like the book very much so far
11:10cemerickBorkdude: Sure; of course, details are important. Don't get too hung up on the creates/produces thing though. :-)
11:10borkdudecemerick I can keep a list for little improvements for the next edition if you'd appreciate it
11:43logaanis it possible to use protocols without using deftype or defrecord?
11:44logaanperhaps by setting the :type metadata of a clojure datastructure?
11:44AimHereWell you can extend protocols to data structures that are already created
11:44AimHere,(doc extend)
11:44clojurebot"([atype & proto+mmaps]); Implementations of protocol methods can be provided using the extend construct: (extend AType AProtocol {:foo an-existing-fn :bar (fn [a b] ...) :baz (fn ([a]...) ([a b] ...)...)} BProtocol {...} ...) extend takes a type/class (or interface, see below), and one or more protocol + method map pairs. It will extend the polymorphism of the protocol's methods to call the suppl...
11:45logaani would like some instances of clojure's map to behave in one way and other instances to behave in another way
11:45logaanas i understand it, extending types would cause all instances to behave in the same way
11:47logaani've implemented using multimethods for now. but it feels like protocols would be a perfect fit.
11:47AimHereYou mean you want different things to happen when you call objects of the same type?
11:47logaanyes
11:48AimHereThat sounds more like a multimethod thing
11:48gfredericksprotocols dispatch on type
11:49logaan@gfredericks type as returned by the type function? or do you mean class?
11:49gfredericksclass
11:49AimHereThe choice is between multimethods dispatching on whatever-the-hell-you-like and being relatively inefficient, and protocols dispatching on type and being efficient
11:50logaanhttps://github.com/logaan/orm-untangled/blob/master/src/orm_untangled/validation_types.clj this is the file where i'm using multimethods if you're curious
11:50logaanok i guess that makes sense
11:51gfredericksare extend-type'd protocol dispatches more efficient than multimethods?
11:52logaanat the very least they'd be dropping a call to the dispatch function you define with defmulti
11:52logaanand i imagine they could be more efficient in addition to that as they line up with the underlying architecture
11:55gfredericksI mean extend-type'd as opposed to types that were created with the protocol implementation in place
11:57AimHereI'd guess they'd be pretty close to any normal function dispatch
11:57AimHereYou can use defn to overload any bog-standard function type multiple argument types
11:59AimHereI can't see how extend is going to be much more inefficient than whatever defn is doing already
12:26winkanyone knows if the change of syntax highlighting in CCW 0.8 was intentional? Can I get the old colors back without manually doing it?
12:52kilon_aliosaloha guys
12:53kilon_aliosanyone can recommend me a link to show how to install and setup slime for clojure in emacs ?
13:13kmicukilon_alios: https://github.com/technomancy/swank-clojure
13:15kilon_alioskmicu: thanks follow the instruction there when i issue jack-in it reports error "erro in process filter: Symbol's definition is void :define-slime-contrib", any idea how to fix this ?
13:16kmicukilon_alios: what version of os, emacs, lein, swank-clojure do you have?
13:16kilon_alioswhat i did with lein was this 1) create a folder, and do a lien new
13:16kilon_aliosand then take the project.clj and add this line in the end
13:16kilon_alios:plugins [[lein-swank "1.4.4"]]
13:17kilon_alioskmicu: i got emacs 24 , macos lion , latest clojure and lein
13:17kilon_aliosI have also installed JDK
13:17kilon_aliosthe latest one from apple
13:17kmicukilon_alios: lein 2 or lein 1.7?
13:18kilon_alioskmicu: https://github.com/technomancy/leiningen
13:18kilon_aliosis that 2 or 1.7 ?
13:19konrIs there a function/macro that expands like (foobar 5 inc 10) -> (-> 10 inc inc inc inc inc)?
13:19kmicu1.7.1 currently
13:19kilon_aliossorry my emacs and lisp kung fu is very weak, can you guid me through
13:19kilon_alios?
13:21semperoscan anyone interpret this stracktrace and provide any info? https://gist.github.com/2815145
13:22semperoshappens when I compile ClojureScript
13:22semperosbeen making edits on my codebase for a while now, so not exactly sure what's caused it yet
13:24konrIn case anybody got curious, (defmacro run-n-times [initial fun times] `(-> ~initial ~@(repeat times fun)))
13:25gfrederickskonr: if you're just using functions, you could use comp
13:25gfredericks,((apply comp (repeat 20 inc)) 1)
13:25clojurebot21
13:26konrgfredericks: even better! Thanks!
13:29coventryIn the code at http://pastebin.com/inpNCR8x if I replace "takeends" in the definition of endstarts with what I think is the corresponding anonymous function, #(vec (last (last %)) (last (first %))), I get "Wrong number of args (2) passed to: core$vec". Why is that?
13:32alexyakushev,(doc vec)
13:32clojurebot"([coll]); Creates a new vector containing the contents of coll."
13:32alexyakushevYou want to use a vector: ,(doc vector)
13:32alexyakushev,(doc vector)
13:32clojurebot"([] [a] [a b] [a b c] [a b c d] ...); Creates a new vector containing the args."
13:33alexyakushevCould someone please explain this behavior? http://pastie.org/3977918
13:34bordatoueIs it possible to make an executable jar from clojure project similar to java project within eclipse
13:35gfredericksbordatoue: are you using lein? or are you asking how to do it in eclipse?
13:35gfredericksalexyakushev: what're you trying to do?
13:36bordatoueno I am not using lein, is there a plugin for eclipse
13:36gfredericksI could explain why it does that if you're really after understanding, but it's a little subtle
13:37bordatoueI just want to make an executable jar for clojure project in eclipse , what would be the best way to do it
13:37coventryalexyakushev: Thanks, I was getting its signature confused with that of list.
13:37alexyakushevgfredericks: This is a condensed example. My real macro extracts an anonymous function from a map in the compile time (using the arguments user provides) and then calls this function
13:38gfredericksalexyakushev: so the short answer is that macros have to return s-expressions. You're trying to return a list containing a function; a function is not an s-expression
13:38gfredericksalexyakushev: you want to "call this function" at compile-time or runtime?
13:38loliveirahi, i'm trying to create a macro to wrap include-js hiccup helper but something is wrong: (defmacro include-backbone []
13:39loliveira(defmacro include-backbone []
13:39coventryFollowup question: Why does (#([1 2])) fail with an arity exception? (I'll know to use an extra vec in there in future, though.)
13:40gfrederickscoventry: you're calling the vector as a function; vectors take 1 arg
13:40gfredericks,([1 2] 1)
13:40clojurebot2
13:40coventryOh, beautiful. Thanks.
13:41alexyakushevgfreederick: Why, no, I return a list with that function inside, basically I want to call this function in runtime
13:41gfredericksloliveira: try using refheap.com
13:41gfredericksalexyakushev: note if you add a backtick to your function form on line 2 it should work
13:41bordatouehow is any documentation on creating a clojure binary distribution
13:42gfredericksalexyakushev: whether or not that helps you is a separate issue I'm not sure about
13:42alexyakushevgfreedericks: Do you mean before the "let"?
13:42gfredericks(let [macro-clojure `(fn [] ~macro-argument)]
13:42gfredericksforgot the ~ as well
13:42loliveiraty gfredericks
13:42alexyakushevgfreedericks: But I want to create the closure at the runtime, not just its definition
13:43alexyakushev*compile-time, sorry
13:43gfredericksso you want that function to return the quoted code that is the argument to the macro?
13:43loliveirahttps://www.refheap.com/paste/2888
13:43loliveirainclude-jquery works fine
13:44loliveirabut include-backbone does not.
13:44gfredericksloliveira: extra parens?
13:44gfrederickswell I guess it's more complex than that
13:44gfredericksdoes include-js let you give multiple args?
13:44loliveiradon't work even without them
13:45alexyakushevgfreedericks: basically yes, I want a closure that returns just the argument to the macro
13:45gfredericks(let [macro-clojure `(fn [] ~(list 'quote macro-argument))]
13:45loliveiragfredericks, yes
13:45loliveiranice idea.
13:46alexyakushevgfredericks: But once again, this one would be just a list, it won't be evaluated in the compile-time this way
13:47loliveirait worked, ty. but what could i do if include-js didn't support multiple args?
13:47alexyakushevgfredericks: But thanks so far, I don't dare to waste your time anymore
13:48gfredericksloliveira: this is hiccup?
13:48loliveirayes
13:48gfredericksalexyakushev: no I like these kinds of questions
13:49gfredericksloliveira: you could replace the outer parens with square-brackets for a vector, and then splice them into your calling hiccup forms with concat or something like that
13:49gfredericksloliveira: you want to call the function at compile-time?
13:49bordatouecan anyone please tell me the preferred way to compile clojure to an executable
13:49loliveiragfredericks: yes
13:50gfredericksbordatoue: does your project have a project.clj? I'm not familiar with how eclipse handles clojure
13:50gfredericksloliveira: then what do you want to do with the return value from the function?
13:50loliveirai am looking for a C macro expansion behavior.
13:50bordatoueso what is the preferred way, I don't mind changing it
13:51gfredericksloliveira: oh like you have a map somewhere defining all possible expansions?
13:51loliveirathis is the client code: https://www.refheap.com/paste/2889
13:52loliveirai'd like (include-backbone) were being replaced by that 2 functions calls (underscore and backbone)
13:52gfredericksbordatoue: if you use leiningen, you'll need to specify your main namespace as the :main key in the project.clj, then add (:gen-class) to the ns-decl in that file, and make sure there is a function called -main
13:53gfredericksalexyakushev: you want to call the function at compile-time?
13:53gfredericksloliveira: sorry I just mixed you up with alexyakushev. did you still have a question?
13:53loliveirai think i don't have this map.
13:53alexyakushevgfredericks: No, generate at the compile-time, but call at the runtime.
13:54gfredericksalexyakushev: then why did you say previously that my solution wouldn't call the function at compile time?
13:54bordatouedoes clojure have an entry point method, similar to public static void main in java
13:54gfredericks(i.e., why is that a problem if you don't want to do it?)
13:54gfredericksbordatoue: yes I just described for you how to set that up
13:54gfredericksusing (:gen-class) to make sure a class gets generated and a -main function for the public static void main
13:54loliveirayes, i still have.
13:55loliveira=)
13:55gfredericksloliveira: okay -- was the using-a-vector-and-splicing-in comment not clear?
13:55gfredericksor have you not asked the question yet?
13:56alexyakushevgfredericks: because macroexpand of your solution looks like ((clojure.core/fn [] (quote "sample-argument")))
13:56loliveiracan you pls point me some comment not clear?
13:56loliveira<gfredericks> or have you not asked the q
13:56gfredericksalexyakushev: and why doesn't that do what you want? You said you wanted the function to return the argument to the macro
13:56loliveiracan you pls point me some using-a-vector-and-splicing-in exemple?
13:56loliveiraexample*
13:56gfredericksloliveira: I said:
13:56gfredericks<gfredericks> loliveira: you could replace the outer parens with
13:56gfredericks square-brackets for a vector, and then splice them into your
13:56gfredericks calling hiccup forms with concat or something like that [13:45]
13:56gfredericks
13:57loliveirai will try, but i don't know how to do that yet.
13:58alexyakushevgfredericks: Because in my actual example I do a lot more than just wrap the macro-argument in a fn, so I want to save time by running this in compile-time
13:58gfredericksloliveira: another thing you could try is wrapping them both in a :div -- I don't know if that's legal in a <head> though
13:59gfredericksalexyakushev: maybe I'd have an easier time if you gave me an example of the macro being called and what it should expand to
14:00loliveirai dont think is legal using div inside head.
14:00loliveirathank you soo much
14:01gfredericksloliveira: so [:html (vec (cons :head (include-backbone)))] would work I think
14:01gfredericksor wait no
14:01gfredericksyou can just return a list from include-backbone and it should work naturally now that I think about it
14:02gfredericksso (defmacro include-backbone [] `(list (include-js ...) (include-js ...))) would do it
14:02loliveirai will try, 1 sec
14:04loliveirair worked! =D
14:04loliveirair = it
14:04loliveiraty gfredericks
14:04gfredericksnp
14:06gfredericksalexyakushev: also you might find something helpful in clojure.tools.macro
14:09antares_Quartzite documentation site is up: http://clojurequartz.info/ (very much WIP but I feel it may be already useful)
14:09jblomoanyone familiar with the new reducers code?
14:20alexyakushevgfredericks: Thanks again. My actual problem was that I tried to transfer an Object from compile-time to the runtime
14:23pandeirowhere is let implemented in cljs?
14:33kilon_alioswho wants to listen to my new ambient track ? raise hands now !
14:34konrI do
14:34konrcomposed with clojure tools? :)
14:34kilon_aliosno sorry i use mainly hardware synthesizers
14:34kilon_alioskonr: here -> http://www.mediafire.com/?cgi2g3dojlgof97 , sorry for the unkowning ads
14:35kilon_aliosbut i plan to start using Overtone , i hope soon enough
14:35kilon_aliosoh the track is still WIP
14:37kmicupandeiro: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj
14:38kilon_alioskonr: dont be afraid not to like it, i love all critics ;)
14:41konrkilon_alios: it's interesting. Not very familiar with ambient music, although I used to listen to Aghast, Maison close et al
14:42kilon_alioskonr: thanks, glad you like it
14:42bartioszeHi! is this a proper place to ask ClojureScript/ClojureScriptOne related questions?
14:43kmicubartiosze: clojure google group or here :)
14:44bartioszeok, then maybe my answer is already on the group. ;-)
14:44kmicubartiosze: I make project based on ClojureScript One, maybe I can help
14:45pandeirokmicu: what line?
14:46kmicupandeiro: from 28 to 45 I guess
14:46kmicupandeiro: its imported from clojure.core
14:47pandeirook so it's not defined in clojurescript at all?
14:47kmicupandeiro: I can't confirm that :)
14:50kmicupandeiro: but from code it looks like 'let' macro is imported from clojure.core
14:56pandeirokmicu: ok thanks
15:01pandeiroare non-blocking fns possible in clojure? ie (do (prn 1) (slow-async-prn 2) (prn 3)) ;=> 1 3 2
15:04gfrederickspandeiro: try future
15:15upwardindexRaynes: I just translated the js in tryclojure to cljs, I sent you a pull request, let me know if you'd like me to improve anything
15:17DvyjonesHow do I round of a rational number to the nearest integer? (Or just always round down, either works)
15:17upwardindex,(Math/round 3.4)
15:17clojurebot3
15:17DvyjonesDuh.
15:18DvyjonesI keep forgetting I have Java :P
15:18Dvyjones,(Math/round 22/7)
15:18clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: round>
15:18Dvyjones:(
15:19upwardindexDvyjones: java doesn't know rationals, I'm afraid
15:19Dvyjonesupwardindex: Figured. How do I round those?
15:20upwardindex,(Math/round (float 22/7))
15:20clojurebot3
15:20gfredericksthere's an exact way too, that'll work for arbitrarily large rationals
15:21tmciver,(int 22/7) ;; rounds down
15:21clojurebot3
15:21borkdudeI tend to do just (int 3.1516)
15:31Raynesupwardindex: Cool stuff. Not sure I actually want to use ClojureScript there though. I'll take a look shortly.
15:32upwardindexRaynes: why not?
15:33RaynesBecause we don't really gain anything besides a compile step from it and I haven't used cljs enough to know how any of that stuff works which could end up making it difficult to make simple changes in the future. *shrug*
15:34RaynesBut that doesn't mean I wont take the pull request. Just going to think about it.
15:35upwardindexI'll let you have a look, I'm sure you'll be pleasantly surprised at how much it looks like your original code :)
15:35RaynesMost of that code was actually someone else's.
15:36NibbleRaynes, what happened to 9b?
15:36RaynesA lovely fellow who added the dynamic tutorial thingy.
15:36RaynesNibble: The IRC network? It's 10b now.
15:37NibbleRaynes, zc00gii still around?
15:37RaynesNibble: No.
15:37Nibbled'awww
15:37NibbleRaynes, nixeagle?
15:38Raynesupwardindex: That's kind of my point though, really. The code is pretty much the same either way. But I'm probably just being an asshole. I've always been apprehensive about cljs.
15:38RaynesNibble: Once every few months.
15:38Nibblekk
15:38upwardindexRaynes: last week you asked me for cljs code to work with jquery console, but I was at work
15:39RaynesIndeed!
15:39Raynesupwardindex: What does (clj->js ..) do?
15:39upwardindexRaynes: transforms clojure data in javascript data
15:40RaynesSo Clojure to JSON?
15:40gfredericksprobably javascript objects rather than a serialized string
15:40gfredericksso "to JSON" would be misleading
15:40upwardindexwhat gfredericks said
15:41RaynesSeems odd that ClojureScript wouldn't do that itself.
15:42gfrederickswhen would clojurescript do that?
15:43RaynesUh, I don't know.
15:43gfredericksor you mean provide the function instead of jayq
15:44RaynesNo, I would have expected ClojureScript to make the conversion under the covers, since the map would be being passed to a javascript function. I'm sure there are technical reasons that that is stupid, but I'm ignorant enough about javascript and friends to mention it anyways.
15:45gfredericksI think that would be kind of unexpected
15:45gfrederickslike asking why clojure doesn't auto-convert seqs to arrays if you call an array-expecting function
15:46gfredericksand I doubt there's a foolproof way to know for sure if you're calling a js function vs a cljs function
15:46ibdknoxa cljs function *is* a js function
15:46gfredericksthat last point is probably the real issue
15:46gfredericksibdknox: yes; thus they're hard to tell apart :)
15:47RaynesI was thinking more along the lines of how you can pass maps to Java that expects a HashMap, but no conversion actually happens there IIRC.
15:47y3diibdknox: did you start devving lighttable in lighttable yet?
15:48ibdknoxy3di: been working on the playground first :)
15:48anonymoose_hello, new clj user here, is there a definitive tidy utility for clojure? I love using tidy for all my blocks.
15:49kilon_alioswow did not know light table uses clojure o_O
15:50ibdknoxkilon_alios: it's written entirely in Clojure
15:50ibdknoxand CLJS
15:50kilon_aliosibdknox: wow, I am actually making a similar project and I wanted to unite with project doing similar things
15:51kilon_aliosmine is more a GUI and a visual programming language
15:51anonymoose_Hi Chris! Great work on light table!
15:51ibdknoxthanks :)
15:51kilon_aliosbut i wanted IDE capabilities like the ones you implement
15:51kilon_aliosibdknox: are you aware of field ? its JVM but jython
15:51ibdknoxI am
15:52kilon_aliosdo you intend for visual coding too ?
15:52anonymoose_anybody know of a tidy utility for clj? i.e. reformatter? also, is there and official style guide somewhere?
15:52ibdknoxit's intended to be a general surface, so absolutely
15:53kilon_aliosvery interesting
15:53borkdudeibdknox support for touch interfaces? (don't know how, but sounds cool ;))
15:53ibdknoxborkdude: should get it for "free"
15:54ibdknoxborkdude: since it uses a webview
15:54kilon_aliosthis is my project --> https://github.com/kilon/Ephestos
15:54ibdknoxborkdude: but yeah, that's something I really want to explore later on
15:54kilon_aliosits basically just a blender addon for now (new GUI for blender) but i am also doing the rest with clojure
15:55kilon_alios*considering doing the rest
15:55borkdudeibdknox touching and moving s-expressions around is easier than remembering paredit key bindings
15:55ibdknoxkilon_alios: cool
15:55kilon_aliosi mean lighttable sorry :D
15:56ibdknoxborkdude: yeah, I think there's some really neat stuff that could be done there. Unfortunately the hardware issues haven't really been addressed yet
15:56cljn00banybody? tidy for clj?
15:56ibdknoxborkdude: if Light Table really takes off, I'd love to help push in that direction
15:56upwardindexcljn00b: what does that do?
15:56gfredericksRaynes: methods expecting a HashMap specifically? or just a Map?
15:57ibdknoxborkdude: finding a way to mix a keyboard centric interface with touch elements would be awesome
15:57ibdknoxmost people just use the indent rules from emacs as gospel I think
15:57cljn00btidy is a reformatter for code, normalizes indents and newlines from unformatted code.
15:57ibdknoxvim has similar indenting though it's slightly different
15:57RaynesEmacs and Vim can both do that.
15:58RaynesWell, unless you write the whole thing on a single line.
15:58RaynesIt can fix indentation.
15:58cljn00byah, I'm looking for something I can pipe a block of clj to and have consistent style enforced by the util.
15:58cljn00blike perltidy or other variants.
15:59pandeirocould anyone point me a naive impl of a let macro?
15:59kilon_aliosibdknox: is there a download i can try, sorry i am very new with clojure
16:00ibdknoxkilon_alios: it's not out yet
16:00kilon_aliosok so it wont be free and open source ?
16:00eduardhow to write short: (map (fn [a b] [a b]) coll) ?
16:01gfredericks(map vector coll)
16:01borkdudeRaynes cljn00b do I feel a new leiningen plugin coming up? (lein tidy)
16:02eduardgfredericks, Thanks
16:03kilon_aliosah ok the info is in the kickstarter
16:03ibdknoxkilon_alios: it will be once it's built
16:03kilon_aliossorry :D
16:03ibdknoxno worries :)
16:04borkdudeibdknox any thoughts on scripting abilities? clojure?
16:04ibdknoxborkdude: GUI scripting will be CLJS
16:04reisiolooking for a copy of the image that was here: http://clojure.googlegroups.com/web/Clojure-logo.png
16:05ibdknoxthe language backends can be written in anything that can do TCP and JSON :)
16:05ibdknoxwhich enables a lot of *really* cool stuff
16:05ibdknoxthe sql and benchmarking modes that I showed were only about 100 lines of CLJS each
16:07Raynesborkdude: Nope.
16:07cljn00bmade a gist for what I'm looking for. Please let me know if anybody knows about a tidy util for clojure. https://gist.github.com/2815682
16:08RaynesYeah, I don't think there is anything that can do that.
16:08RaynesThose rules are entirely arbitrary.
16:08kilon_aliosoh python support is close too :)
16:08kilon_aliosnice
16:08reisiocljn00b: not a lint?
16:09cljn00bif linting implies reformatting, yes. I thought linting was just syntax checking.
16:09reisioI've seen some that reformat, too
16:09ibdknoxthat kind of reformatting is incorrect
16:09reisiothere's at least one clojure lint tool, might check it
16:09cljn00bI'm hoping for a perltidy analogue.
16:09ibdknoxor rather "not correct"
16:09ibdknoxlol
16:10ibdknoxI don't think it'd be meaningful to have such a thing
16:10ibdknoxfor clojure, that is
16:11cljn00bfor consistency across developers in a shared project, I'd think style enforcement would be a good thing.
16:11reisiodon't really need a tool for that
16:11cljn00bmy incorrect newlines not withstanding.
16:11reisiothough obviously one would be useful
16:12kilon_aliosoh a lot of requests for python, did not know python is so popular
16:12ibdknoxthe problem is that what should and should not be on the next line is highly context dependent
16:12reisiokilon_alios: half are probably to do with pornography :p
16:12ibdknoxkilon_alios: it's consistently the highest rated language on most general tech sites
16:13cljn00bwhich is why I was hoping for a clojure style guide to help me figure the newlines out.
16:13ibdknoxcljn00b: I mean that to the point where it depends on what the function/macro does
16:13reisioI assume if it parses there are no rules
16:13kilon_aliosreally ? i thought people hated because of whitespaces and slow execution. I am a big fan of python myself
16:14kilon_aliosi know of course its fairly popular and people love it for the small learning curve
16:14zakwilsonThere are Lisp style guides to be found. They don't vary much.
16:14cljn00bibdknox, what would be the idiomatic indentation for my sample?
16:15reisioI used to hate it just because of the white space, but for even more reasons now :p
16:15ibdknoxhaha probably the way you have it to begin with :)
16:16cljn00boh.
16:16borkdudeglobal variables in for loops are really a weird property of Python
16:16ibdknoxthat's all a single context describing a single output
16:17ibdknoxthose things usually end up on one line
16:17ibdknoxthough that would probably be wrapped in a function and hopefully you wouldn't embed the vectors there
16:17ibdknoxit'd be much smaller if you didn't
16:18cljn00bthank you ibdknox.
16:18zakwilsonibdknox: I hear you had dinner with someone I sort of know last night. You kept him from an online meeting about a game in development.
16:18cljn00b(this is just tutorial code here)
16:18ibdknoxzakwilson: haha I see
16:18borkdudebut I like Python and a fantasic IDE for it would be great
16:19ibdknoxzakwilson: yeah a friend of a friend sort of thing
16:19zakwilsonYeah, that's what he said. He thought Lighttable sounds interesting.
16:19reisiolooking for a copy of the image that was here if someone's got it: http://clojure.googlegroups.com/web/Clojure-logo.png
16:20borkdudereal time debugging in light table will maybe convert more "statically typed" fans to dynamic languages?
16:20ibdknoxwith clang
16:20ibdknoxyou could do the same thing with C :)
16:20kilon_aliosrealtime debugging style common lisp ?
16:20kilon_aliosand smalltalk ?
16:21kilon_aliosinject live objects, compile and decompile, inspect, modify source and resume etc
16:22zakwilsonLisp and Smalltalk environments have had features along those lines for ages. If Lighttable only gets people to start using them in Python, it will be huge.
16:22kilon_aliosand Clojure ;)
16:22ibdknoxLT has definitely helped spread Clojure around some :)
16:22zakwilsonI really don't understand why people still develop such languages in an essentially batch-mode style instead of talking to a running program with their editor.
16:23borkdudeibdknox I mean the real time debugging thing will maybe give them the same (or better) sense of safety a type checker does now for them
16:23kilon_aliosits sad when some of those best technologies are left behind, I am working on Morphic GUI, the very first to implement visual coding on low level with self programming language and then smalltalk
16:23Raynesibdknox: Maybe light table is that 'killer app' crap people talk about.
16:23ibdknoxmaybe
16:23ibdknoxwho knows
16:24ibdknoxIt'd be nice to push Clojure out to more folks though
16:24kilon_alios40 years after, GUIs are inferior in design :D
16:24kilon_aliosmake you scratch your head a bit
16:24zakwilsonI already thought of something I want to bulid on top of it - a web-based SASS editor for client projects and such where somebody might want to change the CSS but not instal SASS tooling.
16:28kilon_alioswell its nice at least that all programming languages and software return back to the roots of software revolution
16:30pandeirohow can i make a macro take let bindings and then execute its body form with those same let symbols bound to recomputed values?
16:33borkdudepandeiro a bit like this? https://www.refheap.com/paste/2700
16:33amalloypandeiro: i suspect if you start by writing down one specific example input and the output you want it to expand to it'll be much clearer
16:33Raynesborkdude: You got paste 2700. Congratulations, you win nothing.
16:34borkdudeRaynes great, maybe an air guitar?
16:34michaelr`hello
16:35eduardhow to swap two values at defined indexes in vector?
16:36pandeiroamalloy: like this? (let*2 [a 1 b 2] (+ a b)) ;=> 6
16:37borkdudeeduard I guess taking the subvectors and then concatting them back with the swapped values in between, but there might be a better way…
16:37amalloywell, it surely won't just straight-up expand to six
16:37pandeiroamalloy: right, that logic would be in the macro
16:37amalloyit'll expand to (let [a (* 2 1) b (* 2 2)] (+ a b))
16:38pandeiroamalloy: k let me think about that; borkdude: thanks i am also looking at your example
16:39eduardborkdude, assoc found http://stackoverflow.com/questions/5979538/what-is-the-idiomatic-way-to-swap-two-elements-in-a-vector
16:40borkdudeeduard of course, assoc.. I was confused by an example I did earlier: removing an element from a vector
16:44ag90Is there a macro/function similar to -> for functions? That is, instead of inserting the value of a form as the first value in the next, it assumes that the next form is a function and calls it?
16:45ag90I think I recall a function that did that, but cannot seem to remember the name.
16:45amalloy&(doc comp)
16:45lazybot⇒ "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
16:45Raynescomp
16:45ag90Ah!
16:45Raynesamalloy: I hate you.
16:45ag90Thanks!
16:46amalloyman, imagine if comp actually did take a set of functions
16:49Raynesamalloy: Well, it actually can.
16:49amalloyokay, fair enoguh
16:49borkdudeset as function or of functions?
16:51ag90borkdude: I think he was suggesting in jest that if comp accepted a set of functions (which it does), it would really ruin everything because sets are unordered.
16:51ag90(and you need the functions to be ordered for a functional composition)
16:51borkdudeag90 I know about the order, but does it really take a set of functions?
16:52borkdudeag90: highly doubt it
16:52ag90Well, a set of functions is still a seq. So, the order it evaluates them in is probably one that you won't like.
16:52borkdudeag90: without apply I mean
16:52ag90Oh, yes, with apply.
16:53borkdudeapply doesn't count
16:53ag90Though, if you think about it, a set of functions is a set which is a function too.
16:53borkdudeag90: finally, I (we?) got it
16:53ag90heh
16:54borkdude,((comp #{+ - *}) +)
16:54clojurebot#<core$_PLUS_ clojure.core$_PLUS_@2f47a2>
17:01borkdudecomposing sets can actually be useful: https://www.refheap.com/paste/2890
17:10pandeirothere's no way to do something like (let-async-resource [foo "http://foo.com&quot;] (.log js/console foo)) ;=> "<html><head>..." with cljs, is there? to abstract away async via a macro?
17:11p_lwrite in CPS?
17:14pandeirop_l: like javascript?
17:16p_lwell, it doesn't come from javascript, but it also makes it possible
17:16p_lno idea how hard CPS would be in Clojure
17:34kab3wmpandeiro: http://brianmckenna.org/blog/cps_transform_js
17:38pandeirokab3wm: thanks
18:04brainproxyso vec (as opposed to vector) will consider a string argument to be a collection of chars?
18:05brainproxyplaying in the REPL w/ examples from the Cloj Prog book ... just making sure I understand correctly
18:08tmciverbrainproxy: it would appear so. ##(source vec)
18:08lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
18:08coventrybrainproxy: Yes. Let me see if I can use this clojurebot. ,(set (map type (vec "test")))
18:08coventryOh, that didn't work.
18:08tmciver&(clojure.repl/source vec)
18:08lazybot⇒ Source not found nil
18:09tmciverbah
18:10tmciverWell, vec calls to-array on its arg if (instance? java.util.Collection arg) is false
18:10tmciver&(instance? java.util.Collection "test)
18:10lazybotjava.lang.RuntimeException: EOF while reading string
18:10hyPiRionheh
18:10tmciver&(instance? java.util.Collection "test")
18:10lazybot⇒ false
18:11coventryI'm using swank, and when it drops me into the sldb buffer, I'll type "e", then an expression, and I always get back "nil". Even for constant exrpressions like "1". I checked the *Messages* buffer, and there's nothing extra in there. Anything else I should try?
18:11brainproxytmciver: thanks, was just looking at the source via clojureatlas and learning how it works
18:12brainproxysometimes I forget I can look at the source for most of the builtins
18:12brainproxybut you reminded me with your invocation of the bot
18:42amalloycoventry: a lot of swank features aren't implemented in the clojure swank server. that's probably one of them
18:42coventryAh, thanks.
18:48amalloymy understanding is that nobody knows how swank-clojure works, and it's a miracle that it still does
18:49danlarkinthat's pretty accurate
19:07velviaNewbie here trying to set up emacs / clojure-mode / slime etc. I followed a bunch of different blogs, but how can I tell that my setup works? I just see a bunch of different warnings when I try to do "clojure-jack-in".
19:10amalloy~swank
19:10clojurebotswank is trust the readme and the readme only. all others will lead you astray.
19:14velvia@clojurebot: so follow the README at github swank-clojure?
19:14velviaHas anybody had experience with clooj, or La Clojure (IntelliJ plugin)? Are those any good?
19:40winkLa Clojure sadly only works on IDEA and not on PHPStorm, so couldn't test it for lack of licence :(
19:40wink(at least back when I tried) but seems sensible, given lack of Java stuff
19:43scottjwink: works on free intellij
19:44scottjvelvia: eclipse is most actively developed of non-emacs plugins.
19:45scottjvelvia: following readme at swank-clojure is best, yes
19:45velvia@scottj, thanks
19:47scottjcoventry: same behavior here. I think that works in ritz though
20:19emezeskeamalloy: That mail about vmware I just got, was that in regards to me rebooting to play diablo 3?
20:21amalloyyes
20:22emezeskeI dunno about running games in a VM
20:22emezeskeAnd there's no way I'm making windows my base OS :)
20:23lynaghkemezeske: The only reason I'm on linux is for Xmonad.
20:23emezeskelynaghk: I didn't know you were a fellow xmonader!
20:23lynaghkemezeske: I ran windows for years; you just learn to love PuTTY and do lots and lots with VMs. Which is actually a pretty good habit, ops-wise.
20:24emezeskelynaghk: Yeah I do lots in VMs, but I like running my editor/etc on raw hardware
20:24lynaghkemezeske: yep. My primary machine is something like 5 years old now. Running linux with three montiors.
20:25seancorfieldWindows belongs in a VM, safely locked up where it can't do any harm!
20:25lynaghkemezeske: thanks for getting that lein cljsbuild out so quickly, by the way.
20:25emezeskelynaghk: Yeah, no problem, I'd wanted that for a long time but never saw a simple solution
20:25emezeskeseancorfield: :)
20:26seancorfieldemezeske: new version of lein-cljsbuild? what's new/cool in it?
20:26emezeskeOh, nothing major, probably my favorite new feature is that it reloads *.clj files in the clojurescript source dir (for macros)
20:26seancorfieldi'm not doing anything with clojurescript yet except playing but cljsbuild is my drug of choice for that :)
20:26seancorfieldnice
20:27emezeskeAlso, it is faster most of the time, in auto mode
20:27lynaghkseancorfield: Also upstream authors can now package JavaScript + Externs that'll get sucked in automatically without end users needing to pass in custom ClojureScript compiler options
20:28lynaghkso basically, I'm going to get everyone to eat highly mutable raw JavaScript and never know it = )
20:28emezeskeBwahaha!
20:30lynaghkemezeske: what are you working on in cljs, anyway? You are doing all of this rad work with the toolchain, but don't seem to have any public projects
20:30lynaghkweren't you making a game or some such?
20:31emezeskeI'm building a website to help school teachers build seating charts
20:31emezeskeIt is all closed-source, which is a bummer, because I want to show it off!
20:31xeqithey don't just use alphabetical order?
20:32emezeskeThe uninspired ones do
20:32lynaghkxeqi: problems with children whose names can be coerced to numbers.
20:32emezeskeThe tool I'm making lets teachers assign students to groups, and it will build randomized charts that keep loudmouths away from one another, for instance
20:33emezeskeGood teachers engineer their charts like that, and mix them up on a regular basis so kids have to work with new people
20:33emezeskeBut that is a huge pain in the ass.
20:38pipelinedo you expect teachers to mark children as "loudmouths"
20:38pipelinein a written record ?
20:39gfredericksperhaps as "Group A"
20:39pipelinehow will you advertise the feature
20:39pipelinehaha
20:39gfrederickswhere A has a "dispersed" characteristic
20:39emezeskeYou'll just have to see how it works once it's out :)
20:40emezeskeI'm sure I'll talk it up on the ML as a finished commercial project using clj/cljs :)
21:55brainproxyis there an emacs command (within some mode, i mean) that will "prettify" a region, e.g. a large hash-map literal I've copied over from the REPL
22:02brainproxynvm, found clojure.pprint/pprint
22:06_KY_#{(1 2 3) (4 5)} is a set with 2 elements, right?
22:06_KY_,(conj #{(1 2 3) (4 5)} '(6 7))
22:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
22:06_KY_How come that doesn't work?
22:07Iceland_jack_KY_: You ness to do '(1 2 3) or (list 1 2 3)
22:07Iceland_jack,(count #{(list 1 2 3) (list 4 5)}
22:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
22:07Iceland_jackbah
22:07Iceland_jack,(count #{(list 1 2 3) (list 4 5)})
22:07clojurebot2
22:08_KY_I see...
22:08_KY_So what was that?
22:08_KY_Without "list"
22:08Iceland_jacka function call
22:08_KY_Ahhh I see =)
22:08Iceland_jackLisps assume that the first element of a list is the function
22:09Iceland_jackor something that will eval to a function
22:10Iceland_jackLists aren't nearly as idiomatic in Clojure as they were in older Lisps though
22:11Iceland_jack,(conj #{[1 2] [10 20]} [100 200]})
22:11clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>
22:11Iceland_jackhah, every time
22:11Iceland_jack,(conj #{[1 2] [10 20]} [100 200])
22:11clojurebot#{[1 2] [100 200] [10 20]}
23:10gfrederickswhat do CLers and schemers do when they want to do [(+ x y) (* a b)]? Do they have to (list (+ x y) (* a b))? (i.e., no data literal for it)
23:19amalloygfredericks: there may be other options, but that's common
23:21amalloyor `(~(+ x y) ~(* a b)), i suppose
23:22gfredericksah
23:23gfrederickswell thank you rich hickey for vectors.
23:31amalloyof course, in any other lisp you can write a reader macro for it
23:31amalloyCL probably has some kind of reader syntax for vectors
23:32amalloybut they're not as interchangeable with lists as clojure's are, i suspect