Re: Clojure 1.9.0-alpha10: Semantic mismatch: any? vs not-any?

2016-07-13 Thread Tassilo Horn
Alex Miller writes: Hi Alex, > Well, there are only so many words. Of course, but I also think that any? is absolutely certain to be confused with some counterpart to every?. > As it happens any? is best name for this function. What about "anything?". To me (as a non-native speaker) that so

Re: vector of chars vs string

2016-05-27 Thread Tassilo Horn
Camilo Roca writes: Hi Camilo, > Everything is ok with that. The next one on the other hand is what > puzzles me: > (identical? \f (first (str "f" "oo"))) > ;;=> true > > If what I guess is right, the amount of chars that exist are finite, > thus Clojure treats them like a "pool of charts". The

Re: Where I can learn this?

2015-10-14 Thread Tassilo Horn
Erlis Vidal writes: > - html completion That typing a < inserts the closing > immediately is probably `electric-pair-mode'. That script expands to could be yasnippet. > - refactoring (rename, move to function) > - adding dependencies and automatic project.clj modificaiton That's all courtesy

Re: Timbre corrupting EDN via prn-str

2015-10-07 Thread Tassilo Horn
Ken Restivo writes: > Only when conch is called, is this error generated. Not shelling out > makes the problem go away. So it's an interaction between pr-str, > conch and/or clojure.java.shell, and Timbre-- all three of which are > manipulating *out* which I'm guessing is not thread-safe. You ca

Re: Sonatype issue with Maven central artifacts

2015-09-18 Thread Tassilo Horn
Alex Miller writes: > FYI, Sonatype had a staging server issue that has affected their CDN - some > Clojure artifacts (notably Clojure 1.8.0-alpha5) are currently unavailable. > They are working on addressing the issue and have prioritized getting that > one back online. Works again! Bye, Ta

Re: apply, mapply, recur, looking for insights

2015-08-13 Thread Tassilo Horn
Dave Tenny writes: Hi Dave, > At issue (for me), keyword arguments and maps that bundle them. > > user> (defn foo [a b & {:keys [c d]}] > [a b c d]) > #'user/foo > user> (defn bar [a b & {:keys [c d] :as options}] > (println (apply foo a b options))) > #'user/bar > user> (bar 1 2

Re: Function syntax

2015-08-13 Thread Tassilo Horn
Amith George writes: >> That's not the same function as #(last (sort %&)) >> The equivalent would be (comp last sort vec) > > Could you please explain why is the `vec` needed? From what I > understand, we are expected to treat the variadic args argument as a > seq, nothing more. With ((comp las

Re: core.logic: Help with insertion sort

2015-08-02 Thread Tassilo Horn
Nicolás Berger writes: Hi Nicolás, >> I've simplified the code a bit so that I don't need the `cconso` > >> relation. > > That's great. It's easier to understand this way. To simplify a tiny > bit more, the `nf` lvar can also be removed: it's unified with `f`, so > f can be used instead of nf in

Re: core.logic: Help with insertion sort

2015-07-30 Thread Tassilo Horn
Nicolás Berger writes: Hi Nicolás, > Sounds interesting :). I hope I get some time to take a look into it > soon. I appreciate your feedback! > In the meantime, have you tried playing with the log and trace > "goals"? I mean log, trace-s and trace-lvar. They might be of help > in trying to d

core.logic: Help with insertion sort

2015-07-29 Thread Tassilo Horn
Hi all, I've just implemented insertion sort with core.logic: --8<---cut here---start->8--- (declare inserto) (defn isorto "A relation where sl is a sorted version of the list l." ([l sl] (isorto l () sl)) ([l acc sl] (conde [(== l ()) (== acc s

Re: [ANN] clj-refactor.el 1.1.0 is released

2015-07-07 Thread Tassilo Horn
Magnar Sveen writes: > Hi Tassilo. Please report this issue on our tracker! > https://github.com/clojure-emacs/clj-refactor.el/issue Done so: https://github.com/clojure-emacs/clj-refactor.el/issues/184 Bye, Tassilo -- You received this message because you are subscribed to the Google Groups "

Re: [ANN] clj-refactor.el 1.1.0 is released

2015-07-07 Thread Tassilo Horn
Magnar Sveen writes: Hi Magnar, > Since the last announcement of clj-refactor in this group, there's been a > flurry of activity. I've just started using it. Especially being able to rename locals and clean up namespace declarations is awesome so thanks for the great work! I've sometimes enc

Re: Boot: How to run with the clojure version declared in the :dependencies?

2015-06-15 Thread Tassilo Horn
Juho Teperi writes: Hi! >> :dependencies `[[org.clojure/clojure >>~(System/getenv "BOOT_CLOJURE_VERSION")] >> ...] > > >> Apparently, that returns nil and so does System/getProperty for >> "BOOT_CLOJURE_VERSION" or "boot.clojure.version". >> > > Boot

