#clojure logs

2015-07-15

00:16mercwithamouthdoes anyone have an example of connecting to postgres with clojure.java.jdbc
00:16mercwithamouthscratch that =P
00:18mercwithamouthactually..examples are welcome
00:19mercwithamouthi'm using luminus and the sample project but trying to figure out how to make it work with postgres...which i'm also new to
00:32mercwithamouththis is what i'm being thrown https://gist.github.com/anonymous/c4f85ad9f3a8792bf846
00:39mercwithamouthoooh
00:40mercwithamouthprofiles.clj =P
01:12mercwithamouthanyone ever gotten .DS_Store' does not appear to be a valid migration ?
01:33noidimercwithamouth, that's a file generated by OS X's finder https://en.wikipedia.org/wiki/.DS_Store
01:35noidiI guess your migration library expects every file in a particular directory to be a migration
01:38mercwithamouthnoidi: yeah i just fixed it a few secs ago. i goofed and manually tried to create a migration file opposed to running 'lein migratus create ...' apparently there's some more stuff going on in the background
01:38mercwithamouthdidn't make any sense =P
06:02PupenoI should use the version 0.1.0-SNAPSHOT should be while developing, then, for release, I should switch that to 0.1.0 and then, when starting developing 0.2.0-SNAPSHOT?
08:24lodin_rs0: I went with resource, thanks.
09:53xificurChi, what does one use to build a GUI nowadays? I played around with seesaw quite a while ago, is it still used? The last github commit is from Feb. Any alternatives one can recommend?
11:27justin_smithxificurC: I think there's some stuff for javaFX, can't remember any library names
11:28justin_smithand figwheel + react with cljs makes a great platform for developing browser based apps, if that's an option
11:34xificurCjustin_smith: thanks, might check that out
11:42tmtwdwhat is the command in cider to pull in a function in nrepl without having to call (load-file)?
11:44justin_smithtmtwd: should be something like cider-eval-defun with a default binding that's something like Control-Alt-x
11:44tmtwdjustin_smith, cool
11:44justin_smithwill work with the cursor anywhere inside the form
11:53csd_Hi -- what are thoughts on using :pre assertions for type checking? I.e. that an arg is an instance of a certain class
11:56justin_smithcsd_: better to check that it implements some protocol or interface
11:56justin_smithbut sure
11:56justin_smithalso look into prismatic/schema which has it's own version of defn that does type checking
11:57csd_but inside a :pre, or inside the code body?
11:57csd_like i'm wondering whether its better to throw an exception, or to violate the assertion
11:58justin_smithI'd use :pre for things that would be dev errors, (since assertions can be turned off as a runtim optimization), maybe just have regular condition checks and throw exceptions for runtime irregularities that would not be caused by bad code
11:58justin_smith:pre creates assertions
11:59csd_like, thinking in terms of contracts, my function should only take an instance of class Foo, and from that perspective an assertion makes sense
11:59justin_smithright, breaking that would be a code error, not a runtime condition
12:00justin_smithbut once again, good clojure code should require some protocol or interface, not some class
12:01csd_justin_smith: the java object in question doesn't rely on a unique interface
12:01csd_should i in that case create a protocol?
12:01justin_smithcsd_: oh, if it's some specific java object that's up to you
12:02csd_yeah its a custom business object. what did you have in mind?
12:02justin_smithunless of course it implements some interface, but you shouldn't break your back to fix someone else's bad design, sure
12:03justin_smithif you wanted to be extra proper you could make a protocol that abstracts the object and extend it for that object and rest knowing you could be flexible even if the original business object isn't, but really that's probably only marginally useful
12:03justin_smithcsd_: the advice about coding to protocols/interfaces is more applicable when designing something new
12:03csd_yeah
12:03csd_ok
12:07csd_justin_smith: unrelated other question for you. what do you think about defining fn's as private and then unit testing them by doing something like (def the-fn #'my.ns/the-fn) ?
12:07justin_smithcsd_: I'm not religious about test coverage, and usually I avoid testing anything that isn't public actually. But I'm probably doing it wrong.
12:28tmtwd[org.postgresql/postgresql "9.4-1201-jdbc41"] how would I require this dep in a core.clj file for example?
12:28tmtwdI tried [postgresql :as post] but it did not work
12:28justin_smithtmtwd: there is no relationship between package names and namespaces provided
12:29tmtwdoh
12:29justin_smithtmtwd: it defines something like jdbc-postgresql-adaptor that you can use with clojure.java.jdbc
12:29justin_smithbut your code would almost all reference functions from c.j.jdbc itself
12:29tmtwdso I would require jdbc?
12:30tmtwdlike [clojure.java.jdbc :as sql] ?
12:30justin_smithright
12:30tmtwdbut how would I specify that it is for postgres and not mysql for example?
12:31justin_smithand I forget the exact mechanism, but somehow jdbc figures out that you are accessing postgres, and it loads the right adaptor for you
12:31justin_smithbased on the connection? brb have to do morning standup
12:32sobelis there a preferred lib for hiding file url details? i want to get a stream from a local, sftp, or ftp URL
12:51tmtwd(defquery "createtables.sql" {:connection db-spec-post}) why is this a bad query for yesql?
12:53justin_smithsobel: as far as jvm is concerned, sftp and ftp accessed things are not and cannot be instances of File
12:53justin_smithsobel: but you could use a weaker and more abstract concept (like InputStream)
12:55justin_smithsobel: I should qualify that. I suspect they can't be File, but there may be a way to do it I don't know of.
12:55tmtwdhttp://pastebin.com/3h9BwtR2 I'm trying to create a db connections and create a db like this, but I'm getting the error that a persistent array cannot be cast to a String
12:55tmtwdwith yesql
12:56justin_smithtmtwd: you are missing the name argument to defquery
12:56justin_smithso it things the hash-map (PersistentArrayMap) is supposed to be the file string
12:57justin_smithtmtwd: perhaps you meant to use defqueries
12:58tmtwdoh I seeee...
12:58tmtwdI thought defqueries and defquery did the same thing
14:24blake_Welp. I found the source of my problem. I cannot deploy to Wildfly if I don't have ring-jetty-adapter as a dependency.
14:27justin_smithwait wat?
14:27justin_smiththat's super weird
14:32blake_It doesn't comport with my understanding of things either.
14:32jcrossley3blake_: i concur with justin_smith :)
14:32blake_Yet if I have ring-jetty-adapter in my project.clj, the project deploys. If I don't, it does not.
14:33justin_smithblake_: does your "wildfly deploy" exist of some construction paper and crayons that say "SeRver" and really it just runs your jar as a standalone?
14:33blake_Is it picking up java.servlet with that? I note that I tried all combinations: with servlet, with jetty, with neither.
14:33blake_justin_smith: lol...I dunno...how would I tell?
14:34blake_(That is CERTAINLY within the realm of possibility, I should say.)
14:34justin_smithbecause a container should not need the jetty-adapter, the jetty-adapter is for when you don't have a container
14:34justin_smith"my car only works when I also use a bicycle"
14:35jcrossley3yeah, i'm guessing it's pulling in another dep you need. what does 'lein deps :tree' say?
14:35blake_Well, maybe that's why I could get it to run locally (after taking out SSL). I thought it was a Widlfly 9 thing but that didn't hold up.
14:35justin_smithjcrossley3: oh, that's much more likely than construction paper and crayons
14:36blake_rin-jetty pulls in jetty-server, javax.servlet-api (3.1 not 2.5 like I had formerly specified), jetty-http, jetty-util and jetty-io.
14:38jcrossley3blake_: none of those with 'jetty' in the name should matter to wildfly, and i would've thought javax libs would already be in the classpath, but maybe not
14:38jcrossley3and if that's the problem, there should be some pertinent stack trace in server.log
14:39blake_jcrossley3: Well, yeah, there were complaints about javax.servlet. But I also got those when it worked. So.
14:39blake_Why don't I need jetty to run using "lein ring server" locally?
14:40jcrossley3you do
14:43blake_Hmmm. My whole development process has been code, lein ring server, more code, etc. All without explicitly pulling in jetty. That's how the problem arose: I removed jetty at one point and deployments to Wildfly stopped working.
14:43blake_Cached?
14:43justin_smithblake_: the lein ring plugin should be pulling in the jetty dep
14:44justin_smithblake_: so my theory is that you were relying on jetty (via lein ring) and coincidentially there is some transitive dep of the jetty adapter that wildfly actually needs
14:44justin_smithso when you add an explicit jetty-adapter dep, that causes the one thing you need (plus a bunch of extra cruft) to deploy
14:45hiredmanlein ring server uses the lein-ring plugin, which due to this that and the other implicitly adds dependencies on various bits of ring (including ring-jetty, and by extension jetty) when running its tasks, such as lein ring server
14:45jcrossley3blake_: lein deps :plugin-tree
14:46hiredmanplugin-tree likely only works on the transitive dependencies of plugins
14:46blake_Hmmm. :plugin-tree shows leinjacker, some clojure.core stuff and data.xml.
14:46hiredmanof course lein plugins can also throw random stuff in to the projects dependencies while running tasks
14:46jcrossley3ah
14:47hiredmanwhich is almost certainly how lein-ring works, as do several others (like cljsbuild)
14:47blake_So...ring-jetty gets pulled in on the sly, perhaps?
14:48hiredmanit depends what you mean by on the sly
14:49blake_Well, without me having to explicitly state it.
14:49hiredmanand only for certain things
14:49hiredmanhow are you packaging this project?
14:49blake_So, the only thing I can see ring-jetty pulling in that might be needed for Wildfly is java.servlet.
14:49blake_lein ring uberwar
14:50csd_I want to test a value coming over an async channel. How can I run this value through clojure.test?
14:50hiredmanright, that should get you ring-servlet, which should get you java.servlet
14:51blake_hiredman: But wait, wouldn't that mean I =don't= need the java.servlet pulled in by ring?
14:51hiredmanhttps://github.com/ring-clojure/ring/blob/master/ring-servlet/project.clj well actually ring-servlet expects java.servlet to be provided, and since I've never looked in to his before, but have used ring uberwar, it must mean other servlet containers do provide it
14:51csd_Only thing I can think of is to do the deftest inside the go loop
14:51hiredmanblake_: for whatever reason, wildfly must not provide it
14:52hiredman(how that is possible, I have no idea)
14:52blake_I also had javax.servlet specified! I mean, tried with java.xservlet/servlet-api specified, and no ring-jetty-adapter and it failed.
14:53justin_smithcsd_: what about a blocking read of a channel in a test but outside the go loop? the test should wait for the read to complete before exiting
14:53blake_But with ring-jetty-adapter and no javax.servlet, it worked.
14:53hiredmanblake_: what do you mean by failed?
14:53blake_(That's where I am right now, actually, trying to figure out how to get rid of ring-jetty-adapter.)
14:53hiredmanwas there an error or some exception?
14:53csd_justin_smith: but a go block cant ever return anything, can it?
14:54justin_smithcsd_: go blocks return a channel that will transmit the final value from the go block
14:54justin_smithyou can block on reading that channel
14:54csd_oh never realized that
14:54blake_hiredman: Oh, right, sorry. What happens is that it deploys but then when you hit it, the 8443 redirect returns nothing or an error.
14:54justin_smithalso, if you need more flexibility, you can pass a channel into the go block, then do a blocking read on that channel, arranging to eventually write to the channel in the go block
14:55hiredmanwhat does the log say?
14:55justin_smithcsd_: but the default channel returned by the go block is totally what you should use
14:55blake_hiredman: The log doesn't report any errors. Or anything. I get some warnings in deployment but nothing when it's running.
14:55hiredmanand what do you mean by nothing or an error, those are different things
14:55csd_justin_smith: what would the blocking read you're referring to look like? just a <!!?
14:55hiredmanwhat warnings do you get in dpeloyment?
14:56justin_smithcsd_: yup
14:56justin_smithcsd_: it will prevent the test from returning until the go loop writes to its result channel
14:57justin_smithand you can also use the value that <!! returns, obvs.
14:57csd_and then juse use an alt with the other channel and (timeout)
14:57csd_just*
14:57justin_smithsure, if you need that logic, that makes sense
14:57csd_thank you
14:58blake_hiredman: Not installing org.eclipse.jetty.continuation, Deployment contains CDI annotations but no bean archive.
14:59hiredmanmy wild guess, not supported by any evidence at all is wildfly has a different version of javax.servlet, then the one you explicitly spec'd with your servlet dependency, or the one you implicitly get from lein-ring
15:00hiredmanif that is the case it may be tricky to fix
15:00blake_hiredman: It's better than anything I got. I need to see if I can get it working without the ring jetty.
15:01blake_I also think maybe more than one thing is going on here.
15:04blake_The "no bean archive" doesn't matter, right?
15:25blake_I've broken it again. The deployment is successful but I get an exception "Attempting to call unbound fn: #'myapp.servlet/service-method". I think that might be progress.
15:28blake_*looks at chat logs, sees exact same error message from 6 days ago...*
15:32TimMcsobel: You can probably use URI for handling different data sources.
16:02jcrossley3blake_: are you saying that with those jetty deps, the 8443 redirect works in wildfly? because that sounds crazy. :)
16:02blake_jcrossley3: Well, yeah. That's the way it's been running for months.
16:03jcrossley3blake_: without an https-listener configured in wildfly, i respectfully don't believe you
16:04blake_jcrossley3: There may well be an https-listener configured in wildfly. (In production. I've got local problems and I just have OOTB wildfly.)
16:05jcrossley3blake_: until you know exactly what you have in production, and can replicate it locally, you're just flailing
16:06blake_jcrossley3: It's a common situation, unfortunately. They do things in production and keep that from us for "security".
16:06jcrossley3blake_: so you may in fact have things correct in your app, but to replicate the behavior in production locally, you'll need to add an https-listener to your OOTB wildfly
16:07blake_jcrossley3: Yeah, that's probably my next step.
16:08jcrossley3blake_: and for your purposes, you may not even care about https (other than the redirect occurring). it may be simplest to just remove the security-constraint locally
16:10blake_jcrossley3: I've done that. The problem for me is that I can't go to deployment and say "It works without security."
16:14jcrossley3blake_: you should at least confirm that the https request is hitting wildfly in production, i.e. no reverse proxy, because if it's not, then you absolutely can say that
16:15blake_jcrossley3: If I can nail down the problem exactly then, yeah.
16:23csd_Maybe someone can understand this behavior. `scheduler.clj` has quartzite boilerplate and defines a simple job. core_test.clj kills any running scheduler, starts the scheduler, and schedules the job, and then listens over an async channel for whether the job was successful. I see that when I make a change to the scheduler file and it refreshes, the test will always fail, but then after i edit the test file, it will succeed again.
16:23csd_Any idea what might be going on?
16:23csd_i think this has to be due to the test-refresh code
16:24justin_smithtop level channel definition that is getting redefined?
16:24blkcatwin 32
16:24blkcatoops
16:24csd_justin_smith: the channel is being redefined, but its also getting passed to the new job
16:25justin_smithhmm
16:25csd_it seems like the job never even runs
16:26justin_smithcsd_: I'd be tempted to defonce an atom holding a vector, then change the job definition so that it always conj's a new timestamp to the end
16:26justin_smiththe contents might end up being informative
16:29gfredericks~defonce is a temptation
16:29clojurebotOk.
16:39justin_smithgfredericks:
16:40justin_smithit's my sloppy debugging style
16:40justin_smithso it does feel like a temptation, or crutch
16:41gfredericksoh if it's just debugging then do whatever you want
16:41gfredericksmy favorite is using (def ...) inside a function
16:41justin_smithgfredericks: that'll be my alibi when I murder Donald Trump
16:41justin_smith"I was debugging my code, see"
16:42gfredericks~justin_smith is a political debugger
16:42clojurebot'Sea, mhuise.
16:42justin_smithtrump dies, code works, you can't explain that
16:44csd_ justin_smith: sorry, colleague grabbed me. it's gotta be directly related to how test-refresh reloads code
16:49blake_Gonna be yoooge.
16:52atomiyeah
17:10lgasHi. Can anyone point me to a good library project that's written in 1.7 and uses reader conditionals to provide Clojure and ClojureScript versions that shows how to set up a project.clj appropriately?
17:11lgasThat is, so that it generates a jar that can be referenced from a clojure or clojurescript project.
17:12justin_smithlgas: here's a project that works in clj and cljs https://github.com/littlebird/conduit
17:12justin_smithI have been working on it lately (it's an abstraction for passing messages between a client and server)
17:13justin_smithlgas: as you'll see, there is not cljc setup in the project.clj at all, just a list of deps
17:13lgasYeah, so everything else just works with the defaults?
17:13justin_smithlgas: yes, it just works
17:13lgasHmmm interesting
17:14justin_smithas compared to eg. cljx
17:14justin_smithbecause cljc is handled on a language level, by clojure.core itself, so there is no tooling setup needed to make it work at all
17:14justin_smithother than using a recent enough clojure of course
17:14lgasright
17:16justin_smithother than certain tools that need fixing on the implementation level (eg. eastwood), but that's not a config thing at all
17:17Bronsajustin_smith: i might be wrong but I think eastwood can't really work with cljc until lein starts using 1.7 by default?
17:17justin_smithBronsa: yeah, I don't think it's strictly eastwood's fault, it's just that the tooling doesn't enumerate cljc files as interesting yet, at some level
17:18justin_smithso eastwood is an example of something that doesn't work with cljc yet, is all
17:18justin_smithas is lein test
17:18Bronsaoh no nevermind. eastwood actually uses tools.reader
17:18lgasYeah I nuked all the cruft I had in my project.clj and just left the deps and it looks like it's working. Awesome. Thanks!
17:19justin_smithlgas: I wish the answer was always as simple as "delete all of it and it will work"
17:19justin_smithLOL
17:19lgasno kidding
17:32justin_smithBronsa: the issue with eastwood is just the part that figures out which files it should be linting, right?
17:34Bronsajustin_smith: and the fact that it uses a version of tools.reader that doesn't support reader conditionals
17:34justin_smithahh, so it's deeper than that
17:34justin_smithinteresting
17:35Bronsajustin_smith: yeah needs updated tools.reader and tools.namespace deps
17:35justin_smithBronsa: I keep forgetting tools.reader is not part of core
17:35Bronsajustin_smith: it's entirely possible that andyf already updated them btw
17:35Bronsamight just need a release
17:36justin_smithBronsa: most recent commits are "small typo in readme" and "mention in readme that 1.7 cljc files are not linted yet"
17:37Bronsaoh well then
18:45weebzI'm wondering, is there a way to start a secure nREPL on a server so only I can connect to it? I'm having trouble finding anything related to this
18:46arrdemweebz: it is possible to tell nrepl to bind to a port or address that's only locally exposed
18:46Surgoyou could use the box's firewall to limit incoming connections
18:46Surgoand just bind to 0.0.0.0
18:46arrdemor you could bind to localhost.
18:46arrdembut there's nothing I know of that's an auth layer for nREPL
18:47SurgoI figured from the question that he wanted to connect remotely
18:47weebzSurgo: yes, start the nREPL on my remote server and then connect from my laptop at home
18:47saimoon44Hi all, I was wondering is there a way to provide to not use the default template structure of a leiningen project? I want my file containing the main function to be on the same level as the project.clj file. is is possible? Thanks a lot!
18:48SurgoI don't know of any auth either but there's some stuff that's on a slightly lower level you could use. You could bind to 0.0.0.0 and use iptables to restrict. Or you could bind to localhost and use a ssh tunnel, or netcat to tie together some connections
18:48Surgossh tunnel is probably the most secure way :p
18:49Surgohttp://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
18:50justin_smithSurgo: by default nrepl won't accept connections from hosts other than localhost
18:50justin_smithand yeah, if you need a remote connection, don't do it without a tunnel
18:50justin_smitheven the localhost thing is a privelege escalation waiting to happen :P
18:51justin_smithsaimoon44: :src-paths "." but this is a terrible idea, still, because top level namespaces are terrible
18:52justin_smithso you should still have some directory structure nesting unless you are evil
18:53justin_smithsorry, that's :src-paths ["."]
18:53saimoon44justin_smith: oh thanks :) How terrible are they?
18:54justin_smithsaimoon44: I'm being a bit hyperbolic of course, but don't use top level namespaces for anything that you would expect someone else to use
18:54justin_smithsaimoon44: also, consider the security implications - if your various paths are inside the top level dir, you can have things in your repo that never end up in a built jar
18:55justin_smithsaimoon44: if the top level dir is the root of the source path, then all files in your repo will end up in the jar, because they are all on that path
18:55justin_smithwhich could easily have unexpected consequences
18:55saimoon44justin_smith: all right, I will look into that, thanks a lot for all the details :)
19:13tmtwdcan I use figwheel or something similar for use on server side (clj) code?
19:15justin_smithtmtwd: ring has wrap-reload which will reload source files when requests come in
19:16tmtwdjustin_smith, thanks :) I wanted it so I don't have to press f5, but I think I will have to do it with websockets
19:16justin_smithI think there are more general auto-refreshing tools too, maybe even some functionality in clojure.tools.namespace
19:16justin_smithoh, with websockets ring auto-reload won't help yeah
19:17justin_smithbut then again, with websockets you wouldn't want to disconnect all your socket connections when you change your code either, so you have to be picky about your reloading (or design things so reloading doesn't break them)
19:51lodin_How does future-cancel work? Where can the code be interrupted? If I for instance write to a file in a future and cancel the future, is it possible to end up with half a file?
19:52arrdemUsing futures for side effects is probably a bad idea... futures as a mechanism are designed for expressing value computations which can occur in parallel.
20:00lodin_arrdem: OK. What do you use when you have a couple of concurrent operations with side effects that each return a value when done?
20:00lodin_core.async?
20:00clojurebotcore.async is 100% imperative
20:02arrdemlodin_: futues would work here, I'm just concerned that you're thinking about them getting caceled somehow.
20:02arrdemdamnit Bronsa is probably asleep...
20:03lodin_arrdem: I'm specifically thinking that canceling would be bad, but I wonder because it could be good to be able to have any waiting derefs return nil immediately.
20:04arrdemlodin_: so if you cancel a future, it will return nil but if the process computing its value has started it will not be killed.
20:05arrdemat least that seems to be the behavior.
20:06amalloyarrdem: if you cancel a future, an effort is made to stop the process that was computing its value, but there are no guarantees
20:07lodin_arrdem: This is what I'm wondering. I haven't found any documentation about this. I think that if you have a Thread/sleep in there, it will listen for interruptions and the thread will be stopped.
20:18saimoon44Is there any way to pass options to leiningen from the command line? Like starting a repl with options that you would provide inside project.clj usually (like init-ns) or a new user profile, etc. ?
20:19arrdemsaimoon44: the :injections keyword is a vector of unquoted code that will get evaluated in the user ns
20:20pydave6367Rookie question: say I have two collections [:a :b :c] [1 2 3] and I want to get a list of maps out of them: [{:a 1} {:b 2} {:c 3}]. Is there an easy/idiomatic way to do that?
20:20kristofarrdem: Sounds invasive.
20:21arrdempydave6367: (map #(assoc nil %1 %2) keyvec valvec)
20:21saimoon44arrdem: but can you provide this on the command line? Or do you have to write into a file anytime you want to pass some different args?
20:22pydave6367arrdem: Thank you so much! Been wrestling with that one for a while!
20:23arrdemsaimoon44: you can set that in the project.clj, alternatively you can write a user.clj file. If you want to manually invoke the Clojure jar I've seen a way to add an expression to be evaluated at the command line lemme dic for it.
20:24lodin_pydave6367, arrdem: Or (map hash-map keyvec valvec).
20:25noncom|2,(keyword "heeeeeey that's rather cool!")
20:25clojurebot:heeeeeey that's rather cool!
20:25saimoon44arrdem: yeah I have heard of this user.clj file thing, it is still a file with conventional path I guess, is there any way to provide from the command line a specific file to be read to overrride it?
20:26arrdemsaimoon44: no. clojure.core is hard wired to read user.clj if it exists
20:26noncom|2,(symbol ":so, generally isn't that really wonderful::::")
20:26clojurebot:so, generally isn't that really wonderful::::
20:26lodin_(Or maybe array-map even since it's small.)
20:26kaiyinis there way to autocomplete file paths in cursive? in vim it's c-x c-f.
20:28saimoon44oh this is clojure thing? I would have thought this was coming from leiningen
20:32saimoon44Ok, well thanks arrdem, too bad that nothing can be provided to override repl options and such from the command line
20:36pydave6367lodin_: That's nice. I totally missed that. Thank you!
20:46danielpcoxdoes anyone know what it means if you get this exception while using proxy? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_proxy.clj#L24 I was trying to make a proxy object of a Scala abstract class, and I got "Incompatible return types".
21:27danielpcoxI found an example in the standard scala libs:
21:27danielpcox(import scala.collection.immutable.StringOps)
21:27danielpcox=> scala.collection.immutable.StringOps
21:27danielpcox(proxy [StringOps] [])
21:27danielpcoxException Incompatible return types clojure.core/most-specific (core_proxy.clj:23)
21:34lvhI'm getting a weird compilation error: java.lang.ClassNotFoundException: taoensso.sente, compiling:(taoensso/sente.clj:1144:5)
21:34lvhI don't understand what it means for the class not to be found while compiling the clj file itself?
21:35lvhHere's the full stacktrace, but it doesn't really seem to help: https://gist.github.com/lvh/1eace2ad8963f12212cf
21:35gfredericksit probably doesn't mean that there is supposed to be such a class
21:36gfredericks(like if everything were working correctly)
21:36gfredericksit's probably clojure misinterpreting a symbol like taoensso.sente/foo for some reason
21:39lvhgfredericks: Huh, okay. How do I debug that? I think I know which ns is causing it, but I can't figure out what it's doing that the compiler doesn't like.
21:41gfredericksI think if you try to use a fully qualified symbol w/o requiring the ns you'd get that msg
21:41gfredericks,taoensso.symbol/foo
21:41clojurebot#error {\n :cause "taoensso.symbol"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassNotFoundException: taoensso.symbol, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.ClassNotFoundException\n :message "taoensso.symbol"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :tra...
21:41gfredericks^ yep
21:42gfredericksmight be other ways to get it, I don't know
21:42lvhhm
21:44hiredmanlvh: the name of a namespace is not bound to anything
21:44tmtwddo lispers dislike yesql?
21:44hiredman,*ns*
21:44clojurebot#object[clojure.lang.Namespace 0x627ae8af "sandbox"]
21:44hiredman,sandbox
21:44clojurebot#error {\n :cause "Unable to resolve symbol: sandbox in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: sandbox in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: sandbox i...
21:44hiredman^-
21:45hiredmanbut most namespace names contain dots, with the clojure compiler uses as a heuristic to decide if it should try and treat a name as a class reference
21:46hiredmanso somewhere in the sente.clj (most likely at the line and column given in the error) you will have the symbol taoensso.sente
21:46hiredman(or you have some badly written macro generating it)
21:47lvhhiredman: OK, but the file it's attempting to compile just requires [taoensso.sente :as sente] and only uses sente/whatever, so, hm
21:47hiredmanyou are looking in the wrong file
21:47lvhthe thing I get the error about is from compiling *upstream*'s sente.clj
21:47lvhokay
21:48lvhHuh, why isn't sente in ~/.m2/repository?
21:49TEttingerunder taoensso ?
21:49lvhTEttinger: nope
21:49lvhoh, com.taoensso
21:49hiredmando you have a compelling reason to use sente?
21:49TEttinger(also it doesn't necessarily correspond to ns, it's the maven artifact naming)
21:50lvhhiredman: it seemed like the easiest thing to accomplish what I wanted (push events to the browser)
21:50lvhalso, it worked fine before, and I'm not sure what broke it, so I guess I'll git bisect
21:53lvh1.6.0-beta1 works like a charm, so I guess it's a sente bug?
21:55NiacHOW to write a php interpretor with clojure?
21:56lvhNiac: You want to write one from scratch?
21:57Niaclvh: yes
21:58Niaclvh: just some basic caculation
21:58lvhNiac: OK, so first figure out how to tokenize and parse (instaparse will probably serve you nicely if you only care about the basics)
22:00lvhNiac: then, you want to match on expressions and execute the equivalent clojure expression
22:00Niaclvh: yes
22:01lvhNiac: so, for example, if your parser turns "5 + 1;" into '[5 + 1], you can write e.g. a core.match rule to match on that and do (+ x y) instead.
22:01lvh(You'd probably want to recursively match so that you can also parse "5 + 1 + 1;")
22:02hiredman(of course the semantics won't be phps, just the surface syntax)
22:02Niaclvh: what about
22:02NiacFunction scope
22:03lvhNiac: I don't know enough about PHP's scoping rules to give you a sensible answer there; sorry.
22:05Niaclvh: maybe you can tell me scope in the semantics
22:05Niaclvh: just about the mind
22:24TEttingerNiac: it does not sound like a quick or easy project, unless you choose a very small subset of PHP
22:25NiacTEttinger: yes ,just the basic part
22:26TEttingersuch as?
22:27TEttingerdo you want to be able to define variables or functions, and would they behave with PHP's bizarre conversion rules or Clojure's more normal ones?
22:27TEttinger"" + 5
22:28TEttingerin php, I believe that may return "5", in clojure it's an error even after you turn it into (+ "" 5)
22:31NiacTEttinger: that's a problem i never thought
22:35NiacTEttinger: in my way,when do the plus caculation , a string is for zero
22:35TEttingererr, nevermind, PHP does not overload +, I was thinking of JS or possibly PHP
22:35TEttingererr, nevermind, PHP does not overload +, I was thinking of JS or possibly PHP's equality stuff
22:36TEttingerin PHP: NULL < -1, and NULL == 0. Sorting is thus nondeterministic; it depends on the order in which the sort algorithm happens to compare elements.
22:37TEttingerhttp://phpsadness.com/sad/47
22:40TEttingerI'm getting most of this from http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
22:47TEttingerIncrementing (++) a NULL produces 1. Decrementing (--) a NULL produces NULL. Decrementing a string likewise leaves it unchanged.
23:45bchamLikely a stupid question, but would you ever defmacro a macro that returns a function? I just tried one
23:45bchamand I got an error when I tried to use it saying that I was using a reserved name (and I definitely wasn't)
23:45bchamany ideas?
23:51whompis there a function which returns true if the element passed in is truthy, i.e. neither nil nor false?
23:52lvhwhomp: I'm not sure, but #(if % true false) <= looks like it does what you want obv :)
23:52whomplvh, true :)
23:52whompty
23:52lvhwhomp: heh heh heh
23:52lvh,(boolean "abcd")
23:52clojurebottrue
23:53lvhwhomp: I guess boolean does what you want?
23:53whompoh cool, never knew that one
23:53whompthat's perfect
23:55lvhI wasn't sure if that's plain-old Java coercion or Clojure truthiness
23:55lvh,(boolean nil)
23:55clojurebotfalse
23:55lvh,(boolean [])
23:55clojurebottrue
23:56lvhlooks about right though :)