Re: Critiques of "my-flatten" which uses CPS

2014-07-15 Thread Jonathan Fischer Friberg
I haven't really used CPS myself, but I think you should be able to use the trampoline function to clean up your code. http://clojuredocs.org/clojure_core/clojure.core/trampoline Jonathan On 15 July 2014 09:13, Mark P wrote: > I'm very new to continuation passing style (CPS), and as part of t

Re: require & :require

2013-12-06 Thread Jonathan Fischer Friberg
Inside the ns form they are the same. Outside the ns form, only (require '[a.b]) works (with quoting, as Kelker said). Jonathan On Fri, Dec 6, 2013 at 10:24 AM, Kelker Ryan wrote: > I believe one is a directive and the other is a function. > > :require doesn't need the values to be quoted > >

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-09 Thread Jonathan Fischer Friberg
I agree! :) On Fri, Aug 9, 2013 at 10:10 AM, Mikera wrote: > On Friday, 9 August 2013 05:07:10 UTC+8, Jonathan Fischer Friberg wrote: > >> I'd suggest avoiding macros until you absolutely know that you need them. >> Usually they aren't necessary. >> >>

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-08 Thread Jonathan Fischer Friberg
I'd suggest avoiding macros until you absolutely know that you need them. Usually they aren't necessary. Problem with this is that you don't really know when you need them unless you know what they do. On Thu, Aug 8, 2013 at 9:58 PM, Jace Bennett wrote: > Thanks, Mike. > > I guess my simple ex

Re: Wrong documentation of contains?

2013-08-07 Thread Jonathan Fischer Friberg
No, it should be more explicit. "If called with a map..." "If called with a vector..." Jonathan On Wed, Aug 7, 2013 at 8:32 PM, Michael Gardner wrote: > Wouldn't changing "collection" to "associative collection" be enough? > Though maybe a note about its behavior on vectors would also be good.

Re: Wrong documentation of contains?

2013-08-07 Thread Jonathan Fischer Friberg
That's only obvious if you already know how it works. Jonathan On Wed, Aug 7, 2013 at 2:13 PM, Karsten Schmidt wrote: > The fact, that the docs refer to checking if a "key" is present in the > collection, should make it obvious which types are supported, no? Only > vectors, maps and sets have ke

Re: [Proposal] Simplified 'ns' declaration

2013-08-06 Thread Jonathan Fischer Friberg
If there was one thing I would deprecate it's that the first element of the vector is special. I find the fact that these two: (ns bob [:require [tawny owl reasoner]]) (ns john [:require [tawny.owl reasoner]]) are totally different, very confusing. That feature is very important to me. It's super

Re: [Proposal] Simplified 'ns' declaration

2013-08-05 Thread Jonathan Fischer Friberg
at 9:04 PM, Mark Engelberg wrote: > On Mon, Aug 5, 2013 at 11:31 AM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > > I think it's java that is at fault here. I think wildcards should never >> have been part of java to begin with. The argument here is ba

Re: [Proposal] Simplified 'ns' declaration

2013-08-05 Thread Jonathan Fischer Friberg
Jonathan On Mon, Aug 5, 2013 at 8:25 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > There is syntax to ns. It's not syntax in the traditional way, but it's > essentially the same thing. And Greg is right that it often causes > confusion. > > I +1 th

Re: [Proposal] Simplified 'ns' declaration

