On Tue, Aug 31, 2010 at 1:52 PM, Greg wrote:
> Can we please drop this?
No offense Greg, but yes, please, drop this.
By replying, all you've done is perpetuate this :(
It's clear you don't agree (with lots of other people's opinions) and
we get that. Style is personal - do what makes you happy.
Hi,
On 1 Sep., 07:33, Adrian Cuthbertson
wrote:
> There are probably ways of creating types on protocols, but I haven't
> tried that yet.
Clojure is a dynamically typed language. I don't think that putting
types on protocols is very interesting. Type hints should be a low-
level construct put i
On 1 Sep 2010, at 00:17, Frederic Koehler wrote:
If you were to say, (macroexpand '(foo)), it returns (foo), even if
it's
not defined in the context, so I'd say it's a little unexpected.
True, but then, the function macroexpand is mostly a development tool,
for which I can accept such mino
Hi Albert,
I made sense of this by keeping the concept of defprotocol separate
from definterface and deftype. defprotocol is like multimethods and
deftype is like creating an implementation of an interface. You then
need to instantiate a new instance of the deftype to execute its
methods. The foll
Hi Peter,
The library clojure.contrib.zip-filter is pretty good at this sort of thing.
For example:
(require '[clojure.xml :as xml])
(require '[clojure.contrib.zip-filter.xml :as zx])
(require '[clojure.zip :as zip])
(defn get-mods-for-iva
"Returns the node if one exists under a node
whos
> It would be a tragedy if The State ordered Picasso to make his paintings more
> realistic
I think your confusing the virtue in shuffling parentheses around. If
you want to place your parentheses on their own line then more power
to you, it's your style -- but don't confuse it with making high
Hi guys,
I'm running a meetup for functional programming in Edinburgh. The
first one will be on the 13th of September at Malone's Irish Bar (14
Forrest Road) and will continue every 2nd monday of each month. For
the first meetup I think we'll just be having a chat and getting to
know each other bu
On Aug 31, 2010, at 5:26 PM, Mike Meyer wrote:
> Um, read the explanation: he's talking about productivity and code
> quality. He didn't say people didn't care about styles, or weren't
> passionate about styles. Which means you haven't addressed his issues,
> just your straw man.
There is no stra
I agree, that's not the expected behavior. The form is just data, it
doesn't have to be valid code. Since '(Object) is not a macro (Object
is a Symbol there, not a class) it should just return the form just
like (identity) does:
user=> (identity '(Object))
(Object)
But macroexpand-1 does some extr
On Tue, 31 Aug 2010 15:41:13 -0700
Greg wrote:
> On Aug 31, 2010, at 2:35 PM, fin wrote:
>
> >> The concept of the One-Style-To-Rule-Them-All is just childish.
> >
> > Have you read "Style is Substance"?
> > http://www.artima.com/weblogs/viewpost.jsp?thread=74230
>
> No, I hadn't, thanks for t
You could call (import) directly after you've initialised the Gate class:
(gate-init "foo")
(import gate.Factory)
; use Factory class as required
Cheers,
Stuart
On 31 August 2010 01:01, zm wrote:
>
> Initialization exception can be avoided if Factory class is
> initialized indirectly:
>
> (let
On Tue, 31 Aug 2010 15:40:10 -0600
"Eric Schulte" wrote:
> I apologize for apparently re-opening some fresh wounds.
>
> I wasn't trying to assert that these guidelines should be universally
> adopted or enforced.
>
> There are a number of conventions that exist for writing lisp, and I
> thought
On Aug 31, 2010, at 2:35 PM, fin wrote:
>> The concept of the One-Style-To-Rule-Them-All is just childish.
>
> Have you read "Style is Substance"?
> http://www.artima.com/weblogs/viewpost.jsp?thread=74230
No, I hadn't, thanks for the link.
I tried to read the whole thing but stopped after readi
XMLHttpRequest vs. xml-http-request. I rest my case.
On Aug 31, 2010, at 3:35 PM, Mark Engelberg wrote:
> Speaking of style conventions, am I the only one who finds it mildly
> irksome that in any Clojure code, half the identifiers are
> lisp-style-multiword-names while the other half are
> javaC
Speaking of style conventions, am I the only one who finds it mildly
irksome that in any Clojure code, half the identifiers are
lisp-style-multiword-names while the other half are
javaCamlCaseMethodNames. It feels so inconsistent.
I'd be happier if Clojure just moved completely to caml case (take
Well, you seem to describe a problem with the m2eclipse plugin, which
may not have recognized the project as a maven project. This is a
third party plugin, hard to help with this.
Alternatively, could you try the (still experimental) labrepl support
ccw offers ?
Go to File > New > Examples > Othe
If you were to say, (macroexpand '(foo)), it returns (foo), even if it's
not defined in the context, so I'd say it's a little unexpected.
More annoying is the result this has on macroexpand-all, which breaks
because of this weird behaviour:
(use 'clojure.walk)
(walk/macroexpand-all '(let [Object
I apologize for apparently re-opening some fresh wounds.
I wasn't trying to assert that these guidelines should be universally
adopted or enforced.
There are a number of conventions that exist for writing lisp, and I
thought that this paper was interesting because it
- collects and explicitly sta
The full error is
No implementation of method: :arraySet of protocol: #'ndarray.NDArray/
ArrayProtocol found for class: ndarray.NDArray.NDArray (NDArray.clj:0)
and the code is this
(ns ndarray.NDArray
(:import java.lang.Object))
(def ... (reify Object))
(defprotocol ArrayProtocol
(fixIndex
On Tue, Aug 31, 2010 at 4:52 PM, Greg wrote:
> Can we please drop this?
>
> This is going to go nowhere fast, like other thread on closing parens on new
> lines.
>
> Whoever wrote this did a terrible job, at least WRT that topic.
>
> Not only did he misrepresent the trailing parenthesis style (no
> The concept of the One-Style-To-Rule-Them-All is just childish.
Have you read "Style is Substance"?
http://www.artima.com/weblogs/viewpost.jsp?thread=74230
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure
Hi everyone,
I'm a computational linguist coming from Python and want to learn
Clojure. So I thought it would be a good idea to start with labrepl.
I'm working on Mac OS X 10.6 (Snow Leopard) with the 32bit Cocoa
version of Eclipse 3.6 (Helios). I followed the instructions on the
labrepl github pa
Hi-
I'm brand new to Clojure and FP, reading a bunch and working on my
first programming task (reading in values from an xml file and a text
file and then creating a new text file with some lines/sections of the
original text file replaced based on the content of the xml).
I found some helpful in
I haven't quite figured out type hinting either, but here's one thing
I realized I was doing wrong that you might want to try.
(.length msg) is a reader macro that expands to (. msg length). The
docs for the . special form state that if no arguments are provided
for an instance member, it is assum
Hi all,
I am puzzled by the type hint support in deftype.
I can add type hints to defprotocol:
user=> (defprotocol PTest
(test-it ^boolean [this ^String msg]))
PTest
… but adding them to deftype fails:
user=> (deftype Test [^String name]
PTest
(test-it [this msg] (str "test " name ": " m
The concept of the One-Style-To-Rule-Them-All is just childish.
It is akin to the enforcement of school uniforms, and in many ways perhaps
worse.
The imposition of aesthetic preferences upon others is likely to result in the
following:
- A counter-reaction, such as argument, insults, "flame wa
Can we please drop this?
This is going to go nowhere fast, like other thread on closing parens on new
lines.
Whoever wrote this did a terrible job, at least WRT that topic.
Not only did he misrepresent the trailing parenthesis style (not all
parenthesis must be trailed), but the so-called rati
On Tue, Aug 31, 2010 at 8:43 PM, tsuraan wrote:
>
>> In this situation, inlining (int 10) does not buy much.
>
> interesting; for me replacing the 10 with (int 10) brings my times
> from 28.7ms to 19.6ms.
I meant putting (int 10) instead of nl and a let.
Anyway, it seems that we can get to java
> This one is quite good for me.
> (defn countnl
> [#^bytes buf]
> (let [nl (int 10)]
> (areduce buf idx count (int 0)
> (if (== (int (aget buf idx)) nl)
> (unchecked-inc count)
> count
>
>
> It appears that == is not resolved for bytes. So converting to
This one is quite good for me.
(defn countnl
[#^bytes buf]
(let [nl (int 10)]
(areduce buf idx count (int 0)
(if (== (int (aget buf idx)) nl)
(unchecked-inc count)
count
It appears that == is not resolved for bytes. So converting to int works fine.
This is the best I've seen so I thought I'd share
(pulled from a post on the guile mailing list)
http://mumble.net/~campbell/scheme/style.txt
(note: the attached copy opens in Org-mode in Emacs for easier reading)
--
You received this message because you are subscribed to the Google
Groups "Clo
SQLRat 0.1 GA is pushed to Clojars. Maven/Lein details here:
http://clojars.org/org.bituf/sqlrat
The same is also reflected here: http://code.google.com/p/bitumenframework/
# Changes and TODO
## 0.2 / planned
- [TODO] Support large sized query result-sets (by adding lazy loading
option)
- [TODO
On Tue, Aug 31, 2010 at 11:08 AM, Justin Kramer wrote:
> Another tip: per the doc for 'empty?', (seq s) is preferred over (not
> (empty? s)). Oh, and 'str' isn't necessary since 'println' adds spaces
> between arguments:
>
> (defn printall [s]
> (when (seq s)
> (println "Item:" (first s))
> (
> Replace also (unchecked-add count 1) with (unchecked-add count (int 1))
>
> (this should get easier in 1.3)
That didn't change anything for my tests, but this code:
(defn countnl
[#^bytes buf]
(areduce buf idx count (int 0)
(if (= (aget buf idx) 10)
(unchecked-add
Replace also (unchecked-add count 1) with (unchecked-add count (int 1))
(this should get easier in 1.3)
On Tue, Aug 31, 2010 at 4:20 PM, tsuraan wrote:
>> (defn countnl-lite
>> [#^bytes buf]
>> (areduce buf idx count (int 0)
>> (if (= (clojure.lang.RT/aget buf idx) 10)
>>
> (defn countnl-lite
> [#^bytes buf]
> (areduce buf idx count (int 0)
> (if (= (clojure.lang.RT/aget buf idx) 10)
> (unchecked-add count 1)
> count)))
>
> Key points are initializing count to a primitive integer and directly
> calling clojure's aget to avoid an u
On 31 August 2010 16:52, Jacek Laskowski wrote:
> As we're at it, how does people reload functions while connected to a
> remote Clojure app from within Emacs? Do they also
> (require...:reload)? Is there a tutorial/article about it?
One possibility is to open the remote file wherein the function
> I'd like to see a day when programmers need to worry about persistence
> about as much as they worry about garbage collection now.
Me too, but of course beware of leaky abstractions.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this g
Another tip: per the doc for 'empty?', (seq s) is preferred over (not
(empty? s)). Oh, and 'str' isn't necessary since 'println' adds spaces
between arguments:
(defn printall [s]
(when (seq s)
(println "Item:" (first s))
(recur (rest s
Justin
On Aug 31, 10:57 am, Nicolas Oury wrote:
One solution to remove it is to use when.
(when (not (empty? s)
(println (str "Item: " (first s)))
(recur (rest s
As there is only one case for a when, you can give multiple
instructions for this case without grouping them
Even better:
(when-not (empty? s)
(println
On Tue, Aug 31, 2010 at 4:44 PM, Mark Rathwell wrote:
>
> I'm not sure if this is the question you are asking, but to reload a
> namespace in a repl, depending on whether you are use-ing the ns or
> require-ing it, there are :reload and :reload-all keyword arguments
> accepted:
> (require '[foo.s
I'm not sure if this is the question you are asking, but to reload a
namespace in a repl, depending on whether you are use-ing the ns or
require-ing it, there are :reload and :reload-all keyword arguments
accepted:
(require '[foo.something :as something] :reload)
(require '[foo.something :as some
> Hey,
> Having this function:
>
> (defn printall [s]
> (if (not (empty? s))
> (do
> (println (str "Item: " (first s)))
> (recur (rest s)
>
> Why do is used here? what happens if I drop it?
> Thanks for help and time.
In Clojure and most other Lisps, `if' has the fo
Hey,
Having this function:
(defn printall [s]
(if (not (empty? s))
(do
(println (str "Item: " (first s)))
(recur (rest s)
Why do is used here? what happens if I drop it?
Thanks for help and time.
--
You received this message because you are subscribed to the
Hi,
I've been reading Mikael Sundberg's Getting started with compojure [1]
and been wondering how to reload a function "display" (without Emacs
and swank) so I don't have to restart repl. I'd love to update the
function while running lein repl. Is it possible?* How?
[1] http://cleancode.se/2010/0
On Tue, Aug 31, 2010 at 1:53 PM, Nicolas Oury wrote:
> I am not convince that (make-array Byte/TYPE *numbytes*) creates an
> array of primitives.
Actually it does, sorry for the noise.
Should check before sending emails.
Best,
Nicolas.
--
You received this message because you are subscribed t
I am not convince that (make-array Byte/TYPE *numbytes*) creates an
array of primitives.
And I think byte [] is an array of primitives.
That would make a difference.
I don't know if clojure has a byte-array. It seems that there is no
byte-array as there is int-array.
Could you try your code with
Hi,
On 31 Aug., 08:46, Robert McIntyre wrote:
> Without AOT compilation countnl-lite takes around 66 msecs
> With AOT compilation countnl-lite takes ~46 msecs
Did you measure start-up time in your runs? AOT compilation should
have no impact on the runtime speed.
Sincerely
Meikel
--
You recei
Consider trying to use "==" in place of where you have "=", which can be
faster when comparing numbers for equality. Source for this and a few other
performance tips:
http://gnuvince.wordpress.com/2009/05/11/clojure-performance-tips/
Andy
On Mon, Aug 30, 2010 at 11:46 PM, Robert McIntyre wrote
--Doh!
Thanks, David, that worked
On Aug 30, 8:29 am, David Nolen wrote:
> On Mon, Aug 30, 2010 at 6:37 AM, garf wrote:
> > I am getting the following error when I switched from defstruct to
> > defrecord
> > **Unable to resolve classname: Rule-record (RecordInitTest.clj:8)**
> > I only have thi
Hi,
On 31 Aug., 12:00, Chris Jenkins wrote:
> The thing that still confuses me is that I can successfully load a source
> file that imports the whole of clojure.contrib.seq once (with warnings) but
> an attempt to reload that source file then fails - even if I edit the source
> file to remove th
Thanks Robert. That makes a lot of sense and I was able to follow your
advice last night and get my source file to reload successfully by adding
":only [indexed]" to my :use clause (because indexed was the only function
that I was using in this case).
The thing that still confuses me is that I can
52 matches
Mail list logo