#clojure logs

2013-05-07

00:10bbs_hi folks. i've been looking through the clojure.java.jdbc docs and i'm hoping someone can help me out with what the binding argument is for "db-transaction". i've only been able to find usage examples with the deprecated "with-connection" and "transaction" functions
00:32muhoois it considered evil to do things in project.clj like slurp passwords out of a different file?
00:33muhooor is there a more elegant way to deal with stuff like migratus that wants passwords to be in the project.clj?
00:33muhoocause, like, i'm not committing my passwords to git
00:34aduwhat?
00:34clojurebotwhat is 2d6
00:34aduclojurebot: are you a bot?
00:34clojurebotThanks! Can I have chocolate next time
00:34aduclojurebot: you're a bot
00:34clojurebotthanks; that was delicious. (nom nom nom)
00:35adumuhoo: I don't see why not
00:35adumuhoo: you can always use .gitignore
00:36adujust do something like my-secret-password-file.txt, then echo my-secret-password-file.txt >> .gitignore
00:36muhoouh, i don't think i've explained this well enough. migratus wants its config in project.clj. i do want to commit project.clj into git. i do NOT want to commit my passwords to git. but they need to be in project.clj. so, i'm asking, how can i get that data into the project.clj without actually putting it in the file?
00:37muhooso the question isn't so much how to keep password *files* out of git, it's how to get secret data into the lein project map without having it in project.clj
00:37muhooand running slurp inside project.clj seems evil to me.
00:39jxxmuhoo: a lesser evil. The Right Thing to Do(tm) is to fix Migratus so that it no longer requires such shenanigans.
00:40muhoohmm, thanks. maybe i'll do that. i like environ and could integrate it, but i'm not sure he'd want a dependency on it. i'll ask though. thanks.
00:41jxx:)
00:50Sarudakomg people!
00:51SarudakDoes anyone here use windows? :)
00:55SegFaultAXI use windows for gaming, does that count?
01:03robearhow do you get the index of an element in a vector in clojurescript?
01:57jxxrobear: how did you get the element in the first place?
02:13robeari just created a vector with […]. i tried .indexOf like in clojure but got a no method error.
02:13robeari assume that is because .indexOf is based on java?
02:34andyfingerhutHas anyone successfully run "lein run" on the same project in parallel on Linux or Mac OS X, e.g. with multiple invocations of "lein run &" in parallel? I tried it, but all of the processes soon enter the Stopped state. That may be perfectly normal and expected, but was curious if there was a way to do it.
04:54naegfor those who haven't seen it: http://lispinsummerprojects.org/
05:55yedii need more clojure reading material and planet.clojure.in isn't cutting it =/
05:59Foxboronyedi, buy books :)?
05:59Foxboronor read source code?
06:00naeghehe, Foxboron the guy being funny about parentheses on reddit ;)
06:00Foxboronhahaha
06:01Foxboronnaeg: not but really, i was sure people would get the joke
06:01naegwhat a coincidence
06:01FoxboronI even said project file!
06:01naegwell, it was in r/python, so I wasn't sure at all
06:01FoxboronShould give any sane person a hint that u have atleast touched lein
06:02naegeven if one touched lein, it doesn't mean he thinks clojure/lisp is good
06:02FoxboronI enjoy Clojure
06:02naegdon't you hear what you said as a joke quite often seriously from people?
06:03Foxboronit is often related too "i dont understand anything"
06:03Foxboronthen they give up.
06:03FoxboronMy first reaction also, after my strong hate for curly bracers.
06:04FoxboronBut why i thought it was funny, is because of the overall lack of curly bracers in Python.
06:04Foxboronand i have kinda always had the belig that many python programmers dislike curly bracers, might just be me.
06:04naegI often hear people hating about lisp's syntax (or lack of syntax) but they are using C#/Java or something similar
06:05Foxboronthat is true.
06:05naegeven though I agree readability is important in a programming language (since honestly, while you're programming you read a lot of code and not only your own)
06:05naegi think readability is subjective
06:06naegthat's why I do think Python is a great language and very suitable for beginners. but once you're a bit a better programmer, you can also cope with seemingly "more complex" syntax
06:09Foxboroni agree
06:09Foxboronthe only real problem with LISP is the whole "functional" and "declarative" thing
06:09jjl`you don't think significant whitespace confuses the hell out of newbies?
06:09Foxboronthey don't actaully
06:09Foxboronnot from my experience
06:10Foxboronand i am currently mentoring a study group with beginners
06:10Foxboronusing python
06:10naegjjl`: well, you should be doing this with c#, java, ... etc. too for readability
06:10naegand once they understood spaces are important, it doesn't seem like a problem to me
06:10jjl`oh sure. but have you actually read the logic for python indentation?
06:11jjl`i suppose if you tell them 'always indent with 4 spaces' it simplifies things
06:11jjl`but the indent rules are utterly batshit. some kid is going to get a mix of tabs and spaces by accident and get confused
06:11naegthat could easily be fixed with a good ide/editor
06:12naegalso, you don't have to use 4 spaces exactly - all you have to do is be consistent
06:12Foxboronjjl`: ummm
06:12Foxboronconfusing spaces and tabs is a editor failure
06:12jjl`oh sure, we're going to teach all the newbies to use emacs
06:12Foxboronif you setup the editor, and only touch tab, no problem
06:12FoxboronSublime Text
06:12FoxboronNotepad
06:12Foxboronall have the feature
06:12naegever decent IDE has this feature
06:13naeg+ vim :P
06:13Foxborontbh
06:13Foxboronany decent editor has the feature
06:13jjl`to be fair, i did teach someone to program in emacs. just i handled the bits where keychords were required. and it used my config
06:14Foxboronbut again
06:14Foxboronwhitespaces, no problem for beginners
06:14Foxboronthe beginners i have encountered have problems with different conceps as objects and functions
06:14Foxboronnot whitespaces and identions
06:14jjl`komodo edit might be a good thing. it can be set to show indent lines. that would help newbies
06:14naegFoxboron: about the functional and declarative: I also think that imperative programming is easier to learn for most people - yet another reason i think python is great for beginners
06:15naegand later they can decide whether they want to try out other stuff
06:15clojurebotTitim gan éirí ort.
06:15jjl`naeg: yes, but MIT teaches scheme in one lesson. that's pretty impressive. can't teach much python in one lesson
06:16naegI like komodo edit too, using it for C-like stuff and python, but lately prefering lighttable wherever possible
06:17naegjjl`: hmmm...I'm not sure what is easier to learn for a complete newbie - are there any studies out there? would be interesting. but the majority starts with an imperative langauge I guess
06:18jjl`naeg: and you wonder why lisp is less popular than many feel it ought to be
06:19naegjjl`: as I said, I'm not sure what's easier for complete beginners. but many people who start out with imperative programming get used to this line of thinking and don't bother trying out other things - which is bad for them and e.g. lisp, but one can't do more than educate those people and show them stuff
06:20Foxboronnaeg: while imperative is easier to learn
06:20Foxboronpeople argue functinal is better
06:21naegI can't really judge here, because I have never teached complete beginners nor read a study/comparison on this
06:23Foxboroni know a 15 year old currently learning haskell as his first "real" language
06:23Foxboronand he himself claims functional is the best way to go for beginners
06:23naegone person is not enough to see a trend
06:24FoxboronWell, Raynes also said that :)
06:24FoxboronHe actually started Haskell himself.
06:24FoxboronSo we got 2 people!
06:24FoxboronDouble the people, double the proof (no, not really)
06:24naegI can see the trend right there :P
06:24lucianmotivation is what drives learning and at least traditionally imperative languages tend to show pretty results faster
06:24lucianbut i would agree pure functions are much, much easier to understand
06:25Foxboronand that, lucian, is a awsome point
06:25Foxboronwhich is why python is recommended for beginners
06:25naeglucian: depends on what results you're after. while a mathematician/physician wants to numbers as his result, e.g. software engineers want to see a gui fast
06:26naegwants to see*
06:27luciannaeg: that's what i mean, the path of least resistance to results that motivate learning is almost always taken
06:28naegagree. even though we both would agree that the path os least resistance is not the best path in form of productivity/simplicity/... (I guess?)
06:38djcoinDo you think it would be possible to mark some clojure code as being "pure" and then run/benefits from some optimization on some part of the code ? Is there any such project ?
06:53mmitchelltechnomancy: I have a leiningen plugin that uses the "hooks" feature, along with robert.hooke/add-hook. My functions is executed, but not in the scope of the project. Is this possible to do? eval-in-project doesn't seem to be working in this context.
06:53jjl`djcoin: even haskell doesn't do terribly much in that way. the benefit of pure code is that you can cache results, but haskell still relies on manually using memoize
06:54djcoinjjl`: you could do streamfusion or stuff like this
06:54djcoin(i'm not really aware of what might be benefits - but i may have some!=
06:54djcoin)
06:55jjl`well it's a hard problem to know when to cache results
06:55jjl`perhaps best solved by a programmer than a language implementer
06:56jjl`especially considering the memory usage of the JVM already
06:56djcoinstream fusion is not about caching results, its about eliminating intermediate datastructure creation etc.
06:56djcoins/its/it's
06:57jjl`sounds like a fairly hard problem
06:57jjl`especially with richer datatypes
06:58djcoinyou could check for it
06:58djcoinanyway, I'm just being curious :)
07:35clgvdoes clojure always convert the result of an addition of a double and a BigDecimal to double?
07:37clgvseems like it: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L555
07:48andyfingerhutI believe it does, from the implementation. Probably for speed reasons.
07:48andyfingerhutIf you want BigDecimal, make sure all operands are BigDecimal, or at least not float or double.
08:17clgvandyfingerhut: yes, just found `bigdec` ;)
09:14gdev,(reverse "racecar")
09:14clojurebot(\r \a \c \e \c ...)
09:14gdev,(seq "racecar")
09:14clojurebot(\r \a \c \e \c ...)
09:19noidigdev, wtf
09:20noidi:D
09:21noidiI can't believe it took me a while to see how that's possible :D
09:23tomojthere's a big case statement in reverse with a bunch of palindromes
09:23Ember-lol
09:23Ember-I too looked for a while like what's happening until I got it :)
09:30gdev,(doc reverse)
09:30clojurebot"([coll]); Returns a seq of the items in coll in reverse order. Not lazy."
09:31gdevwww.4clojure.com/problem/27
09:37gdev,(tree-seq {:a [1] :b [2 3] :c [4 5 6]})
09:37clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$tree-seq>
09:37gdev,(#(tree-seq % seq %2) {:a [1] :b [2 3] :c [4 5 6]})
09:37clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval103$fn>
09:38gdev,(#(tree-seq % seq %2) ["a" ["b"] "c"])
09:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval141$fn>
09:39gdevokay, gonna try to fix light table instead of using irc as a repl
09:40gdevlibudev.so.0 Y U no found?
09:40Bronsagdev: quick fix: libudev.so.0 -> /usr/lib/libudev.so
09:41pyrhi
09:41pyranybody using core.match in anger ?
09:41pyrI have a weird condition of jar compilation failing but lein run working
09:42TimMcLast I used it there were some non-deterministic bugs, but that was liek a year ago.
09:42pyr(even after a lein clean)
09:42pyrException in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'to-source' for dispatch value: class clojure.core.match.WildcardPattern
09:43pyrthat namespace is aot'ed since it contains a -main
09:43pjstadigpyr: AOT is not supported
09:43pyrthat settles it then
09:44pyrso I just need to hide that function in a namespace that's not aot'd and call it from the main namespace then ?
09:44pjstadigyou might be able to set a whitelist or something so that core.match isn't getting AOT'ed, but your namespace is
09:44pjstadigotherwise...you've been CLJ-322'ed
09:44pyrgood to know it's known :) sorry about not figuring it out by myself
09:49tomojis (conde [g1 g2]) semantically equivalent but operationally inequivalent to (conde [g2 g1]) ?
09:51gdevBronsa:) thanks, but it looks like I don't have /usr/lib/libudev.so either
09:51Bronsaoh
09:51gdevubuntu 13 for the win
09:52Bronsawell, apt-get install libudev-dev then
09:52IamDrowsygdev: /lib/x86_64-linux-gnu/libudev.so.1
09:52Bronsaor that
09:55ppppaul,(doc match)
09:55clojurebotIt's greek to me.
09:55ppppaulwhat is core.match pyr?
09:56Bronsahttps://github.com/clojure/core.match
09:56jjttjj`what do people usually do these days to avoid launching to jvm insances for a ring server and a repl? I'm using emacs/clojure-mode/nrepl
09:56jjttjj`*two
09:56nDuffjjttjj`: AFAIK, most people don't try to avoid that.
09:57gdevBronsa:) that worked when I linked it to /usr/lib/libudev.so.0 thanks
09:57ppppauljjttjj`, i get more memory
09:57ppppauli also use drip
09:57gdev(inc Bronsa)
09:57lazybot⇒ 4
09:57jjttjj`nDuff: ok cool. I feel like I've seen it before in a project but forget where, wasn't sure if I was missing out on something cool.
09:57weavejesterjjttjj`: The latest lein-ring allows you to run nrepl alongside it.
09:58ppppaulflatland drip
09:58weavejesterjjttjj`: :ring {:nrepl {:start? true}}
09:58ppppaulneat
09:58jjttjj`weavejester: awesome
09:59ppppaulis there a reason for using core.match over multimethods?
10:00ppppaulthough, that is probably the smallest fizzbuzz i've seen
10:01weavejesterppppaul: core.match allows for more complex matching off the bat, and is more intelligent about optimising IIRC
10:02weavejesterMultimethods just apply a function and dispatch off it
10:02weavejestercore.match does some interesting things around figuring out the most efficient way to match a bunch of destructured matches
10:03weavejesterHowever, AFAIK core.match is all precompiled - you can't add stuff on the fly.
10:08pyrpppaul: a pattern matcher to avoid lots of cond and ifs to make things short
10:08pppaulok
10:08pppauli'm actually interested init
10:08pppaulwhat issues are you having with it?
10:08pyrpppaul: the advantage of match vs a calling a multimethod with (juxt field1 field2) on a map is that it can handle wildcards
10:09pppaulhmmm
10:09pyrpppaul: my issue is with aot namespaces and core.match
10:09pppaulwhat does core.match need AOT?
10:10pppaulwhy*
10:10pyrnope, it breaks on AOT'd namespaces apparently so my stuff works fine with lein run / lein repl, but does not compile to a jar
10:10pyrplumbing details, i'm sure it'll figure itself out
10:11pppaulhmmmmm'
10:11pppaulso it breaks when you want to turn your NS into a class?
10:12pppauli'm not experiences with AOT
10:13pppauli'm also apparently not experienced with english
10:15pyrpppaul: it breaks if it's require'd from your main namespace
10:15pppaulmain
10:15pppaullike .core?
10:15pppaulso, that sounds extremely easy to get around
10:15pppaulmy main ns's are usualy pretty empty
10:28pjstadignot just if it is required, but if it is transitively required
10:28pjstadigwhich usually boils down to: if you use your code at all in your main ns, then you're boned
10:28pjstadigmore or less
10:30pppauloh
10:30tomojthe problem is that AOT on core.match produces broken class files?
10:30tomojor what
10:31pppaulmain as defined in project.clj?
10:35pyrtomoj: the problem is that if core.match is a dependency on an AOT'd namespace, jars cannot be produced
10:35pyrtomoj: at least if leiningen is used to compile, haven't tried anything else
10:36pyrpjstadig: yeah, i had to play dirty tricks to require the namespace from a constructed symbol
10:36tomojhuh, because core.match throws an exception during AOT?
10:36pyrtomoj: yes
10:36tomojah :(
10:37pjstadigpyr: right, you would have to require your core.match dependent code at runtime
10:37tomojmaybe one of the next few clojure versions will have a better story for AOT..
10:37pyrwhich is what i'm doing now
10:47pppaulso, if you make a war file are you srewed?
10:47pppaulscrewed?
10:49pyrpppaul: unless you start playing tricks with constructing the symbol to require, yes.
11:07gdevthere are so many people in the datomic channel yet it is so quiet. so maybe someone in here can help me out. I'm trying to explain the difference between a programmable query language and sql strings
11:09gdevsince my audience doesn't know what datalog is I'm trying to use the analogy of a bank robbery vs a ransom note
11:10tomojhmm
11:11tomojimagine if inheritance in java was based on some string templating mechanism
11:11tomojwhere you're working with the code of the other classes
11:12gdevtomoj:) I like it, that's a way better analogy
11:12tomojthen there's another level where working with java classes that represent queries seems nuts when you can just use data structures
11:13tomojthough, hmm
11:14gdevnow I'm trying to think of a query that would get an inherited method from a base class
11:14tomojI haven't done a whole lot of work with sql, do people successfully get through whole projects without dealing with string query parts?
11:16gdevtomoj:) I've yet to see anyone do any database interaction without tweaking strings
11:17gdevwe have people who spend all their time writing mountains of sql strings for other developers to use
11:17tomojhmm
11:17tomojhow do you compose them?
11:19tomojI guess the other devs will just copy fragments and use string concatenation to compose stuff?
11:19gdevno, if you need something different you put in another request for a different sql string
11:20tomojand every sql string is self-contained? or the sql people are defining helper functions in the background?
11:21gdevto query the database: step 1) email raj with what you need step 2) paste reply into your sql.properties file step 3) ??? step 4) profit
11:21gdevsince some of the relationships are messy, it's hard to tell what will happen if you tried to compose queries based on what you have
11:22gdevand testing your own queries? f'getabout it
11:25gdevnot all departments are like that, but this is the enterprise, people have job security when they're the only ones that can understand the database...makes the "over there" problem even bigger
11:27tomojI'm guessing your problems are more political than practical? :(
11:33gdevI'd say it's equally both; it's impractical to have your database tied to politics
11:36tomojyeah..
11:42gdeveven on the ones that aren't like that, the average time for composing an sql statement is pretty large
12:18silasdaviswill enumerating over (concat a [b c d]) be faster or slower than over (conj a b c d)?
12:18silasdaviswhere I am including the time taken to perform the concatenation in each case
12:18silasdavisi.e. I'm joining two lists
12:19bbloomsilasdavis: ##(doc time)
12:19lazybot⇒ "Macro ([expr]); Evaluates expr and prints the time it took. Returns the value of expr."
12:19silasdaviswould the answer change if I was using different collection types
12:19bbloomgive it a try
12:19bbloom besure to dotimes while you're at it
12:20technomancyjjttjj: FWIW I highly recommend using a single JVM for ring and nrepl
12:21technomancyif you write a -main defn that uses ring-jetty-adapter you can treat your ring server as just another function instead of some magic task you have to invoke from the CLI
12:22weavejestertechnomancy: Just because you invoke a function from a command line doesn't make it inherently magical.
12:22jjttjjtechnomancy: cool that's sort of what I was thinking originally, that that might be useful, I'll play around with it in a bit
12:23technomancyweavejester: what I mean is you can't use M-. to see the source
12:23technomancyit's not nearly as transparent
12:24weavejestertechnomancy: You can run lein-ring with nrepl attached, which amounts to the same thing without tying your web application to a particular adapter.
12:25technomancyI've never seen an actual case where tying to a specific adapter is a bad thing
12:25technomancyexcept netty, which doesn't work with ring anyway
12:26weavejesterThere's a couple of ring-netty-adapter projects around
12:26technomancyright; I mean the use cases that make netty interesting don't work with ring
12:26technomancy(not saying that's a bad thing)
12:27weavejesterI dislike the idea in principle of typing an abstract web application to a particular web server when it's not necessary
12:27technomancyI know. =)
12:27technomancyI just have never seen a practical downside.
12:27technomancyit's only a 5-line function anyway
12:27weavejesterI mean, you have a nice abstraction, and then spoil it by tying it to a specific server
12:28weavejesterWell, if you're deploying as a war file or something else like that, you don't necessarily want a -main method
12:28weavejesterI guess you could argue that even though it's debug code in production, it does no harm...
12:28weavejesterBut it feels wrong.
12:29technomancyit's five extra lines; I'll trade "feels wrong" for the extra transparency
12:31gtrakyou could always just pull out the server bit into a separate project later, that's the benefit of working to an abstraction.
12:32silasdavisbbloom, that's a rather sensible suggestion
12:32tomoj:profiles {:dev {:main com.example.dev-server}} ?
12:32silasdavis(defn test-join [m] (time (dotimes [n 10000] (let [a (rand-list 1000 '[]) b (rand-list 100 '[])] (m a b)))))
12:32technomancygtrak: it's hard to argue that five lines makes that more difficult
12:32silasdavis(test-join into): 4037 msecs
12:32silasdavis(test-join concat): 4032
12:33gtraktechnomancy: yea, I actually agree with you :-), lein-ring is harder to reason about than loading up jetty myself
12:33silasdavisabout the same it would seem
12:33gtraklots of costs involved, would I rather fork the project to do something special or change some lines?
12:33weavejesterIt amounts to the same thing as using the CLI.
12:33technomancyoh, gotcha
12:34noncomhi i have a vector of namespaces. all of them are supposedto have a function, say "update". how do I properly map through them to execute that one function, while I am in another namespace?
12:34weavejesterAnd although it doesn't save too many lines of code, it preserves the abstraction.
12:35hyPiRionIt's not about saving lines in the short term.
12:35weavejesterThough granted I don't know of a practical downside to tying the adapter to the handler :)
12:35gtrakI sacrifice some control over my classpaths to use lein-ring, that gets to be a big deal when it's not a one-off self-contained thing
12:35technomancythe abstraction is still there if you have a -main
12:35weavejesternoncom: What do you mean by "map through them"?
12:36technomancy(def app ...) is still a separate var from (defn -main ...)
12:36gtrakI think preserving the abstraction is a nice thing, but it doesn't have a ton of force.
12:36noncomweavejester: like (doall (map #(%/update) @namespaces)), where namespaces is an atom vector
12:37weavejestertechnomancy: Yeah, but you're still tying a particular web server to your project.
12:37noncombut%/update doesnotwork
12:37noncombinding [*ns* %] either
12:37weavejestertechnomancy: I guess I only have an idiological argument.
12:37gtrakyou're never 'tying' it.. you're only slightly raising the cost of decoupling it later.
12:37bbloomsilasdavis: i'm a sensible guy
12:38hiredmanweavejester: technomancy's is ideological as well, don't let him make you think otherwise
12:38hyPiRionhiredman: oh no, you're wrong
12:38weavejesternoncom: Hmmm… iterating through namespaces like that doesn't seem like a great idea… but you can use ns-resolve I think to resolve a var from a symbol.
12:38hyPiRionhe's quixotic
12:39technomancydefn the ultimate
12:39technomancy^ my ideology =)
12:42silasdaviscan I write multiple bodies for a function so that some of the bodies get called when one of the argument takes a specific value?
12:42noidisilasdavis, what you want is pattern matching: https://github.com/clojure/core.match
12:42silasdavis[n l s] (body...) [:first l s] (other body...)
12:43silasdavisnoidi, ah yes it is... is there a way to do it with destructuring?
12:44noidino, destructuring just takes things apart
12:44noncomweavejester: i tried that, not calling a function seems to compile, however,I cannot add my namespaces to a vector... aren't namespaces just variables in clojure? are them special?
12:45robearis there an equivalent to .indexOf for vectors in clojurescript?
12:45noncomweavejester: sry, i meant "now calling a function"
12:45weavejesternoncom: No, they're namesspaces, not vars. However, you can construct a var from a symbol.
12:45hyPiRionnamespaces are data
12:45noncomweavejester: with quote?
12:46hyPiRion,(var +)
12:46clojurebot#'clojure.core/+
12:46noncomhyPiRion: I see...
12:47weavejester,(var-get (find-var (symbol "clojure.core" "inc")))
12:47clojurebot#<core$inc clojure.core$inc@4082d>
12:47noncomoh..
12:47weavejesterBut using namespaces in the way you're using them might indicate you're approaching a problem in the wrong way.
12:48technomancyweavejester: when did :nrepl get added to lein-ring? that's a cool feature.
12:48weavejestertechnomancy: One of my colleagues suggested it and submitted a patch. I think I merged it in a week or two ago.
12:48noncomweavejester: possibly. maybe you could give me some insight on how to do it more right, if I tell you what I am after? here is my story...
12:49weavejesternoncom: Go ahead
12:50noncomI want to have a multiuser environment where everyone can connect to the running program with a REPL and do their stuff in their own personal namespace. So each user has a namespace. And when a user is registered in the system and is active, his namespace is linked to the main executioner thread
12:51noncomand say, namespace name is build of user login...
12:51noncomthe main point is to have personal parts of the program which can be easily linked oк unlinked from the main execution
12:52noncomand each such namespace must have "Start" "update" and "stop" functions
12:52noncomand thats the only contract for them
12:52noncom.
12:53weavejesterHm...
12:53weavejesternamespaces won't sandbox users, so presumably everyone on the system is trustworthy?
12:54weavejesternoncom: Also, why do all the users need to be in the same process?
12:56noncomweavejester: yes, everyone is trustworthy. in the worst case i can make them connect with a special terminal which will ensure security by disallowing references to anywhere but the allowed functions. And them must be in the same process because they must have the ability to do something in the common "world" which is running in that mainprocess. metaphorically, they can create, say, animals and their animals play together
12:57noncomand that needs to be fast.
12:58weavejesternoncom: Ah, okay, so why not allow each user to register a function themselves? i.e. instead of creating a function that has to be called update, they have some code like (add-to-world my-update-function)
12:59gtraksounds like you need a map of user-id to implementing object, not necessarily a namespace. it's probably fast enough to look up this way for your needs.
13:00gtrakimplementing object can be another map, a record, a reify instance, etc..
13:01noncomweavejester: hmmm! looks like a fair and simple solution! how did not I think... I could just force them to execute a couple of "registration" fns at the beginning of their activity... oh.. still trying to get my mind decomplexified of OOP stuff! :D I will try that solution today and see how it wox!
13:01noncomgtrak: yeah, seems to be I was over-complexifying things :)
13:02weavejesternoncom: Good luck :)
13:02hyPiRionIRC, saving souls since 1988.
13:02gtrakkey-values are convenient ways to think about associations :-)
13:02noncom:D
13:08robearis there a way to get the index of an element in a vector in clojurescript?
13:11gtrak keep-indexed?
13:12gtraksimply supply a pred that returns the index if it matches, nil otherwise, call 'first' on the result.
13:13SegFaultAXrobear: You just want the index of a single element?
13:13SegFaultAXrobear: Probably just use indexOf
13:14robear.indexOf it gives me a no method error. tried it on himera as well and same thing. seems to work on a string but not a vector.
13:14silasdavisis there a built in function that does (fn [f] (fn [&xs] (apply f (reverse xs))))?
13:18winksilasdavis: I don't fully understand what you want to do :P
13:18SegFaultAXrobear: Weird, Arrays in js definitely have an indexOf method. Unfortunately I'm not really familiar with cljs.
13:18emanon_hello there
13:18winksilasdavis: like.. why xs without x :)
13:18hyPiRionSegFaultAX: vector != array
13:18SegFaultAXwink: They want to apply the arguments right to left.
13:18hyPiRionoh, like flip
13:18SegFaultAXhyPiRion: I made the assumption that the underlying datatype is still an array.
13:19emanon_I have a kinda a weird question, by I'm curious
13:19silasdaviswink, get a version of function that takes it's argument in the reverse order
13:19SegFaultAXhyPiRion: Yes.
13:19hyPiRionsilasdavis: no, there isn't afaik
13:20emanon_I am ruby developer and I've just started to learn clojure, but I have no Idea how to get started to write code, means I didn't find any best practices, code conventions etc
13:21SegFaultAXemanon_: I strongly suggest picking up a book on Clojure. Clojure Programming and Joy of Clojure are my personal recommendations.
13:21tomoj((flipper [x y] [y x]) f)
13:21tomoj(flip [x y] [y x] f) ?
13:22tomojer, (flip f [x y] [y x])
13:22SegFaultAXemanon_: As for code conventions, the easiest way to learn is to read a lot of idiomatic code and emulate their style.
13:22emanon_SegFaultAX: Thanks!
13:22Foxboronemanon_: i recommend 4clojure and clojure programming. you should wait with Joy of Clojure until the new version is out
13:22emanon_Is there any good open source projects for newcomers?
13:22SegFaultAXemanon_: Lots.
13:22emanon_To dive in best practices
13:23SegFaultAXemanon_: I suggest looking at stuff written by weavejester, cemerick, Raynes, amalloy, etc.
13:23winksilasdavis: SegFaultAX: yeah was unsure about repeated apply vs apply f to reveresed args.
13:23emanon_thanks!
13:24tomoj(= [2 4] (reduce-kv (flip conj [ret v] [ret k v]) [] {1 2 3 4})) ?
13:24winksilasdavis: that said, I find yours pretty basic. would be a little weird to have a lang construct
13:25slagyrIn ClojureScrupt, how do I extend IDeref without getting a warninig?
13:25slagyrcljs.user=> (deftype Foo [] cljs.core.IDeref (-deref [this] "foo"))
13:25slagyrWARNING: Symbol cljs.core.IDeref is not a protocol at line 1
13:27dnolenslagyr: cljs.core/IDeref is what you want
13:28SegFaultAXwink: What do you mean by a lang construct? Flip is a simple function. flip :: (a -> b -> c) -> b -> a -> c
13:28SegFaultAXwink: (Or in other words, a function that takes a function of two arguments and returns a function expecting those arguments in reverse order)
13:29SegFaultAXExcept in Clojure we can handle any arity we like. :)
13:29silasdaviswink, I think it's quite natural if you're dealing with 2 argument functions or functions that take a homogenous list of arguments like concat
13:30silasdavisI wanted to write (update-in foo [:some :stuff] (flip into) bar)
13:30silasdavisrather than (update-in foo [:some :stuff] (fn [a b] (into b a)) bar)
13:30winkSegFaultAX: I meant: it's composition and you can argue if reversed or normal is the default.
13:31silasdavisfeels cleaner
13:31winkI see
13:32winkI think I'm jsut more in the "if I can write it in 80 chars it should not be in the language" camp
13:32slagyrdnolan: Thanks! That did it
13:32winkeven if it means reinventing wheels
13:32SegFaultAXwink: What wheel is being reinvented?
13:33winkSegFaultAX: said reverese composition function.
13:33SegFaultAXwink: It isn't really reverse composition.
13:33SegFaultAXWe aren't composing functions here, we're applying them.
13:33winkf(g(x)) is composition to me
13:34emanon_Maybe it sounds weird, sorry for my object-oriented brain damage, but is there design patterns in functional languages?
13:34hiredmanf·g would be composition
13:35winkhiredman: yes of course, but isn't it this in this case. it's not partial
13:35SegFaultAXemanon_: There are patterns in every language. Many of the patterns you know from OOP are probably not as common, don't exist at all, or simply fade into the background.
13:35winks,case,case?,
13:35winkmy chicken korma doesn
13:35winkww
13:35technomancyemanon_: middleware is a common FP "pattern" in clojure
13:36emanon_technomancy: thanks, will try google it
13:36xeqiwhich is basically the decorator pattern applied to functions
13:36hiredmanpartial application isn't composing two functions together
13:36SegFaultAXxeqi: Isn't the decorator pattern usually about functions?
13:37emanon_Strategy could be implemented in FP I guess
13:37xeqiSegFaultAX: Isn't it about using composition to add new behavior to an object?
13:38SegFaultAXemanon_: If you're interested in such things, you should check out Clojure's multimethod support.
13:38hiredman.win 15
13:38SegFaultAXxeqi: What the decorator pattern?
13:38xeqiyes
13:38xeqiooh, looks like that the first line in wikipedia
13:38SegFaultAXxeqi: Uh, no?
13:39SegFaultAXxeqi: Maybe you're confused with the mixin pattern or something.
13:39winkhiredman: maybe I'm thinking too mathematically. but even the wikipedia page tells me g .f := g(f(x))
13:39SegFaultAXYou don't usually decorate classes, though.
13:39winkhiredman: and of course it
13:39SegFaultAXwink: Yes, your notion of compositon is correct. flip is not that.
13:39winkhiredman: and of course it's not partial at the moment of application
13:39xeqiI haven't mentioned classes, just objects
13:39hiredmanwink: it isn't, obviously, the left hand side has no x
13:40winkSegFaultAX: aaah, sorry, I misread
13:40SegFaultAXxeqi: Objects then.
13:40SegFaultAXwink: Flip is simply reverse application. It has nothing to do with composing functions.
13:40hiredman(f·g)(x) := g(f(x))
13:41winkhiredman: g . f: A -> C, x -> (g . f)(x) := g(f(x)), yea
13:41SegFaultAXhiredman: I think you got that backwards.
13:41SegFaultAXhiredman: (f . g)(x) := f(g(x))
13:41silasdavisyeah this is nothing to do with composition
13:42silasdavisSegFaultAX, both convention do actually get used
13:42silasdavisconfusingly enough
13:42winkSegFaultAX: what I meant, i misread your 2nd or 3rd line, with reverse on args. I had indeed read it as g . f => f . g origfinally
13:42SegFaultAXsilasdavis: Look closer.
13:42hiredmanSegFaultAX: sure
13:42SegFaultAXsilasdavis: He flipped the right and left side.
13:42SegFaultAXI've never seen a notation where the right function was applied last.
13:43hiredmanyeah, I just reused my previous composition for the left side, which happened to use the same letters but in the wrong order
13:44SegFaultAXwink: There is absolutely no requirement that f and g be commutative under compositon.
13:44SegFaultAXAnd in fact it is often the case that they aren't.
13:44winkSegFaultAX: yes of course, I was just not paying attention properly, sorry :P
13:44wink40min bike ride, delivery guy inbetween
13:45hiredmananyway, my point is f(g(x)) is function application to an argument, not composition
13:46SegFaultAXhiredman: Yes, but so is (f . g)(x)
13:46SegFaultAXNote the (x) part.
13:46hiredmanSegFaultAX: exactly
13:47SegFaultAXhiredman: Oh, I didn't know that's what you were trying to say. We agree, than!
13:47SegFaultAXThen, even.
13:49mads-I'm new to Clojure. I want to make a HTTP connection, but all my google searches are projects on github or something. Isn't there HTTP connections in the language or its standard libraries?
13:50SegFaultAXmads-: There is clj-http
13:50gtrakmads-: java's got it built in, the next step up in abstraction apache commons httpclient, a clojure interface for that is clj-http
13:51mads-Thanks
13:51SegFaultAXmads-: There is nothing in the clojure std lib if that's what you're asking. You could of course just use the java libraries.
13:51technomancymads-: clojure is a very small language
13:51technomancyyou can do (slurp (java.net.URI. "http://example.com&quot;)) for trivial things though
13:51SegFaultAX,(count (keys (ns-publics 'clojure.core)))
13:51clojurebot593
13:51SegFaultAX*cough* small *cough*
13:52hyPiRionSegFaultAX: what do you compare with? Java, Haskell or Assembly?
13:52SegFaultAXhyPiRion: I was mostly kidding. :)
13:52SegFaultAXAlso, CL.
13:53technomancy"bigger than scheme; smaller than CL"
13:53hyPiRionah
13:53technomancy^ every language
13:53SegFaultAXtechnomancy: Exactly, haha.
13:53hyPiRionCL is such a nice thing
13:53silasdavisRaynes, if you happen to be around, I was going to suggest that these functions be added to laser: https://www.refheap.com/paste/14258
13:54SegFaultAXsilasdavis: PR!
13:54silasdavispr?
13:54brainproxydnolen: is it important that in a browser the cljs part of { cljs: ..., mori: ... } is globally accessible, i.e. as window.cljs?
13:54clojurebotforget forget primetime is <lowlycoder> i'm not convined clojure is ready for
13:54SegFaultAXsilasdavis: If you want to contribute, open a pull request.
13:54brainproxydnolen: or is it fine if only mori ends up in the global scope?
13:54silasdavisah I was just about to ask if I should do that
13:54silasdaviswill do
13:55silasdaviscan you get leiningen to use a git repo as a dependency?
13:55emanon_Found out SICP in Clojure but it looks dropped
13:55technomancysilasdavis: no
13:56dnolenbrainproxy: fine if only mori ends up in the global scope.
13:57hyPiRionthe most amazing part of CL is least-negative-normalized-double-float
13:57bbloomdnolen: surely _ is an available identifier ;-)
13:57hyPiRionAlong with other long names.
13:57dnolenbbloom: heh, I imagine people can do that if they like, I don't really want to follow the noConflict pattern that entails
13:58bbloomdnolen: i was kidding. please don't do that :-P
13:58SegFaultAXYou could just keep adding _ until you find an unbound name.
13:58brainproxydnolen: cool, thanks; almost done with the combo-environments wrapper for mori
13:58SegFaultAXIt'll be fun! Depending on load order you could be _ or __ or ___
13:58dnolenbrainproxy: nice!
13:59bbloomSegFaultAX: you laugh, but i've seen a piece of hackathon code that depended on two different versions of underscore & totally just made __
13:59SegFaultAXbbloom: Haha, oh man I'm crylaughing.
14:00bbloomSegFaultAX: i walked out of the room :-P
14:00SegFaultAXThat's amazing.
14:00TimMcI actually like noConflict.
14:01SegFaultAXDoesn't it just unbind jQuery from its shortname?
14:02SegFaultAXI wish Javascript was more flexible with its identifiers. I would totally start writing libraries that use common Haskell operators in confusing ways. <=< >=> >>= etc.
14:05tomojwhy does this counto relation diverge? (the last example at the bottom) https://www.refheap.com/paste/db3f8d59bc1791b03164ea0a5
14:11ro_stRaynes: sooo. switching from noir to lib-noir + compojure. buh-bye defpage and server/add-middleware, right?
14:12Raynesdefpage and add-middleware were horrible, horrible creations.
14:12RaynesEspecially add-middleware.
14:12lynaghkRaynes: the more Clojure I write, the more I hate anything that starts with "def".
14:13ro_sthey lynaghk :-)
14:15lynaghkro_st: what's up?
14:16ro_stcontemplating a rather large noir -> lib-noir refactor. the technical debt is strong with this one.
14:21ro_stRaynes: can i bring in lib-noir 0.5.2 and noir 1.3.0 at the same time and have things stay sane?
14:22ro_sti've already removed uses of noir.request/ring-request
14:22RaynesPossibly. I'm not sure.
14:24ro_stseems like a good time to put clojure.tools.namespace/refresh to use
14:25ro_stenjoying your new hometown, Raynes?
14:25RaynesToday? Not really. Occasionally.
14:28SegFaultAXRaynes: I hear the weather has been pretty shitty down there, actually.
14:28SegFaultAXRainy and stuff.
14:28RaynesSegFaultAX: Well, it rained night before last.
14:28RaynesI'm perfectly fine with rain. The weather is positively boring otherwise.
14:29SegFaultAXI love when it's cold and rainy.
14:29RaynesI could do without cold.
14:29SegFaultAXSF has been a friggin oven lately.
14:30RaynesI can recall one day (last week in fact) that it was really warm here.
14:30SegFaultAXI work across the street from the Embarcadero and its gotten up into the 80's multiple times (which is rare for SF in general)
14:30technomancyI really liked the rain when I was in LA because it meant things would be less brown for a while.
14:31SegFaultAXtechnomancy: Y u no like wall of smog?
14:31RaynesI haven't seen anything brown except for a pile of manshit on the sidewalk in Santa Monica yesterday.
14:32SegFaultAXRaynes: It's really obvious when you're coming over the grapevine.
14:32nDuffRaynes: If you'd rather do without cold, come to Austin! I'm getting ready to head in the other direction and move to Chicago.
14:33SegFaultAXnDuff: Ugh.
14:33ro_sthas anyone solved automatically removing unused :require / :use defintions yet?
14:33nDuffSegFaultAX: With respect to which?
14:33SegFaultAXnDuff: Austin. It's better than Houston though.
14:34SegFaultAXHaha, yes it is.
14:34hammer_what's a but for
14:34SegFaultAXFor pooping, silly.
14:34hammer_(inc SegFaultAX)
14:34lazybot⇒ 2
14:34technomancyro_st: slamhound is the only attempt at that afaik
14:34SegFaultAX:D
14:34technomancyit works to various degrees of success
14:35SegFaultAXnDuff: There is a pretty sick tech bubble in Austin growing.
14:35ro_stwe use :require [n.s :as alias] consistently
14:35ro_stno :use or :refer
14:35ro_sthow will slamhound deal with that?
14:36dnolentomoj: that's not going to work. the second branch of reduceo will never terminate
14:36ro_sthey dnolen!
14:36dnolensorry of reduceo*
14:36dnolenro_st: hullo
14:37ro_sthappy to see you mucking about in cljs land again :-)
14:37dnolentomoj: you'll only getting an answer from the first branch
14:37dnolenro_st: hehe yes, will probably taking a break from that to focus on core.match for a while
14:37ro_stwe're on 1803 / 1.5.1 with no issues
14:37nDuffSegFaultAX: Yup -- been turning down a pretty ridiculous number of recruiters in the last several months.
14:38ro_stjust had to tidy up some sloppy code that tried to use map access on strings, that's it
14:38technomancyro_st: as long as you don't use resolve/eval or fully-qualified vars you should be good
14:38dnolenro_st: sweet, there's a bad bug around empty arrays, will ping stuartsierra to push out another fix soon as he's around.
14:38technomancyoh, or macros that rely on :as clauses which aren't called in the namespace they're defined in
14:38SegFaultAXnDuff: How is the property value doing out there? Historically its always been like an order of magnitude less than the Bay Area but there's a lot of money moving out there in recent years.
14:38technomancythat one is tricky
14:38ro_stdnolen: would you mind describing briefly the change to keywords? they're no longer strings?
14:39nDuffSegFaultAX: Land's still cheap here.
14:39nDuffSegFaultAX: A bit more than I'd like -- have a house I'm looking to unload.
14:39tomojdnolen: hmm, you mean only in the context of the last example and after the first answer has already been found?
14:39ro_sttechnomancy: ok. i'll walk-with-scissors around our macros namespace
14:39silasdavisif I have function defined in the outer scope with the same name as a function argument
14:39technomancyro_st: there's a workaround for the macro issue, but it doesn't work cleanly out of th ebox
14:39SegFaultAXnDuff: Are the salaries still competitive with the valley?
14:39ro_sti'll give it a go and let you know
14:39ro_stthanks technomancy!
14:39silasdavishow can I reference the outer scope from within the function
14:39silasdavis?
14:39dnolentomoj: yes the reason the last example (counto) doesn't terminate is because the second branch of reduceo* won't terminate with run 2
14:39technomancysure
14:39nDuffSegFaultAX: Yes.
14:40tomojah, ok, thanks
14:40nDuffSegFaultAX: ...after taking into cost-of-living differences, superior to.
14:40SegFaultAXnDuff: Yea, definitely.
14:40dnolenro_st: keyword change hasn't landed yet, but the idea is to move way from keywords as strings, V8 penalizes modifying the string prototype
14:40dnolenro_st: but there are other benefits, with keywords as strings we'll probably land constant literal optimization as well
14:41ro_stwill it just be some sort of singleton instance per keyword then?
14:41SegFaultAXnDuff: I have family all over southeast TX. Mostly Houston, Baytown, Orange, Beaumont, etc.
14:41dnolentomoj: there's no reason for reduceo* to fail, it'll just keep adding up numbers
14:41SegFaultAXnDuff: It staggers me how cheap property is out there comparatively speaking.
14:41dnolenro_st: yes with some special handling of the dynamic read keyword case
14:42ro_stgotcha
14:42ro_stkinda hard to write cljs without keywords, so it's a big decision :-)
14:43ro_stRaynes: so, noir.statuses gives you a nice way to set a 500. compojure only does not-found. how do you handle your 500?
14:43RaynesI return {:status 500} :p
14:44ro_stok so you don't keey your 500 error page centralised?
14:44technomancyro_st: I have a simple middleware to catch and set status
14:44technomancyif it's an ex-info, I pull :status out of the ex-data
14:44technomancyyou could dispatch HTML error pages based on ex-data easily too
14:45ro_sttechnomancy: thanks. is that online somewhere?
14:45technomancysure: https://github.com/technomancy/syme/blob/master/src/syme/web.clj#L111
14:45ro_stgreat, thank you
14:45akells`(reset! storage-map (merge @storage-map (hash-map posted-data posted-data))) this works completely fine in the repl, but in actual practice its giving me 'PersistentArrayMap cannot be cast to clojure.lang.IDeref' -- is there something special about the repl in this case?
14:46amalloy(throw (ex-info {:status 200 :body "lol who needs to return values via the stack"})) ;; technomancy, make this work
14:46akells`storage map is an atom in this case
14:46technomancyamalloy: evil
14:46amalloyakells`: you hope storage-map is an atom, but apparently it's a map
14:47akells`amalloy: well its a map when its @storage-map, which is what I was intendin
14:47akells`g
14:47amalloyno, storage-map itself is a map, or you wouldn't get this exception
14:48akells`oh my god you're right. I am an idiot
14:48akells`thank you
14:48ro_stnoir/defpartial is utterly useless
14:48ro_sti'm pretty certain the source code is (def defpartial defn)
14:49ro_sthey dobladez! how's life in Argentina?
14:51amalloytomoj: reduceo is trying longer and longer lists, and has no way to know one of them won't eventually return 10
14:52tomojI tried adding some < constraints in counto but no luck
14:52amalloyoh, dnolen already got there and i missed it
14:53amalloyi don't think you can fix it in counto. reduceo will just keep going forever
14:56edtsechguys, anybody know why ring/compojure display exception on the web only once and remove it after reload? and how to fix it?
14:57tomojseems foldro in 'from variadic functions to variadic relations' fails the same way
14:57tomojso I guess it's unfixable :)
14:58amalloy~helpme
14:58clojurebotA bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.
14:58technomancyedtsech: compojure won't display exceptions unless you have some kind of stacktrace middleware
14:58amalloyhiredman: does clojurebot have a syntax whereby i could ~helpme and also highlight a user, so it's clear who the message is intended for?
14:59hiredmanno
15:02tomojactually foldro can't even find the first answer
15:03amalloytomoj: where is foldro? i wouldn't expect foldr to work very well relationally, compared to foldl, but i haven't thought very hard about it
15:06ro_steasy bits done. 166 defpages to refactor :-(
15:07tomojamalloy: my current attempt at translating it https://www.refheap.com/paste/864c78faff82f4f8c7699d4ba
15:07tomojit's on page 5 of the referenced paper
15:07amalloyoh man. here's an unpleasant surprise: ##(clojure.string/replace [1 2 3 4] " " "|")
15:07lazybot⇒ "[1|2|3|4]"
15:07amalloyclojure.string/replace implicitly converts any input into a string by calling .toString on it
15:08tomojamalloy: well obviously my current attempt is wrong :)
15:08amalloytomoj: i don't see a referenced paper
15:09tomoj$google from variadic functions to variadic relations
15:09lazybot[From Variadic Functions to Variadic Relations] http://repository.readscheme.org/ftp/papers/sw2006/12-byrd.pdf
15:10tomojthis one gets the first answer and then diverges https://www.refheap.com/paste/854b10b81ec3bec746caba56e
15:11edtsechtechnomancy: I use https://github.com/weavejester/compojure/blob/master/src/compojure/handler.clj#L28 and it already display smth http://dl.dropboxusercontent.com/u/2428018/Screenshots/12.png
15:12edtsechI don't know if ring already don't use this https://github.com/mmcgrana/ring/blob/master/ring-devel/src/ring/middleware/stacktrace.clj#L83
15:12tomoj(and stabbing away with (fd/< val c) (fd/<= out c) doesn't help)
15:16tomojhmm, this works though https://www.refheap.com/paste/6cd808869ada988874d3c99d8
15:16tomojthat's silly, https://www.refheap.com/paste/8e84c6953ee66aea776fa904f
15:20gfredericksamalloy: I dunno that doesn't seem like the worst sort of duck-wrapping to me
15:20gfredericksgiven that it's basically inconceivable to call a clojure.string function on anything but a string
15:21amalloygfredericks: i did it accidentally, and took ages to find it because it didn't break until much later in my program
15:21gfredericksyeah I believe it
15:25ro_stRaynes: how do i deal with migrating :session-cookie-attrs values for server/start ?
15:25ro_stwe set {:secure true :http-only true}
15:26ro_sti guess i could just ask weavejester :-)
15:26weavejesterAsk me what?
15:26Glenjaminro_st: http://ring-clojure.github.io/ring/ring.middleware.session.html
15:27ro_stweavejester: i'm migrating from noir to lib-noir. we use session-cookie-attrs in noir's server/start
15:27Glenjaminyou want :cookie-attrs
15:27ro_staha
15:27Glenjamincompojure mostly uses ring middleware :)
15:28ro_stok. the migration path is to move it to :cookie-attrs in noir-wrap-session
15:28Glenjaminoh right, noir to lib-noir, not to compojure :)
15:29Glenjaminweavejester: would you be able to tag/release a new ring-mock soonish? I'd like to depend on the new functionality in peridot
15:29Glenjaminnot urgent though :)
15:30ro_stwerrrrl, yes-ish. once i get noir out, i'll see what stuff from lib-noir we want to keep. as simple as -ing possible is my preference
15:30weavejesterYeah, I can do that tonight
15:30Glenjaminexcellent, thanks
15:33ro_stso, lein-ring gives me a nifty way to start ring from shell. is there a way to start and stop ring apps from the repl? a year ago there was something but it was lein 1.x
15:34weavejesterro_st: You can do it with the standard Ring adapter.
15:34weavejesterGlenjamin: 0.1.4 of ring-mock released.
15:34Glenjamincool, thanks
15:35Glenjaminthat reminds me, i was going to try and add pluggable http-kit support into ring-server
15:35weavejesterro_st: There's also a ring-server library that makes adds a few extra pieces.
15:35Glenjaminbut i couldn't see how to only optionally include the default jetty adapter
15:38ro_stweavejester: ring-server/serve returns something i can stop?
15:38Glenjaminro_st: https://github.com/weavejester/ring-serve
15:39ro_stthat's the old one, Glenjamin
15:39weavejesterro_st: If you have {:join? false}. I can't remember whether it has it automatically.
15:39ro_sthere's the new one https://github.com/weavejester/ring-server
15:39ro_stok, i'll poke at it. thanks
15:39Glenjaminoh, whoops - the example looks like the right thing :)
15:40weavejesterro_st: Passing {:join? false} to the standard Jetty adapter means it won't block, and returns a Server object
15:40weavejesterring-serve was just a small wrapper around that
15:40ro_stok, great! join false it is!
15:55_{^_^}_if combinator caluclus is to concatenative languages what lambda calculus is to lisp, is there a calculus that relates to OO or am i just making up random bollocks? ;)
15:56bbloomguy who's name i can't get to tab complete: i'm sure there could be a calculus to study OO, but you'd need to define OO first :-P
15:57dnolen_{^_^}_: might want to take look a the Abadi & Cardelli book, A Theory of Objects
15:58_{^_^}_(inc dnolen)
15:58lazybot⇒ 9
15:58_{^_^}_it always irks me that inc is a function that side affects in here heh
15:59bbloom(dec inc)
15:59lazybot⇒ 0
16:00bbloom_{^_^}_: btw, i made that combinator/lambda comparison in my talk at clj/west (although i took it from somewhere else)… may i ask where you're coming from with that question? just curious about how people are finding their way around the concatenative world
16:00wink(dec (hex (inc 0)))
16:00lazybot⇒ -1
16:02_{^_^}_bbloom: i watched your talk and messed with factjor/factor but didn't remember you made that connection, must have been subconscious association
16:02bbloom_{^_^}_: then it's working :-) haha
16:03bbloom_{^_^}_: (and dnolen too) i also really liked this paper http://www.vpri.org/pdf/tr2011003_abmdb.pdf for formalizing object message sending & what not as associative memory
16:04bbloombonus: it's pretty brief and easy to understand
16:05rbxbxdouble bonus: it's not $150
16:07bbloomwell while we are discussion free descriptions of calculi related to objects, see the original Communicating Sequential Processes paper too: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.85.2760
16:09dnolenbbloom: thanks for the links
16:13sveduboisHow I can translate this to CLJS?
16:13svedubois var metadata = [];
16:13svedubois metadata.push({ name: "name", label: "NAME", datatype: "string", editable: true});
16:15_{^_^}_http://images.wikia.com/uncyclopedia/images/math/a/2/a/a2a900751fb30591f371d3e29a990654.png
16:15_{^_^}_wrong channel
16:16vgrbrhi, i was thinking about some tools for manipulating maps, https://github.com/vgrocha/map-lib , would it make sense?
16:16Raynestpope: You should write an ido-mode thing for vim.
16:17mthvedtcan mutually recursive defns be inlined with each other by the jvm in clojure?
16:17gtrakmthvedt: defns can't be inlined
16:17rbxbxRaynes: rails.vim has things similar to ido mode, but they're scoped to rails-y things.
16:17rbxbxRaynes: which features of ido-mode are you missing in vim?
16:17Raynesrbxbx: All of them
16:18rbxbxheh
16:18RaynesFile system navigation.
16:18RaynesIt's seriously the one thing from Emacs that it physically hurts me to not have.
16:18tos9Raynes: That exists.
16:18rbxbxRaynes: have you tried https://github.com/kien/ctrlp.vim ?
16:18Rayneswildmenu kinda sorta works that way but...
16:18tos9Raynes: In at least 3 filesystem fuzzy matcher plugins.
16:18rbxbxIt gets you pretty close.
16:18RaynesNone of those do what ido-mode does.
16:18tos9Raynes: CommandT, CtrlP and Fuzzy*
16:18rbxbxand is the best of that lot that I've tried.
16:18mthvedtgtrak: i'm finding references to ^:static for inlining and primitives, but this was declared not necessary for performance later
16:19mthvedtand it is not clear to me why
16:19tos9Raynes: Oh. What else does it do?
16:19RaynesIf I ctrlp from /, it is going to try to index every file in my filesystem.
16:19tos9Yes.
16:19gtrakmthvedt: the static was for primitive-stuff, I think the compiler can figure it out now, here's an example of inlining: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L936
16:19tos9What will ido do there?
16:19gtrakmthvedt: definline is another relevant macro
16:20ppppaulcan someone help me in the datomic channel
16:20mthvedtis this clojure compiler inlining, enabling jvm inlining, or a combination of both
16:20ppppauldefinline?
16:20RaynesIt will show you the files in the top-level there and let you cycle through them and narrow the list as you type like ctrlp does. Wildmenu works kind of like it in a certain mode, but not quite the same experience.
16:20ppppaul,(doc definline)
16:20clojurebot"([name & decl]); Experimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expanded inline as if it were a macro. Cannot be used with variadic (&) args."
16:21tos9Raynes: So basically the same thing just not recursive?
16:21rbxbxRaynes: I think I actually prefer ctrl-p style, it's nice that ido-mode is everywhere though.
16:21Raynesctrlp is great for project scope.
16:21RaynesNot for whole file system scope.
16:21rbxbxProbably just a matter of whichever you were raised on.
16:21technomancywhat happens if you rebind ctrlp
16:21Raynestos9: Also, if I backspace, it cd ..
16:21technomancydo you have to rename it?
16:21tos9Yeah I think I also prefer recursive, but I can't say without trying it. I wouldn't ever try to do it on /, I basically always want project scope.
16:21rbxbxtos9: ditto.
16:22RaynesI never want project scope.
16:22tos9technomancy: what happens if you're not on OSX but want to use commandt? Do you have to switch OSes :)
16:22rbxbxtos9: another reason not to use commandt ;)
16:22technomancytos9: sounds like trouble
16:22Raynesamalloy: Nobody gets ido-mode unless they've used it. :(
16:22RaynesWe need to shove Emacs down these people's throats.
16:22gtrakmthvedt: the problem with defns is the var, fn's can be inlined
16:22ro_stRaynes: +1
16:22tos9rbxbx: yeah, too bad it's better than ctrlp :D
16:22ro_stemacs -chant-
16:22gtrakmthvedt: or you can hint the compiler a-la +
16:23rbxbxRaynes: I've been using emacs/ido mode for about 5 weeks now. I think it's just a matter of what you're raised on.
16:23rbxbxdiscomfort breeds contempt, or something.
16:23technomancyisn't vim supposed to be good about separating objects from commands?
16:23ro_stbeen using projectile since rkneufeld's talk. using his config verbatim, actually. works great
16:23rbxbxtechnomancy: text objects?
16:23ppppaulhey guys. i could really us some help on a simple datomic query against an empty db... getting an error and i don't know why (no error when the db has something in it) https://gist.github.com/boxxxie/09bf48ebdfcfc0f99433
16:23technomancyseems weird that they wouldn't understand that fuzziness is an orthogonal top-level concept, not something that should be tightly coupled to a specific command
16:24rbxbxtechnomancy: there's wildmode/wildmenu which are decoupled
16:24rbxbxbut not quite the same.
16:24technomancyI see
16:25technomancyanyway, I think project-scoped fuzziness can be useful, but having it project-scoped by default is stupid
16:26tos9It *isn't* project scope. It's "from here, recursively", whatever recursively means.
16:26rkneufeldtechnomancy: can I ask why? projectile doesn't really re-invent the wheel, it just re-orients useful commands *at* the project.
16:26technomancyrkneufeld: I've never heard of projectile
16:26tos9I don't personally ever want to locate files on my file system randomly, but I could imagine someone wanting that. If I wanted that I'd use something else
16:27tos9Also g:CommandTMaxDepth looks like a thing, though once it reaches that depth I doubt it will then search again if you select the directory.
16:27rkneufeldtechnomancy: ahh, it is a little library for emacs that wraps a number of commands like fuzzy-find, grep in project, etc. with a project focus. https://github.com/bbatsov/projectile
16:27technomancyrkneufeld: I'm saying the default operation for fuzzy finding should be scoped to the current directory, which is how ido works.
16:28rkneufeldI agree.
16:28tos9There's also https://github.com/burke/matcher
16:28technomancyproject-scoped variants are nice, but they should be layered on top of existing versions
16:28rkneufeldtechnomancy: bingo, afaik projectile does (mostly) that.
16:28tos9technomancy: I disagree, which means it'd be good to have both options.
16:28tos9In ido mode, how do you select a thing once you've matched it?
16:28tos9Do you ahve to hit a key?
16:29rbxbxtos9: yes.
16:29technomancyas opposed to...?
16:29tos9technomancy: If I want to locate foo/bar/baz/quux.clj I just type fbbq and hit enter faster than I can look at the results
16:29RaynesI think he is arguing multiple key presses to get through directories.
16:29RaynesBut that's what I want.
16:29RaynesExactly what I want, in fact.
16:29rbxbxhaha
16:29RaynesAnd if there is a way to make ctrlp do that please let me know.
16:29technomancytos9: sure; find-file-in-project works that way
16:30hiredmanenter isn't a key?
16:30rbxbxseems like a matter of taste not worth discussing :p
16:30tos9technomancy: Is the other thing you were referring to something else than that?
16:30tos9rbxbx: eh this seems kind of informative. I like hearing how other people work as long as everyone's got level heads.
16:31technomancytos9: that's a lot of pronouns
16:31pjstadigtechnomancy: they don't call them 'pro' for nothing
16:33technomancyhere's the thing. you should have an orthogonal "fuzzily select from this list" function, and a function for getting a list of files in the current directory, and functions for getting some other sets of files, maybe some stuff for filtering and sorting. compose as you like.
16:33tieTYT2I wrote this code that's a web crawler. You give it a url, it gets the html of that url, finds all the images, then downloads all the images. But my code is kind of hard to test because this all is done by calling "crawl-site" and it has IO 3 times
16:34technomancythat's it =)
16:34tieTYT2or twice, or whatever, the point is
16:34tieTYT2unlike a haskell program, i'm mixing the functional part and the side effect part
16:34tieTYT2i'm assuming a better way to organize the code would be to put all the IO/side effect parts at the top level
16:36tos9technomancy: That seems fairly obvious, these fuzzy matchers don't exist as one long procedural thing, so I guess you mean "and that should be built into the editor" or "and that should be exposed as library code" or something. The first well, and the second probably exists. Matcher I linked and probably there's a VimL thing somewhere, I know there are other matchers for ctrlp. But yeah all of thsoe pieces exist either in Vim itself or within ...
16:36tos9... the fuzzy matcher plugins, and you're obviously free to use those pieces
16:36tos9It's likely not as easy as in emacs though.
16:39killing-jokeare there any gotchas/shortcomings in learning Clojure on YARV instead of the LVM?
16:40technomancyit's generally regarded as difficult to run clojure on a VM it hasn't been ported to, yes
16:41killing-joketechnomancy, thanks. have you seen https://github.com/rouge-lang/rouge ?
16:41amalloytechnomancy: LVM would be even worse, though: running it on a VM that doesn't exist?
16:41RaynesRouge is pretty immature and unmaintained.
16:41amalloysounds like Raynes
16:42RaynesSounds like your mom.
16:42pjstadigwat
16:42technomancyvery skeptical that you could call rouge a clojure implementation
16:42killing-jokeok. reason #1 sounds like "early". reason #2 sounds like "buggy", which usually follows "early".
16:43killing-jokeand reason #3 (per technomancy) "not a faithful implementation"
16:43RaynesWell, I'm talking about the fact that there haven't been any useful commits in 4 months.
16:43killing-jokeany others?
16:44RaynesIf your'e got an early implementation and it isn't being made not-early, it's probably unmaintained.
16:44amalloykilling-joke: so far it sounds to me like racket might be closer to clojure than rouge is
16:45RaynesThere's that.
16:45killing-jokeah. that's different. that could be reason #4 "low rate of fixes/features/improvements"
16:45amalloyi mean, feel free to use rouge if you want
16:45technomancyit sounds like it's explicitly "clojure-inspired", not an implementation of clojure
16:45RaynesWhy are you changing everything we say?
16:45Raynes:\
16:45amalloybut you asked for problems, and the channel seems to be saying "it is nothing but problems"
16:45killing-jokeamalloy, i like Racket. i was looking for something with a really quick startup time, which rules out some larger runtimes.
16:45RaynesIf I say something I probably mean it.
16:46RaynesYou don't have to truncate it or try to decipher it because it isn't a riddle or code.
16:46Raynes:p
16:46RaynesIIRC racket is pretty fast to startup.
16:46SegFaultAXRaynes: What did you decide on for the topic of your talk?
16:46winkthe oracle hath spoken!
16:46killing-jokeRaynes, sorry if i offended you. i'm summarizing, like a journalist.
16:46RaynesSegFaultAX: Laser.
16:46mthvedtgtrak: how does :inline work? does it plug the fn object into call sites, making them eligible for JIT inlining?
16:46Rayneskilling-joke: 'corse not
16:46SegFaultAXRaynes: Is this the first time you've talked about it publicly?
16:46RaynesSegFaultAX: Yes.
16:47SegFaultAXRaynes: Sick! Do you know if they are going to record the talk? It's just at your local meetup right?
16:47RaynesYeah, they don't record talks.
16:47technomancyRaynes: are you going to bring a laser pointer to demonstrate?
16:47winkI got a style question. how deep can you nest if-let and let before gets weird?
16:47hiredmanmthvedt: :inline works exactly like macro expansion, the body is literally replaced in
16:47Raynestechnomancy: Unfortunately no.
16:48gtrakmthvedt: I don't know the details as I haven't had to rely on it :-), but it's there, I think the compiler does it
16:48gfrederickswink: nine levels
16:49SegFaultAXwink: If you're nesting very deeply that's usually a good indication that something needs to be factored out.
16:49winkSegFaultAX: but how deep is very deeply? :)
16:50winkgfredericks: I know, badly phrased
16:50winkhttps://github.com/winks/multiplex/blob/master/src/multiplex/routes/home.clj#L45
16:50winkit would be if-let .. if-let, let
16:50SegFaultAXwink: Probably a couple levels.
16:50winkI find 3 already.. not pretty
16:50mthvedthiredman: is there a way to get to a var that points to something hotspot can inline
16:50SegFaultAXwink: That code you pasted there looks fine.
16:50gfredericksthe if-let monad
16:50winkSegFaultAX: it's only 2, would add a 3rd.
16:51killing-jokeamalloy, thanks. :) i did ask for gotchas. i should have asked for positive items, reasons TO switch (instead of reasons NOT to switch).
16:51hiredmanmthvedt: inlining in hotspot is very complicated, why are you so concerned with it?
16:51FireFlyI might very well be missing something here, but.. question: why "some" and not "some?" (especially in comparison with "every?") The docs don't seem to clarify on the naming
16:51SegFaultAXFireFly: Because some isn't a bollean operator.
16:51FireFlyOh
16:51shriphanihi. I have been trying to get ac-nrepl to work in emacs. Currently, when I hit RET on my keyboard, I get : nrepl-return: Wrong type argument: integer-or-marker-p, nil and I can't obtain a newline. My .emacs is here: https://gist.github.com/shriphani/5535977
16:51technomancyFireFly: the "some" name was inherited from CL; it was chosen for historical reasons rather than clarity.
16:51mthvedthiredman: i'm writing an experiment that generates code for performance purposes, and java performance best practices is to let the hotspot worry about inlining methods
16:51SegFaultAXFireFly: It returns the first item that matches the predicate, not whether any of the items match the predicate.
16:52mthvedtin most cases
16:52hiredmanmthvedt: same for clojure
16:52technomancy(but also what SegFaultAX said about bools)
16:52FireFlySegFaultAX: I see, so that's why. that makes sense
16:52SegFaultAXFireFly: In other lisps, it's common to denote predicate functions with a p suffix.
16:52SegFaultAXFireFly: Clojure is much more forgiving about valid identifiers in that it allows ?
16:53mthvedthiredman: so that's why i'm wondering about def-ing fns that are eligible for hotspot inlining. as i understand it the default code path is a var lookup
16:53SegFaultAX(CL has lots of -p functions)
16:53winkdoes CL have truthiness?
16:53FireFlyYeah, it was mostly the difference between some and every? that caught me, I overlooked that every? strictly returns a boolean
16:53amalloySegFaultAX: i think even CL supports ?, it's just that -p is traditional
16:53hiredmanmthvedt: no, vars are looked up at code load time
16:53SegFaultAXwink: Not in the same way clojure does.
16:53technomancyyeah, I think -p is just a CL-ism
16:53technomancyor maybe a maclisp-descendant-ism
16:53SegFaultAXYea probably.
16:54winkSegFaultAX: thought so. (if (some ...) does not 100% care for strict bools.
16:54SegFaultAXI almost never see ? used as a predicate suffix in CL.
16:54hiredmanmthvedt: there is a var deref, which can be inlined (for non-dynamic vars)
16:54SegFaultAXwink: Well, in clojure you have to think about what counts as a truthy value.
16:54FireFlyOkay, so, this inevitably leads to the question.. why every? rather than every (i.e. why not return the first truthy value?)
16:54SegFaultAXwink: In a boolean context, everything except for nil and false evaluates to true in a boolean context.
16:54winkSegFaultAX: yeah, that
16:54SegFaultAXWhoops, one too many boolean contexts there.
16:54wink's why it works
16:55SegFaultAXFireFly: Think about it, what would you return if not a bool for that. Does every single item match this predicate?
16:56FireFlyWell, I'd return the last evaluated value I think, which is either the last value if every value is truthy, or the first falsy value otherwise
16:56FireFlyHm
16:56mthvedthiredman: right, but hotspot is better at ref chasing when the refs are final, whereas vars can be redef'd
16:56FireFlyNever mind
16:57SegFaultAXFireFly: So you basically want some and any? to work like or and and, respectively?
16:57clojurebotGabh mo leithscéal?
16:57SegFaultAX(But with a predicate function, obviously)
16:57hiredmanmthvedt: in practive they are effectively final at runtime
16:57FireFlySegFaultAX: yup, that seems to make sense to me
16:58hiredmanwhich is what hotspot looks for, it doesn't actually care about the "final" modifier
16:58SegFaultAXFireFly: Not an entirely unreasonable request. That's effectively how they work in other languages.
16:58SegFaultAXFireFly: Except that they /always/ return boolean values.
16:58hiredmanmthvedt: http://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection and http://www.azulsystems.com/blog/cliff/2011-10-27-final-fields-part-2
17:00SegFaultAXFireFly: Anyway, if you really want any? that should be very easy to write. It turns out that some a) does the same thing if you consider what sorts of things evaluate to true in a boolean context and b) has other useful properties for finding values given some fn.
17:00SegFaultAXtl;dr you'll get used to it.
17:01FireFlyYeah, okay, good enough :p
17:01SegFaultAXFireFly: Good luck!
17:01FireFly:-) thanks
17:03pandeirois there a way to clear the terminal like C-l does from clojure?
17:04TimMcpandeiro: C-l works fine from `lein repl`
17:04amalloyyeah, use anything with readline, pandeiro. lein repl, rlwrap, whatever
17:05shriphanihi. I have a file that I am updating and want to see the updates reflect in the repl. I have :aot :all in my project.clj and doing (use '<namespace>) doesn't update the repl with the newer routines. what am I doing wrong?
17:05pandeiroTimMc: programatically?
17:06pandeironot talking about a repl, sorry, but a cli app
17:07technomancyshriphani: I strongly recommend not using :aot :all outside deployment
17:07shriphanitechnomancy, I see. why?
17:08gfredericksguys have we made sufficient use of the term "technomantic" yet?
17:08technomancyshriphani: because it doesn't work very well with reloads if you use protocols or records or something like that
17:08SegFaultAXpandeiro: The common way is to get the term info and scroll the screen up.
17:08amalloyeven in deployment it doesn't sound good
17:08technomancyamalloy: eh?
17:08SegFaultAXpandeiro: That's effectively what `clear` does.
17:08amalloyi mean, i guess i don't know what "deployment" means. but i've never wanted to :aot :all
17:09SegFaultAXI'm assuming that means "in production" or something.
17:09technomancyamalloy: "that environment in which you produce a unit of deployment" I guess
17:09amalloyi'd guess that as well, and can't think why you'd want to aot-all just because it's in production
17:09amalloyi guess faster startup?
17:09technomancyfaster boot times; catching compilation errors before you deploy
17:09pandeiroSegFaultAX: thanks, where should i be looking to find out how to get the term info?
17:10technomancygranted a test run (which you should be doing anyway) will catch the former
17:10technomancylatter
17:10SegFaultAXpandeiro: I think laterna has a module for doing that. I could be talking out of my ass though.
17:10winkwhen I have some macro like sqlkorma's (select (limit n)) - (via ~@args I think) - is there a way to use some nil-value for one of the inline values? like (select table (if (whatever) (limit n) ???))
17:11SegFaultAXpandeiro: https://github.com/sjl/clojure-lanterna/blob/master/src/lanterna/terminal.clj
17:11SegFaultAXpandeiro: See if that has anything useful.
17:12winkseems a simple (identity) helps
17:13winkI really need to join #rubberduckdebugging for such questions.
17:13dnolengtrak: mthvedt: the point of inline is to leverage type information if available at compile time, Clojure does this to make many operations faster, especially arithmetic.
17:14SegFaultAXwink: Sometimes just explaining the problem you're having to someone else is the most effective way to solve it.
17:14SegFaultAXwink: I prefer a plastic Android on my desk.
17:14SegFaultAXwink: :D
17:14gfredericksdnolen: I was thinking the jvm's :inline feature would be interesting as an emulator for cljs's fn-macro-combo feature
17:15hiredmandnolen: well, that is the most extensive use of it, largly to target the compiler's limited set of intrinsics
17:15mthvedtdnolen: generally, i believe programming languages shouldn't be teleological; specifically, i'm interested in having clojure fns that can be inlined as effectively as a final field method call in java
17:16hiredman:inline has nothing to do with jvm inlining
17:17mthvedtif there's no way to make clojure defns that play nicely with hotspot, that's really bad news for performance
17:17pandeiroSegFaultAX: seems like i would have to create the terminal from my program in order to query it w/ lanterna; i'm planning on running the app from an existing terminal, so i would need to get _its_ size i guess?
17:17SegFaultAXYes. No idea how to do that in Java.
17:18pandeironp thanks for the link to lanterna anyway
17:18hiredmanmthvedt: they play nicely with hotspot by default
17:19mthvedthiredman: hotspot might not optimize non-final lookups even if they're 'effectively final'
17:19mthvedtfor example
17:19hiredmanmthvedt: hotspot my not optimize final lookups
17:19hiredmanhotspot is complicated
17:19mthvedthiredman: it's more likely to
17:20SegFaultAXIn what case would it not optimize a final lookup?
17:20SegFaultAXThat's like the easiest optimization ever I'd have thought.
17:21hiredmanSegFaultAX: non-hot paths, and final is not really enforced
17:21hiredmanwhat happens to inlined finals when you reflectively change the value
17:22dnolengfredericks: hrm, what do you mean? They do serve somewhat the same purpose.
17:23mthvedthiredman: i cannot say for sure for that specific case, but the jvm supports tracking constants and deoptimization when they change
17:23hiredmanmthvedt: right, which is the effectively final stuff
17:23gfredericksdnolen: I just don't know of anybody using :inline in that manner, or if that's a supported usage. E.g., should hiccup's html macro be an :inline function instead?
17:23gfredericksso it has the flexibility of a function but can still do compile-time optimizations when possible
17:24gtrakgfredericks: I've abused definline just to not have an extra stack-frame :-), clojure.test reporting...
17:24mthvedthiredman: but the jvm is worse at figuring out 'effectively final' than actually final
17:24mthvedtthis is a well known factor in java performance
17:24gfredericksI just didn't know if that tactic was a hack or a recommended usage
17:24SegFaultAXHow does something become effectively final?
17:25hiredmanmthvedt: it was on very early versions of the jvm
17:26hiredmanhttp://www.infoq.com/presentations/JVM-Mechanics is pretty good
17:26killing-jokeamalloy, thanks for the Racket / PLT pointer. TIL that (in chapter 19 of the Racket docs) you can say '#lang racket/base'
17:26killing-jokein a script for about a 4x faster startup
17:26SegFaultAXhiredman: Thanks!
17:26SegFaultAXThere's also a decent talk on JVM GC on infoq if anyone is interested.
17:27mthvedthiredman: per oracle docs (and personal experience) it is still the case
17:27mthvedtbetter at figuring out effectively final != as good in practice
17:27SegFaultAXmthvedt: How can you make something effectively final?
17:27SegFaultAXWhat exactly does that mean?
17:28hiredmanSegFaultAX: it means it is never changed
17:28hiredmanSegFaultAX: it is also part of the java closure spec
17:28mthvedtsegfaultax: the JVM can take certain decision points in code, look at what path it takes, and optimize if it always takes the same path
17:28hiredmanthe closures close over "effectively final variables"
17:28SegFaultAXLike methods that always return the same value but are not final?
17:28SegFaultAX(In the simplest case)
17:29hiredmanhttp://mail.openjdk.java.net/pipermail/lambda-dev/2011-August/003834.html
17:29hiredmanSegFaultAX: not methods, fields
17:30SegFaultAXhiredman: Ah.
17:30mthvedti don't know all the specific cases. one commonly cited one is that if a polymorphic call always goes through one subtype, it will optimize for that subtype, so you shouldn't worry about whether a polymorphic method is overridable for performance
17:30mthvedtthe compiler will stick a deoptimization check if the type ever changes
17:31SegFaultAXOh neat.
17:31mthvedtthen calling some other method becomes very expensive once, but at the trade-off of the method call being a jump or inline call a million times
17:33mthvedtin particular, an IFN call can be as fast as inline code, once the JIT warms up… but that depends on if the IFn lookup itself can be optimized away, also
17:34mthvedtwait, it might not
17:35mthvedtif the call site is smart enough to do the inlining… hm
17:37sveduboisIf I have a map where (nth metadata 4) is:
17:37svedubois{:editable true, :datatype "string", :name "country", :label "COUNTRY"}
17:37sveduboisHow I can change the value of "country" to for example "USA"?
17:38tieTYT2i've got this fn that takes in a java ArrayList as input and processes the elements in complex ways (deleting, overwriting, etc.). This works, but I also need to audit the changes I'm making. What's a good way to add this functionality? My first thought is an atom that collects the changes as they're happening, but this is probably the worst way
17:39mthvedthiredman: effectively final in the closure spec seems to refer to variables that are effectively final at compile time, not run time
17:42amalloymthvedt: there's no such thing as effectively-final for runtime. a local variable is effectively final if nothing ever writes to it. it is not possible for anything but a local to be effectively final, because anything can write to it; and for a local there's no need to do runtime checks because the set of things that can write to it is fixed
17:43amalloytieTYT2: don't modify an arraylist? copy it into something persistent, and then while you work on it you'll implicitly generate an audit trail of all the old versions
17:43mthvedtamaloy: then it seems we are talking about two different things--the claim was that fn invocations through vars can be JIT optimized if they are "effectively final" at runtime, and the citation was for the notion of effective final in the closure spec
17:43tieTYT2amalloy: how do I implicitly do that?
17:44tieTYT2wouldn't I have to explicitly do that?
17:44amalloyyou just...keep the old versions around. (let [init [1 2 3], v2 (conj init 4)] {:states [init v2]})
17:45tieTYT2oh wow
17:45amalloyi would say that's the whole point of functional programming, but of course that's only one of the benefits
17:45tieTYT2and I assume :states will grow?
17:45tieTYT2and then I need to write functions that can see the changes between init and v2, then v2 and v3?
17:46amalloystates is whatever you want. i just wrote it. you can write it however you want
17:48SegFaultAXtieTYT2: Fun fact for you: if you're doing a lot of repeated modifications `reductions` is a nice way to see each successive state.
17:49tieTYT2let me google that
17:49SegFaultAXtieTYT2: Think of it like reduce, but instead of only returning the final state of the accumulator, it returns all of its states.
17:50SegFaultAX,[(reduce + (range 10)) (reductions + (range 10))]
17:50clojurebot[45 (0 1 3 6 10 ...)]
17:51tieTYT2that seems like it'd work if i could turn my whole algorithm int one reduce
17:51tieTYT2but right now it's this:
17:51tieTYT2(->> input (group-by should-remove) vals (map sort-by-start-time) (map remove-inputs) flatten)
17:52tieTYT2starting with amalloy's suggestion, am I supposed to change every step so it returns a map with states in it instead of what they're currently returning?
17:53SegFaultAXThat's an odd looking algorithm.
17:53tieTYT2since I'm a newb, it's probably wrong
17:54SegFaultAXWhy group them if you're just going to flatten them back out?
17:54tieTYT2it's all about the remove-inputs
17:54tieTYT2it has a very complicated reduce algorithm
17:54tieTYT2with a (cond) with 6 branches
17:55clojurebot,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is a")) )] (testar 11 25))
17:55amalloythank you, clojurebot
17:55SegFaultAXtieTYT2: I'm assuming should-remove returns true or false?
17:55tieTYT2no, it returns a vector of 3 fields in the input
17:56tieTYT2so it groups things that are similar in this way, then it decides if it should remove certain elements in the group
17:56tieTYT2then it flattens them back out
17:57tieTYT2so the list ends up as a homgeneous list of input
17:57SegFaultAXBut remove-inputs knows nothing about which group each was in.
17:57tieTYT2why would it need to?
17:57SegFaultAXDunno, it's your program.
17:57sveduboisIn CLJS with:
17:57svedubois(nth country 0)
17:57svedubois;-> {:America {:br "Brazil", :ca "Canada", :us "USA"}, :Africa {:ng "Nigeria", :za "South-Africa", :zw "Zimbabwe"}, :Europe {:be "Belgium", :fr "France", :nl "Nederland", :uk "Great-Britain"}}
17:57sveduboisI am not able to obtain the value of the map:
17:57svedubois(get (nth country 0) :br)
17:57sveduboisnil
17:57sveduboisWhy? Is there something wrong?
17:58tieTYT2hehe, it just knows all the things in the group are the same by those three fields and that's the assumption it needs to make
17:59tomojsvedubois: :br is nested under :America
17:59tomoj(get-in (nth country 0) [:America :br])
18:00tomojassuming (nth country 0) is really the map you showed, which would be somewhat surprising..
18:00amalloyincidentally, having :America and :br as keywords sounds like a mistake. you quite likely want those to be strings
18:00SegFaultAXWhat does it mean to get the 0th index of a map?
18:01technomancyeh; :br isn't bad because it's clearly not intended for display
18:01technomancywell, presumably not
18:02FoxboronSegFaultAX: we count from 0. So the first index is essentially 0
18:02technomancybut the capitalization on :America makes me wonder
18:02SegFaultAXFoxboron: What? ##(nth {:a "foo" :b "bar"} 0)
18:02lazybotjava.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
18:05amalloySegFaultAX: i don't think he claimed country was a map. perhaps it's a vector containing maps, in which case (get (nth country 0) whatever) makes sense
18:06Foxboronlol, sorry SegFaultAX. Didn't read the context.
18:06SegFaultAXamalloy: Fair. I assumed country was the country map he pasted. More logical to assume it's the result of the nth expression.
18:06SegFaultAXFoxboron: Np.
18:08SegFaultAXsvedubois: Also, you may not need the inner nth if you use get-in, since get-in can traverse vectors.
18:08SegFaultAX(get-in [0 {:a {:b "foo"}}] [1 :a :b])
18:08SegFaultAX,(get-in [0 {:a {:b "foo"}}] [1 :a :b])
18:08clojurebot"foo"
18:08sveduboisOne part of the original JS is here https://www.refheap.com/paste/14276
18:09sveduboisAnd the clojurescript conversion that I have done here: https://www.refheap.com/paste/14277
18:11SegFaultAXsvedubois: I tend to agree that you probably don't want those countries and codes as keywords. It may incur a lot of sense name/keyword calls depending on your usage.
18:11SegFaultAXSenseless*
18:38tieTYT2is there a better way to write this: #(reduce remove-algorithm [(first %)] (rest %))
19:11tieTYT2does clojure have a library that's an alternative to drools?
19:12hiredmantieTYT2: not real, but you an java interop with it
19:12hiredmancan
19:16mthvedtdrools is a nightmare
19:16hiredmanthe alternative is what, jess?
19:17hiredmanhttp://java-source.net/open-source/rule-engines I guess there are more then just those two
19:18mrcheekstieTYT2: I guess, you'll likely need to write a 'nice wrapper', instead of type those "." everywhere in most cases, unless there's dedicated 'clojure' effort.
19:19mthvedti suspect the question is that 'clojure library that's an alternative to drools' => not a nightmare
19:20technomancywith clojure you can experience the nightmare of drools outside Java
19:20technomancywill the marvels of this modern world ever cease to amaze
19:20mthvedtit's terrible, but with more parens
19:20mthvedtsweet
19:20hiredmanmthvedt: I would love to hear a more detailed critique of drools
19:21hiredmantechnomancy: drools actually has this jess compatibility mode, which on the surface looks lispy, but under the hood is really weird
19:21tieTYT2i don't really know drools. I had no idea it was a nightmare
19:21tieTYT2but we use it at work (I never have)
19:21tieTYT2and soon, I'm going to have to have a talk with the "architects" about whether or not we should use clojure
19:22tieTYT2and I figured I could make a comparison between clojure and drools in terms of effort it takes to learn
19:22tieTYT2(I know that wasn't my original question, I'm just ranting)
19:22hiredman~google clojure drools
19:22clojurebotFirst, out of 1880 results is:
19:22clojurebotjavierdallamore/drools · GitHub
19:22clojurebothttps://github.com/javierdallamore/drools
19:22hiredmanfeh
19:22tieTYT2interesting
19:22pjstadighttp://jamesfindonblog.files.wordpress.com/2012/12/the-architect.jpg
19:23tieTYT2pjstadig: yep
19:23brehautthat dude needs to eat more fibre
19:23hiredmanthere are definitely google hits for clojure and drools, even hits for reasoning over clojure maps instead of pojos
19:24mthvedtwell, i might be a little biased because the place i worked at used it in nightmarish ways
19:24tieTYT2so I wrote this clojure code to solve this complex problem, but now we're going to have a meeting about whether we should rip out the clojure code to use pure java
19:24hiredmanI've never used drools for anything, but it is interesting
19:24tieTYT2and I want to defend clojure but I'm not sure how to go about it
19:27hiredman"look at all the code I'm not writing" -- guy in that rails video
19:29bbloomtomoj: of course just as i'm telling you yesterday i know the vars i want to bind statically… i find a use case where knowing them dynamically would be lovely haha
19:29gtraktieTYT2: tell em lisp is good for AI
19:29tomojI feel like dynamic vars are basically meant for the cases where you don't
19:30bbloomtomoj: well the binding macro can be resolved statically
19:31tomojbut what about pre-existing bindings? or what if you call binding in a function called from inside your macro?
19:31bbloomtomoj: so the challenge i have is that i want to assign names to values dynamically matching a view hierarchy
19:32bbloomat first, i knew all those var names lexically by analyzing the view definitions
19:32bbloombut the theming system might want to override some of those values dynamically
19:34patchworktieTYT2: Just spit in their face about what fools and simpletons they are
19:34patchworkThat usually does the trick
19:34tieTYT2i'm doomed
19:34gtrakif they're making you have a meeting about it, sounds like they already made up their mind
19:34tieTYT2most likely, yes
19:34patchworktieTYT2: In all seriousness, just show them how many fewer lines of code it takes, and how it works in a concurrent environment without modification
19:35tieTYT2you mean current?
19:35patchworkWell, I meant it would work concurrently, if your app has multiple threads
19:36technomancythe trick is to get out of the way and let Clojure defend itself
19:36tomojbbloom: view definitions can't call functions which call binding? not sure I follow your use case
19:36technomancybut that only works if people aren't already prejudiced against it
19:36patchworkIsn't there a good "Why to use clojure over java" writeup online somewhere?
19:36gtrakrationale?
19:36clojurebotrationale is http://clojure.org/rationale
19:37tieTYT2ooh thanks I'll read that
19:37technomancypatchwork: I dunno; if "it's not Java" isn't convincing enough I'm not sure where to go from there
19:37tomojin general I vaguely suspect that if you know statically the vars you need to convey, you're not really using the full power of dynamic scope anyway. or conversely, in the cases where dynamic scope is absolutely necessary, you can't know all the vars
19:37tomojvery vaguely..
19:37patchworktechnomancy: "It's not java" is usually the one and only sin, to management trying to avoid taking blame for things
19:38patchworkWe recently had a client demand that we stop using clojure
19:38hiredmantieTYT2: just tell them it is a DSL for ETL jobs
19:38patchworkThey only thing they cared about was that it wasn't java so they couldn't run their static analyzer on the code
19:38gtrakdecompile it and let them run it on that?
19:38hiredmanwow
19:39patchworkgtrak: I wanted to do that but it turns out that though the clojure compiler is written in java, there are things clojure does that can not be emulated in pure java code
19:39patchworkjava bytecode sure
19:39patchworkbut no java code can generate certain clojure bytecode
19:39gtrakah, that would throw a wrench in it :-)
19:39hiredmanthe locals clearing stuff
19:40patchworkYeah
19:40hiredmana shame
19:40patchworkhiredman: Truly, especially since we already had a couple projects in flight
19:41hiredmanwell, you just have to write clojue code that generates java code then :)
19:41technomancyI wonder if turning of locals clearing would fix that
19:41bbloommaybe you should just use guava's immutable types & start with just that tiny battle :-)
19:41patchworkAll this will change with time, the inertia of the past always resists progress, but in the end it is inevitable
19:41hiredmanwrite a java source backend for clojurescript
19:42gtrakhiredman: I'd like that for android :-)
19:42patchworktechnomancy: Would it? I imagine there are other obstacles
19:42technomancypatchwork: that's the only case I know of where Clojure bytecode is not representable by Java source
19:43tieTYT2hiredman: that might work
19:43technomancybut then again I don't know Java, so ... ?
19:43patchworktechnomancy: What triggers locals clearing?
19:43tieTYT2patchwork: that's why everyone uses haskell and lisp
19:43patchworkIE: what clojure code would trigger a locals clearing event?
19:43hiredmanI guess it would be more traditional to write an xml backend for clojurescript and generate java from that
19:43gtraklet, i believe
19:43technomancypatchwork: if you have a lazy seq in a local that is passed to another function but not used after that
19:44hiredmantechnomancy: it is not that specific
19:44technomancyoh right; not just lazy seqs?
19:44technomancyI mean that's *why* it's there, but it's not picky
19:44hiredmanbasically if the compiler figures out that any local isn't used again, it emits code to load it on the jvm stack, then null it out at the last use
19:45technomancyand the bit that isn't representable is performing the nulling out *after* the return
19:45technomancyor something
19:45technomancyI don't know java
19:45hiredmanno
19:45mthvedtnulling it out before the call, i think
19:45hiredmanyeah
19:45technomancyoh right
19:45tieTYT2technomancy: does lein use maven behind the scenes, or just know how to use the repositorys?
19:46tieTYT2repositories
19:46technomancyand stack manipulation
19:46hiredmanclojure.lang.* has a method somethere the java code can use to fake it
19:46technomancytieTYT2: there's a library called aether that's extracted from maven
19:46hiredmanRT.return1(o,o=null) or something
19:46tieTYT2i see
19:46tieTYT2i'm surprised you don't know java but you build a build tool for clojure
19:46technomancytieTYT2: so it's literally the same code as mvn uses when it comes to repos
19:47technomancytieTYT2: I have been extraordinarily fortunate
19:47tieTYT2i just started clojure, but it seems like lein gives you a way to avoid java. I don't know how you could avoid it to bootstrap your program before it existed
19:47tieTYT2didn't you have to learn java to use aether?
19:47technomancyI used maven for like six months =)
19:47hiredmanmaven multi module builds!
19:48patchworktieTYT2: You can't avoid java entirely, if you spend enough time with clojure
19:48xeqitechnomancy: haha, I wouldn't call the maven-ant-tasks stuff fortunate
19:48technomancyyou have to learn the JDK's classes and how to read javadoc and stuff
19:48patchworkeventually the quirks of the VM show through
19:48technomancyxeqi: it was all over and done in like three pages of code though
19:48tieTYT2or the quirks of the language, if you're using a pure java library, I'd think
19:49tieTYT2technomancy: (perhaps you have a blog article about this) what attracted you to clojure when you seem so repelled by java?
19:50technomancytieTYT2: I did a bunch of JRuby for about a year before picking up clojure
19:50technomancyand I saw all the undeserved crap headius gets due to the JVM
19:51headiusI don't even get to be a Ruby hero ;-(
19:52technomancyI believe in you headius =)
19:52headiusthank you!
19:52technomancyhow is Mirah coming these days?
19:53tieTYT2headius: did you write jruby?
19:53gtrakheadius: you're a ruby hero to clojurists :-)
19:54brehautgtrak: is that damning with faint praise ;)
19:54hiredman<headius> tieTYT2: I am but the project lead, many others have contributed
19:55hiredmanoh headius, you are too modest
19:55tieTYT2nice
19:55headiustechnomancy: others are continuing to move Miraah forward
19:55headiusbrehaut: hah
19:55gtrakI guess it could be taken that way, but I'm serious, it's impressive.. especially since I was involved with python 4 years ago, and jruby is light-years past jython
19:55gtraksimilar engineering challenges, I think, the GIL, hashmaps everywhere
19:58headiustieTYT2: me and others, but I have the most commits
19:58headiusif that means something :-)
19:58headiusit could just mean I slice my commits finer
19:59tieTYT2so why are you hanging out in #clojure? Are you learning/using the language?
20:02gtrakI got a chance to sit through a talk at pycon 2009 which fully consisted of a guy apologizing about the GIL
20:04technomancyheadius: still planning on using it for jruby's implementation at some future point?
20:04headiusit's certainly a possibility, but it's also not usually valuable to reimpl known-working code just for the sake of using a new language
20:04technomancyheadius: an age-old conundrum
20:05headiusindeed! it might be more attractive to rubyists that want to impl exts for JRuby though
20:32cflemingHi everyone
20:33cflemingIs it possible to call the Clojure compiler from Clojure as part of a macro?
20:33gtrakeval?
20:33clojureboteval is evil
20:33gtrakno it's not, don't listen to clojurebot
20:33cflemingI'm interested in integrating a Java library that uses byte code weaving
20:34gtrakwhat's your expected output of the clojure compiler?
20:34technomancycfleming: the compiler isn't special
20:34technomancyit's just defns and methods like any code
20:34cflemingIdeally I'd be able to define a new type of fn where I could call the compiler to compile the body of the function, get the byte code back and weave it
20:35cflemingBut the actual compilation happens in clojure.lang.Compiler, and it's not immediately clear to me whether I can call that directly
20:35hiredmanno, the compiler doesn't expose bytecode
20:35cflemingAnd still get correct line numbers for debugging, for example
20:36cflemingThe other option would be to macro expand the fn body and try to manipulate that to mimic the effect of the weaving, but I suspect I'd still screw up line number mappings doing that
20:37hiredmanwhat do you mean by weave?
20:37gtraki think you need a custom ClassFileTransformer and classloader isolation of the compiler to pull this off, unless you want to hack up clojure source.
20:37cfleminghiredman: the lib modifies the byte code after compilation, usually the compilation is Java via javac
20:38hiredmancfleming: for what purpose?
20:38cfleminggtrak: could you elaborate on that a little? How would I do that?
20:38cfleminghiredman: In this case it's for lightweight threads, but there are lots of similar libs in the java world
20:39cflemingAOP and so forth, although that's less necessary in Clojure with macros
20:39hiredmancfleming: ah, have fun
20:39gtrakcfleming: classlojure is a convenient library to look into, and I think the eval stuff goes through here: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/DynamicClassLoader.java
20:40gtrakhere's an example of a ClassFileTransformer: https://code.google.com/p/java-profiler/source/browse/trunk/profiler/src/main/java/org/glandais/profiler/ClassFileTransformer.java?r=3
20:41cflemingAh, this is for a JVM agent, right?
20:41gtrakI'm not sure of the significance of ClassLoader arg, but that might be something to look into: transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
20:41gtrakyea
20:41cflemingThe lib already has one of those
20:41gtrakperfect :-)
20:42cflemingThe issue is marking which things I need to transform
20:42gtrakright
20:42cflemingIn Java it's done using methods which throw a particular exception
20:42gtraklike I said earlier, clojure spins up its own classloaders
20:42gtrakif you can track those somehow, then you've got it
20:42cflemingUnfortunately Clojure fns don't even have Clojure metadata
20:43arohnerThis is kind of a crazy question, but is there a way to stick conditionals into a project.clj? specifically I want (when (System/getenv "foo")) in my :jvm-opts
20:43gtrakah, here! 'loader - the defining loader of the class to be transformed, may be null if the bootstrap loader'
20:43cflemingyeah, I can check if the class loader for a particular class is a DCL, but I can't mark certain fns for weaving from a Clojure macro
20:43arohnercfleming: clojure fns have had metadata since 1.3 I believe
20:44gtrakarohner: the classes or the instances?
20:44hiredmanarohner: you can use unquote in project.clj
20:44cflemingarohner: I might be wrong, but I think that's the var that defn assigns to, not the fn itself
20:44gtrakthe fn itself is an instance of a class..
20:44arohnerhiredman: is there a way to do it that can be read w/ EDN?
20:45hiredmanarohner: no
20:45arohnercfleming: pre 1.3, only the var. post 1.3, the fn as well
20:45arohnergtrak: instances
20:45gtrakarohner: right, so I think that doesn't help here
20:45gtraksince this is classloading-time
20:45arohnergtrak: ah, sorry, I'll read for context more next time
20:47cflemingInteresting, neither IFn nor AFn implement IMeta, so I guess the fn class does?
20:48cflemingI'd have to check what the compiler does in that case
20:48gtrakI guess you could transform all classes, look for instances :-), check their metadata, and retransform
20:49tomojAFunction is the IObj
20:49tomojthis is part of the reason why fns with metadata are ugly
20:51tomoj&(with-meta + {})
20:51lazybot⇒ #< clojure.lang.AFunction$1@81d54e>
20:51tomojhmm but wait
20:52cflemingThis is weird
20:52tomoj&(satisfies? clojure.lang.IObj +)
20:52lazybotjava.lang.NullPointerException
20:52tomoj&(instance? clojure.lang.IObj +)
20:52lazybot⇒ true
20:52cflemingThe Clojure compiler is definitely checking metadata on the fn
20:52cflemingBut I can't see anywhere where it emits anything different based on that
20:53cfleming&(instance? clojure.lang.IMeta +)
20:53lazybot⇒ true
20:53cflemingI'll have to check how that metadata is restored when a ns is AOT compiled
20:54tomoj&(instance? clojure.lang.AFunction +)
20:54lazybot⇒ true
20:55tomojscratch what I said about AFunction then..
20:55tomojit's just ugly cus it's ugly :)
20:56cflemingYeah, the compiler emits AFunction for fns when they're single-arity and RestFn when they're variadic
21:00cfleminggtrak: thanks for the pointer to classlojure, I'll check it out
21:02gdevis there a way for nrepl to startup as soon as emacs starts up to edit a clojure file?
21:05gdevi'm using emacs live and I'm afraid to touch the init.el file...it has ascii pictures of nuclear explosions 0_o
21:20technomancythat's terrible
21:22gdevit's a pretty effective error message
21:23technomancytelling someone not to edit init.el is against everything Emacs stands for
21:24gdevtechnomancy, no it's not to keep people from editing it, it's just for error messages at startup
21:25gdevwas being melodramatic since i'm always intimidated by config files that have a lot of clever ascii art
21:26technomancyoh, I see
21:29gdevhrm, wonder how long it will be before we get emacs written in clojure. i guess it couldnt hurt to learn a little emacs lisp if it means I can shave the yak quicker
21:29SegFaultAXgdev: Then you might not want to ever read a gamefaq tutorial.
21:29SegFaultAXYour average gamefaq tutorial has at least 2MB of ascii art.
21:30gdevSegFaultAX: oh yeah I know, luckily those aren't config files
21:30SegFaultAXHeh, true.
21:31bruceadamsgdev: Emacs in Clojure being worked on :-) https://github.com/hraberg/deuce
21:31gdevbruceadams: =D that just made my whole night
21:33gdevwork must be slow at the bank if he has time to work on that
21:35SegFaultAXAlso, light table.
21:37gdevhe works on light table as well?
21:37mthvedtis there a way to tell if a given expression is constant, by the clojure compiler's definition of constant
21:43hiredmanmthvedt: it depends what you mean
21:43hiredmanthe compiler has this thing called a ConstantExpr, which is just quoted values
21:45hiredmanwhat happens for ConstantExprs is the values are put in to static final fields, but there are other kinds of Exprs that also happens for
21:45mnemnionThere is also Catnip, in the general family of Clojure editors in Clojure
21:45mnemnionthe actual code base is pleasingly polyglot
21:45hiredmanthere is also :const which is another thing entirely
21:47mthvedthiredman: well i was looking at the docs for case and wondering about macros/evals that can generate a case
21:47mthvedtbut playing in the repl, it looks like anything can go in a case
21:48hiredmanmthvedt: literals can go in case
21:48hiredmansymbols won't be evaluated
21:48hiredmanlists are treated as an or
21:48mthvedtyes, i was mistaken
21:48hiredman(case x (1 2) :foo) x can be 1 or 2 for :foo
21:48mthvedti thought i was embedding a new object in the case
21:49hiredman:const might not be a thing anymore
21:49mthvedtbut it was a list containing an object constructor, whatever that does
21:50hiredmanmthvedt: a list with a symbol
21:50hiredman,(type '(Foo.))
21:50clojurebotclojure.lang.PersistentList
21:50hiredman,(type (first '(Foo.)))
21:50clojurebotclojure.lang.Symbol
21:50hiredman,(first '(Foo.))
21:50clojurebotFoo.
21:51amalloyhiredman: afaik :const still exists
21:51hiredmanamalloy: hmmm, I wonder what version of the compiler I am looking at
21:52mthvedthey, is const a solution to the static linking question i was asking way earlier
21:53amalloyhiredman: i could be wrong, for sure. looking now, i don't see it, but i don't remember where it was before :P
21:53mthvedtanyway, the case expression was about
21:53hiredmanmthvedt: no, :const is weird
21:54mthvedtoh?
21:54mthvedtweird how
21:55hiredmanif I recall (and I may not since I have never had cause to use it) you do something like (def ^:const x foo) and now the compiler will replace x with 'foo everywhere
21:55amalloyhiredman: yeah, :const is still around. RT.CONST_KEY, used in Compiler.analyzeSymbol
21:56tomojwhoa, nuts
21:56hiredmanyep
21:56hiredmannuts
21:59hiredmaninteresting that is not exactly right
21:59hiredmanit would eval foo, and whatever the value of foo is there, would be inserted quoted
22:07amalloyright, the idea being to (def ^:const pi (approximate pi...))
22:08amalloyand then you can use the approximation anywhere cheaply
22:09SegFaultAXHas anyone played with dropwizard?
22:13mthvedtbut ^:const must be a primitive or something?
22:13mthvedtyou can't def const, say, a fn
22:17gdevSegFaultAX, no, but it does look interesting
22:24supersymOh how did 2 weeks of full-time clojure improve my understanding of any other language as if magic,...I'm literate/meta-programming and writing my own DSL where I can :D
22:24gdevbut not english ;)
22:24supersym*sacrifices a goat*
22:24supersymthat's just for fun ;)
22:25gdevI give up, how?
22:25supersymwell if only I knew
22:26s4muelit's a side-effect of clojure itself
22:26supersymbut significant part has to do with changing from OOP -> functional
22:26supersymthough also I tend to map much more, use hashes differently, even a monad or two
22:27supersymyeah I believe so as well, the ideas expressed in it come from every-day life so I recognize the problems that rich addressed much easier
22:28supersymbut also I read that Lisp-languages tend to have had such an effect in general through history
22:31gdevmaybe this one will stick around for a while and we won't have to keep solving problems that were solved before the internet was invented
22:33arrdemgdev: hah
22:33arrdemgdev: a likely story
22:33arrdems/story/proposition
22:49gdevaccording to xkcd http://xkcd.com/1205/ figuring out how to get nrepl to startup automatically when emacs starts is no longer worth the time
22:55Apage43gdev: I should print that out
22:57gdevApage43, yeah it's saved me a lot of time. If I spend so much time shaving the yak that I have to consult the chart, i've spent too much time