2013-08-05 Thread Jonathan Fischer Friberg
There is syntax to ns. It's not syntax in the traditional way, but it's essentially the same thing. And Greg is right that it often causes confusion. I +1 the second version. The first version's :as-class was too messy. It could very easily be made backwards-compliant as well. All we have to do i

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread Jonathan Fischer Friberg
#x27;s no excuse. What I meant to say is "I heard > that lispindent has serious problems integrating with other features of ST2 > but I don't remember how and can't find that gist where it was explained". > > Sorry. > > -Steven > > > On Sat, Jul 27, 2013

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread Jonathan Fischer Friberg
Probably not, editor wars tend to bring out the worst in people. Jonathan On Sat, Jul 27, 2013 at 9:38 PM, kovas boguta wrote: > Guys, is this argument helping answer the OP's question? > > > On Sat, Jul 27, 2013 at 12:34 PM, Jonathan Fischer Friberg < > odysso...@gmail

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread Jonathan Fischer Friberg
My whole previous message appears as "trimmed" (probably because it starts with a >), that wasn't meant to happen. :) If you want to read it please open the "trimmed content". Jonathan On Sat, Jul 27, 2013 at 9:34 PM, Jonathan Fischer Friberg < odysso...@gmail.com&

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread Jonathan Fischer Friberg
> Yes. See this part of his > readme where he says it's missing some important functions. Plus see this issue I opened for him about other important missing commands. I'm not ignoring that

Re: Exporting Multiple Namespaces

2013-07-19 Thread Jonathan Fischer Friberg
Yes, there is https://github.com/ztellman/potemkin Jonathan On Fri, Jul 19, 2013 at 10:06 PM, JvJ wrote: > I'm creating a library with a lot of available functions in a lot of > different namespaces, and I'd like many of them to be available to users of > the library without having to specify a

Re: Exporting Multiple Namespaces

2013-07-19 Thread Jonathan Fischer Friberg
Hehe, yep. I mean, it's super useful for any library that needs more than one file. Which is most of them. Jonathan On Sat, Jul 20, 2013 at 12:57 AM, JvJ wrote: > "Facades and workarounds for things that are more difficult than they > should be." Very nice. > > > On Friday, 19 July 2013 13:06:

Re: Penumbra vs. LibGDX

2013-07-19 Thread Jonathan Fischer Friberg
While I haven't tried libgdx myself, you should be able to do something like this: 1. Create a "global" namespace (or similar), which should contain global variables and/or functions that should never be reloaded. In this namespace you essentially put the things that there can only be one of - the

Re: Comma separated String values from vector

2013-07-16 Thread Jonathan Fischer Friberg
Jay beat me to it. :) I'll add the documentation for pr-str: http://clojuredocs.org/clojure_core/clojure.core/pr-str Jonathan On Tue, Jul 16, 2013 at 4:39 PM, Jay Fields wrote: > this seems to do what you want: (clojure.string/join ", " (map pr-str > my-strings)) > > > On Tue, Jul 16, 2013 at

Re: lein repl and missing yank

2013-06-28 Thread Jonathan Fischer Friberg
Should pasting be part of jline? Am I the only one that finds that really odd? In my opinion, pasting should be part of the terminal - and it is. Standard shortcuts are ctrl+shift+v for gnome-terminal (and I assume other modern terminals, but I don't really know). The old standard is middle-click

[UPDATE] sublime-lispindent, clojure indenting for sublime text 2/3

2013-06-28 Thread Jonathan Fischer Friberg
Hi, This is a message to announce that sublime-lispindent has recently received an update. If you don't know what it is, check out the github page: https://github.com/odyssomay/sublime-lispindent The updates are: * Improved string/comment handling. Previously, lispindent tried to guess whether s

Re: using partial with ->

2013-06-07 Thread Jonathan Fischer Friberg
On Fri, Jun 7, 2013 at 11:13 PM, Matt Smith wrote: > (-> '([1 2] [3 4] [5]) > (partial map first) > flatten > ) Because this becomes (flatten (partial '([1 2] [3 4] [5]) map first)) I think I understand how you thought; "(partial map first) becomes a function, then I call this

Re: user math expression evaluation

2013-05-28 Thread Jonathan Fischer Friberg
Found this: http://www.objecthunter.net/exp4j/ Might be useful. Jonathan On Wed, May 29, 2013 at 12:45 AM, SpiderPig wrote: > You could just write this yourself. > It's easier than it looks. > First start with an evaluator for rpn (reverse polish notation) > expressions. > "x + sin(y)" in rpn w

