Re: (str ()) = clojure.lang.PersistentList$EmptyList@1

2013-03-03 Thread Jack Moffitt
I know there have been some recent improvements surrounding reading and writing data structures. Is there a way to just say, Convert this to a string that corresponds to the way it prints at the REPL? I think you're looking for pr-str. For example: (pr-str (take 10 (iterate inc 0))) ;;= (0 1

Re: Using lein in upstart init script

2013-02-06 Thread Jack Moffitt
I need to start a ring server from an upstart script on Ubuntu. Normally I would use an uberjar and execute java directly, but in this case I cannot do AOT and would like to simply run lein ring server-headless from my upstart script. Even when I use lein trampoline I get respawning too fast

Re: iOS and Windows RT support?

2013-01-24 Thread Jack Moffitt
Relatively succesfull efforts have been made to compile Clojure to ObjC, but they aren't legally usable in practice. Why wouldn't a cross compiler be legal? There are tons of apps in the App Store that were originally written in C# and Lua (lots of game frameworks compile down from higher level

Re: ANN Drip: A fast JVM launcher

2013-01-23 Thread Jack Moffitt
There was a bug that prevented drip from working with preview10. That's been fixed. Then for a while the drip JAR was distributed as compiled by Java 7, which failed silently when run on older JVMs. That's also been fixed now. I've been using it successfully for the last few days now. So if you

Re: why would I use uberwar instead of uberjar?

2013-01-22 Thread Jack Moffitt
I know very little about the JVM eco-system. I have been using lein uberjar for all of my webapps, and it has worked great (Jetty/Ring). Why would I use uberwar? What are the advantages? A WAR file can be dropped right into a app server like Tomcat. It contains some extra context information

Re: Two clojure with emacs questions

2012-12-19 Thread Jack Moffitt
On Wed, Dec 19, 2012 at 9:52 AM, Jonathon McKitrick jmckitr...@gmail.com wrote: I was wondering if I could make changes in emacs, C-c C-k, and refresh the web page to see the results. You'll probably want to use ring-serve for this. To some degree lein-ring also offers this functionality as it

Re: Need ideas for carving project into namespaces

2012-12-14 Thread Jack Moffitt
I've done this for a project in Emacs, and Slime needed to get slightly confused sometimes. As I recall the buffer names got out of sync with the filenames somehow or something like that. Has anyone gotten this working smoothly with Slime or nrepl-el? It works well even with the minor quirks.

Re: Has anyone posted with Clojurescript (XhrIo) to a non Clojure based web framework?

2012-10-26 Thread Jack Moffitt
(.send goog.net.XhrIo action callback 'POST' serialized ))) You are using the clojure symbol 'POST' not the string POST. Switch to double quotes and I bet it works. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: XML parsing with namespace prefixes