Re: Boot: How to run with the clojure version declared in the :dependencies?

2015-06-15 Thread Tassilo Horn
Juho Teperi writes: > I have tried to describe how to set Clojure version with Boot > here: https://github.com/boot-clj/boot/wiki/Setting-Clojure-version Yes, I'm using that now, i.e., I set BOOT_CLOJURE_VERSION in boot.properties. Is there a way to access that from my build.boot so that I can

Boot: CLASSPATH troubles with javax.tools.JavaCompiler

2015-06-12 Thread Tassilo Horn
Hi all, I'm toying around with boot and try to get my leiningen config converted to it. My Clojure project uses a third-party Java library which uses a javax.tools.JavaCompiler to compile classes at runtime. By default, such a JavaCompiler compiles with the CLASSPATH which is the value of the "j

Boot: How to run with the clojure version declared in the :dependencies?

2015-06-12 Thread Tassilo Horn
Hi all, I'm toying around with boot and try to get my leiningen config converted to it. My build.boot contains --8<---cut here---start->8--- (set-env! :resource-paths #{"src" "resources"} :dependencies '[[org.clojure/clojure "1.7.0-RC1"] ...

Re: (slurp nil)

2015-06-02 Thread Tassilo Horn
Elric Erkose writes: Hi Elric, > Is it reasonable that ```(slurp nil)``` throws an Exception rather > than evaluates to nil? Yes, totally. The first argument is something from which a reader can be created, e.g., a java.io.File, a file name as String, an URL, an InputStream, etc. So to me (sl

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-28 Thread Tassilo Horn
Andy Fingerhut writes: Hi Andy, > Tassilo, the issue with flatland.ordered.set/ordered-set was that > library had never been updated to match the change in hash function > that occurred when Clojure 1.6.0 was released. > > Alan Malloy released a new version of the ordered library today that > fi

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-28 Thread Tassilo Horn
Alex Miller writes: > This a dupe of CLJ-1372. Yes, I guessed so and therefore mentioned CLJ-1372 in the description. What about the other related issue I mentioned (CLJ-1649). Also a dupe of CLJ-1372? Bye, Tassilo -- You received this message because you are subscribed to the Google Groups

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-28 Thread Tassilo Horn
Hi Alex, I've spotted another bug which I've already reported http://dev.clojure.org/jira/browse/CLJ-1739. The problem is that sets of different kinds are equal which is of course expected, e.g., (= #{1 2 3} (flatland.ordered.set/ordered-set 1 2 3)) ;=> true (= #{1 2 3} (java.util.HashSet. [

Re: Interop: mutability vs. inheritance

2015-05-27 Thread Tassilo Horn
Mars0i writes: > Is the following correct? > > The only way to define *multiple* mutable instance variables/fields > for a class visible in Java is by using deftype with :volatile-mutable > or :unsynchronized-mutable. The only way to inherit from a concrete > Java class is by using gen-class or

Re: One more argument for cyclic dependencies

2015-05-23 Thread Tassilo Horn
Mars0i writes: > Tassilo, thanks for being willing to look at the code. I appreciate > it. There's no need to look at it to solve the > delete/restore/recompile problem. (If you or anyone else still want > to look at the source for any reason, it's at > https://github.com/mars0i/majure. The l

Re: One more argument for cyclic dependencies

2015-05-22 Thread Tassilo Horn
Mars0i writes: > However, in all versions (gen-class, reify, deftype, defrecord, > proxy), I can only get maximum speed by the same awkward trick that I > used with gen-class: I remove a type hint in Student.clj, compile all > of the files, then I add back the type hint in Student.clj and > recom

Re: One more argument for cyclic dependencies

2015-05-19 Thread Tassilo Horn
Mars0i writes: > MASON simulations typically consist of > > (a) One or more "agents", which implement an interface (Steppable) > with a single method, step(). > > (b) An instance of a class that extends SimState, which contains a > scheduler that repeatedly calls step() in every agent that's re

Re: extend-type and extend-protocol: different syntax for multi-arity methods

2015-05-13 Thread Tassilo Horn
Alexey Cherkaev writes: Hi Alexey, > If you have a protocol > > (defprotocol Foo (foo [x] [x y])) > > and implement it for the record > > (defrecord Bar [p q r] > Foo > (foo [x] x) > (foo [x y] [x y])) > > you write each method separately. The same is true for extend-type. > Yet, if you u

Re: CLJ-703 - 10x compilation time decrease after applying one-line patch, no downsides.

2015-05-08 Thread Tassilo Horn
Luc Prefontaine writes: > There's a better 'fix'. > Run your builds on SSDs or on a memory based file system. "Performance problems are solved best by throwing more hardware at them." Seriously?! No, I completely agree with Bozhidar in that regular bugfix releases would be a good thing. Cloj

Re: Generating .clj files with content

2015-04-08 Thread Tassilo Horn
Sven Richter writes: Hi Sven, > What you are saying makes sense. I am always a bit shy to using macros > as I have not understood them completely yet and everytime I tried I > got distracted fast enough to not get it. Syntax-quoting has not much to do with macros except that the latter frequent

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

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

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

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

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

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: 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: 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: 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-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: about dumping defrecords

2014-11-26 Thread Tassilo Horn
records are printed like so and can be read back, but *data-readers* have no user.P entry and neither is *default-data-reader-fn* set. So I conclude #ns.Rec{keyvals} is the standard read-syntax of records. Bye, Tassilo > On Wednesday, 26 November 2014, Tassilo Horn wrote: > >>

Re: about dumping defrecords

2014-11-26 Thread Tassilo Horn
Vladimir Bokov writes: > I really like that (pr some-hash-map) dumps structure which can be > recognized by clojure reader like (def same-hash-map '..paste..here) > > Could it be achieved with defrecords? Currently (pr some-record) produced > non-recognizable by clojure reader at all. (Btw. why

Re: style question on tightly coupled functions

2014-11-20 Thread Tassilo Horn
henry w writes: > you have understood my arguments pretty much. again the thing that > bothers me is that f and g are logically part of x only, but are > visible from y and z (even if and and y are declared higher up, the > same problem applies to their own related, private fns and x). Then decl

Re: Referencing aliased namespace

2014-11-18 Thread Tassilo Horn
pmf writes: > using tc/whatever works as expected, but I have not found a way to use the > handle tc to refer to the namespace: > user=> (the-ns 'tc) > Exception No namespace: tc found clojure.core/the-ns (core.clj:3933) `ns-aliases` returns the map of aliases to namespaces of a given namespac

Re: Recursive definition in core.logic

2014-09-21 Thread Tassilo Horn
Casper writes: > For me that leads to the question, how do we then define the relationship > 'descendant' (which would be the generalisation of child, grandchild etc)? > > (defn child [x y] > (parent y x)) Ok, so you have a `child' relation already, so this should be easy (but it's not teste

Re: emacs-cider company-mode no match found

2014-09-21 Thread Tassilo Horn
Xiangtao Zhou writes: Hi Joe, > i'm pretty sure, because I also want to have company working with repl. > both cider & cider-repl not working. Hm, strange, it works just fine for me since ages. And looking in my ~/.emacs, there's no special code for making it work. I currently use those MELP

Re: emacs-cider company-mode no match found

2014-09-21 Thread Tassilo Horn
Xiangtao Zhou writes: Hi! > I have upgrade the latest emacs-cider, the document suggest me to use > company for auto completion, but it doesn't work, anyone know what > should I do. Just to be sure, you did M-x cider-jack-in RET in the Clojure project you are hacking in, right? Bye, Tassilo -

Re: What is happening in this code?

2014-08-27 Thread Tassilo Horn
Andy Fingerhut writes: Hi Andy, > FYI, if you *want* warnings about redefinition of functions, or any > vars in general, the Clojure lint tool Eastwood does that, among other > things: > > https://github.com/jonase/eastwood Nice. It really occured to me that while refactoring some working

Re: What is happening in this code?

2014-08-27 Thread Tassilo Horn
Hemant Gautam writes: Hi Hemant, > This is the code > > (ns clojure_begins_19_08_2014.core) Use hyphens instead of underscores for namespace and var names. > (defn first-fn[x] > (print x)) > > (defn first-fn[x] > (print "Value of x with String " x)) > > (first-fn 10) > > See, above code co

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread Tassilo Horn
phi...@free.fr writes: > I have read up on atoms and used swap! to set the urls2 vector atom in > my code. Thanks. > > One problem remains though: I can't retrieve the atom vector's items > > *(nth urls 10)* > > throws the following exception > > java.lang.UnsupportedOperationException: nth not su

Re: Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-08-01 Thread Tassilo Horn
Flea Wong writes: Hi! I'll take the third question first: > 3. Why the different function call "subtotal" (*without* Dot, see > Apple) vs ".subtotal" (*with* Dot, see Orange) for extend-type vs > inline implementation of Fruit? You should always use (subtotal fruit). That with an inline impl

Re: destructure command line arguments

2014-07-25 Thread Tassilo Horn
empty...@gmail.com writes: Hi! > I have a main function: > > (defn -main [& args] > (let [{:keys [graph filepath title]} args] > (cond > (= graph "response") (graph-response filepath title) > (= graph "requests") (graph-request filepath) > (= graph "throughput") (graph-throu

defprotocol's :on-interface directive

2014-07-25 Thread Tassilo Horn
Hi all, in the JIRA issue http://dev.clojure.org/jira/browse/CLJ-308?focusedCommentId=35149&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-35149 Brandon Bloom mentioned that instead of extending a protocol upon existing interfaces using `extend` (or `extend-prot

Re: casting error

2014-07-16 Thread Tassilo Horn
Brian Craft writes: Hi Brian, > The cast error, however, persists. It's something to do with reloading > the namespace with the defrecord. Ah, yes, I've had that, too, even without AOT compilation. Basically, you simply cannot reload/recompile protocols, deftypes, definterfaces, and defrecords

Re: Core.logic appendo for string?

2014-05-05 Thread Tassilo Horn
David Nolen writes: > There's no easy way to do this beyond making your own relational > string type as you've suggested. FWIW, I had the same need as Adam and the poor-man's solution below is enough for my use-case. --8<---cut here---start->8--- (defn ground

Re: find the last and the nth item without using last or nth

2014-04-30 Thread Tassilo Horn
Roelof Wobben writes: >>> For nth, you need a counter that you can increment in each recursion >>> step. For last, you return the first element of the list whose rest >>> is the empty list. >> >> Thanks, and if I use cons (item, list) then item is the value I >> want. I only have to print it. I

Re: find the last and the nth item without using last or nth

2014-04-29 Thread Tassilo Horn
Roelof Wobben writes: > Could a recurvice way or a loop do the trick. Yes. > And how do I then take the right value. For nth, you need a counter that you can increment in each recursion step. For last, you return the first element of the list whose rest is the empty list. Bye, Tassilo -- Y

Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben writes: > Chips I thought I understand it > But this does not work > > (defn divides? [divisor n] > (mod n divisor)) It seems that `divides?` should be a predicate but your definition returns a number and no boolean. A number n is divisible by some divisor if the result of `mo

Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben writes: > So if I understand everything well when I want true or false I do not > need a if. No, when the last form of your function already returns true or false, e.g., (< 12 age 20), then you don't need to wrap that in an `if` which checks if the result is true to return true, or

Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben writes: > The only thing which is failing now is this one ; > > (defn abs [x] > (< x 0) > (* x -1); > x) > > I keep getting -2 as answer where it must be 2 Well, the function contains three forms where the results of the first two are ignored and only the value of the l

Re: boolean problem

2014-04-17 Thread Tassilo Horn
Michael Gardner writes: >> And now you have an if without then which will give you another >> exception. > > Not true. It's more common to use 'when', but single-branch ifs are > perfectly fine. Yes, but that was a zero-branch if, and that's not ok. Bye, Tassilo -- You received this message b

Re: boolean problem

2014-04-17 Thread Tassilo Horn
Roelof Wobben writes: Hi Roelof, >> > I have to check if x is a nil or false and then the output must be >> > false,\ Otherwise I have to be true. >> >> Why? nil and false are already falsy, everything else is true. And >> if you have to interact with java where some method wants some "real"

Re: boolean problem

2014-04-17 Thread Tassilo Horn
Stanislas Nanchen writes: > You miss one parentheses at the end of your expression > > (defn boolean [x] > (if (and (nil? x) (false? x)) > )) And now you have an if without then which will give you another exception. And the test expression is a contradiction, i.e., it's always false. Noth

Re: where as clojure-fill-docstring gone?

2014-04-08 Thread Tassilo Horn
Colin Yates writes: Hi Colin, > I upgraded my emacs and clojure-fill-docstring seems to have > disappeared. clojure-mode is still there and activated but no > clojure-fill-docstring. > > Before I spend time hunting through changelogs has anybody else > noticed? Is this expected? I has been re

Re: every? expected behavior

2014-04-08 Thread Tassilo Horn
Jeff Mad writes: Hi Jeff, > I was surprised to find out in the REPL that every? returns true if > you pass in an empty or nil collection. > > user=> (every? #(= 77 %) nil) > true > > user=> (every? #(= 77 %) '()) > true That's correct. Every item in an empty collection satisfies the predicate

Re: java interop help for beginner calling java class

2014-03-28 Thread Tassilo Horn
"bww00amd...@yahoo.com" writes: > I have read so much i cant see the tree for the forest. and need some > help calling the ocfLZW class below from clojure. If that's really the complete class definition... > /* */ public class OcfLZW > /* */ { ... then you can't use it from Clojure be

Re: Core async / how to work around "No more than 1024 pending puts are allowed on a single channel"

2014-03-27 Thread Tassilo Horn
Hanh Huynh Huu writes: > If I replace the buffer with a dropping buffer or a sliding buffer, it > works but I can't afford to drop messages. However, I'd be fine with a > larger buffer than 1024. I also replaced the >!! with >! and > async/put!, but the result is the same. > > Is there a way to

Re: [ANN] Clojure 1.6.0-RC3

2014-03-24 Thread Tassilo Horn
Sean Johnson writes: Hi Sean, > I get the following warning when using 1.6.0-RC3 > > WARNING: record? already refers to: #'clojure.core/record? in namespace: > clojure.core.logic, being replaced by: #'clojure.core.logic/record? > > when requiring [clojure.core.logic :refer (run* membero distinc

Re: fn and let are special forms or macros?

2014-03-05 Thread Tassilo Horn
Plínio Balduino writes: Hi Plínio, > Clojure.org says fn and let are special forms, but using the macro > sourceshows that both are macros calling fn* and let* respectivelly. > > So fn and let are "special special forms", or clojure.org is > incorrect/outdated? Well, they are correct from a use

Re: Latex style file for formatting/coloring clojure code?

2014-02-18 Thread Tassilo Horn
Jean Niklas L'orange writes: >> I am unable to find a style file that supports clojure code in LaTeX. >> Can anyone point me in the right direction? > > I always use Minted for this kind of stuff: See > https://code.google.com/p/minted/ I just want to second that. Minted is excellent. The onl

Re: [ANN] Clojure 1.6.0-beta1

2014-02-14 Thread Tassilo Horn
Dom Kiva-Meyer writes: >> 5) New "some" operations >> Many conditional functions rely on logical truth (where "falsey" >> values are nil or false). Sometimes it is useful to have functions >> that rely on "not nilness" instead. These functions have been added to >> support these cases [CLJ-1343]:

Re: Should predicates always have one argument?

2014-01-31 Thread Tassilo Horn
Andy Fingerhut writes: > contains? every? extends? identical? instance? not-any? not-every? > satisfies? > > That list might not be complete. Just to add some more: =, ==, <, <=, >=, > are also predicates with more than one arg and even no question mark at the end. Bye, Tassilo -- You receive

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Tassilo Horn
Jarrod Swart writes: > The reason you can't get this to work is that r/map returns a > not a for reduce to operate on. Ah, indeed. I couldn't see the forest for the trees. > I'm not sure of a solution because I'm not familiar with > core.reducers. This works: (reduce set/intersection (r

clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Tassilo Horn
Hi all, in the following, set is clojure.set, and r is clojure.core reducers. Why is user> (reduce set/intersection (map set [[1 2] [3 1] [1 3]])) #{1} but user> (reduce set/intersection (r/map set [[1 2] [3 1] [1 3]])) ArityException Wrong number of args (0) passed to: set$int

Re: howto use reify in defmacro

2013-12-18 Thread Tassilo Horn
"Joe (Zhou Xiangtao)" writes: > that's great, thanks. I current use a function wrap reify, it's > simple. > > (defn make-reify [entity] ...) > > (defmacro def-site-entity > `(let [e# (create-e)] >(def ~ent (make-reify e# That's even better. ;-) Bye, Tassilo -- -- You received this me

Re: howto use reify in defmacro

2013-12-18 Thread Tassilo Horn
Xiangtao Zhou writes: Hi! > I want to use reify in macro, but the namespace is the problem. the > following code shows what have done. is there a way to make it right? Probably this will work: (defmacro def-site-entity [ent & body] `(let [e# (create-e)] (def ~ent (reify ~'clojure.lang

Re: error-on-reflection

2013-12-09 Thread Tassilo Horn
phillip.l...@newcastle.ac.uk (Phillip Lord) writes: > I know about *warn-on-reflection* but is there anyway that I can get > an error-on-reflection instead? I don't think so. > I've been type hinting my application (50% done and yes it goes faster > now), and it's a bit painful. What I would rea

Re: Using xlisp assoc-lists in clojure

2013-11-18 Thread Tassilo Horn
Justin Smith writes: Hi Justin & Hans-Peter, > Typically in clojure we use hash-maps (represented literally as {}) > where other lisps would use an alist. One difference between alists and maps is that in alists a "key" can occur multiple times, and then the first entry with that key shadows al

Re: Caribou: custom templates shadow _admin templates

2013-11-15 Thread Tassilo Horn
Justin Smith writes: Hi Justin, > The your own resources subdirectory is merged over the admin one, the > structure visible here: caribou admin > templates Ok, thanks for the clarification. At least login and logout seem

Caribou: custom templates shadow _admin templates

2013-11-15 Thread Tassilo Horn
Hi all, I'm just toying around with Caribou. I successfully created the models of my toy app, and now I started defining routes, pages, and templates. I started with this: --8<---cut here---start->8--- (def routes [["/":home [["login" :l

Re: Why isn't a docstring allowed for defrecord?

2013-10-31 Thread Tassilo Horn
"Jim - FooBar();" writes: > Ok my bad...for a second there I thought that a defrecord expression > returns a Var but it doesn't. It returns a Class object. You can't put > anything on that therefore 'doc' won't work on it anyway. Hm, well, the only thing a record has to document are its fields.

Re: binding and lazy seqs

2013-10-22 Thread Tassilo Horn
Brian Craft writes: Hi Brian, > I just came across this example in "Clojure Programming", chapt 4: > > (def ^:dynamic *max-value* 255) > (defn valid-value? [v] (<= v *max-value*)) > > (binding [*max-value* 500] (map valid-value? [299])) > ;= (false) > > It's not really explained in the text. I'm

Re: Macro problem: passing a function to a macro

2013-10-22 Thread Tassilo Horn
Phillip Lord writes: > Is it because you're expansion returns the symbol and not the > function. > > ('inc 2) > > returns nil which is what I think is happening. Ah, indeed. I really whished that would throw an error. I mean, it's cool that keywords can lookup themselves in maps, but I don't

Macro problem: passing a function to a macro

2013-10-22 Thread Tassilo Horn
Hi all, I'd like to have a macro that I can call and pass it some function that the macro uses inside. Concretely, the macro iterates over some class model and should expand to a ns declaration with one defn per class in the model. Currently, the macro calls a generate-defn-for-class function in

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

  1   2   3   4   5   6   >