Re: find first match in a sequence

2013-05-19 Thread Jonathan Fischer Friberg
On Sun, May 19, 2013 at 4:54 PM, Jim - FooBar(); wrote: > ha! you cheated with iterate... > > try this which is closer to the example... > > (first (filter odd? (map #(do (println "realized " %) %) [2 4 6 7 8 9]))) > realized 2 > realized 4 > realized 6 > realized 7 > realized 8 > realized

Re: Screencast: Clojure development with Sublime Text 2

2013-05-18 Thread Jonathan Fischer Friberg
Nice introduction! Problems/suggestions for lispindent can be reported here: https://github.com/odyssomay/sublime-lispindent/issues don't be shy! In any case, I went ahead and implemented checking for the syntax of the file. So non-saved files with clojure syntax is now indented correctly. This

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Jonathan Fischer Friberg
On Sat, May 11, 2013 at 9:25 PM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > Most of the code I see and write at work at Runa uses (not (empty? foo)). > I'll continue to defend the position that it is more obvious code, and > therefore better (imo :) ) > > Alex > Completely agree. (

Re: Struggling with encapsulation

2013-05-09 Thread Jonathan Fischer Friberg
I agree with Gary, there's normally not really any need to obfuscate the implementation, and using the underlying structure can sometimes be useful. That said, if you really want to, you can create a "woobly" protocol and implement it using reify, this will make the underlying implementation compl

Re: Separating Out .cljs Content

2013-05-08 Thread Jonathan Fischer Friberg
nceError: goog is not defined > http_rpc.js:1<http://localhost:8080/javascript/shoreleave/remotes/http_rpc.js> > > >1. Uncaught ReferenceError: shoreleave is not defined > edgar.js:1<http://localhost:8080/javascript/edgar.js> > > Tim > > > On Tue, M

Re: Separating Out .cljs Content

2013-05-07 Thread Jonathan Fischer Friberg
.EventType', 'goog.events.EventTarget', > 'goog.events']); > ... > goog.addDependency("../shoreleave/remotes/http_rpc.js", [ > 'shoreleave.remotes.http_rpc'], ['cljs.core', 'shoreleave.remotes.xhr', > 'cljs.reader']); > goog.

Re: Separating Out .cljs Content

2013-05-07 Thread Jonathan Fischer Friberg
*DON'T DO IT* I just realised, if the :optimizations missing triggers this behaviour, it should be possible to set it to nil, and it was! So try ':optimizations nil' in your build. Jonathan On Tue, May 7, 2013 at 10:20 PM, Jonathan Fischer Friberg < odysso...@gmail.com>

Re: Separating Out .cljs Content

2013-05-07 Thread Jonathan Fischer Friberg
I've a more detailed description > abouve. Maybe I just can't do this, but I thought I'd ask around. > > > Tim > > > On Tue, May 7, 2013 at 4:03 PM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> From the sample.project

Re: Separating Out .cljs Content

2013-05-07 Thread Jonathan Fischer Friberg
groups of them with different lein-cljsbuild groups. > > > On Tue, May 7, 2013 at 12:24 PM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> I haven't used clojurescript in a while, but if I recall correctly, the >> only way >> to not compile eve

Re: Separating Out .cljs Content

2013-05-07 Thread Jonathan Fischer Friberg
I haven't used clojurescript in a while, but if I recall correctly, the only way to not compile everything into a single file is to leave out the :optimization flag completely. If this is the case this should probably be considered a bug. I might be wrong though. Jonathan On Tue, May 7, 2013 at

Re: Import java classes in clojure

2013-05-05 Thread Jonathan Fischer Friberg
(:import ...) only works in (ns ...). Outside ns, you have to use (import ...) instead (note: no ":"). See: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html Jonathan On Mon, May 6, 2013 at 12:04 AM, Caocoa wrote: > Hi all! I'm a new C

Re: Using a Java game engine in my project

2013-05-05 Thread Jonathan Fischer Friberg
That sounds scary. :) I haven't experienced any of the sort. Tested in both linux 64-bit and windoze 32-bit. The problem likely stems from the way jme loads the native libraries. As far as I know they do it "manually" by extracting the libraries and then setting some sort of path. It should be au

Re: [ANN] bleach 0.0.11

2013-05-04 Thread Jonathan Fischer Friberg
You could try reading about it here: http://search.cpan.org/~dconway/Acme-Bleach-1.150/lib/Acme/Bleach.pm I still can't figure out exactly what it does though... Reading the description, it seems like it removes, for example whitespace at the end of lines. But from the example it seems like it rem

Re: idiomatic way to force evaluation of a lazy operation

2013-05-04 Thread Jonathan Fischer Friberg
If you don't need the result, you should use dorun instead of doall. http://clojuredocs.org/clojure_core/clojure.core/dorun Jonathan On Sat, May 4, 2013 at 8:07 PM, Gary Verhaegen wrote: > Just want to point out that doall seeming more idiomatic in this case > might just be an accident of histo

Re: A JMonkeyEngine3 wrapper?

2013-05-01 Thread Jonathan Fischer Friberg
UI example: https://github.com/odyssomay/orbit/blob/master/test/orbit/test/ui.clj#L45 Sorry for the "spam". :) Jonathan On Wed, May 1, 2013 at 11:28 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > Some info about the current status: > > * Input handlin

Re: A JMonkeyEngine3 wrapper?

2013-05-01 Thread Jonathan Fischer Friberg
'd like to know more. Jonathan On Wed, May 1, 2013 at 11:20 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > My effort can be found here: > https://github.com/odyssomay/orbit > > It's kind of "all over the place" in that I have started on a lo

Re: A JMonkeyEngine3 wrapper?

2013-05-01 Thread Jonathan Fischer Friberg
My effort can be found here: https://github.com/odyssomay/orbit It's kind of "all over the place" in that I have started on a lot of things, but not really finished any parts. In any case, should be some useful stuff in there. I haven't really been active on the project lately - there's a bunch o

Re: Using a Java game engine in my project

2013-04-30 Thread Jonathan Fischer Friberg
> > I think that for today I will stick with the "lib" folder solution, > proposed by James, but I encourage the knowledgefull people Jonathan and > James to work together to deliver a Clojars or Amazonaws online repository > with more-or-less daily update, since the engine is really well-maintaine

Re: Now *there*'s a machine made for Clojure.

2013-04-29 Thread Jonathan Fischer Friberg
7;t support better. Everything from concurrency to the GC is > implemented better in the JVM. > > Timothy > > > On Mon, Apr 29, 2013 at 2:41 PM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> On Mon, Apr 29, 2013 at 5:25 PM, Konrad Hinsen < >>

Re: Now *there*'s a machine made for Clojure.

2013-04-29 Thread Jonathan Fischer Friberg
On Mon, Apr 29, 2013 at 5:25 PM, Konrad Hinsen < googlegro...@khinsen.fastmail.net> wrote: > --On 29 avril 2013 09:09:27 -0400 Lee Spector > wrote: > > On Apr 29, 2013, at 9:01 AM, Jonathan Fischer Friberg wrote: >> >> You could always give >> https://g

Re: Using a Java game engine in my project

2013-04-29 Thread Jonathan Fischer Friberg
I'm currently making a library for jmonkeyengine. It's not ready yet, however, a while back I decided to put jme in a repository. Url: "http://jmonkeyengine.s3-website-eu-west-1.amazonaws.com/"; Add to deps: [jme "2013-04-01"] The biggest problem with it right now is that it contains all test mod

Re: testing for nil may not be enough

2013-04-29 Thread Jonathan Fischer Friberg
If you don't want to set the initial value to nil, set it to ::unbound or similar. Should be very hard to accidentally bind the same value. Jonathan On Mon, Apr 29, 2013 at 8:04 PM, AtKaaZ wrote: > the pain with that is that it wouldn't work inside a function where a > would be the function pa

Re: Now *there*'s a machine made for Clojure.

2013-04-29 Thread Jonathan Fischer Friberg
You could always give https://github.com/halgari/clojure-py a spin, might not be so easy to get everything working though. :) Jonathan On Mon, Apr 29, 2013 at 2:48 PM, Lee Spector wrote: > > On Apr 29, 2013, at 8:15 AM, Michiel Overtoom wrote: > > On Apr 28, 2013, at 05:36, Lee Spector wrote

Re: cannot read foo.xml from the top level of a jar!

2013-04-26 Thread Jonathan Fischer Friberg
Did you put "/" at the beginning of the string to resource? Because you shouldn't. You should call it like this: (resource "foo.xml"). Jonathan On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); wrote: > Hello everyone, > > I hope you're all doing well... > > Can anyone enlighten my as to why I

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Jonathan Fischer Friberg
If that's a problem, you could try https://github.com/hugoduncan/criterium On Thu, Apr 25, 2013 at 5:38 PM, Phil Hagelberg wrote: > Three repetitions is not nearly enough to get a feel for how hotspot > optimizes functions when it detects they're in a tight loop. I don't know > how javac works,

Re: Memoization in clojure

2013-04-14 Thread Jonathan Fischer Friberg
> > Oops ;) > Of course you are right. The amazing thing is that the times I observed > fitted somehow the situation (the first (fib 30) call taking much more time > than the others, the third call more than the second and fourth) that I was > tricked into believing the calculations were being done

Re: Memoization in clojure

2013-04-14 Thread Jonathan Fischer Friberg
> > (letfn [(fib [x] > (memoize > #(if (or (zero? %) (= % 1)) >1 >(+ (fib (- % 1)) (fib (- % 2))] > (time (fib 30)) > (time (fib 30)) > (time (fib 40)) > (time (fib 40))) > Calling fib just creates a new function, no values are calc

Re: Analog to Scheme's partition in Clojure?

2013-04-04 Thread Jonathan Fischer Friberg
I think group-by can do what you want (and more); http://clojuredocs.org/clojure_core/clojure.core/group-by Jonathan On Thu, Apr 4, 2013 at 2:16 PM, Christian Romney wrote: > Hi all, > > I was wondering if something in core (or new contrib) like this exists > already... > > (defn segregate >

Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
e content > as a function, very helpful! > > Ryan > > > On Friday, March 29, 2013 12:08:04 AM UTC+2, Jonathan Fischer Friberg > wrote: > >> It can still be done with the #(), with for example the hash-map function. >> It's basically the same as the {} bu

Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
hose keys represent sql columns > which they use underscore so I gotta go with underscores in order code to > match them :) > > Ryan > > On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg > wrote: > >> It's because the #() syntax always c

Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
It's because the #() syntax always calls the content as a function. So #(...) is the same as (fn [] (...)). In your case, #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) is the same as: (fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})) Note the extra () around {}. In other words, y

Re: a bug?

2013-03-27 Thread Jonathan Fischer Friberg
I don't think it's fixed in 1.5.1. In both 1.5.0 and 1.5.1, (range 1500) is not enough to cause the overflow for me. However, (range 2000) "successfully" overflows in both versions. Jonathan On Wed, Mar 27, 2013 at 8:53 PM, Timothy Baldridge wrote: > Holding on to the head would result in a ou

Re: a bug?

2013-03-27 Thread Jonathan Fischer Friberg
The problem is probably too much nested laziness. Try: (reduce (fn [a b] (doall (map + [1 1] a))) [1 1] (range 1500)) Related: https://groups.google.com/d/msg/clojure/-d8m7ooa4c8/pmaO7QubhosJ Jonathan On Wed, Mar 27, 2013 at 8:48 PM, Michael Klishin < michael.s.klis...@gmail.com> wrote: > >

Re: doing a Google search from Clojure?

2013-03-22 Thread Jonathan Fischer Friberg
Found some info here: http://stackoverflow.com/questions/3727662/how-can-you-search-google-programmatically-java-api Jonathan On Fri, Mar 22, 2013 at 8:32 AM, Cedric Greevey wrote: > Change your code to it spoofs a common browser user-agent, change your > DHCP-assigned IP address, and try aga

Re: Java interop with dynamic proxies

2013-03-12 Thread Jonathan Fischer Friberg
I think you can simply use 'Fred' instead of 'Fred.class'. Since, in the repl: (class Integer) ;=> java.lang.Class I.e. just by using the name, we get a Class object, which should correspond to .class in java. In other words, you should be able to run: (let [f (Factory/createInstance) fre

Re: ANN Validateur 1.4 is released

2013-03-12 Thread Jonathan Fischer Friberg
"We recommend all users to upgrade to 1.7.0 ." I'm guessing it should be 1.4.0? Jonathan On Tue, Mar 12, 2013 at 8:58 PM, Michael Klishin < michael.s.klis...@gmail.com> wrote: > Validateur is a functional validations library inspi

Re: What's the point of -> ?

2013-03-11 Thread Jonathan Fischer Friberg
-> and ->> are for some reason really hard to grasp for many when starting out - me included. On Mon, Mar 11, 2013 at 11:58 AM, wrote: > So I understand that: > > (-> foo bar wibble) > > is equivalent to > > (wibble (bar (foo))) > Correct, but that misses the point. Thinking about -> in terms o

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-10 Thread Jonathan Fischer Friberg
I would say using :require :as is in almost all cases better. However, I think :use is preferred if almost everything done in the current namespace depends on the used namespace. Though, no more than one namespace should ever be imported with :use in the same namespace. In your case I think it's a

Re: Windows Installation

2013-03-09 Thread Jonathan Fischer Friberg
My experience: 1. Download lein.bat 2. Run it Jonathan On Sat, Mar 9, 2013 at 10:23 AM, BJG145 wrote: > Perhaps this general anti-Windows attitude is what Windows-based newcomers > to Clojure find off-putting... > > > On Saturday, March 9, 2013 3:55:59 AM UTC, James Ashley wrote: >> >> Since

Re: features expression

2013-03-07 Thread Jonathan Fischer Friberg
ipt, and > are the kinds of things you would want to conditionally compile on for > Clojure/JVM. > > Andy > > > On Thu, Mar 7, 2013 at 5:44 AM, Jonathan Fischer Friberg < > odysso...@gmail.com> wrote: > >> Isn't it possible to solve this with a simp

Re: features expression

2013-03-07 Thread Jonathan Fischer Friberg
Isn't it possible to solve this with a simple macro? (case-dialect :clojure (... clojure code ...) :clojurescript (... clojurescript code ...)) Then, in jvm clojure, it could be implemented as: (defmacro case-dialect [& {:keys [clojure]}] clojure) and in clojurescript: (defmacro case-diale

Re: Like "if", but it composes functions

2013-02-20 Thread Jonathan Fischer Friberg
Function composition similar to that has been explored a lot in the haskell world. See: http://www.haskell.org/haskellwiki/Arrow I also made a small library to implement some of the operators: https://github.com/odyssomay/clj-arrow I think the reason arrows are so interesting in haskell is beca

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: [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: 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-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: [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: 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: 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: [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: 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
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: 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-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 -

[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: 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

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: 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: 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
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: 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: 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-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-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

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: 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

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: 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

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: 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

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: [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: 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: 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

[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: 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

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
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',

  1   2   >