2012-10-19 Thread Jack Moffitt
(zf/xml- zipper :ListRecords :record :metadata :oai_dc:dc :dc:language zf/text) This would require a namespace aware thing, but a possible syntax for this (called Clark notation) is to use the URI of the namespace instead of the prefix: (zf/xml- zipper :ListRecords :record :metadata

Re: ANN: LispIndent, jEdit plugin that indents lisp code

2012-10-17 Thread Jack Moffitt
I don't know if the Emacs clojure-mode is user-configurable in that way. I haven't needed to change it. Most Clojure users seem to indent in pretty much the same way, fwict, which is probably pretty close to how Emacs does it automatically. I haven't tried Eclipse. All the lisp and scheme

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Jack Moffitt
scenario. The minute forking occurs however you lose coordination capabilities (at least this is my understanding). He said it very casually in the video that is why this has been bugging me so much... Fork/Join is just threads, so I'm not sure why you'd lose coordination capabilities. You

Re: basic quoting question

2012-10-08 Thread Jack Moffitt
user= ('X 'Y) nil All of these are as I expected except the last, which I thought would throw something like the 1st case. What's going on there? You've prevented X from being evaluated (it will be seen as the symbol X), but you haven't prevented evaluation of the function call. Symbols

Re: ANN Drip: A fast JVM launcher

2012-09-13 Thread Jack Moffitt
I did just that, but I don't get any speedup with leiningen. All I can see is that after every leiningen command, drip ps shows one process more. For example: This is also happening for me. Is there some way to configure drip to ignore certain arguments? jack. -- You received this message

Re: ANN Drip: A fast JVM launcher

2012-09-13 Thread Jack Moffitt
I did just that, but I don't get any speedup with leiningen. All I can see is that after every leiningen command, drip ps shows one process more. For example: This is also happening for me. Is there some way to configure drip to ignore certain arguments? I added a way to specify options

Re: redefining multimethods at the repl

2012-09-04 Thread Jack Moffitt
user= (defmulti collide classify-colliding-things) You want (defmulti collide #'classify-colliding-things) Binding to the var instead of the value will allow it to be udpated. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: why does this anonymous function work with 'map' but not 'apply'?

2012-07-17 Thread Jack Moffitt
So far, everything is working as I thought. But I also thought that apply let me run a function on everything in a sequence. Other than str, I could not get this to work: user (apply #(println %1) @visitors) I think you are looking for direct invocation: (#(println %1) @visitors) your

Re: lein-daemon 0.3

2012-06-26 Thread Jack Moffitt
I've released a new version of lein-daemon. daemon is like 'lein run', only it runs the process in the background rather than blocking. 0.3 and up is a complete re-write, that no longer depends on apache commons daemon. The new version has no dependencies on any external programs. For

Re: correctness / error checking for Clojure

2012-06-20 Thread Jack Moffitt
So taking up the task of insuring correctness/consistency but leaving aside static typing as is typically practiced.   How can we best catch errors and inconsistencies in our code before our end users do? How can we do this better than any competing system (like Haskell)? How quickly can

Re: Problem with defmacro

2012-06-11 Thread Jack Moffitt
(defmacro vmap [coll f] '(map ~f ~coll)) This needs to be backtick, not single quote. (defmacro vmap [coll f] `(map ~f ~coll)) jack. -- 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

Re: Simultaneous use of the same dynamic binding

2012-05-30 Thread Jack Moffitt
What do I do if I have to instantiate two things that uses the same dynamic binding at the same time.  Using the java.jdbc example, what if I wanted to run multiple selects from db-1 and insert each result into db-2?  Do I need keep calling (sql/with-connection db-2 ...) after each select

Re: Partitioning a list when the result of a predicate becomes a certain value.

2012-05-10 Thread Jack Moffitt
   (when-let [s (seq coll)]      (let [run (cons (first s) (take-while #(not= value (f %)) (next s)))]       (cons run (partition-when f value (seq (drop (count run) s      )    )  ) ) ... What test? (seq coll) is the test here. when-let (and if-let, etc) bind only when the right

Re: core.logic program doesn't terminate

2012-03-26 Thread Jack Moffitt
This probably just shows my naivety,  but what do you mean unifying c earlier? The order of forms in a `run` clause don't matter, right? There's an explanation of it in the talk that Friedman and Byrd gave at the Conj: http://blip.tv/clojure/dan-friedman-and-william-byrd-minikanren-5936333

Re: Resolving vars and quoting

2012-03-15 Thread Jack Moffitt
If I apply the following function to 4 and 6 (defn arith [x y]  (map (fn [op] [(op x y) `(~op ~x ~y)]) [+ - / *])) I'd like to get a result of the form ([10 (+ 4 6)] [-2 (- 4 6)] ...) but instead I get something like ([10 (#core$_PLUS_ clojure.core$_PLUS_@4f6de641 4 6)] ... You want to

Re: ((symbol whatever) 1 :a) evaluates to :a . How can this be?

2012-03-15 Thread Jack Moffitt
What's going on? Symbols, like keywords, are functions that look themselves up in maps. In the 2 arg version, you're supplying an invalid map and a not-found value, and it's returning not-found. In the 1 arg version, it returns the default not-found of nil. jack. -- You received this message

Re: Looking for parser generator library

2012-01-28 Thread Jack Moffitt
I'm looking for a parser generator library. I stumbled upon fnparse, but unfortunately it doesn't work with clojure 1.3. I ended up just using ANTLR and it works pretty well from Clojure. Most of my time was spent on the grammar and implementation, not the ANTLR integration bits. I started

Re: how to get font-lock to work in swank repl buffer

2012-01-19 Thread Jack Moffitt
The instructions in the git repo don't work for me either, but M-x clojure-mode-font-lock-setup M-x font-lock-mode (turning it off) M-x font-lock-mode (turning it back on) does. The suggested (add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup) does not work either. You can

Re: Sorry Don't understand for macro, a bug or a newbie-question??

2012-01-18 Thread Jack Moffitt
doesn't show any effect of the for. The only difference is the additional statement at the end. I can not imagine how this statement sequentially behind can influence the for. for returns a lazy sequence. In the first case, in printing out the result to the REPL, the lazy sequence is

Re: 4Clojure exersice question

2012-01-13 Thread Jack Moffitt
An alternative solution to trying to make macros opaque is just to disallow the macros which depend on disallowed functions. It should be a relatively simple matter to generate this list programmatically from clojure.core source. So instead of just saying You can't use count. It would say You

Re: 4Clojure exersice question

2012-01-10 Thread Jack Moffitt
I'm solving the following exercise and when I'm trying to use the answer: #(reduce + (for [x coll] 1)) I get the error saying that I was using count which I'm not. Someone knows why is that? Is this a bug in 4Clojure or something in the language that I cannot see? If one of the macros

Re: [ANN] swank-clojure 1.3.4 released

2012-01-03 Thread Jack Moffitt
The main feature in this release is Derek Mansen's work integrating clj-stacktrace into the debugger frames, so now you can get stack traces with alignment and colorization. I'm very excited about this release since it's a significant usability improvement: http://imgur.com/fD3rA I get the

clojurescript extend-type question

2011-12-11 Thread Jack Moffitt
Is there a technical reason that there is no (extend-type object ...) in ClojureScript? I just found myself implementing several protocols on the native object to get better host interop, but it occurred to me that if it was this easy, surely it would have already been done. If there is no

Re: Update swank classpath on the fly?

2011-11-04 Thread Jack Moffitt
I've noticed that swank (which I run in emacs using M-x clojure-jack- in) doesn't pickup changes to the classpath on-the-fly. For example, if I update my leiningen project.clj with a new dependency and run lein deps, I need to restart swank to have it use the library. Is there a way to load

Re: anyone interested in a small game?

2011-10-31 Thread Jack Moffitt
Unfortunately, I'm not sure a game as small as asteroids would work well to have multiple people working on it. Simply because each part of the game (graphics, physics, gui, etc.) are all so small, that multiple developers would just step on each other's toes. What we need is a Clojure game

Re: anyone interested in a small game?

2011-10-31 Thread Jack Moffitt
for example, right now i have a record called gameentity which contains a position, the current health, speed, the polygon representation which should be rendered and a few more things - but haven't figured out yet where to put the logic and how to apply it so that everything is easily

Re: anyone interested in a small game?

2011-10-31 Thread Jack Moffitt
However I would recommend against everything is a polygon route. Once again, for a simple game, this may be fine, but you're now making an assumption: everything is a polygon. What if you want a simple laser point-to-point entity? What if you want a planet that is represented by a circle?

Re: Code problem: setting an atom from a deref'd atom that's inside a let.

2011-10-25 Thread Jack Moffitt
Also, I wonder if there are any existing realize type functions? i.e. (realize (filter ...)) This is what doseq, dorun, and doall are for. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: [ClojureScript]: Breaking change coming WRT object property access syntax

2011-10-14 Thread Jack Moffitt
Thoughts? I like it. +1 to it going in sooner rather than later. jack. -- 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

inconsistent results from String.valueOf

2011-10-09 Thread Jack Moffitt
Hi, I discovered this testing some code this evening: (String/valueOf nil) ; throws NullPointerException (#(String/valueOf %) nil) ; null Another formulation of the above (courtesy of brehaut in IRC): (let [s nil] (String/valueOf s)) ; exception (let [s nil] (String/valueOf ^Object s)) ; null

Re: How to flatten a nested sequence?

2011-10-04 Thread Jack Moffitt
user = s1 (s1 (s2 s3) s4 s5 (s6 (s7 s8) s9)) How to convert s1 to a flat sequence like this: (s1 s2 s3 s4 s5 s6 s7 s8 s9) (flatten s1) jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

clojurescript interop problems

2011-07-31 Thread Jack Moffitt
I'm having some trouble attempting to use interop with ClojureScript. I'm trying to translate examples from the Closure book into ClojureScript, and I keep getting stuck on various things. 1) When using goog.testing, it appears that I can't access goog.testing.TestRunner and goog.testing.TestCase

Re: Code structure/design problems

2011-07-28 Thread Jack Moffitt
Hm it seems like what he did was a bit extreme. Would you do it that way? In Clojure you could just use atoms and all would be well, right? My game is going to be quite a bit more complex than Pac-Man, the game- state is going to be way more complex. His stated goal was to provide examples of

Re: [Clojurescript] Any of this in the pipeline?

2011-07-26 Thread Jack Moffitt
Widgets that work identically [and correctly!] on all browsers + You get widgets through goog.ui, which is part of Closure Library. There are no special wrappers in ClojureScript for this yet, but the infrastructure appears to be in place. Custom widgets You can write new goog.ui widgets, and

Re: ClojureScript Questions

2011-07-25 Thread Jack Moffitt
- On page 2 of the Closure book, there is a workflow figure on using the Closure tools, how would ClojureScript change this workflow? It would be great to post such a modified diagram to the closure wiki. Some quick notes on this: 1) calcdeps.py and the compiler are taken care of for you by

Re: Alright, fess up, who's unhappy with clojurescript?

2011-07-25 Thread Jack Moffitt
Rich, the pseudo class model with the new keyword is a syntactic obfuscation, semantically javascript is prototypical inheritance. It's class free. In addition to the pseudo class inheritance advocated by google closure and the prototypical inherent in javascript, others like Doug Crockford

clojurescript and external libs

2011-07-24 Thread Jack Moffitt
I'm exploring clojurescript and wondering how to use an external library? In my particular case, I was trying to use Soy from Closure Templates. I realize that arbitrary third party libraries will need to fit into the Closure Compiler ways, and part of my exploration is trying to port some of my

Re: clojurescript and external libs

2011-07-24 Thread Jack Moffitt
You use js* like here https://gist.github.com/1098417 See how jquery is being pulled in Unfortunately this means that my external JS lib won't get any benefits from the closure compiler. Is there some way to tell the compiler where more external libs are and then use them via :require just

clojurescript advanced compile error

2011-07-24 Thread Jack Moffitt
I'm working through Closure tutorials translating them to ClojureScript. Unfortunately, I've hit a problem where the code works with {:optimizations :simple} but fails with {:optimizations :advanced}. The code is very simple. It basically is a trivial template example with Soy (from Closure

Re: clojurescript and external libs

2011-07-24 Thread Jack Moffitt
You can use the :libs key in the options which are passed to build. Thanks very much for this pointer. That worked like a charm. jack. -- 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