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 Tue, Oct 23, 2012 at 2:49 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:
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
On Tue, Oct 23, 2012 at 2:58 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:
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 whether or not to do
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 kur...@gmail.com wrote:
Hi Brian,
Laziness (and first class functions) can help with
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 r...@cfcl.com wrote:
This conversation never
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 senquential
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
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
On Thu, Dec 22, 2011 at 5:10 PM, Kevin Downey redc...@gmail.com 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
Gah, hit send before I meant to.
On Thu, Dec 22, 2011 at 7:03 PM, Brian Hurt bhur...@gmail.com 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, Nov 1, 2011 at 12:14 PM, Ben Smith-Mannschott bsmith.o...@gmail.com
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
On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins chrisperkin...@gmail.comwrote:
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 purposes
On Fri, Sep 16, 2011 at 4:28 PM, Chris Perkins chrisperkin...@gmail.comwrote:
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 chrispe...@gmail.comwrote:
On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote
On Fri, Sep 16, 2011 at 4:01 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:
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 maybe
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
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
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 d...@djpowell.net wrote:
You can use proxy for this. It doesn't create wrappers, it creates a
proper
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
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 to
On Fri, Feb 11, 2011 at 12:22 PM, timc timgcl...@gmail.com 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
...@ubercode.de
wrote:
On 13/10/10 22:28, David Sletten wrote:
On Oct 12, 2010, at 5:44 PM, Brian Hurt wrote:
For example, in base 10, 1/3 * 3 = 0.9...
It may seem counterintuitive, but that statement is perfectly true.
1 = 0....
That's a good test of how well you
On Tue, Oct 12, 2010 at 3:35 PM, cej38 junkerme...@gmail.com 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.
RANT
Every fucking language I've ever worked on has had this problem- floats are
broken! And every
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 value
On Wed, Aug 18, 2010 at 11:34 AM, David Nolen dnolen.li...@gmail.comwrote:
On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt bhur...@gmail.com 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
On Sat, Aug 14, 2010 at 10:33 AM, Eric Lavigne lavigne.e...@gmail.comwrote:
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
Sorry, hit send too soon.
On Sun, Aug 15, 2010 at 10:43 AM, Brian Hurt bhur...@gmail.com wrote:
On Sat, Aug 14, 2010 at 10:33 AM, Eric Lavigne lavigne.e...@gmail.comwrote:
I originally wanted to include the contents of the units file in the
physics file, but then there would be a circular
On Tue, Aug 3, 2010 at 3:21 PM, David Andrews dammi...@gmail.com 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
On Mon, Jul 19, 2010 at 10:20 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
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
On Tue, Jul 20, 2010 at 12:19 PM, Sang Noir noir.sangn...@gmail.com 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
On Wed, Jul 7, 2010 at 5:46 PM, Ryan Waters ryan.or...@gmail.com wrote:
On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 07.07.2010 um 23:11 schrieb Ryan Waters:
(send a init-function)
(send a f))
It's not guaranteed
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
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 m...@kotka.de 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
message (the message function
On Tue, Jun 29, 2010 at 4:22 PM, Chas Emerick cemer...@snowtide.com 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
On Mon, Jun 28, 2010 at 2:26 PM, cageface milese...@gmail.com 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
On Mon, Jun 28, 2010 at 3:13 PM, Daniel Gagnon redalas...@gmail.com 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
On Mon, Jun 28, 2010 at 3:32 PM, Daniel Gagnon redalas...@gmail.com 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 lspec...@hampshire.edu 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
On Mon, Jun 28, 2010 at 5:46 PM, cageface milese...@gmail.com 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
On Sun, Jun 27, 2010 at 4:54 PM, rob levy r.p.l...@gmail.com 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.
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
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 Tue, Apr 27, 2010 at 9:10 AM, Jules jules.gosn...@gmail.com 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:
On Tue, Mar 23, 2010 at 11:07 AM, cageface milese...@gmail.com 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
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
-empty 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 bhur...@gmail.com wrote:
So the doc comment on empty? reads, in part:
Please use the idiom (seq x) rather than (not (empty? x))
A heads up
On Thu, Mar 11, 2010 at 2:36 PM, Chouser chou...@gmail.com wrote:
On Thu, Mar 11, 2010 at 2:19 PM, Brian Hurt bhur...@gmail.com 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 code sequences
On Thu, Mar 11, 2010 at 3:40 PM, Kevin Downey redc...@gmail.com 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
On Wed, Mar 10, 2010 at 1:31 PM, John R. Williams j...@pobox.com 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
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
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:
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.
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
On Tue, Nov 3, 2009 at 4:22 PM, Brian Hurt bhur...@gmail.com wrote:
On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler deanwamp...@gmail.comwrote:
Ah, of course. Thanks. This works:
(defn for-each [f items]
(if (not (empty? items))
(let [] (f (first items)) (for-each f (rest items
On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler deanwamp...@gmail.com 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
On Tue, Nov 3, 2009 at 5:19 PM, Paul Mooser taron...@gmail.com 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
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,
On Sun, Nov 1, 2009 at 8:04 PM, CuppoJava patrickli_2...@hotmail.comwrote:
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
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
--~--~-~--~~~---~--~~
You
On Tue, Oct 20, 2009 at 11:57 AM, Rich Hickey richhic...@gmail.com 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
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
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
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
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
On Sun, Aug 30, 2009 at 9:31 AM, Jason Baker amnorv...@gmail.com wrote:
On Aug 30, 2:24 am, Dan Fichter daniel.fich...@gmail.com 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
On Mon, Aug 31, 2009 at 9:03 AM, Konrad Hinsen
konrad.hin...@fastmail.netwrote:
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
On Fri, Aug 14, 2009 at 7:00 PM, Jonathan Smith
jonathansmith...@gmail.comwrote:
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
On Thu, Aug 13, 2009 at 4:59 PM, Daniel Lyons fus...@storytotell.orgwrote:
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 that would
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
On Fri, Aug 7, 2009 at 5:04 PM, tsuraan tsur...@gmail.com 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
71 matches
Mail list logo