(I'd say something about my own particular idiom, but that's more of a
Python thing.)
Anyway, new to Clojure but not to Lisp or Java. Writing something to
interoperate with some Perl code that stores a hash in a simple flat
file syntax:
key1value1key2value2...
sorted on the keys.
These are my
7;t have Java, click here and follow the
instructions.")
JRuby's installation is more manual, but includes examples.
All three install on Ubuntu with apt-get, though the latest Clojure
there is 1.0. It does come with a "clojure" shell script for starting
up a REPL, though.
-
to me. In particular, (byte 0xFF) throws an error.
What version? It works here:
Clojure 1.1.0
user=> (byte 0xff)
-1
In fact, it seems that (byte) doesn't check the range at all:
user=> (byte -129)
127
--
Mark J. Reed
--
You received this message because you are subscribed to the
problem here; Clojure is not even getting as
far as compiling the code because its reflection code is too strict
when matching methods to candidates.
I submit the attached patch as a more general solution than Armando's,
although whether it's worthwhile I'll leave up to Rich and co
Clojure could adapt/adopt that solution.
On Tue, Mar 23, 2010 at 4:26 PM, Mark J. Reed wrote:
> As far as I can tell, you're doing nothing wrong and just hitting a
> bug in Clojure. Which is still in 1.2.0-master...
>
> On Tue, Mar 23, 2010 at 11:43 AM, Konstantin Bar
ogle
> 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
x27;s not hard to write a fix:
(defmacro unsigned-byte [bval] (byte (if (> bval 127) (- bval 256) bval)))
Or call it (ubyte) for less wordiness...
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
Is this it?
> http://www.assembla.com/spaces/clojure/tickets/259
>
> On Mar 23, 8:26 pm, "Mark J. Reed" wrote:
>> As far as I can tell, you're doing nothing wrong and just hitting a
>> bug in Clojure. Which is still in 1.2.0-master...
>>
>>
>
p! saved-colors conj :red)
[:black :white :red]
user=> start-colors
[:black :white]
user=> saved-colors
#
user=> @saved-colors
[:black :white :red]
user=>
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to t
ou don't have C dev tools installed. You can often get modules
with prebuilt binaries, but the mechanism is platform-dependent. For
instance, each module is its own apt package for Debian/Ubuntu, while
ActivePerl on Windows uses its own Perl Package Manager (ppm.exe).
--
Mark J. Reed
--
e+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
gt; 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
>>>
>>> To unsubscribe from this group, send email
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/cloj
" ]; then
CLASSPATH="$CLASSPATH:$f"
fi
done
fi
rlwrap java clojure.main "$@"
The actual java invocation can of course be replaced to e.g. use JLine
instead of rlwrap; I use the latter because JLine doesn't seem to have
a vi mode. (Yes, I kno
> 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
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or
Addendum: I highly recommend Jeffrey Friedl's book
_Mastering_Regular_Expressions_ if you want to learn how to use
regexes well. There are also a number of introductions/tutorials
online, but I'm not familiar enough with them to recommend any.
On Tue, Mar 30, 2010 at 12:50 PM, Ma
great! i guess I can also just leave out the
> parenthesis all together.
>
> but, what if i wanted just the portion inside?? the duplicate I
> wanted to get rid of?
>
> also any way to return the sequence without all those bars or do i
> have to use a seperate regex and or fil
(map #(let [n (Integer/parseInt % 16)] (short (if (bit-test n 15)
(bit-or n -65536) (bit-and n 65535 ["ff43" "0032"])
although of course factoring some of that out into named functions is
probably not the worst idea.
On a related note: if I have the symbol for a type, like
ure 1.2, (short n) blows
up on n < -32768 or n > 32767. I would like a way to programmatically
determine those values based on the identity of the function I'm about
to call. Again, I can obviously make a lookup table; just thought
there might be something introspectable.
--
Mar
ze)
positive-mask (- (bit-shift-left 1 size) 1)]
(type
(if (bit-test value sign-bit)
(bit-or value negative-mask)
(bit-and value positive-mask)
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
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 post to this group, send email to clojure@googlegroups.com
> Note that posts from new members
tand that result.. but what the OP asked for is for a
function foo such that
(foo '((1 2 3) (4 5 6))) returns (5 7 9) - a list of the sums in order.
(apply map +) does that.
Except what the OP really wants the average instead of the sum.. there's
probably an arithmetic mean function in c
On Tuesday, April 13, 2010, Mark J. Reed wrote:
> (defn mean [& rest] (/ (apply + reset) (count rest)))
that "reset" should be "rest".
> And then use the same trick with it in place of +:
> (apply map mean '((1 2 4) (2 4 6) (1 3 5)))
> which yiel
ion of the [bindings] would be caught just
as if it happened inside the body, and of course the bound variables would
be visible to both the catch blocks and the finally block.
It could be implemented as a macro that duplicated the catch/finally blocks
within and outside a let...
--
Mark J. R
xceptionAfterConnect x (do-something-with conn))
(finally (API/closeConnection conn))))
(catch .ExceptionDuringConnect x (do-something-without-conn
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to thi
> > I'm not sure I phrased that clearly, please let me know if I'm not
> > making sense. :-)
> >
> > Alex
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To
our first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group athttp://
> groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Goog
On Tue, Apr 27, 2010 at 3:41 PM, Mark J. Reed wrote:
> I'm a bit surprised that it's not there already, at least in
> clojure.contrib, but it's not hard to write, at least for vectors:
>
> (defn insert [vec pos item]
> (apply merge (subvec vec 0 pos) item
h 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
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
Gr
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
--
Mark J. Ree
bers 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
--
Mark J. Reed
--
You received this message because
glegroups.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
-
On Fri, Apr 30, 2010 at 12:25 PM, Mark J. Reed wrote:
> I got an error when I tried ([a b]) instead of (list [a b]), by the way:
>
> Clojure 1.1.0
> user=> (cons [1 2] ([3 4]))
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> PersistentVector (NO_SO
Of course. Which is what I would have done automatically with a
Lispier construct. Just still not used to seeing literal vectors as
functions. :)
On Friday, April 30, 2010, Michael Wood wrote:
> On 30 April 2010 18:25, Mark J. Reed wrote:
> [...]
>> (defn pairup
>>
Ok, so I was right the first time. It think it's past everyone's bedtime.
:)
On Fri, Apr 30, 2010 at 5:49 PM, Douglas Philips wrote:
> On 2010 Apr 30, at 5:45 PM, Mark J. Reed wrote:
>
>> Of course. Which is what I would have done automatically with a
>> Lispier co
p; args]
> (map vector args (rest args)))
>
Nope, that doubles the middle elements:
user=> (pairup 1 2 3 4)
([1 2] [2 3] [3 4])
--
Mark J. Reed
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email t
mail 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/g
37 matches
Mail list logo