Re: core.async consumer + producer working by chunk?

2018-01-05 Thread Moritz Ulrich
Rob Nikander writes: > Thanks for the explanation! This is very close to what I want. I see some > confusing behavior though. See below. > > On Friday, January 5, 2018 at 2:40:14 PM UTC-5, Brian J. Rubinton wrote: >> >> >> The work-queue channel has a fixed buffer size of 1. A collection (range

Re: [core.spec] Stricter map validations?

2017-10-04 Thread Moritz Ulrich
Yuri Govorushchenko writes: > Thank you the pointers! So far I ended up with writing a small `map` macro > which is similar to `s/keys` but checks that keys are already in the > registry: > https://gist.github.com/metametadata/5f600e20e0e9b0ce6bce146c6db429e2 Note that you can simply combine

Re: Generate a million file from a template

2016-08-23 Thread Moritz Ulrich
Abhinav Gogna writes: > (defn run-in-parallel > "run-in-parallel runs 500 different threads. > you can give each thread number of files you want to generate > Eg: run-in-parallel 100 will generate 500*100 = 5 files" > [y] > (dotimes [_ 500] > (future > (.start (Thread. (run-me y

Re: Filtering lazy sequence on itself - Eratosthenes Sieve

2015-11-05 Thread Matthew Ulrich
range-peek > (filter (partial prime? primes)) > first)] > (cons p (lazy-seq (sieve (conj primes p))) > > (last (take 1 (sieve))) > > This version keeps the visited primes in a vector so it will grow in > memory but won’t overfl

Filtering lazy sequence on itself - Eratosthenes Sieve

2015-11-04 Thread Matthew Ulrich
All - I'm trying to generate a lazy sequence of primes using Erastosthenes Sieve (from Abelson & Sussman) and am encountering some issues with lazy sequence. Here's what I have: --- (defn divisible? [input numerator] (= 0 (mod input numerator))) (defn sieve [stream] (lazy-seq (con

Re: code-rewriting "with-connection" macro (monger and maybe beyond?)

2015-04-12 Thread Moritz Ulrich
Also keep in mind that a dynamically-bound variable is global state, even if it's unbound by default. You might want to keep your library as simple and possible and just pass it as the first argument. That also greatly simplifies usage with Stuartsierra's component design. A `with-connection' mac

Re: Conditional dependency question

2015-03-06 Thread Moritz Ulrich
You need to use `ns-resolve' to resolve the actual vars you want to use. Here's a snippet from one of our projects which shows the approach: ```clojure (defn ws-repl [] (require 'cemerick.piggieback 'weasel.repl.websocket) (let [cljs-repl (ns-resolve 'cemerick.piggieback 'cljs-repl

Re: Serving files from outside a ring uberjar

2015-02-10 Thread Moritz Ulrich
See https://github.com/ring-clojure/ring/wiki/Static-Resources You should be able to pass '.' signifying the directory your application was started in (that might NOT be the same place as the jar). viper110110 writes: > I would like to be able to serve up files from a folder after the jar has

Re: Help: Instantiating a known record from an unknown namespace

2015-01-24 Thread Moritz Ulrich
Fluid Dynamics writes: > On Saturday, January 24, 2015 at 1:43:15 PM UTC-5, Elric Erkose wrote: >> >> Hello, >> >> I have an app which specifies a protocol and a record name. At runtime, it >> searches the classpath for files implementing the specification and creates >> a map of namespace to i

Re: [ClojureScript] ANN: ClojureScript 0.0-2719, JavaScript Dependencies

2015-01-24 Thread Moritz Ulrich
David Nolen writes: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > README and source code: https://github.com/clojure/clojurescript > > New release version: 0.0-2719 > > Leiningen dependency information: > > [org.clojure/clojurescript "0.0-2719"] > > ClojureScrip

java.lang.OutOfMemoryError: PermGen space

2014-12-17 Thread Moritz Ulrich
Hello, I'm getting the following error while working on a Clojure(Script) REPL on a middle-sized project after some time. None of my colleagues seem to be able to reproduce it. I'm not able to reproduce it on other projects either. Caused by: java.lang.OutOfMemoryError: PermGen space, compiling

Re: Core.logic for boardgames

2014-08-11 Thread Moritz Ulrich
gt;> >> > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your >

Re: lazy list comprehension

2014-06-27 Thread Moritz Ulrich
Use map. for produces permutations. Am 27.06.2014 17:02 schrieb "Glen Rubin" : > I have a list that I want to combine in some way with an incremented list, > so I was trying to write a for expression like this: > > (for [i '(my-list-of-crap), j (iterate inc 0)] (str i j)) > > > The problem with th

Re: Search seqs in seqs

2014-06-08 Thread Ulrich Küttler
>>> more)))] >>> (or (step coll) ( >>> >>> => (partition-by-seq [:b :c] []) >>> >>> () >>> >>> => (partition-by-seq [:b :c] [:a :d]) >>> >>> ((:a :d)) >>> >>> => (partiti

Search seqs in seqs

2014-06-03 Thread Ulrich Küttler
Hi, what is the preferred way to find sub-seqs in a seq? I am trying to convert [:a :b :c :d :a :b :c :d :a :b :c] into ((:a) (:b :c) (:a :d) (:b :c) (:a)) using the sub-seq (:b :c) instead of positions. partition, partition-by and the like all look at one element at a time. What I need is a

Re: [ClojureScript] ANN: Om 0.6.1, moving towards independently addressable components

2014-04-26 Thread Moritz Ulrich
Could it be that 0.6.1 doesn't trigger a re-render of a component when just `:opts' has changed? I have a parent component with passes a boolean (`:selected?') down to it's children in the `:opts'-map. The parent-component's `render' is called, but the children's isn't anymore. I understand that t

Re: Why can I not parse the command line arguments in this way

2014-04-22 Thread Moritz Ulrich
This snippet is wholly incomplete. Can you please provide a more complete, testable example as well as a detailed description of the error you're seeing? On Tue, Apr 22, 2014 at 4:48 PM, Cecil Westerhof wrote: > Obvious not very neat, but I tried as a first hack to do something with the > command

Re: Idiomatic Clojure for iterating all items of a map

2014-04-21 Thread Moritz Ulrich
Really depends on that you want. First thing coming to my mind is: (for [l (:langs langs) [k v] l] (str k " " v)) This will give you a flat lazy list of strings. On Mon, Apr 21, 2014 at 5:32 PM, Hussein B. wrote: > Hi, > > For a data structure such as: > > (def langs {:langs [ {:lang "C

Re: [ANN] iroh 0.1.9 - class reflection and exploration

2014-04-13 Thread Moritz Ulrich
A simple repl-targeted library to introspect classes might prove useful, but is there any reason to use such a short syntax for everything? I'll surely have problems remembering the symbols. On Fri, Apr 11, 2014 at 5:57 AM, zcaudate wrote: > Please use 0.1.10 update. clojure 1.6 does not load clo

Re: "true" lightweight threads on clojurescript?

2014-04-09 Thread Moritz Ulrich
What on this page would solve your problem? I just see Generators/Iterators, Array Comprehensions, lexical let and destructuring assignment. On Wed, Apr 9, 2014 at 9:39 AM, t x wrote: > I believe > https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7 > suffices. > > Howe

Re: vim-fireplace debug workflow: modifying jars

2014-03-27 Thread Moritz Ulrich
Checking out a project your project depend on, finding the right version, etc. is quite cumbersome. With Emacs/nrepl, you can just press M-. over any function to jump to the definition, even when it's inside a jar. You can also edit and reload it (via C-c C-c). I don't think you can save it, but t

Re: One more question about invoking java methods from Clojure

2014-03-26 Thread Moritz Ulrich
You are likely passing a string to the function, not a java.io.File object. On Thu, Mar 27, 2014 at 1:16 AM, Brandon Barret wrote: > > I am working on a project that requires me to get the size of a file and > access it's last date of modification. It seems like the java methods > .length and .

Re: data associated with a particular state

2014-03-25 Thread Moritz Ulrich
The data type created by defstruct isn't anything more than a map which can store the specified fields a bit more efficient than 'normal' maps. You can just `assoc' any other key-value pairs as in any other map. Also, have a look at records - I think StructMaps have been deprecated (or at least ar

Re: apply to quoted form

2014-03-21 Thread Moritz Ulrich
symbol. You start with the symbol +. The function `(ns-resolve ns sym)' will try to find a var in `ns' with the same name as `sym' and return it. In the end, you want to call the function behind the var, so you have to use `var-get' to get the value the var points to. -- Moritz Ulrich pgphkZl7qIu1U.pgp Description: PGP signature

Re: rant / cljs in cljs ? :-)

2014-03-21 Thread Moritz Ulrich
>>>> Groups "Clojure" group. >>>> To post to this group, send email to clojure@googlegroups.com >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> clojure+unsubscr...@googlegroups.com >>>> For more options, visit this group at >>>> http://groups.google.com/group/clojure?hl=en >>>> --- >>>> You received this message because you are subscribed to the Google Groups >>>> "Clojure" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to clojure+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clojure@googlegroups.com >>> Note that posts from new members are moderated - please be patient with your >>> first post. >>> To unsubscribe from this group, send email to >>> clojure+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to clojure+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. -- Moritz Ulrich pgp5NE2maqqks.pgp Description: PGP signature

Re: om component state

2014-03-20 Thread Moritz Ulrich
erformance penalty on state-changes should be negligible as long as React doesn't need to modify the DOM. -- Moritz Ulrich -- 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 N

Re: reduced

2014-03-19 Thread Moritz Ulrich
`reduced' was added in 1.5. It looks like 4clojure is using an older version. On Wed, Mar 19, 2014 at 5:44 PM, Andy Smith wrote: > Hi, > > Ive been looking at http://www.4clojure.com/problem/137 and I have a > solution : > > (fn [x b] (reduce #(let [r (quot x %2) d (mod r b)] (if (zero? r) (redu

Re: Question about importing java classes to Clojure

2014-03-11 Thread Moritz Ulrich
If so, take a look at `file-seq': http://clojuredocs.org/clojure_core/clojure.core/file-seq Passed a java.io.File pointing to a directory, it gives you a sequence of file objects in it and all its subdirectories. To get a list of all files ending in .jar in the current directory:

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Moritz Ulrich
It might actually be counter-productive to learn Common Lisp before Clojure, as Clojure is so much simpler easier to learn/understand than Common Lisp. On Mon, Mar 10, 2014 at 4:52 PM, Dennis Haupt wrote: > you can learn clojure without learning lisp first :) > > > 2014-03-10 15:41 GMT+01:00 Roel

Re: Working with big datasets, merging two ordered lists by key

2014-03-09 Thread Moritz Ulrich
I think it would be more efficient to read one of the inputs into a map for random access instead of iterating it every time. On Sun, Mar 9, 2014 at 4:48 PM, Timothy Washington wrote: > Hey Frank, > > Try opening up a repl, and running this for comprehension. > > (def user_textfile [[:id1 {:name

Re: File and Project organization questions

2014-03-08 Thread Moritz Ulrich
Another great talk about techniques used to structure bigger applications is "Clojure in the Large" by Stuart Sierra. I think it might be a bit premature if you're just getting started, but it's definitely useful: http://www.infoq.com/presentations/Clojure-Large-scale-patterns-techniques On Sat, M

Re: Latest web framework for clojure

2014-02-26 Thread Moritz Ulrich
Om is well-suited to handle the UI-part for you. It doesn't do any server communication or forces you into any particular programming style or project layout. On Thu, Feb 27, 2014 at 2:35 AM, Mark Engelberg wrote: > As far as I can tell, neither luminus nor caribou are well-suited to > building,

Re: Latest web framework for clojure

2014-02-26 Thread Moritz Ulrich
In addition to all the other message here please note, that it's very helpful to build a site with just http-kit, hiccup and compojure, which are all three independent components. This gives you the freedom to structure your application however you like without getting in your way like many framewo

Re: Image Resizer lib exception error

2014-02-25 Thread Moritz Ulrich
]core.clj:25 > compojure.core/if-method[fn]core.clj:107compojure.core/routing[fn] > core.clj:2443clojure.core/somecore.clj:107compojure.core/routing > > Does anyone have any experience with this lib and the correct way to employ > it, I'm not making much progress from the readme docs. Thanks. -- Moritz Ulrich pgpzSjHvaFY_D.pgp Description: PGP signature

Re: map semantics

2014-02-08 Thread Moritz Ulrich
On Sat, Feb 8, 2014 at 6:39 PM, Timothy Baldridge wrote: > First of all, you are right. Map with things like sets is a bit of iffy > concept. Now, most of the the time, I just don't care. If I was to increment > every value in a set I'll just do (set (map inc #{1 2 3})) and not really > care less

Re: [ANN] com.stuartsierra/frequencies "0.1.0"

2014-01-26 Thread Moritz Ulrich
On Sun, Jan 26, 2014 at 10:10 PM, Mimmo Cosenza wrote: > You could clone and deploy it yourself into clojars. The only caveat is to > give it an org.clojars. as group-id to make it clear it's not > the official one. Please don't deploy a project to the public clojars repository for such purposes.

Re: Simple Macros

2014-01-22 Thread Moritz Ulrich
ng a trivial macro to make it look a bit cleaner. It's more or less the same for `with-open'.: You could just write the (let [...] (try ... (finally ...))) yourself, but it's much easier to understand the purpose when you read `with-open'. -- Moritz Ulrich pgpZyu7NHe8M4.pgp Description: PGP signature

Re: core.async count in a channel

2014-01-21 Thread Moritz Ulrich
On Tue, Jan 21, 2014 at 9:43 AM, Aaron France wrote: > Since channels yield nil when they are devoid of items, surely this is enough > to know when the channel is empty? That's not correct. Take-Operations block on empty channels. They yield nil when they're closed. You could add a timeout to th

Re: [ClojureScript] ANN: Om, a ClojureScript binding to Facebook's React

2013-12-20 Thread Moritz Ulrich
hen following the React tutorial. I really look forward to using this library for some private and (hopefully) work-related projects in the future. Cheers! -- Moritz Ulrich pgpAxW_2KmKeQ.pgp Description: PGP signature

Re: .cljrc

2013-11-25 Thread Moritz Ulrich
Leiningen profiles in ~/.lein/profiles.clj will be merged into the current project.clj by leiningen. Also dumented in https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md On Mon, Nov 25, 2013 at 3:34 PM, Dave Tenny wrote: > With all my attention on trying to learn things about clo

Re: cloure-mode indenting (or not)

2013-10-11 Thread Moritz Ulrich
Wait, RET should probably get bound to `paredit-newline' instead of `newline-and-indent' when paredit is enabled. Try both and see which works better :-) On Sat, Oct 12, 2013 at 12:40 AM, Moritz Ulrich wrote: > On Fri, Oct 11, 2013 at 11:33 PM, n aipmoro wrote: >> I have

Re: cloure-mode indenting (or not)

2013-10-11 Thread Moritz Ulrich
On Fri, Oct 11, 2013 at 11:33 PM, n aipmoro wrote: > I have to hit the TAB key after ENTER to get indentation. I can't believe > that was intentional (famous last words). So something must've broke. Actually, the common Emacs convention is that RET (command: `newline') shouldn't indent. C-j is `n

Re: Teaching Clojure to students (how ?)

2013-10-05 Thread Moritz Ulrich
elp them much but Clojure would help them a lot > > (+ 1. 2.) → > 3. They want to learn Clojure ! ☺ > > I'd be most grateful for any help, either to complete/amend my list in 1., > or to provide ideas for 2. > > > Best Regards, > > B. > > -- -- Moritz Ulrich pgpcWyTfKFXAJ.pgp Description: PGP signature

Re: How to force clojure evaluate all commands?

2013-09-05 Thread Moritz Ulrich
The only 'implicit' laziness in Clojure comes from lazy lists. map, filter, and others are lazy. If you map over a list for side effects, don't use map, use dolist or wrap the map in a doall. On Thu, Sep 5, 2013 at 9:28 PM, Kang Tu wrote: > Hi all, > > Clojure something *automatically" removed my

Re: [ANN] bouncer 0.2.4-alpha1 [breaking changes]

2013-08-15 Thread Moritz Ulrich
b.com/leonardoborges/bouncer/blob/master/CHANGELOG.md> > for > details. > Feedback on this version and the new API is greatly appreciated. > > Cheers, > Leonardo Borges > www.leonardoborges.com > > -- -- Moritz Ulrich -- -- You received this message because you are subsc

Re: [ANN] Leiningen 2.3.0 released

2013-08-09 Thread Moritz Ulrich
e email went out. > > -Phil > > -- https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.0-standalone.jar is still AccessDenied for me. -- Moritz Ulrich -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Out of memory on spit

2013-08-07 Thread Moritz Ulrich
Just a guess: You put 500 (or so) actions to the internal agent queue and the agent isn't fast enough to keep up. The queue grows very fast and goes out of memory. On Wed, Aug 7, 2013 at 3:09 PM, Jérémie Campari wrote: > Hello ! > > I don't understand why my code raise an Out of memory except

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Moritz Ulrich
come very > cumbersome to read : > > (cascalog/?<- (cascalog/stdout) [?a ?b] (generator :> ?a ?b)) > > The same applies to SQL DSLs like korma. > > So, IMHO there are cases where (:use) simplifies things. > > -- > > Philippe Guillebert > > -- Just use

Re: In what OS do you code?

2013-06-18 Thread Moritz Ulrich
NixOS, a linux distribution built on a purely functional package manager at work and at home. Emacs with package.el and ~/.emacs.d/ in a git repository. On Fri, Jun 14, 2013 at 3:46 PM, Erlis Vidal wrote: > Hi, > > I'm a bit curious to know in what OS do you code. Do you prefer iOS, Linux, > Wind

Re: Is it good functional style to use a protocol to create a plugin point?

2013-06-05 Thread Moritz Ulrich
If you want to keep this style, why not use a simple map of function instead of reifying a protocol? Something like: (defn calc-multiply [data] ...) (defn calc-add [data] ...) (defn make-calc [] {:calc-add #'calc-add, :calc-multiply #'calc-multiply}) Looks simpler and cleaner for me. On Wed, Jun

Re: [ANN] bleach 0.0.11

2013-05-05 Thread Moritz Ulrich
It's also nice for printing on paper. Ink is expensive. On Sun, May 5, 2013 at 6:49 PM, Michał Marczyk wrote: > On 5 May 2013 15:19, Simone Mosciatti wrote: >> It is probably me being stupid, but WHY ? > > Much easier to maintain your code when you can touch it without > risking it soiling your

Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
Can you please show your implementation of the other functions? On Thu, Mar 28, 2013 at 1:11 AM, JvJ wrote: > The function i wrote below isn't working. (is-drink q) returns all drinks > (I tested it), but hates-drink, which should return all drinks that aren't > liked, doesn't return anything...

Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
Expansion: Sorry, I seem to be wrong: => (doc !=) clojure.core.logic/!= ([u v]) Disequality constraint. Ensures that u and v will never unify. u and v can be complex terms. On Thu, Mar 28, 2013 at 7:55 PM, Moritz Ulrich wrote: > I haven't played around with the new a

Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
I haven't played around with the new additions to core.logic, but it seems to me that != only works for values, not for lvars. On Thu, Mar 28, 2013 at 1:11 AM, JvJ wrote: > The function i wrote below isn't working. (is-drink q) returns all drinks > (I tested it), but hates-drink, which should re

Re: In Emacs Org mode, how to round-trip Clojure code edits?

2013-03-24 Thread Moritz Ulrich
Just a shot in the dark; try: #+BEGIN_SRC clojure (defun org-xor (a b) "Exclusive or." (if a (not b) b)) #+END_SRC On Sat, Mar 23, 2013 at 10:27 PM, Matching Socks wrote: > I've got clojure-mode and nrepl installed, but I skipped Slime. From the > org-mode s

Re: how to automatically and idiomatically add newlines to clojure code in emacs

2013-02-14 Thread Moritz Ulrich
C-u M-x indent-pp-sexp On Thu, Feb 14, 2013 at 6:06 PM, Mayank Jain wrote: > @Feng > It doesn't clean up the way John is looking to clean some code like this: > > >> (defun func1 [a b c d] (func5 (let [f (func3 c)] (func2 a b f)) (let >> [e 5] (func4 c d e > > > > > On Tue, Feb 12, 2013 at 9:

Re: Strange behavior with future

2012-12-30 Thread Moritz Ulrich
Laziness might be your problem, but that wouldn't explain (println "called") working without a deref. Can you show a bit more code around this call to `future'? On Sun, Dec 30, 2012 at 8:31 AM, Oskar Kvist wrote: > Hi! > > I'm trying to play a sound in my application, using > http://www.javazoom

Re: Clarification on setting up Clojure, Lein and Emacs on fedora

2012-12-29 Thread Moritz Ulrich
If you have a recent (24) Emacs, use M-x package-install and install clojure-mode and nrepl. nrepl is the successor-in-spirit of slime, as many people consider slime as deprecated. When you have access to leiningen 2 (strongly recommended), the whole setup simplifies to: 1) Install leiningen 2 & E

Re: The idiomatic use of keyword arguments

2012-12-16 Thread Moritz Ulrich
I think one of the main reasons we don't use keyword arguments everywhere is their verbosity. Most function names implicate the order of arguments, and many functions don't take more than two or three. It's a trade-off between how much a programmer has to remember and how much he has to code. On

Re: (iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-29 Thread Ulrich
(drop 3 (range)) ) ) ) SHOULD imho properly work in a proper clojure implementation, n'est ce pas? If it doesn't because of internal!!! representation of the involved sequences, be it chunked or something else, than this is a huge pitfall, which might be hard to

Re: (iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-28 Thread Ulrich
Now, this is a good such example, where chunking leads to behavioral error. Has the afore mentioned interface for forced single-item consumption meanwhile been created? Ulrich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: (iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-28 Thread Ulrich
Am Mittwoch, 28. November 2012 16:42:32 UTC+1 schrieb Christophe Grand: > > Hi Ulrich, > > Wow, you got me scratching my head because your code should not even work. > The problem I see with it is that your recursion has no base case. You > have to know that 2 is prime to boot

(iterate inc 2) vs (drop 2 (range)) in corecursion

2012-11-28 Thread Ulrich
a batch. While using "iterate" instead updates "primes" each step. Can someone more into clojure than me please correct and better explain internal reasons of this strange behaviour. How could one know the "batch size" of more complicated expressions? And how could &

Re: ease of use

2012-11-22 Thread Moritz Ulrich
Don't use Aquamacs. I don't know of the current state, but some time ago experienced the same stuff. It "somehow doesn't work" when using Aquamacs. I recommend Emacs.app from http://emacsformacosx.com or installation via homebrew (brew install emacs --cocoa && brew linkapps). M-x package-list-pack

Re: defpromise?

2012-11-20 Thread Moritz Ulrich
), I > don't see any reason why not... > > (defmacro defpromise [name] >`(def ~name (promise))) > > Jim How often do you need a top-level promise? Where are the advantages over the def-only example? -- Moritz Ulrich pgpFttgbpDvnz.pgp Description: PGP signature

Re: why no :>> for cond?

2012-11-08 Thread Moritz Ulrich
What should :>> do? For me, it looks awfully like the operator mess they have in Scala and Haskell. On Thu, Nov 8, 2012 at 6:55 PM, Ben Wolfson wrote: > A message in early 2010 notes that there had been some discussion of > adding support for :>> to cond, but I suppose nothing came of > that---

Re: pattern-matching in Closure?

2012-11-04 Thread Moritz Ulrich
Use core.match: https://github.com/clojure/core.match On Sun, Nov 4, 2012 at 10:09 PM, Vladimir Tsichevski wrote: > Hi gurus. > > Is it possible in Clojure to use pattern matching, like I can with Bigloo > scheme, for example: > > (match-case '(a b a) > ((?x ?x) 'foo) > ((?x ?- ?x) 'bar)) > >

Re: fastest way to remove nils

2012-10-26 Thread Moritz Ulrich
(filter (comp not nit?) [nil 2 3 nil false true 4]) -> (remove nil? [...]) On Fri, Oct 26, 2012 at 12:53 PM, kevin roth wrote: > Be careful with the (filter identity ...) which will also remove "falses" > from seqs. > (filter identity [nil 2 3 nil false true 4]) > => (2 3 true 4) > Since (identit

Re: ClojureScript dead-code elimination

2012-09-18 Thread Moritz Ulrich
js file on some CDN. This would enable caching of the biggest part of the compiled code. -- Moritz Ulrich pgpvKB8iufMw5.pgp Description: PGP signature

Re: Data Structure server (Redis in Clojure)

2012-09-18 Thread Moritz Ulrich
`clojure.core/sorted-set' and `clojure.core/sorted-set-by' http://clojuredocs.org/clojure_core/clojure.core/sorted-set -- Moritz Ulrich pgphaYjwAMe51.pgp Description: PGP signature

Re: Nested functions on #() reader

2012-09-17 Thread Moritz Ulrich
I think the most simple reason is that it's unreadable for humans. On Sun, Sep 16, 2012 at 6:16 AM, vhsmaia wrote: > Hello. I'm new here, so, not sure if those were already posted. But why is > this not used? An example would be: > #(%a %%b %%%c) would be the same as (fn [a] (fn [b] (fn [c] (a b

Re: `cljs.reader/read-string` on anonymous functions

2012-09-07 Thread Moritz Ulrich
This won't work, as ClojureScript doesn't includes a compiler in the runtime. You can't eval ClojureScript code at runtime and you can't read new anonymous functions in. On Fri, Sep 7, 2012 at 9:18 AM, Shantanu Kumar wrote: > Hello, > > Anonymous functions with #() notation (example below) expand

Re: quick question about #'

2012-09-02 Thread Moritz Ulrich
I usually store vars to functions when developing in the REPL. The practical difference is that when you redefine `foo' in the above example, calls via the `actions' map will use the "old" function as the function itself ist stored, while after redefining `bar' calls through `actions' will use the

Re: (merge) => nil

2012-08-29 Thread Moritz Ulrich
This isn't true in Clojure: http://clojure.org/lisps However, most functions treat an empty seq as nil because they call `seq' on their arguments. On Wed, Aug 29, 2012 at 6:41 PM, Joop Kiefte wrote: > An empty sequence is equal to nil. > > 2012/8/29 Ambrose Bonnaire-Sergeant : > > My guess is t

Re: `format` behavior on Clojure vs CLJS

2012-08-29 Thread Moritz Ulrich
ntanu This seems like a bug to me. It's caused by an implementation detail of ClojureScript (keywords and symbols are string starting with a specific UTF8 byte sequence). -- Moritz Ulrich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Moritz Ulrich
.Number > at who_is_logged_in.core$run_server.invoke(core.clj:27) > > I'm calling it from the command line with: > > java -jar who-is-logged-in-1.0.0-SNAPSHOT-standalone.jar 3456 > who-is-here-now > > I also tried putting the service name in quotes: > > java -jar

Re: How to get unit test failure details

2012-08-27 Thread Moritz Ulrich
This is a result of Light Table's instarepl: The test details get printed as string to *test-out*, which instarepl doesn't display. Tryclj seems to have a bug where it doesn't redirect *out* to the web-repl. Anyway, try the following in instarepl: (binding [*test-out* *out*] (run-tests)) Thi

Re: [ANN] nrepl.el 0.1.3 released

2012-08-21 Thread Moritz Ulrich
On Tue, Aug 21, 2012 at 10:04 PM, Tassilo Horn wrote: > - The completion only completes if there's exactly one match. If > there are multiple candidates, it simply echos them in the echo > area. Why not doing the usual emacs completion stuff with a > *Completions* buffer and comple

Re: doubt about clojure.test output

2012-08-18 Thread Moritz Ulrich
Is one of the asserts in some kind of loop or recursion? On Sat, Aug 18, 2012 at 2:49 PM, Vincent wrote: > Dear , > > I am using clojure.test for test > > in one 'deftest , i had used 3 'is function to assert > and in another 'deftest , i had used 5 'is function to assert > > It ran all tes

Re: clojure.logic project.clj file

2012-08-15 Thread Moritz Ulrich
I'd vote against removing too. It's just too helpful to be able to fire up a quick lein/swank repl to quickly try something. On Thu, Aug 16, 2012 at 12:35 AM, Alan Malloy wrote: > Blech. I've found having the project.clj helpful myself for the same reason > David has: it's easy to start up lein (

Re: A clojurescript newbie q.

2012-08-12 Thread Moritz Ulrich
Take a look at the javascript console. Most likely the `prinln' generates an error because *print-fn* isn't bound. It's not usual to use println on the client side. Logging to console is done via (.log js/console obj1 obj2 ...) On Sun, Aug 12, 2012 at 10:01 AM, mmwaikar wrote: > Hi, > > I am expe

core.logic: (run* [q] (membero :x #{:x})) -> ()

2012-08-11 Thread Moritz Ulrich
ms strange. -- Moritz Ulrich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe f

Re: Writing code to get the source of a function

2012-08-08 Thread Moritz Ulrich
The source function only works for function where the .clj where the function is defined is in the classpath. If you have control over all functions, I'd suggest using https://github.com/technomancy/serializable-fn when defining them. On Wed, Aug 8, 2012 at 11:19 AM, Samuel Lê wrote: > Dear all,

Re: why would this fail in core.logic?

2012-08-07 Thread Moritz Ulrich
You can. Using core logic 0.8 alpha thanks to the newly introduced cKanren extensions. It's mentioned in the (or another, I'm not sure at the moment) video. Am 07.08.2012 12:20 schrieb "Jim - FooBar();" : > On 07/08/12 04:07, David Nolen wrote: > >> You have to be careful when using Clojure or Jav

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Moritz Ulrich
(some identity ((juxt :k1 :k2) m)) is the first thing I can think of. On Tue, Jul 31, 2012 at 12:48 AM, Michael Gardner wrote: > Is there an elegant way to say '(or (:k1 m) (:k2 m)), without repeating m? > Using a let can be awkward if the expression isn't already wrapped in one; > '(apply #(or

Re:

2012-07-29 Thread Moritz Ulrich
Also, take a look at `partition'. On Sun, Jul 29, 2012 at 3:19 PM, Mark Rathwell wrote: > In your has22 definition, (by-pairs [a]) should be (by-pairs a) > > On Sun, Jul 29, 2012 at 9:07 AM, John Holland wrote: >> I'm doing some exercises in coding that are meant for Java but I'm doing >> them i

Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)

2012-07-27 Thread Moritz Ulrich
On Fri, Jul 27, 2012 at 9:37 PM, Vinzent wrote: > Unfortunately, I can't access your site: http://kodefund.com/ gives me "The > domain name you have requested isn't available". Looks like your DNS server hasn't received the updated record yet. Works fine on Google DNS. -- You received this mess

Re: How-to construct for example (.value record) with a macro

2012-07-16 Thread Moritz Ulrich
Simply use the alternative dot-form: (. (java.util.Date.) getDate) (. record value) On Mon, Jul 16, 2012 at 9:42 PM, john wrote: > Hello, > I have for example: > > (defrecord record [^long value]) > > (def aRecord (record. 123)) > > ; Now I want to construct code like (.value aRecord) > ; with a

Re: newer versions

2012-07-15 Thread Moritz Ulrich
You can't unless there's a maven release for that specific branch. There is a leiningen feature called 'checkouts' which might be used for the kind of functionality you want. On Sun, Jul 15, 2012 at 4:58 PM, cej38 wrote: > I know that this might be more of a question for elsewhere, but I have be

Re: newbie question about the difference of proxy [Runnable] and fn

2012-07-06 Thread Moritz Ulrich
On Fri, Jul 6, 2012 at 5:22 PM, grahamke wrote: > (.start (Thread. (println "I ran!") "tName")) You're missing a # here. You create a new thread object passing two args to the Thread constructor: The return value of (println ...) and "tName". println returns nil, so you effectively do (Thread. ni

Re: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath:

2012-06-24 Thread Moritz Ulrich
tring and i'm currently using clojure 1.3... > Basiclly i need the fuctionalty of . String as split, and such... > > On 25 בJun 2012 00:53, "Moritz Ulrich" wrote: >> >> >> omer writes: >> >> > hi i need help!!! >> > i have a pr

Re:Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath:

2012-06-24 Thread Moritz Ulrich
the namespace clojure.data.string. May I ask you if and what libraries you try to use? You might need to update to newer versions if one of these use clojure.contrib, as it isn't supported with 1.4 anymore. -- Moritz Ulrich -- You received this message because you are subscribed to the G

Re:struggling with two simple list of lists operations

2012-06-24 Thread Moritz Ulrich
] (let [[a b] (last lst)] (if b (concat lst (list (list x))) (concat (butlast lst) (list (list a x)) --8<---cut here---end--->8--- You could use zippers here, but it would propably be slower. Cheers, Moritz -- Moritz Ulrich -- You received this

Re: A tutorial for how to setup your clojure development environment for: Emacs, Leiningen and Linux.

2012-06-23 Thread Moritz Ulrich
Because emacs is traditionally THE editor for lispy programming languages and is so versatile. Of course there are other IDEs out there and you should try a few, but Emacs is easily the most common tool when programming lisp and therefore has the biggest variety of helpers available. -- Sent from

Re: error in clojurescript compilation

2012-06-23 Thread Moritz Ulrich
e that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Moritz Ulrich -- Y

Re: One little question about vectors and nth?

2012-06-23 Thread Moritz Ulrich
embers are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Moritz Ulrich -- You received this mess

Re: memoization of an no-arg fn that returns a map?makes sense?

2012-06-19 Thread Moritz Ulrich
as >>> well? >>> >>> Jim >> >> > > -- > 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 m

Re: [leiningen2] problem with com.intellie/lazytest, swank-clojure and leiningen2

2012-06-16 Thread Moritz Ulrich
gt; > Author: Antoine R. Dumont > > Org version 7.8.09 with Emacs version 24 > > Validate XHTML 1.0 > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegrou

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Moritz Ulrich
That's strange. You usually just run lein swank in the folder with you project.clj. Nothing to do wrong there. Can you show the project.clj and the directory structure of a non-working project? -- Sent from my mobile Am 16.06.2012 01:07 schrieb "Dave Kincaid" : > I'm with you, Peter. The proble

Re: clj-pdf for declarative PDF generation (status update)

2012-06-10 Thread Moritz Ulrich
To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at &g

  1   2   3   >