Re: Getting started with lein-cljsbuild

2012-04-19 Thread Evan Mezeske
That's great news that you got it to work. I can't make any sense of the stack trace you're seeing with "lein deps", though, unfortunately. Other than installation, does the plugin seem to work (e.g. "lein cljsbuild once", etc)? I haven't tested it under Windows myself, and people have had tr

Re: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Yes, I've only tested "lein cljsbuild once", but it worked just fine once I figured out the alternative way to get the plugin installed. On Thu, Apr 19, 2012 at 12:03 AM, Evan Mezeske wrote: > That's great news that you got it to work. I can't make any sense of the > stack trace you're seeing w

ClojureCLR on .net compact?

2012-04-19 Thread David Jagoe
Hi all, Does anyone know whether I can run ClojureCLR on .net compact? Specifically I would need to run it on Windows CE. Currently the application is written in C# which works ok, but I need to rewrite it and I'm deciding between C#, F# and ClojureCLR. Thanks, David -- David Jagoe davidja...@

Re: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Unfortunately, "lein trampoline cljsbuild repl-rhino" (and all the trampoline tasks) generates the same error that I got when I tried to run lein deps. On Thu, Apr 19, 2012 at 12:18 AM, Mark Engelberg wrote: > Yes, I've only tested "lein cljsbuild once", but it worked just fine once > I figured

Re: a library I'm working on for generating PDFs from Clojure

2012-04-19 Thread David Jagoe
Hi Dmitri, This is great, thanks! I have a system where I need to render web reports to nicely formatted PDFs. Currently I maintain separate HTML and TeX templates for this purpose (in a Python system) but wanted to have a system that allows me to write hiccup once and have it output HTML & PDF r

Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I'm trying to get some Clojure code to compile to javascript. So I've got a clojurescript repl up and running, and I was hoping it would be a straightforward iterative process of: Compile code. Test code. Get detailed bug (or at least a line number) if I used a feature not available in clojurescri

Re: Getting started with lein-cljsbuild

2012-04-19 Thread Chris Perkins
On Thursday, April 19, 2012 3:03:53 AM UTC-4, Evan Mezeske wrote: > > That's great news that you got it to work. I can't make any sense of the > stack trace you're seeing with "lein deps", though, unfortunately. > > Other than installation, does the plugin seem to work (e.g. "lein > cljsbuild on

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
clojurescript is still pretty young. Error reporting is not where I expect most people would like to see it. This is a problem for all languages complied to js at the moment. That said - you can get used to the situation pretty quickly, with a little patience and the occasional challenge. If y

Re: a library I'm working on for generating PDFs from Clojure

2012-04-19 Thread Dmitri
It should be pretty easy to map some basic Hiccup tags to this, headings, paragraphs, lists, and tables, etc. I suspect it's probably easier to go the hiccup->pdf route, as you could simply ignore the html tags that aren't applicable. On Apr 19, 4:45 am, David Jagoe wrote: > Hi Dmitri, > > This

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
Additionally, if you are using the repl to experiment, you may benefit from defining and testing each bit as you go. On Thursday, 19 April 2012 21:59:03 UTC+10, Dave Sann wrote: > > clojurescript is still pretty young. Error reporting is not where I expect > most people would like to see it. Thi

[ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to inspect namespaces and report possible problems. Currently it should work with projects running Clojure 1.3.0 and newer. Currently eastwood warns when it finds - deprecated java instance methods, static fields, static method

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Stefan Kamphausen
inc for the name! :-) -- 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 gro

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Did I do something wrong? ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install jonase/eastwood 0.0.1 ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK Client VM ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ le

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Baishampayan Ghose
On Thu, Apr 19, 2012 at 6:34 PM, Jonas wrote: > Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to > inspect > namespaces and report possible problems. Currently it should work > with projects running Clojure 1.3.0 and newer. > > Currently eastwood warns when it finds > - depr

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Baishampayan Ghose
I got exactly the same error. Regards, BG On Thu, Apr 19, 2012 at 6:54 PM, Ambrose Bonnaire-Sergeant wrote: > Did I do something wrong? > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install > jonase/eastwood 0.0.1 > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojur

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jay Fields
same outcome for me. On Thu, Apr 19, 2012 at 9:24 AM, Ambrose Bonnaire-Sergeant wrote: > Did I do something wrong? > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install > jonase/eastwood 0.0.1 > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version > Lein

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant wrote: > > Did I do something wrong? > Sorry, I only tested in with lein2. I'll try to make it work with both in the next release. -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: ClojureCLR on .net compact?

2012-04-19 Thread dmiller
I believe that Reflection.Emit is not available in .Net Compact Framework. This is essential for the ClojureCLR. This also prevents DLR-based languages such as IronPython from running on .Net CF. -David On Thursday, April 19, 2012 3:11:02 AM UTC-5, David Jagoe wrote: > > Hi all, > > Does any

