On Fri, Aug 7, 2009 at 5:04 PM, tsuraan wrote:
>
> Most languages I've used define a zip method, where you can take two
> lists and get a list of the pairs of elements in those lists. So,
> (zip '(1 2 3) '(4 5 6)) would give ([1 4] [2 5] [3 6]). Does clojure
> have a core function like that? I
I'm just wondering what people's response would be to allow user-generated
reader macros. I'm not sure, but I think the only change to the clojure
core that would be necessary in order to do this would be that in
clojure/src/jvm/clojure/lang, LispReader.dispatchMacros would have to be
made public.
On Thu, Aug 13, 2009 at 4:59 PM, Daniel Lyons wrote:
>
> On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote:
>
> I'm just wondering what people's response would be to allow user-generated
> reader macros. I'm not sure, but I think the only change to the clojure
> core
On Fri, Aug 14, 2009 at 7:00 PM, Jonathan Smith
wrote:
>
> It would be nice if someone wrote a separate extension to clojure that
> (reads in a text file and) that does tokenization and manipulation of
> said tokens (I'm thinking YACC, flex/bison sort of thing).
>
> (Then you could substitute in c
On Sun, Aug 30, 2009 at 9:31 AM, Jason Baker wrote:
>
> On Aug 30, 2:24 am, Dan Fichter wrote:
> > The Clojure version is more concise and radically safer but a little more
> > conceptually packed. Is it worth your trouble?
>
> Being primarily a Python programmer, I can say that the first thing
On Mon, Aug 31, 2009 at 9:03 AM, Konrad Hinsen
wrote:
>
>
> In this particular case, there is no reason to worry: open() returns a
> file object that is fed to the method read(), but after that method
> returns, there is no more reference to the object, so it is garbage
> collected. Upon destructi
So I have a situation where I want to spool out a data structure as a file
where I want to be able for a human to read & modify this structure, and
then be able to read it back in. At first I thought this was going to be
easy- just use print to write out the structure, and then use read to read
it
The API documentation:
http://clojure.org/data_structures#toc22
mentions the existence of the basic set operations of union, intersection,
and difference. But these functions don't seem to exist anymore (including
in the version of clojure I pulled from github about five minutes ago). I
was just
So, I'm working on a medium-largish server application in Clojure (medium
amounts of code- currently >10KLOC and growing quickly, two people working
on it now and hopefully more in the future. This isn't brag-worthy size,
but it's large enough to start causing problems). Specifically, there will
So, I've hit a problem and I'm hoping for some help on how to solve it. The
problem is that prn and read are not perfect duals- that is, not everything
that prn produces can be read in by read. The specific case I'm hitting is
with double precision infinities and NaNs. pr just calls .toString on
>
>
> I'll have to think about how best to handle this, but would appreciate
> an issue in Assembla to track it.
>
>
>
Sorry for the delay in responding. I don't seem to have permission to add
new tickets to the Clojure Assembla page.
Brian
--~--~-~--~~~---~--~~
Y
On Tue, Oct 20, 2009 at 11:57 AM, Rich Hickey wrote:
>
> Anyone can file a support ticket:
>
> http://www.assembla.com/spaces/clojure/support/tickets
>
> Rich
>
>
I've been kicking around that website for an hour now, and can't find where
to add a new ticket. So either a) I'm an idiot, or b) I d
On Sun, Nov 1, 2009 at 8:04 PM, CuppoJava wrote:
>
> Hi,
> For the purposes of a DSL that I'm writing, it would be very
> convenient to have a break/return statement that early exits from a
> subroutine.
>
>
I'm not sure why you need this.
The body of a function in clojure isn't a series of state
On Tue, Nov 3, 2009 at 4:22 PM, Brian Hurt wrote:
>
>
> On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler wrote:
>
>> Ah, of course. Thanks. This works:
>>
>> (defn for-each [f items]
>> (if (not (empty? items))
>> (let [] (f (first items)) (for-eac
On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler wrote:
> Ah, of course. Thanks. This works:
>
> (defn for-each [f items]
> (if (not (empty? items))
> (let [] (f (first items)) (for-each f (rest items)
>
>
Or:
(defn for-each [ f items]
> (for-each (fn [x] (println (* x x))) (list 1 2 3
On Tue, Nov 3, 2009 at 5:19 PM, Paul Mooser wrote:
>
> I understand the pragmatism of your approach, but it's really
> unfortunate. Seqs are a really convenient abstraction, and the ability
> to model arbitrarily large or infinite ones (with laziness) is really
> useful. In my opinion, only using
We encountered similar problems at work trying to wrap I/O up into lazy
seq's. The problem is that it is very easy to accidentally hold on to the
head of a seq while enumerating it's elements. In addition, we had problems
with not closing file descriptors. A common pattern was to open a file,
pr
Or am I just stupid and using definline wrong? I started experimenting with
definline today, and don't seem to be able to make it work:
$ ./repl
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (definline foo [ x ] (+ x 1))
> java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to
> java.lang
What I'd like to do is mock a full name-space for the purpose of testing
other functions that use or require the original name-space. Do people have
ideas or best practices for how I can do this?
The problem comes in that I very much prefer doing my uses/requires in the
name space declaration. I
A better solution that looks like it works is this: load the mock module
second. Say I have a module I want to mock:
(ns tomock)
(defn foo [] 4)
and a module that requires it:
(ns totest
(:require tomock))
(defn bar [] (tomock/foo))
So if I create the file mock_tomock.clj which contains:
On Wed, Mar 10, 2010 at 1:31 PM, John R. Williams wrote:
> I have some patches I'd like to submit, but I'm having trouble with
> the submission process. I've sent in a CA, and my name is on the
> contributor list (at http://clojure.org/contributing), but I still
> can't submit tickets on Assembla
In a recent clojure:
user=> (class 2147483647)
java.lang.Integer
user=> (class (inc 2147483647))
java.math.BigInteger
user=> (class (inc (inc 2147483647)))
java.lang.Long
user=>
This isn't *technically* a bug, but it is an odd behavior.
Brian
--
You received this message because you are subsc
So the doc comment on empty? reads, in part:
Please use the idiom (seq x) rather than (not (empty? x))
>
A heads up to people: these two code sequences are *not* identical in
behavior:
user=> (seq? '())
true
user=> (not (empty? '()))
false
user=>
Brian
--
You received this message because you
mpty lists
are. Which means that (seq? x) and (not (empty? x)) are not equivalent bits
of code.
> On Thu, Mar 11, 2010 at 11:19 AM, Brian Hurt wrote:
> > So the doc comment on empty? reads, in part:
> >
> >> Please use the idiom (seq x) rather than (not (empty? x))
> &
On Thu, Mar 11, 2010 at 2:36 PM, Chouser wrote:
> On Thu, Mar 11, 2010 at 2:19 PM, Brian Hurt wrote:
> > So the doc comment on empty? reads, in part:
> >
> >> Please use the idiom (seq x) rather than (not (empty? x))
> >
> > A heads up to people: these two c
On Thu, Mar 11, 2010 at 3:40 PM, Kevin Downey wrote:
> it's not a corner case, seq returns a seq containing more items if
> there are more, or nil if there are not. have you looked at clojure's
> truth table? if distinguishes from nil and not-nil, with true and
> false thrown in for interop.
>
>
On Tue, Mar 23, 2010 at 11:07 AM, cageface wrote:
> So perhaps it would be worthwhile to create, like jruby, a single zip/
> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> file that will find at least the core clojure jar files on its own? I
> don't see how you're going
On Tue, Apr 27, 2010 at 9:10 AM, Jules wrote:
> Guys,
>
> I've searched the group and cannot find an answer to this one...
>
> Why are many of the more common collection types in Clojure not
> Serializable :
>
I have an assemblia ticket open on this issue:
https://www.assembla.com/spaces/clojure
Personally, I think this idea is a bad one, that will come back to bite
people hard- but I doubt anyone is going to listen to me.
If you serialize the code (either in lisp s-expression form, or java byte
code), you can easily end up serializing most of the whole program. See,
serialization isn't
On Thu, May 13, 2010 at 2:06 PM, j-g-faustus wrote:
> Hi,
>
> just started looking at Clojure, and it looks promising as a modern-
> day Lisp for practical use.
>
> I saw this presentation on Clojure: http://clojure.blip.tv/ and I
> wholeheartedly agree with the design principles. Unified access t
The problem with STM is that it adds significant overheads to modification
costs. In a "classic" imperative programming language like Java or C#,
stores to variables compile down to simple memory writes- very cheap. An
STM memory write, by contrast, is 10x or 100x more expensive (depending upon
p
I have no flipping clue what "system-level programming" means these days,
and I'm hoping someone could spell it out. I used to think (back when I
was doing that sort of stuff) that it mean operating systems level stuff-
device drivers, embedded, real time, stuff like that. But no language with
a
Lifting subexpressions up into lets is actually something I do a lot- for
one very important reason: it lets me insert print statements (or logging
statements) showing the value of the subexpression. So I'll do;
(let [ x (subexpression) ]
(main-expression))
because it lets me do:
On Sun, Jun 27, 2010 at 4:54 PM, rob levy wrote:
> HI Michael,
>
> If I understand correctly, the proxy function might be what you are looking
> for. I think gen-class can only be used with AOT compilation.
>
> -Rob
>
>
This is actually something that has been bugging me for a while. Most of
th
On Mon, Jun 28, 2010 at 2:26 PM, cageface wrote:
> As I said in the HN thread, I think you're right that getting started
> with a productive clojure environment is harder than it has to be.
>
> However, as I also said in the thread, I think the *real* obstacles
> for a noobie are the concepts in
On Mon, Jun 28, 2010 at 3:13 PM, Daniel Gagnon wrote:
>
>> This is the question I had on the blog post- what is meant by a "newbie"?
>> Specifically, what sort of newbie is Clojure wanting to attract? One of the
>> "complaints" the original poster had was that you had a choice of editors.
>> Of
On Mon, Jun 28, 2010 at 3:32 PM, Daniel Gagnon wrote:
>
>> What editors do they use?
>>
>>
> Komodo, TextMate, IDLE, Eric, Wing, etc.
>
>
>> And is there a reason that the same editors can't be used for Clojure?
>>
>>
>
> They don't have clojure language packs.
>
>
And that makes them impossible
On Mon, Jun 28, 2010 at 3:33 PM, Lee Spector wrote:
(B) I want to teach Clojure to students who don't necessarily know emacs.
> Some of these students may know another editor in your list, but many won't
> and many will never have touched Java.
>
>
This is the core distinction I keep trying to m
On Mon, Jun 28, 2010 at 5:46 PM, cageface wrote:
> I don't think the goals of making Clojure a little
> easier to start with and keeping it a "professional" language are
> necessarily totally at odds but efforts to build something like
> Processing or even DrScheme on it seem misdirected.
>
>
Isn
On Tue, Jun 29, 2010 at 4:22 PM, Chas Emerick wrote:
>
> The discussion about newcomers is *not* about what one needs to know or
> should know in order to build über-complicated applications for deployment
> in "production" -- it's about what the learning curve looks and feels like
> to various c
I'm wondering if the following pattern is safe or not. I'm in a
transaction, and I want to create an agent and then send it an initializing
message (the message function isn't transaction-safe, so I don't want to run
it in the transaction). So I want to do something like:
(def my-ref (ref nil))
On Wed, Jul 7, 2010 at 5:04 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 07.07.2010 um 22:46 schrieb Brian Hurt:
>
> > I'm wondering if the following pattern is safe or not. I'm in a
> transaction, and I want to create an agent and then send it an initializing
> m
On Wed, Jul 7, 2010 at 5:46 PM, Ryan Waters wrote:
> On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer wrote:
> > Hi,
> >
> > Am 07.07.2010 um 23:11 schrieb Ryan Waters:
> >
> >>> (send a init-function)
> >>> (send a f))
> >>
> >> It's not guaranteed the init-func
A better API for this particular use suggested itself to me: simply allow
the state to be nil, and require the functions that are sent initialize the
state if necessary. Code like:
(defn my_f [ state ]
(let [ state (or state (init-function)) ]
...
In this case, it doesn't matter whic
On Mon, Jul 19, 2010 at 10:20 PM, Mark Engelberg
wrote:
>
> I think stateful things are too hard to do in Haskell, and they are an
> important part of most real-world programs. Clojure's blend of
> persistent data structures with a variety of reference-type objects
> that can contain them feels m
On Tue, Jul 20, 2010 at 12:19 PM, Sang Noir wrote:
> I'm really tickled by the reaction to this comment on places like
> reddit. Especially how all the Haskell apologists are rushing to the
> defense of their language even though it's obvious that no Haskell
> programmer UNDERSTANDS the language,
On Tue, Aug 3, 2010 at 3:21 PM, David Andrews wrote:
> I want to create a lazy seq backed by an open file (or db connection,
> or something else that needs cleanup). I can't wrap the consumer in a
> with-anything.
>
> Is there a general method for cleaning up after the consumer discards
> its re
On Fri, Aug 13, 2010 at 7:13 AM, Seth wrote:
> Given Oracle's lawsuit against Google for its use of the JVM, is
> anyone else suddenly much more concerned about the states of Clojure
> in Clojure and CLR compatibility? I know the former is an important
> goal and also that the existence of the la
On Sat, Aug 14, 2010 at 10:33 AM, Eric Lavigne wrote:
>
> I originally wanted to include the contents of the units file in the
> physics file, but then there would be a circular dependency between
> physics and io.
So what was the problem with splitting units out into it's own name space?
Circu
Sorry, hit send too soon.
On Sun, Aug 15, 2010 at 10:43 AM, Brian Hurt wrote:
>
>
> On Sat, Aug 14, 2010 at 10:33 AM, Eric Lavigne wrote:
>
>>
>> I originally wanted to include the contents of the units file in the
>> physics file, but then there would be
Consider the following bit of code:
(let [ x (new java.lang.Boolean false) ] (if x "trouble" "ok"))
As you might guess from the fact that I'm calling it's a trick question, the
above code returns "trouble", not "ok". From experimentation, it looks like
clojure's if takes the second branch if the
On Wed, Aug 18, 2010 at 11:34 AM, David Nolen wrote:
> On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt wrote:
>
>> This is, however, more than a little bit surprising and depressing.
>> Somewhere, in my 10K lines of clojure code, boolean values are getting boxed
>> in exact
On Sat, Jul 9, 2011 at 8:58 AM, Christian Marks <9fv...@gmail.com> wrote:
>
> I'm using recur, however some clojure programmers inform me that recur
> "should" be eliminated in favor of doseq or fold. I see nothing wrong
> with recur myself--am I missing
> something?
>
>
If there is an obvious way
What's this awk-a-mel he speaks of? Ocaml, pronounced oh-camel, I
know very well, but I've never heard of this awk-a-mel. :-)
Seriously, his pronunciation of "ocaml" highlights, I think, the core
problem of his talk. There has been significant development in
languages, just not in the popular l
Accesses to atoms are just wrappers around atomic compare and swap
instructions at the hardware level. Locking an object also uses an atomic
compare and swap, but piles other stuff on top of it, making it more
expensive. So atoms are useful in situations where there is likely not
going to be much
Adding my two cents:
I'd say immutablity, transactions/refs, futures, and actors. I'd also talk
a lot about what I call the "four horsemen of the parallel apocalypse"-
race conditions, deadlocks, live locks, and priority inversions. These are
all bugs that, while they *can* show up in senquentia
When he's calling Haskell "useless", he's referring to Haskell before they
figured out how to do I/O. A language that can't do I/O is pretty useless
in practice, no matter how theoretically interesting.
On Fri, Sep 28, 2012 at 6:22 PM, Rich Morin wrote:
> This conversation never mentions Clojur
On Tue, Oct 23, 2012 at 2:49 PM, Jim - FooBar(); wrote:
> On 23/10/12 19:38, Brian Craft wrote:
>
>> it's always faster to do it up-front.
>>
>
> it will always always be faster do it upfront...no way around that!
>
Unless you don't need to do it at all.
Brian
--
You received this message beca
On Tue, Oct 23, 2012 at 2:58 PM, Jim - FooBar(); wrote:
> On 23/10/12 19:57, Brian Hurt wrote:
>
>> Unless you don't need to do it at all.
>>
>
> nce... ;-)
>
>
I was actually serious. One of the advantages of lazy eval is that it lets
you delay deciding
Sorry- I didn't mean for my post to come off sounding like the only reason
to use lazy eval is to skip computation. It's just *one* of the many
reasons.
On Tue, Oct 23, 2012 at 3:08 PM, Kurman Karabukaev wrote:
> Hi Brian,
>
> Laziness (and first class functions) can help with code modularity,
OK, I'm not sure if I'm just missing something obvious here, or if there
really is no way to do this.
What I want to be able to do is to be able to create new exception classes,
in the repl, and be able to throw them and catch them. What I want to be
able to do is something like:
(defexception m
How can I catch a proxied Throwable class without catching everything? I
suppose I could grab the class and go at it with reflection...
Brian
On Mon, Aug 22, 2011 at 3:21 PM, David Powell wrote:
> You can use proxy for this. It doesn't create wrappers, it creates a
> proper subclass with meth
Say I have two name spaces, A and B, with A depending on B. I want to test
namespace A, replacing module B with a mock B for testing purposes-
preferably without having to load B at all (B sucks in a bunch of stuff,
like dependencies on databases and external web sites and etc. that I don't
want t
On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins wrote:
> On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote:
>>
>> Say I have two name spaces, A and B, with A depending on B. I want to
>> test namespace A, replacing module B with a mock B for testing pu
On Fri, Sep 16, 2011 at 4:28 PM, Chris Perkins wrote:
> On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote:
>>
>>
>>
>> On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins wrote:
>>
>>> On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian
On Fri, Sep 16, 2011 at 4:01 PM, Stuart Sierra
wrote:
> On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote:
>>
>> How *should* I structure this code for testing? I was assuming the
>> natural way to do this is to make A, B, and C separate name spaces but m
On Tue, Nov 1, 2011 at 12:14 PM, Ben Smith-Mannschott wrote:
>
> 2 Make NaN contagious
> -
>
> Define min and max to return NaN if and only if at least one of their
> arguments is NaN. This seems most in keeping with the (admittedly
> perverse) behavior of NaN as specified.
>
If I wasn't using Incanter (see Alex Robbin's reply), I'd probably just use
a vector of vectors. If your matricies 70% dense, it's generally not worth
it to try and use some sort of sparse data structure- the extra overhead of
the sparse data structure will be greater than the savings of not
repre
On Thu, Dec 22, 2011 at 5:10 PM, Kevin Downey wrote:
>
> fns are not free. every (fn* …) in macroexpanded source results in a new
> class.
>
>
This is only a problem with respect to load times- clojure tends to make
java's already long load times even longer.
Actual function call costs are prett
Gah, hit send before I meant to.
On Thu, Dec 22, 2011 at 7:03 PM, Brian Hurt wrote:
>
> That being said, in defense of functions:
>
-Many JVMs don't optimize large functions, or optimize them less
aggressively.
So there are reasons to use functions, even functions called via
On Tue, Oct 12, 2010 at 3:35 PM, cej38 wrote:
> The more that I think about it, the more I would rather have a set of
> equalities that always work. float= was a good try.
>
>
>
Every fucking language I've ever worked on has had this problem- "floats are
broken!" And every single one, people
real numbers c such that a < c < b. However, there do not exist any numbers
> between 0.9... and 1, thus they must be same number.
> >
> > > As it turns out, it took mathematicians a long time to nail down
> formally exactly what we naively think of as "numbers&
On Fri, Feb 11, 2011 at 12:22 PM, timc wrote:
> How on earth is one supposed to do communication programming (not to
> mention handling binary files etc) without an unsigned byte type?
>
> I see that this issue has been talked about vaguely - is there a
> solution?
>
> Thanks
>
>
Java guarantees
73 matches
Mail list logo