Sorry, you are not commenting out a line of code but ignoring the next form.
On Feb 11, 12:49 pm, Brenton <bashw...@gmail.com> wrote: > You can also you #_ to comment out a line of code > > #_(.vm detach) > > so that you don't have to put )) on the next line. > > Brenton > > On Feb 11, 10:39 am, Greg Bowyer <gbow...@fastmail.co.uk> wrote: > > > Hi all, long time lurker first time irritant. > > > I have been playing with clojure for a little while, and finding it most > > excellent; however my lack of lisp thinking keeps leading me to write > > ugly code. > > > I have the following code in java: > > > ------ > > static final String CONNECTOR_ADDRESS = > > "com.sun.management.jmxremote.localConnectorAddress"; > > > VirtualMachine vm = VirtualMachine.attach(id); > > String connectorAddress = > > vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); > > > // no connector address, so we start the JMX agent > > if (connectorAddress == null) { > > String agent = vm.getSystemProperties().getProperty("java.home") + > > File.separator + "lib" + File.separator + "management-agent.jar"; > > vm.loadAgent(agent); > > > // agent is started, get the connector address > > connectorAddress = > > vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); > > > } > > > ----- > > > I have translated this into the following clojure form > > > --- > > (defn obtain-local-connection [vmid] > > (let [vm (VirtualMachine/attach vmid)] > > (let [aquire-connector > > #(.. vm (getAgentProperties) (getProperty > > "com.sun.management.jmxremote.localConnectorAddress"))] > > (if (aquire-connector) aquire-connector > > (do > > (. vm (loadAgent > > (apply str > > (interpose java.io.File/separator > > (list (.. vm (getSystemProperties) (getProperty > > "java.home")) > > "lib" "management-agent.jar"))))) > > (aquire-connector)))) > > ;(. vm detach)) > > )) > > --- > > > My question would be is there a better way to express this ? > > > Many thanks > > > -- Greg Bowyer -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en