Re: ClojureCLR on .net compact?

2012-04-19 Thread David Jagoe
Ok, thanks David. On 19 April 2012 15:53, dmiller wrote: > I believe that Reflection.Emit is not available in .Net Compact Framework. >  This is essential for the ClojureCLR.  This also prevents DLR-based > languages such as IronPython from running on .Net CF. > > -David > > > On Thursday, April

Re: ClojureCLR on .net compact?

2012-04-19 Thread Timothy Baldridge
If you AOT compile the ClojureCLR code, will it still depend on Reflection.Emit? Timothy On Thu, Apr 19, 2012 at 11:10 AM, David Jagoe wrote: > Ok, thanks David. > > On 19 April 2012 15:53, dmiller wrote: >> I believe that Reflection.Emit is not available in .Net Compact Framework. >>  This is

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:59 AM, Dave Sann wrote: > If I have errors, I use the stacktrace which you can access easily in > chrome for example to get my bearing and figure out what is going on. > Can you elaborate on this? Right now, I'm using a rhino repl as per the getting started instruction

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
If you are running in a browser - the console log will show a stacktrace that you can use. As you are using Rhino, sorry I don't use this. Others may be able to help. (I think that *e and .printStackTrace are clojure repl and jvm interop respectively - not available in cljs) If you are porting

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
I released 0.0.2 to clojars. It should now (hopefully) be possible to use eastwood with lein1. Note that eastwood will only work with projects that use Clojure version 1.3 and newer. This means that if you want to lint for example a leiningen plugin project you better use lein2 because lein1 run

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Still not working with lein1. ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install jonase/eastwood 0.0.2 [INFO] Unable to find resource 'jonase:eastwood:jar:0.0.2' in repository central (http://repo1.maven.org/maven2) Copying 4 files to /tmp/lein-cc995082-fa11-4245-8f7a-88d6c5a

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:01 AM, Dave Sann wrote: > The error that you showed originally does not look like a compile error - > but an execution error. I may be wrong. > Agreed. The error happens only when I execute the code, not when I compile it. Since the code works fine in Clojure, my bes

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
How are you compiling the code? David On Thu, Apr 19, 2012 at 5:55 AM, Mark Engelberg wrote: > I'm trying to get some Clojure code to compile to javascript. > > So I've got a clojurescript repl up and running, and I was hoping it would > be a straightforward iterative process of: > Compile code.

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote: > How are you compiling the code? > > David > > In the REPL, using (ns test (:require [namespace-of-file-I-want-to-compile :as s])) and then invoking the functions using (s/function item). -- You received this message because you are subscribe

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
How are you starting the REPL? What version of ClojureScript? Are you using lein-cljsbuild? On Thu, Apr 19, 2012 at 2:09 PM, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote: > >> How are you compiling the code? >> >> David >> >> > In the REPL, using (ns test (:require

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
lein-cljsbuild's trampoline tasks for starting REPLs are not working for me (I reported this in another thread). Seems to be a problem with lein's batch file for Windows not properly handling spaces in directories that relate to plugins. So I do lein repl (I've configured the project file with ad

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
Then you need construct your REPL with: (repl/repl env :warn-on-undeclared true) David On Thu, Apr 19, 2012 at 2:27 PM, Mark Engelberg wrote: > lein-cljsbuild's trampoline tasks for starting REPLs are not working for > me (I reported this in another thread). Seems to be a problem with lein's >

Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Hi, I've been doing some thinking about the treatment of nil in a statically typed version of Clojure. It occurs to me that nil is significantly different to Java's null reference, which is almost a Bottom type. Java's null is a subtype of any reference type. Clojure's nil is just nil, subtype t

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 2:46 PM, Ambrose Bonnaire-Sergeant wrote: > Hi, > > I've been doing some thinking about the treatment of nil in a > statically typed version of Clojure. > > It occurs to me that nil is significantly different to Java's null > reference, which > is almost a Bottom type. > >

Re: ClojureCLR on .net compact?

2012-04-19 Thread dmiller
On Thursday, April 19, 2012 11:20:05 AM UTC-5, tbc++ wrote: > > If you AOT compile the ClojureCLR code, will it still depend on > Reflection.Emit? > > Timothy > Yes, it will still depend on Reflection.Emit. If you eval, you need it. Also, any place where ClojureJVM does runtime reflection, Clo

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
OK, this was very helpful advice. Using these warnings I was able to identify several problems: Clojurescript didn't like my use of defstruct Clojurescript didn't like my throwing of a RuntimeException Clojurescript doesn't understand the format function (is there a substitute in Clojurescript-la

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread James Reeves
On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant wrote: > I've been doing some thinking about the treatment of nil in a > statically typed version of Clojure. Statically typed in what way? Java's type system doesn't seem particularly suited to a functional programming language like Clojure. - J

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
yes. because this would be interpreted as a function/var that was expected to be defined in the current namespace - you will see this in generated code. my.namespace.function_I_thought_was_in_core David's :warn-on-undefined should pick this up for code compiled via the repl. -- You received

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I've found that by completely exiting and restarting the REPL, it is working now. Woo hoo! Way, way, way slower though. 16 seconds to produce an answer that takes 6 milliseconds in Java. I have a suspicion that part of the time difference may have something to do with Clojurescript's treatment

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
I am working on an optional type system for Clojure. It looks more like Scala's type system, ie. working on top of existing Java types. I'm inspired by Typed Racket, which include recursive types, unions, singleton types, the ability to type complex variable arity functions, and other cool stuff.

Re: Converting clojure code to clojurescript

2012-04-19 Thread Evan Mezeske
Is the 16 seconds figure from running your code in Rhino? From what I've heard, the V8 engine is much, much faster (like, order(s) of magnitude) than Rhino. I'm not really sure what the best way to interactively run code on V8 is. You could compile with node.js as the platform, and I think Da

Re: Converting clojure code to clojurescript

2012-04-19 Thread Kevin Lynagh
Mark, There's a format-like function in the Closure library. Add to your namespace (:require [goog.string :as gstring] [goog.string.format :as gformat]) and call it like (gstring/format "%02.0f" (inc 8)) ;;or whatever. On Apr 19, 4:46 pm, Evan Mezeske wrote: > Is the 16 seconds fi

Re: cljsbuild and checkouts?

2012-04-19 Thread Dave Sann
I finally started take take a look at this. Apologies are due - it does work. I had errors in my tests. I have a question though. Ideally, I don't really want to have .crossover. or .generic. in my namespaces. Is it possible to put crossover/generic files in a completely separate src directo

Re: cljsbuild and checkouts?

2012-04-19 Thread Evan Mezeske
Yeah, you should be able to avoid having a .crossover or .generic or whatever in your namespaces; those are just examples based on my personal way of organizing things. You can put the crossover files wherever you want, as long as they're in the classpath (even in a JAR). They don't need to be

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske wrote: > Is the 16 seconds figure from running your code in Rhino? > Yes, Rhino. I'm also not doing any optimizations, although my understanding is that advanced optimizations is more about pruning code and reducing file size than reducing execution

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Alan Malloy
On Apr 19, 4:06 pm, James Reeves wrote: > On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant > > wrote: > > I've been doing some thinking about the treatment of nil in a > > statically typed version of Clojure. > > Statically typed in what way? Java's type system doesn't seem > particularly suited

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:38 PM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > I am working on an optional type system for Clojure. It looks more like > Scala's type system, ie. working on top of existing Java types. > > I saw Gilad Bracha speak a couple weeks ago about the des

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
Rhino is slow. If you want to see performance anywhere near the JVM you to have to use a modern JavaScript engine - JavaScriptCore, SpiderMonkey, or Google V8. David On Thu, Apr 19, 2012 at 7:31 PM, Mark Engelberg wrote: > I've found that by completely exiting and restarting the REPL, it is > wo

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
On Thu, Apr 19, 2012 at 8:43 PM, Mark Engelberg wrote: > On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske wrote: > >> Is the 16 seconds figure from running your code in Rhino? >> > > Yes, Rhino. I'm also not doing any optimizations, although my > understanding is that advanced optimizations is more

Re: cljsbuild and checkouts?

2012-04-19 Thread Dave Sann
Great. Do I need to be explicit in naming crossover files. what If I have for example crossover/a/b/x.clj crossover/a/y.clj can I do [crossover] and get all of these? my test says - yes in the main project - but only to the level immediately below. i.e picking up crossover/*.clj - no in ch

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
OK, I ran the same test directly in the browser with optimizations. I wasn't doing it in a REPL, so I couldn't use the time function, but Firefox appeared to take about 2 seconds, and Chrome was definitely under a second. So yes, there does seem to be a world of difference from Rhino. I'm still

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
This is basically my approach. I'm performing static analysis a la carte. Right now I have a "check-namespace" function that performs type checking transitively for a given namespace. You could imagine performing this at the REPL, lein plugin, or via an editor shortcut. And adding types has zero e

Re: cljsbuild and checkouts?

2012-04-19 Thread Evan Mezeske
Your testing revealed accurate information. The general rule is that if a namespace is from one of the cljsbuild :source-path entries, it will be followed recursively. Unfortunately, for namespaces coming out of the classpath, it's not always possible to recurse (e.g. there's no way to list a

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
(binding [*print-fn* #(.log js/console)] (time ...)) works in the browser On Friday, 20 April 2012 11:25:31 UTC+10, puzzler wrote: > > OK, I ran the same test directly in the browser with optimizations. I > wasn't doing it in a REPL, so I couldn't use the time function, but Firefox > appeared

Re: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
On Thu, Apr 19, 2012 at 9:25 PM, Mark Engelberg wrote: > OK, I ran the same test directly in the browser with optimizations. I > wasn't doing it in a REPL, so I couldn't use the time function, but Firefox > appeared to take about 2 seconds, and Chrome was definitely under a > second. So yes, the

Re: Friend: an extensible authentication and authorization library for Clojure Ring webapps and services

2012-04-19 Thread Gert Verhoog
That looks promising, good work! I read through the docs and browsed the sources, and (admittedly without trying to code an example myself) it's not immediately obvious to me how Friend would handle the following use case: Given: - three users: alice, bob, and admin. Alice and Bob have a "user"

Term rewriting systems implemented in Clojure

2012-04-19 Thread Matthew Rocklin
Hello, << As a disclaimer I know very little about this topic or about Clojure; please be kind. >> Background: I'm interested in implementing a small term rewriting system for a specific application. I'm willing to spend some time learning a new language/system in order to do this cleanly. I'

question about a macro

2012-04-19 Thread Thomas
Hi, I'd like to write a macro which transforms (my-macro SomeClass. a b [x y] c [e f]) into (SomeClass. a b x y c e f) (the order of collections and single values in the arguments should be arbitrary) The closest I came was (defmacro my-macro [func & args] `(~func ~@(flatten args))) This

question about a macro

2012-04-19 Thread thomas kalbe
Hi, I'd like to write a macro which transforms (my-macro SomeClass. a b [x y] c [e f]) into (SomeClass. a b x y c e f) (the order of collections and single values in the arguments should be arbitrary) The closest I came was (defmacro my-macro [func & args] `(~func ~@(flatten args))) Th

Newbie question about rebinding local variables

2012-04-19 Thread Craig Ching
Ok, I've read that what I want to do is a no no. But this is the sort of thing I did in Scheme about 20 years ago (and because of that I'm probably misremembering ;-)). Basically I'm learning clojure and thought I'd write a tic tac toe game. But not any tic tac toe, I want to write one where

New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-19 Thread David Greenberg
Paredit mode is a structural editor for Clojure code in Vim. It allows you to edit your code while keeping parenthesis matched, and providing shortcuts to manipulate (), {}, [], and "" easily. Use :help paredit for details. I just implemented support for VimClojure repls and {} syntax. Please repo

Re: Term rewriting systems implemented in Clojure

2012-04-19 Thread David Nolen
What don't you like about Maude? On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin wrote: > Hello, > > << As a disclaimer I know very little about this topic or about Clojure; > please be kind. >> > > Background: > I'm interested in implementing a small term rewriting system for a > specific appl

Re: Newbie question about rebinding local variables

2012-04-19 Thread Armando Blancas
You could keep the board in an atom so it can mutate; then try to find maybe two good places for mutation to happen, your move and the program's. With the rest being functional you'll avoid the problems of global state while not being forced to fit your logic into a loop of some re-binding that

Re: Newbie question about rebinding local variables

2012-04-19 Thread gaz jones
to answer your question directly, you would need to do something like this to make it work the way your example is set up: (defn new-game [] (let [board (atom (into [] (repeat 9 nil)))] (fn [n & [i]] (cond (= n :x) (swap! board assoc i 'x) (= n :o) (swap! board assoc i 'o

Re: question about a macro

2012-04-19 Thread Armando Blancas
Flatten isn't the problem. You can't put together a special form with apply. Try taking the class name as a symbol or string and use reflection. On Wednesday, April 18, 2012 1:57:27 PM UTC-7, Thomas wrote: > > Hi, > > I'd like to write a macro which transforms > > (my-macro SomeClass. a b [x y] c

Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Matthew Phillips
I've always liked the way assoc and dissoc return the original map instance when there's no change to be made. But this is not apparently true of records. e.g.: > (def m {:a 1}) > (identical? m (dissoc m :x)) ; true > (def r <>) > (identical? r (dissoc r :x)) ; false Does anyone know if there'

Re: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread David Jagoe
On 20 April 2012 07:08, Matthew Phillips wrote: > I've always liked the way assoc and dissoc return the original map > instance when there's no change to be made. But this is not apparently > true of records. e.g.: Out of curiosity, why is this useful to you? I would imagine that the fact that

Re: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > > Out of curiosity, why is this useful to you? > It certainly has performance benefits. When things are tested for equality (e.g., to test against keys in a hash map), identical things are the fastest to recognize as equal. Also, saves on