Re: Question about instance?

2009-03-10 Thread Tassilo Horn
Laurent PETIT writes: Hi Laurent, > For this to work, instance? would have to return logical true instead > of real true. I'm new to clojure, so please forgive any stupid questions. But you mean that (instance? java.lang.Integer 17) should return 17 instead of true, right? Seems plausible, b

swank-clojure-extra-classpaths troubles

2009-03-10 Thread Tassilo Horn
Hi all, to get started with Clojure I've bought the PDF version of "Programming Clojure". But I don't get how I have to setup swank-clojure in order to make the examples work. I tried both --8<---cut here---start->8--- (swank-clojure-config (add-to-list 'sw

Debugging support for clojure?

2009-03-10 Thread Tassilo Horn
Hi all, is there any debugging support for clojure which lets one step though a function? If not, is there better way than inserting gazillions of printlns to check why and where a function doesn't do the right thing? Bye, Tassilo --~--~-~--~~~---~--~~ You recei

Re: Debugging support for clojure?

2009-03-10 Thread Tassilo Horn
Joshua writes: Hi Joshua, > The eclipse plugin also provides some debugging support. Ok, so Eclipse & IntelliJ support debugging. Does SLIME do, too? Bye, Tassilo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Debugging support for clojure?

2009-03-11 Thread Tassilo Horn
Phil Hagelberg writes: Hi Phil, >> If not, is there better way than inserting gazillions of printlns to >> check why and where a function doesn't do the right thing? > > Most definitely! Break your functions up into smaller pieces, then > write tests for them using test-is. If your functions a

Re: Debugging support for clojure?

2009-03-12 Thread Tassilo Horn
Mark Engelberg writes: Hi Mark, > On Wed, Mar 11, 2009 at 12:21 AM, Tassilo Horn wrote: > >> Investigated it a bit more (doing the algorithm step by step in the >> repl) and now I know what's the culprit:  The `expt' function from >> the math contrib l

Re: Debugging support for clojure?

2009-03-12 Thread Tassilo Horn
Jerry K writes: Hi Jerry, > Also, I've not looked at any of the math code in clojure contrib, but > expressed as such, I wouldn't expect the idiom "(mod (expt n exp) m)" > to be at all fast for reasons largely independent of the numeric > implementation underneath. Yes, you're right. And afte

Miller-Rabin pseudo-primality test (was: Debugging support for clojure?)

2009-03-12 Thread Tassilo Horn
Mark Engelberg writes: Hi Mark, >> For number theory you often need things like >> >>    (mod (expt n exp) m) > > Yes, and to make things like this fast, the trick is to perform the > mod at each multiplication step, rather than waiting until the end. So now I added this suggestion and the tes

Re: Miller-Rabin pseudo-primality test

2009-03-13 Thread Tassilo Horn
Jerry K writes: Hi Jerry, > Glad your problem is resolved. Miller-Rabin is quite zippy... and > practical for real use. If you want a next cool exercise to take a > crack at, the direction one often goes is to improve the speed of the > underlying multiplications using the FFT... I looked a

How to abort a long running operation at the SLIME REPL?

2009-03-15 Thread Tassilo Horn
Hi all, when experimenting at the SLIME REPL it often happens to me that I eval an expression which runs very long (or infinitively). This may be intended, like to prove that (some #(= 12 %) primes) will run forever (it does). The question is: How do I abort such an evaluation? Currently I do

Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
Hi, when I write a lib with this header --8<---cut here---start->8--- (ns de.tsdh.math.primes (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) --8<---cut here---end--->8--- and create a jar file

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
Meikel Brandmeyer writes: Hi Meikel, >> --8<---cut here---start->8--- >> (ns de.tsdh.math.primes >> (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) >> --8<---cut here---end--->8--- > > The obviou

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
"Stephen C. Gilardi" writes: Hi Stephen, > I don't see anything to cause that failure in what you posted. Using lists in :only part of the used libs instead of vectors made it work. (This is at the SLIME REPL.) > Could there be another ".clj" file in classpath with the classpath- > relative

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
stephaner writes: Hi Stephane, > Did you include your jar name into you classpath on your REPL starting > script? Yeah, but it seems the jar's content were broken somehow and I didn't recreate it... Bye, Tassilo --~--~-~--~~~---~--~~ You received this message

Re: How to abort a long running operation at the SLIME REPL?

2009-03-15 Thread Tassilo Horn
Raffael Cavallaro writes: Hi Raffael, > > > shows how to do this > > basically, add the following to your user.clj > > (use 'clojure.contrib.repl-utils) > (add-break-thread!) Hm, but C-c C-c only issues a SIGINT if `slime-use-

swank-clojure: swank-clojure-init-files not used

2009-03-15 Thread Tassilo Horn
Hi, I'd like that slime loads ~/.clojure/user.clj when starting the clojure REPL. Therefore I added that file to `swank-clojure-init-files'. This variable is used in `swank-clojure-cmd' to build the java invocation command line. But that didn't work. So I wanted to debug `swank-clojure-cmd' t

Re: swank-clojure: swank-clojure-init-files not used

2009-03-16 Thread Tassilo Horn
Cosmin Stejerean writes: Hi Cosmin, >> I'd like that slime loads ~/.clojure/user.clj when starting the >> clojure REPL. Therefore I added that file to >> `swank-clojure-init-files'. This variable is used in >> `swank-clojure-cmd' to build the java invocation command line. >> >> But that didn'

Re: swank-clojure: swank-clojure-init-files not used

2009-03-16 Thread Tassilo Horn
David Nolen writes: Hi David, >> When adding ~/.clojure/ to `swank-clojure-extra-classpaths' and >> starting SLIME, htop shows that this directory is not in the -cp java >> option. Sending a SIGINT kills the clojure process and doesn't >> interrupt the current Thread only... > > I've noted tha

Re: swank-clojure-extra-classpaths troubles

2009-03-16 Thread Tassilo Horn
Shawn Hoover writes: Hi Shawn, >> user> (require 'examples.introduction) >> >> I get this exception: >> >> , >> | java.io.FileNotFoundException: Could not locate \ >> | examples/introduction__init.class or \ >> | examples/introduction.clj on classpath: (NO_SOURCE_FILE:0) >> |

swank-clojure: init-files / classpath troubles solved (was: swank-clojure: swank-clojure-init-files not used)

2009-03-16 Thread Tassilo Horn
Hi all, now I've solved my "swank-clojure doesn't use my extra classpath and init files" problems. This didn't work, cause I had something like this in my .emacs: --8<---cut here---start->8--- (add-to-list 'load-path "~/repos/el/swank-clojure") (setq swank-cl

Re: swank-clojure-extra-classpaths troubles

2009-03-16 Thread Tassilo Horn
Shawn Hoover writes: > Hmm, that is a new one to me. The only other things I can think of: > >1. Inspect the value of slime-lisp-implementations (C-h v) and make >sure the java command line options look like you expect, including >the classpath directories you added and the path sepa

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Tassilo Horn
Paul Mooser writes: Hi Paul, > I've been using clojure in a similar way at work. I run a swank server > in a separate thread inside of a running application instance, and I > can connect to it remotely using SLIME. It works pretty well! I could benefit from such an approach, too. Could you e

Re: swank-clojure: swank-clojure-init-files not used

2009-03-17 Thread Tassilo Horn
"AndrewC." writes: > On Mar 16, 2:08 pm, David Nolen wrote: >> On Mon, Mar 16, 2009 at 3:42 AM, Tassilo Horn wrote: >> >> >> >> > When adding ~/.clojure/ to `swank-clojure-extra-classpaths' and starting >> > SLIME, htop shows that

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Tassilo Horn
Paul Mooser writes: Hi Paul, > It's actually fairly straightforward. In my (ordinary java) > application, I create a thread which loads a clojure program passed on > the command line (I don't have the source in front of me, but if you > need it, I can give you a hand), That would be great. >

Starting Swank from Java (was: I got to use Clojure at work today !!!)

2009-03-17 Thread Tassilo Horn
Victor Rodriguez writes: Hi Victor, > Take a look at this blog post: > http://avodonosov.blogspot.com/2008/12/simpler-clojureslime-embedding.html > > I think you will find it useful. Cool, but I had to modify it a bit to get it working: --8<---cut here---start-

Accessing java objects from SLIME using Swank (was: Starting Swank from Java)

2009-03-18 Thread Tassilo Horn
Tassilo Horn writes: >> Take a look at this blog post: >> http://avodonosov.blogspot.com/2008/12/simpler-clojureslime-embedding.html >> >> I think you will find it useful. > > Cool, but I had to modify it a bit to get it working: > > (add-classpath "

Re: Accessing java objects from SLIME using Swank

2009-03-18 Thread Tassilo Horn
Christophe Grand writes: Hi Christophe, >> Ok, so now I can start a swank server from Java and can connect to it >> using SLIME. But now comes the next problem: How do I access the >> objects of the running java app? >> >> Basically all our apps operate on a graph, and that's what I'd like >>

Re: Accessing java objects from SLIME using Swank

2009-03-18 Thread Tassilo Horn
Michael Reid writes: Hi Michael, >>     ... >>     Graph g = GraphIO.loadGraphFromFile("foo.tg"); >>     defInClojure("graph", g); >>     ... >> >> so that from inside SLIME I have a variable graph holding a reference >> to the graph g from the java app.  If possible, how would I do this? >> >

Re: Slime integration

2009-03-26 Thread Tassilo Horn
vseguip writes: Hi! > Just responding to myself, the issue seems to have been fixed by > itself. OTOH compiler errors don't popup like before. I can see them > in the *SLIME Compilation* buffer but clicking on them doesn't lead to > the source code. The faulty lines are also not highlighted in

Re: Slime integration

2009-03-26 Thread Tassilo Horn
vseguip writes: > Hi I tried your code but still no luck with errors. Then I don't know. I use ut-to-date versions of swank-clojure, clojure-mode, SLIME and clojure all from their version control systems. Maybe that makes the difference. Bye, Tassilo --~--~-~--~~~

Re: Request for improved error reporting

2009-03-29 Thread Tassilo Horn
Mark Volkmann writes: Hi Mark, >> The long list of stuff you get is called a Stack Trace. It will save >> your life someday. > > Definitely having the ability to see the full stack trace is be > useful. I wonder though if that should be the default output. Maybe by > default only lines from the

Re: Quick slime/emacs questions

2009-03-29 Thread Tassilo Horn
Mark Engelberg writes: Hi Mark, > Also, where can I look up the names of various commands to rebind to > different keys? For example, I want to remap C-s to do what C-x-C-s > currently does, and I wan to remap C-f to do what C-s currently does, > to make behavior more consistent with other pro

Re: Is oracle going to make the jvm part proprietary?

2009-05-30 Thread Tassilo Horn
Baishampayan Ghose writes: >> http://tech.slashdot.org/story/09/05/29/1711203/Java-Gets-New-Garbage-Collector-But-Only-If-You-Buy-Support?from=rss > > Who cares? There are many classy JVM implementations from third > parties like IBM. Well, at least them IBM one is proprietary. ,[ /usr/por

Re: filter on sequence

2009-06-02 Thread Tassilo Horn
Wilson MacGyver writes: Hi Wilson, > I saw that clojure has loop. But in other functional languages, using > loops are always discouraged. So I didn't know if loop was the > "clojure" idiomatic way of doing this. Clojure's `loop' (with `recur') is no "real" loop in an imperative sense. It's

Re: Are agents transaction'y in dosync?

2009-06-05 Thread Tassilo Horn
mifrai writes: Hi! > I noticed that there's a send-off in the dosync clause of ants.clj > > Does send-off hold off enqueue'ing the action when a dosync fails/ > repeats or do the actions keep getting added? send and send-off actions will only be enqueued if the transactions succeeds. Bye, Tas

Re: Clojure goes Git!

2009-06-16 Thread Tassilo Horn
Antoni Batchelli writes: Hi Antoni, > For learning Git I found "Git Magic" ( > http://www-cs-students.stanford.edu/~blynn/gitmagic/ > ) to be very helpful, and "Git Internals" ( > https://peepcode.com/products/git-internals-pdf > ) if you want to understand how it works internally. I j

Loading ImageIcons from clojure code

2009-06-19 Thread Tassilo Horn
Hi all, I did some Swing app in clojure. For some JLabels I want to provide an icon, but I cannot load them. In Java the tutorial says I would do class Foo {... new ImageIcon(getClass().getResource("image.png")); } to load the image. The "image.png" is relative to the location of the c

Re: Loading ImageIcons from clojure code

2009-06-19 Thread Tassilo Horn
pmf writes: Hi! > On Jun 19, 12:52 pm, Tassilo Horn wrote: >>   foo/bar/baz.clj >>   foo/bar/i1.png >>   foo/bar/i2.png >> >> I tried (ClassLoader/getSystemResource "i1.png"), but that looks >> somewhere in the clojure location, not my apps loc

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Tassilo Horn
Daniel Lyons writes: Hi Daniel, > In your particular case I think you might want to take a look at the > source code in the contrib project which implements a lazy list of > primes: > > http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/lazy_seqs.clj I came up wit

Clojure/EPL and the GPL

2009-08-28 Thread Tassilo Horn
Hi all, I have a licensing question. Am I allowed to include clojure.jar in a GPL project? On the net I've found out that the EPL is not GPL compliant, and there's an explicit statement by the FSF that it's not possible to include GPL code inside an EPL licensed project, or to create an EPL lic

Re: Clojure/EPL and the GPL

2009-08-28 Thread Tassilo Horn
Matthias Benkard writes: Hi Matthias, > On 28 Aug., 13:42, Tassilo Horn wrote: >> I have a licensing question. Am I allowed to include clojure.jar in a >> GPL project? > > IANAL, but if I understand the GPL correctly, it prohibits you from > distributing a GPL-covered

Re: Clojure/EPL and the GPL

2009-08-29 Thread Tassilo Horn
Meikel Brandmeyer writes: Hi! >> perhaps this link in the FAQ for the EPL will clear things up. >> >> http://www.eclipse.org/legal/eplfaq.php#USEINANOTHER > > Wow! All but one of my Clojure projects are illegal! (They are all MIT > licensed...) Yep, but I think this doesn't apply. We wouldn't

Re: Clojure/EPL and the GPL

2009-08-29 Thread Tassilo Horn
Garth Sheldon-Coulson writes: Hi Garth, > Another option Rich could consider for Clojure is the Mozilla > tri-license (GPL/LGPL/MPL). > > http://www-archive.mozilla.org/MPL/relicensing-faq.html > > The tri-license would remove any lingering ambiguity about building > GPLed Clojure projects. Wh

Re: OutOfMemoryError with loop/recur

2009-09-18 Thread Tassilo Horn
Patrik Fredriksson writes: Hi Patrick, > Could someone please help me understand why the following causes a > java.lang.OutOfMemoryError: Java heap space for large n:s (10 > works fine, 100 does not). > > (def integers (iterate inc 1)) > > (defn limited-reduce [fn coll n] > (loop [c c

Re: OutOfMemoryError with loop/recur

2009-09-21 Thread Tassilo Horn
John Harrop writes: Hi John, >> Although that doesn't really help, the normal `reduce' doesn't do >> better. >> >> (reduce + (take 100 (iterate inc 1))) ; works >> (reduce + (take 1000 (iterate inc 1))) ; OutOfMemoryError > > Are you sure? I'd expect that with > > (def integers (iterat

Re: On using GPL libs in Clojure

2009-10-10 Thread Tassilo Horn
Elliott Slaughter writes: Hi Elliotts, > Am I allowed to distribute and use unmodified copies of GPL'd libs as > jars? I've been told that dynamic linking against GPL libs in C counts > somehow as derivative work. But I don't know how valid this > interpretation is, and whether it applies to J

Re: On using GPL libs in Clojure

2009-10-11 Thread Tassilo Horn
Miron Brezuleanu writes: Hi Miron, > This thread is getting confusing. The initial question was about > GPL'ed libraries, yet the example used is clojure.jar. Isn't Clojure > licensed under the EPL? It is. The question was about licensing issues when building GPLed stuff using clojure. Bye,

Re: Newcomer's question about Clojure's compatibility with common lisp

2009-10-30 Thread Tassilo Horn
Daniel Simms writes: > On Thu, Oct 29, 2009 at 4:34 PM, Rayne wrote: >> but I would highly recommend that you just pull it from the github >> repository. > > Especially if you're going to use clojure-contrib ...or is there some > "release" of contrib synch'd to clojure releases that I missed >

Re: Syntax highlighting clojure code

2009-11-02 Thread Tassilo Horn
Timothy Pratley writes: > VIM makes this very easy > :TOhtml And for emacs, there's htmlize.el. Bye, Tassilo > On Nov 3, 10:41 am, Stefan Arentz wrote: >> I want to post some Clojure code to my blog. Does anyone know of a   >> simple, preferably online, code highlighter for Clojure or Lisp t

Re: Call for masters thesis ideas (possibly related to Clojure)

2009-12-18 Thread Tassilo Horn
ajay gopalakrishnan writes: Hi Ajay, > An idea I was interested in (more from an learning opportunity > perspective than thesis) is provided more Persistent data structures. > As of now, we have the the Array mapped Hash tree based structure that > works well for Vectors, Maps and Graphs too. I

Re: My non-ELPA Emacs swank-clojure setup

2010-04-08 Thread Tassilo Horn
On Thursday 08 April 2010 07:08:43 Phil Hagelberg wrote: Hi Phil, > Both those options sound like an awful lot of work. I'm curious as to > what advantages there are to this method over the original > installation instructions. To me, all this stuff seems to magical, for example that swank-cloj

Re: My non-ELPA Emacs swank-clojure setup

2010-04-08 Thread Tassilo Horn
On Thursday 08 April 2010 12:08:37 Pelayo Ramón wrote: Hi! > > M-x slime RET > > > > I only get this error: > > > > , > > | Clojure 1.1.0 > > | user=> java.io.FileNotFoundException: Could not locate > > swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0) > > | user=

Re: My non-ELPA Emacs swank-clojure setup

2010-04-08 Thread Tassilo Horn
On Thursday 08 April 2010 12:28:07 Alex Osborne wrote: Hi Alex, > > To me, all this stuff seems to magical, for example that > > swank-clojure downloads the required clojure/contrib jars (at least > > the comment in the el-file says so). How do I know what version it > > will fetch? How does it

Re: My non-ELPA Emacs swank-clojure setup

2010-04-08 Thread Tassilo Horn
On Thursday 08 April 2010 13:33:43 Alex Osborne wrote: Hi Alex, > > To get swank-clojure.jar I need to check out the project from github > > and use "lein jar" to generate the jar, right? Or is it possible to > > download a ready-made jar? > > You can just download it by hand from Clojars if yo

Re: Clojure Concurrency Screencast Available

2010-04-09 Thread Tassilo Horn
On Friday 09 April 2010 20:53:22 Craig Andera wrote: Hi Craig, > Feedback welcome! Is there a way to watch the videos without having to install this silverlight thingy? Bye, Tassilo -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Try + finally question

2010-04-21 Thread Tassilo Horn
On Wednesday 21 April 2010 15:06:40 ka wrote: Hi! > The macro solution looks good. But with 2 different APIs for 2 > connections, I would need to write 2 macros right? No, not really. You could also make the symbols for the API class an additional arg to the macro, like: (defmacro with-api-c

Re: Execute a string containing a form?

2010-04-22 Thread Tassilo Horn
On Thursday 22 April 2010 14:17:15 Base wrote: Hi! > say i have a string that contains a form: > > "(+ 1 1)" > > I want to actually execute this. How do you do this? I thought that > eval would be able to handle this but apparently am misunderstanding > what eval does. `eval' evals a form, s

Re: Help with error...

2010-05-05 Thread Tassilo Horn
On Wednesday 05 May 2010 04:34:04 venkat wrote: > when i use this on single values, it works, but doesnt if i try to use > it over a lazy sequence > > user> (take 3 (mulseq (iterate inc 5))) > ; Evaluation aborted. > > clojure.lang.Cons cannot be cast to java.lang.Character > [Thrown class jav

Re: autoloading code at repl startup

2010-05-11 Thread Tassilo Horn
On Tuesday 11 May 2010 10:43:00 Lauri Pesonen wrote: > How do people autoload code in their repl at startup? > [...] > > I know I can use user.clj on my classpath to do this, but then I need > to copy that file to each clojure project that I have. I think ~/.clojure/user.clj is evaluated on each

Re: Making things go faster

2013-06-05 Thread Tassilo Horn
David Pollak writes: Hi David, > * Is there a faster cycle than to change code, change tests and type > "lein test" to see the results? Obviously, you can run the tests from the already running REPL. FWIW, when I change something in using Emacs/nrepl.el/clojure-mode in a namespace, I do C-c

Re: 'foldcat' slower than 'mapv' even for 10,000 elements

2013-06-19 Thread Tassilo Horn
"Jim - FooBar();" writes: Hi Jim, > I'm finding that (r/foldcat (r/map f coll)) is consistently slower > than a simple mapv, even for a collection of 10,000 elements and more! I might be wrong, but I think reducers are only faster in situations where you bash many filters/maps/mapcats/etc on to

Re: Anybody has tried to (re)write re-match in core.logic?

2013-07-04 Thread Tassilo Horn
Adam Saleh writes: Hi Adam, > 3) (re-match expression string) is a relation Well, for a given string there are infinitely many regexps that match it. And the other way round, for many regexps there are also infinitely many strings. Not sure if core.logic can do relations between infinite sets

Re: core.async JAR

2013-07-04 Thread Tassilo Horn
pmf writes: > Is there a prebuilt binary JAR of core.async available somewhere? I > did not find it on Clojars. Clone the git repository and do a "lein jar" in there. Bye, Tassilo -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: lazy-seq with meta

2013-07-14 Thread Tassilo Horn
Karsten Schmidt writes: > Sinc the prefix map is built iteratively as part of the parsing I was > hoping to attach it as meta data to the returned lazy-seq, since I > can't see any other way of returning this map apart from attaching to > every single triple in the seq (which seems like overkill)

Re: error (init-db)

2013-07-15 Thread Tassilo Horn
jayvandal writes: > CompilerException java.lang.RuntimeException: Unable to resolve symbol: > init-db > in this context, compiling:(NO_SOURCE_PATH:1) > This is the db.clg file > === > (ns jimsweb.models.db > (:require [clojure.java.jdbc :as sql])) According

Re: cljs.core.async: Uncaught ReferenceError: state_machine__5113__auto____$1 is not defined

2013-07-16 Thread Tassilo Horn
Mike Longworth writes: > I'm trying to use cljs.core.async to convert async code to > synchronous, I've hit a problem chaining some calls. I'm getting a > runtime state machine problem, here is a test case for the issue: Since the go macro transforms its body, you cannot have function defs using

Re: Calling Clojure from Emacs Lisp

2013-07-18 Thread Tassilo Horn
JvJ writes: > I'd like to be able to define some custom emacs commands that send > clojure code strings to a running repl, and to which I could attach > key bindings. Does anyone know an easy way to do this? Well, I guess that should be fairly straightforward using nrepl.el. ,[ C-h f nrepl

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
Alice writes: > (defmacro foo > [c] > `( > (let [c (chan)] > (go (prn (foo c))) > (>!! c :hi)) > > I thought this would not work because foo is expanded after go is expanded, > so What am I missing? `go` explicitly macroexpands the form given to it rather than relying on the standard o

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
Alice writes: > I didn't know that macros can do that! Then you might want to have a look at `macroexpand-1` and `macroexpand` from clojure.core and `mexpand-1`, `mexpand`, and `mexpand-all` from clojure.tools.macro. Bye, Tassilo -- -- You received this message because you are subscribed to

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
cursive calls in the "execute as test" case. Bye, Tassilo > On Monday, August 5, 2013 8:52:56 PM UTC+9, Tassilo Horn wrote: >> >> Alice > writes: >> >> > I didn't know that macros can do that! >> >> Then you might want to have a look at

Re: [Proposal] Simplified 'ns' declaration

2013-08-05 Thread Tassilo Horn
Mark Engelberg writes: >> 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 >> basically exactly the same as why :use shouldn't be used, so I wont >> explain it further. > > Well, Clojure is hosted on Java and cle

Re: [Proposal] Simplified 'ns' declaration

2013-08-06 Thread Tassilo Horn
Sean Corfield writes: > Deprecating (not removing) :use from ns seems reasonable but I really > don't see any value in a new unified syntax - esp. since it would have > to support the legacy syntax for several releases alongside (and then > you'd have to consider whether mixed syntax should be su

Re: Wrong documentation of contains?

2013-08-07 Thread Tassilo Horn
Marcus Lindner writes: > But the problem is, that this is not mentioned in the documentation of > contains? I found so far :(. Well, it kind of is: Only associative data structures (maps, sets, records, vectors) have keys, lists and seqs (such as APersistentMap$KeySeq) don't. I guess the confus

Re: Wrong documentation of contains?

2013-08-07 Thread Tassilo Horn
Jay Fields writes: > For a list, it seems like converting the list to a vectoc (via vec) > would be a reasonable solution, though I'm sure there's some side > effect that I haven't considered. Perf would be impacted, but this > doesn't seem like the kind of thing you'd want to do anyway, so havin

Re: IDE feature

2013-08-08 Thread Tassilo Horn
Mark Engelberg writes: > I've tried paredit several times and dislike it. I found that while > editing the code, I spent a lot of mental energy trying to figure out > how to edit the code within the constraints of the > structure-preserving transformation key combos, which took away from > my ab

Re: IDE feature

2013-08-08 Thread Tassilo Horn
"Meikel Brandmeyer (kotarak)" writes: >> now I don't know how people can edit Lisp without it. >> > Quite simple: You type an (, you type some more code, you type ). Easy > as that. Writing is easy. IMO, paredit (or structural editing in general) shines when refactoring code. > Can we stop th

Re: stringify the name of an interned function

2013-08-28 Thread Tassilo Horn
erebus.m...@gmail.com writes: > What am I missing here? Functions don't really have names. A function may be bound to a var, and that has a name (:name metadata, to be precise). That said, since function's get compiled to classes you could twiddle with the class name. user> (defn fnname [f]

Re: stringify the name of an interned function

2013-08-29 Thread Tassilo Horn
Erebus Mons writes: > I am reading in a csv-file, and then transform the attributes into a > hash-map: > > __ > name,property1,property2,etc > John,drunk,stinks,etc. > etc. > __

Re: Satisfies? seems strangely slow

2015-01-22 Thread Tassilo Horn
Ghadi Shayban writes: > I don't think satisfies? is worth optimizing as using ton of it seems > antithetical to protocols. It signals to me that a caller does in fact > care about the implementation, whereas protocols are about not > caring. Like your PR, if you want to ensure a protocol's covera

Re: Satisfies? seems strangely slow

2015-01-23 Thread Tassilo Horn
phillip.l...@newcastle.ac.uk (Phillip Lord) writes: >> I use satisfies? for optional features, e.g., if some data structure >> satisfies some protocol, then that optional feature is enabled, else >> it's disabled. But that's not really on a hot path so I don't care >> much about satisfies? perfor

Re: Satisfies? seems strangely slow

2015-01-24 Thread Tassilo Horn
Fluid Dynamics writes: Hi! > One approach is to have a first-class-edges? method in the mother > graph protocol. Another is to have such a method in IEdges and extend > that to Object with first-class-edges? returning false and the other > IEdges-specific methods throwing IllegalStateExceptions

Re: Lucky Numbers again

2015-02-18 Thread Tassilo Horn
Cecil Westerhof writes: > One problem is that max-value is used in the doc-string also, so if it > changes, it has to be done at two places. Is there a way around this? I wouldn't specify a max-value at all. Some users might have enough time to wait for the result, have faster machines, might u

Re: Using type to change the behaviour of a function

2015-02-19 Thread Tassilo Horn
Cecil Westerhof writes: Hi! > At the moment the following: > (lucky-numbers 1001) > gives: > AssertionError Assert failed: (<= upto (* 10 1000 1000)) user/lucky-numbers > > But I would like the following to be executed: > (lucky-numbers :no-max-check 1001) > > ​How would I implement that

Re: Using type to change the behaviour of a function

2015-02-19 Thread Tassilo Horn
Fluid Dynamics writes: > (defn lucky-numbers > ([upto] > (lucky-numbers false upto)) > ([no-max-check upto] > {:pre [(if no-max-check true (<= upto (* 10 1000 1000)))]} > ;; code as before > )) > > > Why not (or no-max-check (<= upto (* 10 1000 1000)))? Becaus

[ANN] lein-html5-docs-3.0.0

2015-03-02 Thread Tassilo Horn
Hi all, I've just pushed version 3.0.0 to Clojars. lein-html5-docs is a Leiningen plugin to generate API docs for Clojure projects. The docs are valid HTML5, and they have a simple JavaScript-based search facility. With version 3.0.0, lein-html5-docs now also supports generating docsets for use

Re: [ANN] lein-html5-docs-3.0.0

2015-03-02 Thread Tassilo Horn
Colin Yates writes: Hi Colin and Jeremy, > And an example of its output would be nice :). Here's an example: http://userpages.uni-koblenz.de/~horn/funnyqt-docs/ > The project is https://github.com/tsdh/lein-html5-docs I think. Yes, that's it. > On 2 March 2015 at 20:49, Jeremy Heiler wrote:

Re: Newify java class dynamically

2015-03-09 Thread Tassilo Horn
"Juvenn Woo" writes: > I am writing a function that'll take a java class name as an arg, > wherein I'll make instance of the class. Several approaches did I try: > > (let [klass Integer] (new klass 42)) ; this raises exception "unable to > resolve > symbol: klass" > > (let [klass Integer] (.new

Re: Project fails to compile on different machines

2015-03-11 Thread Tassilo Horn
Aaron France writes: > Here is output compiling on the different machines: > https://gist.github.com/AeroNotix/70a2d10bbb050aa0542a What does your Makefile look like? Does it just call "lein uberjar" or what? I think it's strange that even on the machine where it builds successfully every name

Re: Project fails to compile on different machines

2015-03-11 Thread Tassilo Horn
Aaron France writes: Hi Aaron, > The makefile calls compile then uberjar, which is why things are > compiled twice, so it seems my problem lies *just* with uberjar. So why do you compile and then let uberjar compile again? And there's also no need to call the deps target explicitly. Leiningen

Re: How do I upgrade nREPL?

2015-03-29 Thread Tassilo Horn
Shannon Severance writes: > I would like to upgrade nREPL, but it appears I am still using version > 0.2.6. Yes, that's the version Leiningen depends on, so I think we all have to wait until the next Leiningen upgrade to satisfy CIDER. Bye, Tassilo -- You received this message because you are

Re: clojure, not the go to for data science

2015-03-30 Thread Tassilo Horn
Fluid Dynamics writes: > * i don't have to learn and use a distinct, possibly > resource-hungry, IDE[2] for every new programming language or > environment i need/want to work in. (When the Swift language was > released, for example, basic Swift support in the form of > `swift

Re: clojure, not the go to for data science

2015-03-30 Thread Tassilo Horn
Fluid Dynamics writes: > You can have as many of them open as you like, say, one for > "task X", and one for "switching focus between windows". > > And then have what, two 27x24 and a 26x24 keyhole to squint through at > everything? :) Less a couple of lines at the bottom for status > no

Transducers: sequence versus eduction

2015-04-01 Thread Tassilo Horn
Hi all, I've switched many nested filter/map/mapcat applications in my code to using transducers. That brought a moderate speedup in certain cases and the deeper the nesting has been before, the clearer the transducers code is in comparison, so yay! :-) However, I'm still quite unsure about the

Re: Transducers: sequence versus eduction

2015-04-01 Thread Tassilo Horn
vve...@gmail.com writes: > Eduction retains the ability to be recomposed with other transducers > higher in the function chain. The following two are nearly equivalent: > > (transduce (take 1e2) + (eduction (filter odd?) (range))) > (transduce (comp (filter odd?) (take 1e2)) + (range)) > > This wi

Re: Transducers: sequence versus eduction

2015-04-01 Thread Tassilo Horn
Alex Miller writes: Hi Alex, > - Eduction is no longer Seqable and thus the return from eduction is not > seqable (but it is reducible and iterable). You can use iterator-seq to get a > chunked seq over the top if you need one. Really? user> *clojure-version* {:major 1, :minor 7, :incremental

Re: Transducers: sequence versus eduction

2015-04-01 Thread Tassilo Horn
Alex Miller writes: > > seqable (but it is reducible and iterable). You can use > > iterator-seq to get a chunked seq over the top if you need one. > > Really? > > user> *clojure-version* > {:major 1, :minor 7, :incremental 0, :qualifier "alpha6"} > user> (seq (eduction (m

Re: Transducers: sequence versus eduction

2015-04-02 Thread Tassilo Horn
Alex Miller writes: > Ok. But to me, if I can call `seq` on a thing and iterate it using > `first` and `rest`, that's a sequable thing to me. :-) > > Fair enough. I just meant it no longer implements Seqable. :) Yes, I got that. But I think that's an implementation detail. I go with t

Re: Transducers: sequence versus eduction

2015-04-02 Thread Tassilo Horn
Alex Miller writes: Hi Alex, > If you're going to use expanding transformations and not realize all of the > results then I think sequences are likely a better choice for you. Ok, I see. >> However, at least I had expected that in the case where all elements >> are realized the transducer vers

Re: Transducers: sequence versus eduction

2015-04-02 Thread Tassilo Horn
Alex Miller writes: Hi Alex, > Just for fun, I ran the (dorun (sequence (comp (mapcat #(range %)) > (mapcat # (range %))) (range 1000))) and eduction version with the > CLJ-1515 patch. I saw ~ 20 seconds before and 15 seconds after. > > But the new version also makes pure seqs better and I saw t

Re: Generating .clj files with content

2015-04-08 Thread Tassilo Horn
Sven Richter writes: Hi Sven, > I want to create clojure source files with some code and a namespace > and everything else what is useful for some source code. What I am > looking for is a templating language for clojure code, is there > something like this already? The templating language for

  1   2   3   4   5   6   >