Re: aset and shorts, aset vs aset-int

2011-05-29 Thread Jonathan Fischer Friberg
I think he meant that vectors of primitives are more efficient than normal vectors. Jonathan On Sun, May 29, 2011 at 11:26 PM, Ken Wesson wrote: > On Sun, May 29, 2011 at 1:39 PM, David Nolen > wrote: > > Vectors of primitives are more efficient, > > [1] > > > but there's work to be done for t

Re: Small Problem: Which Strings Differ at One Location

2011-05-30 Thread Jonathan Fischer Friberg
There is clj-diff for levenshtein and standard diff: https://github.com/brentonashworth/clj-diff Jonathan On Mon, May 30, 2011 at 10:19 PM, joshua-choi wrote: > Thanks for the reply. Levenshtein distance would be especially useful > for when I need to compare general strings, with a general amo

Re: Small Problem: Which Strings Differ at One Location

2011-05-30 Thread Jonathan Fischer Friberg
I got an idea which probably doesn't perform very well although I found it a little interesting. https://gist.github.com/999430 It simply groups the strings together, saying: * if the first and second characters are the same, they only differ in one position. * if the second and last characters .

Re: Best/Idiomatic way of managing data that changes

2011-06-01 Thread Jonathan Fischer Friberg
I would say: 1. Make a function that, given a sequence of units and the next move, returns an updated sequence given the move. 2. Make a recursive function that takes a sequence of units(*). Put in the function body code for drawing the current board, and a query for the next move (or something s

Re: using reduce instead of loop recur

2011-06-01 Thread Jonathan Fischer Friberg
Maybe not what you're looking for, but this is my take on this particular problem: (defn rem-dup [str] (->> str (partition-by (partial = \space)) (map #(if (= (first %) \space) \space %)) flatten)) I find partition-by the 'weapon of choice' when a sequence contains valu

Re: Best Installation Option

2011-06-04 Thread Jonathan Fischer Friberg
That was a weird guide. I don't see any real benefits from using some sort of 'installer' for clojure. In my view it's better to simply use maven or leiningen for actual management of dependencies (such as clojure). If you don't want that it's still simpler to just download a clojure jar file. Jon

Re: Best Way To Load and Run Clojure program in REPL

2011-06-07 Thread Jonathan Fischer Friberg
A simple way is to use 'load'. That is only for simple testing, otherwise use the namespace facilities. http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns Jonathan On Tue, Jun 7, 2011 at 9:47 PM, octopusgrabbus wrote: > I've been searching the docum

Re: New to Clojure

2011-06-09 Thread Jonathan Fischer Friberg
If you are coming from java, I think that a book on (common) lisp would be far better. Especially since practical clojure is essentially a reference (and a good one). I would recommend 'practical common lisp' and 'land of lisp'. http://www.gigamonkeys.com/book/ http://landoflisp.com/ Jonathan On

Re: Filter map collection by list of keys

2011-06-13 Thread Jonathan Fischer Friberg
I find that functions that extract or update data from some collection often has the collection first. nth, assoc, contains?, get-in, assoc-in, update-in ... Jonathan On Mon, Jun 13, 2011 at 6:50 PM, Sean Corfield wrote: > On Mon, Jun 13, 2011 at 2:36 AM, Meikel Brandmeyer wrote: > >> Needs to

Re: What's the best way to test private functions?

2011-06-17 Thread Jonathan Fischer Friberg
If you're in a repl*, why not simply use (in-ns ) ? Of course, this wont work in all cases (e.g. testing private functions from two different namespaces). In that case, I find it simpler to remove the '-' temporary. When you're finished, it really doesn't take that much effort to add them again. J

Re: #= reader macro

2011-06-20 Thread Jonathan Fischer Friberg
You should use ~' for anaphora. If for example `~this is used, 'this' is going to be unquoted, and the content of "this" will be backquoted. With ~'this , the symbol "this" is first quoted, and then that symbol is unquoted, resulting in the symbol "this". Backquote should by the way definitely no

ANN: Hafni

2011-06-20 Thread Jonathan Fischer Friberg
Hi, I figured that I would announce a library that I have been working on for a while now. It's called Hafni, and it's a swing wrapper. Why another swing wrapper? I wanted to solve the following problems: 1. There are a lot of boilerplate code needed. 2. Changes made to content is not very func

Re: Are the docs on clojure.org always kept up to date?

2011-06-20 Thread Jonathan Fischer Friberg
There is a clojure design page: http://dev.clojure.org/display/design/Home http://dev.clojure.org/display/design/Library+Coding+Standards Jonathan On Sun, Jun 19, 2011 at 4:51 PM, James Keats wrote: > Hi all, > > Clojure seems to be a language in a bit of flux (eg, defstruct vs > defrecord), is

Re: Allow Data Structure to Be Called as Function

2011-06-20 Thread Jonathan Fischer Friberg
Here is said macro: https://gist.github.c om/1035590 user=> (definvokerecord (fn [& args] (apply + args)) ATEST []) user.ATEST user=> (ATEST.) #:user.ATEST{} user=> (def a (ATEST.)) #'user/a user=> (a 1 2 3) 6 user=> (a 1 2 3 4 5) 1

Re: Allow Data Structure to Be Called as Function

2011-06-20 Thread Jonathan Fischer Friberg
Maybe I should add how to actually use it: the first argument is a function which will be called when the record is called. the rest is simply the arguments to defrecord, as usual. Jonathan On Mon, Jun 20, 2011 at 3:23 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > Her

Re: Allow Data Structure to Be Called as Function

2011-06-20 Thread Jonathan Fischer Friberg
user=> (a 1 2 3 4 5) 15 Jonathan On Mon, Jun 20, 2011 at 3:28 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > Maybe I should add how to actually use it: > > the first argument is a function which will be called when the record is > called. > the rest is

Re: Detailed Macro Quoting Question

2011-06-20 Thread Jonathan Fischer Friberg
As Benjamin said, proxy does not support variable arg list with &, multiple arity is used in the following way: (method-name ([arg0] ...) ([arg0 arg1] ...)) Jonathan On Sun, Jun 19, 2011 at 10:58 AM, Benjamin Teuber wrote: > Some remarks: > > > (defmacro make-msg-ewrapper [method-names] > m

Re: Help organizing code and namespaces

2011-06-20 Thread Jonathan Fischer Friberg
Create a new namespace+file my.server where the *server* resides, then let my.query and my.update use my.server. Jonathan On Sat, Jun 18, 2011 at 3:52 PM, Matt Mitchell wrote: > Hi, > > I have 3 namespaces, each with functions that relate to the name of the ns: > > core -- contains config and *

eval and load-string behavior

2011-06-20 Thread Jonathan Fischer Friberg
I got a very nasty bug from this behavior today user=> (def a (fn [] "outside a")) #'user/a user=> (let [a (fn [] "inside a")] (load-string "(a)")) "outside a" user=> (let [a (fn [] "inside a")] (eval '(a))) "outside a" Is this really how these functions should behave? Jonathan -- You received

Re: eval and load-string behavior

2011-06-21 Thread Jonathan Fischer Friberg
ich I think would be much more intuitive. Jonathan On Tue, Jun 21, 2011 at 2:49 AM, David Nolen wrote: > On Mon, Jun 20, 2011 at 7:45 PM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> I got a very nasty bug from this behavior today >> >> user=>

Re: eval and load-string behavior

2011-06-21 Thread Jonathan Fischer Friberg
It seems like the following macro would work as well: (defmacro load-string-here [string] (read-string string)) => (let [a (fn [] "inside fn")] (load-string-here "(a)")) "inside fn" Jonathan On Tue, Jun 21, 2011 at 12:51 PM, Jonathan Fischer Friberg < odysso

Re: Re: eval and load-string behavior

2011-06-22 Thread Jonathan Fischer Friberg
Yes, unless you wrap it in another macro. (defmacro a [] (vec (map (fn [x] `(load-string-here ~x)) ["1" "2" "3" "4"]))) => (a) [1 2 3 4] But it's still pretty useless, unless macros are to replace functions... Jonathan On Wed, Jun 22, 2011 at 8:20 AM, Meikel Brandmeyer wrote: > Hi, > > note

Re: ANN: Hafni

2011-06-24 Thread Jonathan Fischer Friberg
junction > with Seesaw. If you have further ideas on this or need help, feel free > to contact me. > > ... and don't feel too bad about writing "another Swing wrapper". A > month after starting Seesaw, I stumbled upon another, abandoned > Clojure+Swing project called ..

Re: ANN: Hafni

2011-07-06 Thread Jonathan Fischer Friberg
>> (arr inc) (arr dec)) 1) > ;; 1 > > ((flow (arr inc) >>> (arr inc) >>> (arr inc)) 1) > ;; 4 > > ((*** (arr inc) > (arr dec)) > [1 1]) > ;; [2 0] > > ((&&& (arr inc) > (arr dec)) > 1) > ;; [2 0] > > ((fst (ar

Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-07 Thread Jonathan Fischer Friberg
On Thu, Jul 7, 2011 at 7:42 AM, nchubrich wrote: > * Since Lisp is highly extensible, in the long run being > 'prescriptive' is a losing battle. It is better to eventually add > standard 'bad' features to the language than to tempt third parties to > do it in even worse and incompatible ways. >

Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-08 Thread Jonathan Fischer Friberg
On Fri, Jul 8, 2011 at 4:29 PM, James Keats wrote: > May I also add the following caveat emptors: > - If you're new to programming, clojure will overwhelm you. Start with > something like python. > I think most programming languages overwhelm you if you don't have any prior experience. I started

Re: Vagrant setup [was Re: Please stand firm against Steve Yegge's "yes language" push]

2011-07-08 Thread Jonathan Fischer Friberg
It looks like you haven't got enough privileges, try "sudo gem install vagrant" Jonathan On Fri, Jul 8, 2011 at 6:58 PM, Lee Spector wrote: > > On Jul 8, 2011, at 12:38 PM, Vivek Khurana wrote: > > > That is still not as easy as python. Running VM is a bigger overhead... > > There are different

Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-08 Thread Jonathan Fischer Friberg
I don't agree that clojure is, or should be seen as something entirely different than java. If it weren't for java, clojure wouldn't have much use at all. When it comes to IDEs, I agree. I write all code in vim (for editing only), and do the rest from the command line (meaning mostly leiningen). I

Re: Recommendation for Clojure Enterprise Development toolkit

2011-07-09 Thread Jonathan Fischer Friberg
That's not very constructive at all. I think clojure would work fine (or better) for enterprise applications. The one thing that could pull it down is maintainability, as the maintainers must know clojure. There was recently a thread about working on large programs in clojure. It might contain so

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
Maybe this would do: https://gist.github.com/1073506 I should add that I have never used iterators, and that the code is untested ;) Jonathan On Sat, Jul 9, 2011 at 11:10 AM, stu wrote: > Hi, > > I'd like to make use of Java classes implementing the Java2D > PathIterator interface: > > > http:

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
I don't think I like the notion of a lazy-seq and an iterator, since reading the iterator also changes it. Consider the case where you create a lazy-seq from an iterator, and the iterator somehow escapes. Somewhere else the iterator is read from, and now the data that where supposed to be in the la

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
Well, I guess. But I get the feeling that the iterator are probably coming from some java object somewhere, and might get passed around in that environment, that's why I'm worried. In the examples you mentioned, line-seq for example. The reader has already 'escaped' since it is passed as an argume

Re: Extending a type to an Interface

2011-07-10 Thread Jonathan Fischer Friberg
I think the reason is that an interface means that the function must be 'inside' the class. I.e you can call (.method object). Since it isn't possible to extend a java class in that way, it isn't possible to use extend. In a defrecord body however, a new class is defined, which means that it's poss

Re: Local bindings w/o let

2011-07-10 Thread Jonathan Fischer Friberg
There's no interfaces, that's the function definition. define function max (defn max attach docstring "Returns the greatest of the nums." attach metadata {:added "1.0"} if max is called with one argument, use this function definition ([x] x) if max is called with two arguments, use this functi

Re: Results from 2011 State of Clojure survey

2011-07-13 Thread Jonathan Fischer Friberg
All those are available in 1.2, or am I missing something? >From my own experience: metadata, when I started to learn clojure, I thought "this is awesome". When I realized that metadata only applies to clojure types, it felt unreliable and I never got to using it. protocols & records/types - they

Re: Noobie needs help

2011-07-14 Thread Jonathan Fischer Friberg
def defines a global binding (i.e. you can reach the symbol from everywhere). defn does the same thing, but always binds the symbol to a function. Therefore, you only need either def OR defn. (defn string-maker [the-string] (str the-string)) OR (def string-maker (fn [the-string] (str the-stri

Re: Noobie needs help

2011-07-14 Thread Jonathan Fischer Friberg
I see I misunderstood the question, sorry about that. What you want is a macro: (defmacro string-maker [string-name the-string] `(def ~(symbol string-name) ~the-string)) Jonathan On Thu, Jul 14, 2011 at 1:13 PM, Giancarlo Angulo wrote: > Please look at this: > http://clojure.org/data_structu

Re: Modelling relationships between objects

2011-08-04 Thread Jonathan Fischer Friberg
I like to have the datastructure as one big mutable structure. It's not optimal in many cases, but it is simple. In this case you could have something like: (def NoteDb (atom [{:text "a note" :category :misc} {:text "note 2" :category :misc} {:text "blabla" :category :important}])) (defn

Re: [ANN] CongoMongo 0.1.6

2011-08-05 Thread Jonathan Fischer Friberg
Might be appropriate: https://github.com/aboekhoff/congomongo Jonathan On Fri, Aug 5, 2011 at 1:29 AM, Sean Corfield wrote: > Available on Clojars. > > Compatible with Clojure 1.2 and Clojure 1.3. Fixes (almost) all reflection > warnings. Handles multi-server connections (bug in previous snapsho

[CLJS] Disable name mangling for 'static'

2012-04-24 Thread Jonathan Fischer Friberg
Hi, I want to create a (partially static) server with nodejs and express. I want to be able to write something like the following: (def app (.createServer express)) (.use app (.static express "public")) (.listen app 8080) The problem here is that clojurescript seems to compile the name 'static

Re: Disable name mangling for 'static'

2012-04-24 Thread Jonathan Fischer Friberg
hris. >> >> On Apr 24, 12:33 pm, David Nolen wrote: >> > It's a known bug. We should not munge JS reserved words that appear in >> > property access. Patch welcome. >> > >> > David >> > >> > On Tue, Apr 24, 2012 at 3:31 PM, Jonat

Re: ClojureScript One

2012-05-27 Thread Jonathan Fischer Friberg
When clojurescript first came out (.toString this) (.toString this 3) both of these seems to be a function call, but the first one was transformed to (. this toString) and because there is no way to know if the user meant to call the function "toString" or get the property "toString", it return

Re: [ANN] Timbre, an all-Clojure logging library

2012-05-28 Thread Jonathan Fischer Friberg
Looks good! As you said, logging is just too damn complicated in java. Suggestion: change timbre/config to a function, seems way nicer to call (timbre/config :current-level :warn) rather than (swap! timbre/config assoc :current-level :warn) Jonathan On Mon, May 28, 2012 at 1:17 PM, Peter Taou

Re: Clojure contrib profiler error

2012-08-04 Thread Jonathan Fischer Friberg
clojure.contrib is not supported in clojure versions 1.3+ The reason in this case is that in 1.3+, it is necessary to add ^:dynamic or ^{:dynamic true} in the def form (i.e. to the metadata) for the var to be dynamically changed with bindings. Fixed clojure.contrib.profile: https://gist.github.com

Re: Fixing a broken Java library

2012-08-13 Thread Jonathan Fischer Friberg
gen-class supports both static methods and protected vars. http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/gen-class (see :exposes in the second for protected access). Jonathan On Mon, Aug 13, 2012 a

File endings proposal for easier cross-compiling

2012-10-07 Thread Jonathan Fischer Friberg
Hi, In my opinion, cross-compiler projects is way too complicated to pull off. When they really shouldn't be. Therefore, I'm proposing the following file ending scheme: .clj - detected by all compilers. In a cross-compiler project, .clj files contains code not specific to the compiler. .cljj - d

Re: functional approach to algorithm

2012-10-09 Thread Jonathan Fischer Friberg
(partition 2 1 [a b c d e]) http://clojuredocs.org/clojure_core/clojure.core/partition On Wed, Oct 10, 2012 at 12:49 AM, Brian Craft wrote: > I'm holding a list, say [a b c d e]. I need all the adjacent pairs, like > [[a b] [b c] [c d] [d e]]. > > It's a bit like reduce, but I don't know how to

Re: Could be my favourite improvement in 1.4

2012-10-10 Thread Jonathan Fischer Friberg
On Thu, Jan 19, 2012 at 8:50 PM, Jeremy Heiler wrote: > On Tue, Dec 20, 2011 at 2:05 AM, Alan Malloy wrote: > > I agree, this horrifies me. It isn't even as simple as "letting them > > be whitespace", because presumably you want (read-string "{a: b}") to > > result in (hash-map 'a 'b), but (read-

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Jonathan Fischer Friberg
I agree with Lee. Everything that works in standard clojure should also work in an eval. Jonathan On Mon, Oct 15, 2012 at 8:11 PM, Lee Spector wrote: > On Oct 15, 2012, at 12:51 PM, Alan Malloy wrote: > > > Evaluating function literals is not intended to work; that it works > > for non-closure

ANN: LispIndent, jEdit plugin that indents lisp code

2012-10-17 Thread Jonathan Fischer Friberg
Hi, As I were unable to find a way to indent lisp code in jEdit, I decided to write a plugin for this purpose. It's called LispIndent and can be found here: https://github.com/odyssomay/LispIndent Please report if you have any problems! Jonathan -- You received this message because you are su

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

2012-10-17 Thread Jonathan Fischer Friberg
n Wed, Oct 17, 2012 at 7:33 PM, John Gabriele wrote: > On Wednesday, October 17, 2012 10:26:01 AM UTC-4, Jonathan Fischer Friberg > wrote: >> >> Hi, >> >> As I were unable to find a way to indent lisp code in jEdit, I decided to >> write a plugin for this purpos

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

2012-10-17 Thread Jonathan Fischer Friberg
The plugin has been updated to support function argument indenting. It is configurable in the plugin options. Next, I think I will implement "presets". The idea is that each preset corresponds to one language. That way, LispIndent can still be language-independent. Users will also be spared of imp

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

2012-10-18 Thread Jonathan Fischer Friberg
5 AM, John Gabriele wrote: > On Wednesday, October 17, 2012 7:39:26 PM UTC-4, Jonathan Fischer Friberg > wrote: >> >> The plugin has been updated to support function argument indenting. >> It is configurable in the plugin options. >> > > Oooh, this is nice. :) I

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

2012-10-23 Thread Jonathan Fischer Friberg
> > BTW, I created the beginnings of a CDS "development tools" guide > https://github.com/clojuredocs/cd > s/blob/master/articles/ecosystem/development_tools.md

Re: when to be lazy

2012-10-23 Thread Jonathan Fischer Friberg
Example: You want to find an element with a certain property in a list. In a imperative language you can do: function ... for( ... loop over list) if( ... current element has the property ...) return the element But in clojure we can do: (first (filter has-the-property? the-lis

Re: when to be lazy

2012-10-23 Thread Jonathan Fischer Friberg
Just found this: http://www.infoq.com/presentations/Laziness-Good-Bad-Ugly Jonathan On Tue, Oct 23, 2012 at 10:09 PM, Brian Craft wrote: > Thanks for all the responses! This is great. > > b.c. > > On Tuesday, October 23, 2012 12:51:11 PM UTC-7, Sean Corfield wrote: > >> On Tue, Oct 23, 2012 at

Re: when to be lazy

2012-10-23 Thread Jonathan Fischer Friberg
No, that's unfortunate. :( Jonathan On Wed, Oct 24, 2012 at 12:27 AM, Brian Craft wrote: > hipster presentation is not so great in archive: can't really see what > he's doing. > > > On Tuesday, October 23, 2012 1:55:08 PM UTC-7, Jonathan Fischer Friberg >

Re: let in the middle of thread-first

2012-10-26 Thread Jonathan Fischer Friberg
You could also let every function take a map as input/output. Then, b could return a map with key :result-b or similar. This result would then pass through the rest of the functions and be accessible in e. Like this: a ; => {:result-a ...} b ; => {:result-b ... :result-a ...} ... d ; => {... :resu

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-04 Thread Jonathan Fischer Friberg
> > It would be nice if clojure.core/conj had a unary implementation > >([coll] coll) > I support this. Reasons: 1. It makes sense, adding nothing to something should give back the something. 2. It's consistent with disj as mentioned. 3. Supporting edge cases like this can make some algorithm

[ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-12 Thread Jonathan Fischer Friberg
Dear clojure mailing list, As the indenting for clojure (and lisp in general) was very lacking in sublime, I decided to make a plugin: https://github.com/odyssomay/sublime-lispindent I hope someone finds this useful. By the way, if someone with a mac could try the keyboard shortcuts that would

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-12 Thread Jonathan Fischer Friberg
> On a Mac, enter and Cmd+I work as advertised. > Nice! Thank you for testing. :) Jonathan -- 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 -

Re: Closure Accordion Widget

2012-11-23 Thread Jonathan Fischer Friberg
I recommend simply using jquery(ui). closure has just been a pain to use for me. Nothing but frustration came out of it. jquery on the other hand, is great! :D I mean, it even has documentation. ;) That's pretty hard to beat. On Thu, Nov 22, 2012 at 7:10 AM, J Elaych wrote: > I'm designing a

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-23 Thread Jonathan Fischer Friberg
Uploaded new version today which ignores strings when indenting and adds menu entries for changing the settings/key bindings. Jonathan On Mon, Nov 12, 2012 at 5:44 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > > On a Mac, enter and Cmd+I work as advertised. >&g

Re: Object identity and with-meta

2012-11-23 Thread Jonathan Fischer Friberg
When you compare functions, it only checks if it is the same function object (not if the function "behaves" the same way). For example: (= (fn []) (fn [])) ;=> false The reason you get false in your case is because with-meta returns a new object every time you call it. We need a new object to kee

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-23 Thread Jonathan Fischer Friberg
ess > instead of copying the package to Pristine Packages. > > Shantanu > > > On Friday, 23 November 2012 22:46:14 UTC+5:30, Jonathan Fischer Friberg > wrote: > >> Uploaded new version today which ignores strings when indenting and adds >> menu entries for changing t

Re: amap, areduce ... hopefully afilter, aremove , aconcat, amapcat etc

2012-11-23 Thread Jonathan Fischer Friberg
The exception is because (into-array [0 1 -7 2 -1 -3 4 5 -10]) is not an array of longs, use long-array instead. In the areduce, we also have to return ret after each computation, like so: (defn aremove [pred ^longs ns] (areduce ns i ret (long-array (alength ns)) (let [v (aget ns i)]

Re: Closure Accordion Widget

2012-11-24 Thread Jonathan Fischer Friberg
I don't think there's a consensus. You will have to weigh the pros/cons and choose what fits you best. For example: closure integrates perfectly with the closure compiler while jquery does not. jquery has great documentation while closure does not. And so on. :) Jonathan On Sat, Nov 24, 2012 at

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-25 Thread Jonathan Fischer Friberg
I didn't realize that the install looks completely different on mac. Sorry! In any case, I have sent a request to include it into the sublime package control. That should make it much easier to install. :) *Also, will this work with the built in 'reindent' command? If not, will it work with vintag

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-11-26 Thread Jonathan Fischer Friberg
ately start using it in a clojure file. Please report if you have any problems! Jonathan On Sun, Nov 25, 2012 at 3:31 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > I didn't realize that the install looks completely different on mac. Sorry! > In any case, I have sent a

Re: ClojureScript & Three.js

2012-12-04 Thread Jonathan Fischer Friberg
I usually never care about bringing external libs into the closure system. Instead, I would do this: HTML: Clojurescript: (def THREE js/THREE) Of course, this places it outside closure, and wont be compiled with the closure compiler. I don't think this matters much (in most cases anyway). Becau

Re: [ANN] sublime-lispindent, clojure indenting for sublime text 2

2012-12-07 Thread Jonathan Fischer Friberg
You're welcome :) On Fri, Dec 7, 2012 at 1:12 AM, Anton Holmberg wrote: > This is so awesome! You are my hero. Been searching for this for a while > now. > > Den måndagen den 12:e november 2012 kl. 17:25:38 UTC+1 skrev Jonathan > Fischer Friberg: > >> Dear cloju

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread Jonathan Fischer Friberg
I don't know why it doesn't work. However, changing defgreeter to the following seems work. (defmacro defgreeter [greeter-name] (let [greeter (make-greeter)] `(def ~greeter-name ~greeter))) Might be a clue. :) Jonathan On Sun, Dec 16, 2012 at 6:49 PM, juan.facorro wrote: > I think it ha

Re: What's wrong with my *print-dup* persistence?

2011-09-11 Thread Jonathan Fischer Friberg
Or (load-string "(+ 1 (+ 2 4))") Jonathan On Fri, Sep 9, 2011 at 5:14 PM, Chouser wrote: > On Thu, Sep 8, 2011 at 5:16 PM, Tassilo Horn > wrote: > > Hi all, > > > > I've just read Alan Malloy's excellent clojure persistence article at > > > > > http://amalloy.hubpages.com/hub/Dont-use-XML-JSON

Re: debugging

2011-09-11 Thread Jonathan Fischer Friberg
Sort of. http://georgejahad.com/clojure/cdt.html Jonathan On Sat, Sep 10, 2011 at 5:36 PM, Dennis Haupt wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > hi there, > > what's the currently best way to debug a clojure program? > ideally, i want to see all vars, symbols, functions et

Re: Misleading Exception due to function name containing ->

2011-09-11 Thread Jonathan Fischer Friberg
I've had no problems with functions containing -> Jonathan On Fri, Sep 9, 2011 at 10:47 AM, Christina Conway wrote: > A function name contains the characters -> > e.g. foo->fn > The function causes an exception. > However the exception is not reported on the function but on another > function

Re: Exceptions in Haskell and in Clojure

2011-09-12 Thread Jonathan Fischer Friberg
Incidentally, I was just working on such a thing. I'll send it in a new thread. Jonathan On Sun, Sep 11, 2011 at 7:03 PM, Michael Jaaka wrote: > Couldn't match expected type `(t, t1)' > against inferred type `(t2, t3, t4)' > In the expression: (8, 11, 5) > In the expression: [(1, 2), (8, 11, 5)

trace-forms macro

2011-09-12 Thread Jonathan Fischer Friberg
Hello, I made a small macro, if anyone is interested. https://gist.github.com/1209498 It wraps one or more forms and if an exception is thrown, prints the form that caused it, and throws the exception itself. Examples: user=> (trace-forms 3) 3 user=> (trace-forms (+ 6 (/ 9 0))) java.lang.Arith

Re: heaps in clojure

2011-09-13 Thread Jonathan Fischer Friberg
There is the inbuilt sort function, also sort-by is useful. In "The joy of clojure", there were an example of a lazy sort. It can be found here: http://www.manning.com/fogus/ In the file "q.clj" in the source code. Jonathan On Tue, Sep 13, 2011 at 1:44 PM, Sunil S Nandihalli < sunil.nandiha...@g

Re: trace-forms macro

2011-09-14 Thread Jonathan Fischer Friberg
It was tested with 1.2.1 Jonathan On Wed, Sep 14, 2011 at 9:09 AM, Sergey Didenko wrote: > Looks interesting. Did you use it with Clojure 1.3 or earlier? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to c

Re: Mocking out namespaces

2011-09-14 Thread Jonathan Fischer Friberg
You could call the mock file B_mock.clj then (require '[B-mock :as B]) Jonathan On Wed, Sep 14, 2011 at 5:19 PM, Brian Hurt wrote: > Say I have two name spaces, A and B, with A depending on B. I want to test > namespace A, replacing module B with a mock B for testing purposes- > preferably wi

Re: trace-forms macro

2011-09-24 Thread Jonathan Fischer Friberg
gt; errors. > There's not much you can do to trap these. > The macro is still valuable for runtime tracing. > > Luc P. > > On Mon, 12 Sep 2011 11:31:39 +0200 > Jonathan Fischer Friberg wrote: > > > Hello, > > > > I made a small macro, if anyone is int

Re: trace-forms macro

2011-09-26 Thread Jonathan Fischer Friberg
I looked at it today and have updated the macro. (same gist: https://gist.github.com/1209498) Additions: It detects if a form contains (recur ...), and if it does, the form isn't wrapped in (try ...). trace vectors, maps, and sets. trace (fn* ...) & (new ...) --- The code feels a bit "thrown t

Re: iterate with side-effect function?

2011-09-28 Thread Jonathan Fischer Friberg
How about while? (while not-finished (do stuff ...)) On Wed, Sep 28, 2011 at 4:23 AM, Nathan Sorenson wrote: > Quite often I convince myself I need state or some effectful trigger, but > further thought reveals a simpler stateless approach. > > That being said--if you absolutely need to be do

Re: Learning clojure - comments on my function?

2011-09-29 Thread Jonathan Fischer Friberg
First of all, you should switch from ((fn [ls wip ans] ...) ls [] nil) to (loop [ls ls wip [] ans nil] ...) Read about it here: http://clojure.org/special_forms Using higher-order functions, you could do: (defn split-zero [coll] (if (seq coll) (let [divided (partition-by zero? coll)]

Re: goog.net.cookies with clojurescript?

2011-10-06 Thread Jonathan Fischer Friberg
I managed to do it. The problem is that we need to use the function set in a goog.net.Cookies object. There is already such an object, which is called goog.net.cookies, see the bottom of the source file: /** * A static default instance. * @type {goog.net.Cookies} */ goog.net.cookies = new goog.

Re: clojure.contrib.base64

2011-10-06 Thread Jonathan Fischer Friberg
> > thus enable all Clojure developers to have lightning > fast Base64 encoding/decoding? > This is already possible, if you're using leiningen: put the file in src/util/ and compile, you can now call it as usual. On Thu, Oct 6, 2011 at 11:16 AM, Rok Lenarcic wrote: > I use Base64 encoding a lot

Re: The Website / Wikispaces

2011-10-06 Thread Jonathan Fischer Friberg
I do On Thu, Oct 6, 2011 at 2:32 PM, Simon Morgan wrote: > When using clojure.org does anybody else quite frequently get the > Wikispaces homepage instead? This seems to happen most often when I > start Firefox because I always have a clojure.org tab open. Any idea > what's causing this? > > --

Re: tools.logging vs clojure.contrib.logging

2011-10-12 Thread Jonathan Fischer Friberg
As I understand it, tools.logging was created from clojure.contrib.logging (but has been updated since). In any case; if there exists a library in clojure/, which can perform the same things as some part of contrib, use the clojure/ one. On Wed, Oct 12, 2011 at 5:06 PM, jingguo wrote: > Is tool

Get the name of keyword/symbol in clojurescript

2011-10-17 Thread Jonathan Fischer Friberg
Hi, As I understand it, clojurescript uses some unicode characters to identify keywords/symbols. I guess that's why (str 'a) gives me ï·‘'a I thought that this was intentional, and that (name 'a) would give me "a", but I got the same result as with (str). So how do I extract the name from a symbo

Re: Get the name of keyword/symbol in clojurescript

2011-10-18 Thread Jonathan Fischer Friberg
mode, browser REPL, etc.) ? > > David > > On Mon, Oct 17, 2011 at 6:41 PM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> Hi, >> >> As I understand it, clojurescript uses some unicode characters to identify >> keywords/symbols. >> I g

Re: Get the name of keyword/symbol in clojurescript

2011-10-18 Thread Jonathan Fischer Friberg
the REPL (say via > script/repljs) ? > > David > > > On Tue, Oct 18, 2011 at 7:22 AM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> I'm on the master branch. >> >> I compiled the file using 'cljsc file > file.js',

Re: Get the name of keyword/symbol in clojurescript

2011-10-18 Thread Jonathan Fischer Friberg
It works now, and the result is as expected. In the browser I still get the extra characters however. On Tue, Oct 18, 2011 at 5:04 PM, David Nolen wrote: > Have you rerun the bootstrap script since the Rhino upgrade? > > > On Tue, Oct 18, 2011 at 10:33 AM, Jonathan Fischer Friber

Re: Get the name of keyword/symbol in clojurescript

2011-10-18 Thread Jonathan Fischer Friberg
It works! Thanks for all the help. On Tue, Oct 18, 2011 at 5:52 PM, David Nolen wrote: > I see you're not setting the encoding. Try adding the following to the top > of > > > > David > > > On Tue, Oct 18, 2011 at 11:43 AM, Jonathan Fischer Friberg < > od

<    1   2