have any comments about how appropriate Clojure would be
for implementing new programming languages?
thanks,
Alex Mitchell
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this gr
Just wanted to say I had a great time at the meetup. Really fun to
see people using Clojure in earnest and hear Rich talk about stuff. I
blogged it a bit here:
http://tech.puredanger.com/2009/06/10/clojure-rich-hickey/
On Jun 4, 11:44 am, Paul Mooser wrote:
> I wanted to say thank you to eve
mething in the (string ... ) function is causing it
to hang if the response has not yet completed. Anyone have any idea
what might be causing this?
Thanks,
Alex
Does anyone have any ideas why
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Rob, that's perfect. Thanks very much for looking into that and
supplying the patch. Hopefully we can get that applied to the source
in git.
On Oct 30, 9:58 pm, Rob Wolfe wrote:
> Alex writes:
> > Hi,
>
> > I'm getting some strange errors when trying to make
Hi,
I have a question about the scope of "binding" of a var.
Let's say I have the following var:
(def *v* 1)
And I define a function that uses it:
(defn f [n] (+ *v* n))
"binding" behaves as expected, establishing a thread-local binding to
a new value in its scope:
user=> (bindin
D'oh! Thanks.
I fall for that trap yet again. Sounds so simple when explained.
2010/2/9 Sean Devlin :
> The problem is that map returns a lazy seq, and the lazy seq is
> evaluated outside of the binding by the REPL. If you add a doall
> inside the binding, it behaves as you expect.
>
> user=> (b
Hi, Norman Richards,
In the example, "arg" and "goal" were not literal but were meant to be
replaced with something appropriate to whatever you are trying to do. Yes,
unless you use a projected value, it is equivalent to precomputing it
outside the run*. The point was that, although very hacky, th
Hello everybody,
How to transform sequence
*[[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]]*
to
*[[1 1.2] [2 1.0] [3 0.2]]*
?
Best regards,
Alex
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
Check out our new platform (built in Clojure/Clojurescript), the one stop
shop for Functional Programming roles across the globe. Check it out ..
www.functionalworks.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
Morning Everyone,
For those of you that are looking for your next FP gig then check out the
worlds leading Functional Programming job board! Functional Works
<https://functional.works-hub.com/?utm_source=Clojure-google-group&utm_medium=Google-group&utm_campaign=alex>
thanks,
That's very subjective, but I'd vote for "Joy of Clojure" for understanding
ideas behind language design and some idiomatic use cases. I'd not
recommend "Clojure Programming" for start, as it's very comprehensive and
dives deep into detailes(which was a minus when I was starting with Clojure
an
Thanks for your work Zach
пятница, 16 марта 2018 г., 18:21:19 UTC+2 пользователь Zach Tellman написал:
>
> Almost exactly two years ago, I announced on this mailing list that I was
> working on an intermediate-level book on Clojure [1], and released the
> first chapter. I've confined updates si
Zakon is declarative authorization library which unleashes all the power of
multimethods.
Github: https://github.com/dawcs/zakon
--
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 p
Looks like pre defrecord stuff used in early days to add "type" to map. Can
still be used if you need "type" on a map without using defrecord.
среда, 24 октября 2018 г., 10:30:14 UTC+3 пользователь Didier написал:
>
> Reviving this thread, as I'd like to kmow if someone can explain the
> purpose
flow is a tiny library for declarative errors handling without monads
https://github.com/dawcs/flow
--
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 mode
How about using exception instances as errors? That plays pretty nicely
with ex-info and (try ... (catch Exception e e)). I've built
https://github.com/dawcs/flow on top of that approach and that seems like
pretty good abstraction. Despite I'm not sure about CLJS.
Anomalies are also great and y
ue, and you can return a plussed up version with new capabilities,
> without having to return a wrapped value. Wrapped values are sometimes
> problematic because they introduce new representations of existing types,
> and this allows an API to return values to the caller that behave the same
's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>
> --
> *From:* clo...@googlegroups.com > on behalf of alex >
> *Sent:* Wednesday, November 7, 2018
s** should
be called **catch-from* *to make its purpose more clear without reading
docstring.
пятница, 9 ноября 2018 г., 8:05:18 UTC+2 пользователь Sean Corfield написал:
>
> Alex, I’m curious, should this
> https://github.com/dawcs/flow/blob/master/src/dawcs/flow.clj#L53 use *
>
I'm not sure, but probably it behaves so because of throwing at macroexpand
stage.
вторник, 18 декабря 2018 г., 11:29:09 UTC+2 пользователь puzzler написал:
>
> Consider the following macro:
>
> (defmacro f [x] {:pre [(number? x)]} `(+ ~x 5))
> => (f 3)
> 8
> => (f true)
> Unexpected error (Asser
...@functionalworks.com
Paying up to $180,000 + Benefits + Bonus + Stock!
Look forward to hearing from you.
thanks,
Alex Mesropians
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
finding out all the details drop me a line
a...@functionalworks.com
thanks,
Alex
--
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 -
Morning,
I have just had a 3 month contract come up for a Clojure/Clojurescript/Reagent
engineer here in London. Working for a top Clojure house!
Drop me a line for more info or if you are interested!
a...@functionalworks.com
thanks,
Alex
--
You received this message because you are
Hey all,
I've been using clojure.java.jdbc to write a simple database app. When I
use the `update-or-insert-values` function, I get an SQLException thrown
whenever my column names have special characters in them (like a space or
an ampersand). I think the solution is in line 908: the column-str
@Andy: Sorry, I didn't know the proper channel, I'll post it there.
I don't control the column names. They're imported from an excel
spreadsheet or assigned by the client I'm writing the app for. From
experience, it is certainly *possible*, at least to add these columns.
Currently I just have a
o change on
the slime-repl clojure side.
I realize how little I understand about all this but would love to get
started. Any advice much appreciated.
Thanks
Alex
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
I wrote this immediately after writing the code and running the test.
I should have waited a bit because in retrospect the test is bound to
fail. Guessing I should have used a transaction.
On Sep 28, 7:17 pm, Alex wrote:
> I'm new at clojure+emacs+slime+swank+leiningen and I wanted
On Sep 29, 1:08 pm, Phil Hagelberg wrote:
> On Tue, Sep 28, 2010 at 4:17 AM, Alex wrote:
> > $ lein swank
> > user=> Connection opened on local port 4005
> > # > 127.0.0.1,port=0,localport=4005]>
>
> > First question: why no visible output?
>
> Runn
If you have trouble viewing or submitting this form, you can fill it out
online:
https://docs.google.com/spreadsheet/viewform?formkey=dFpleU1QbVRyLWVXVElRMmJpQlpoYWc6MQ
Clojure Community Values
For no particular reason I got to thinking about things the Clojure
community values in the styl
t is, the first
screen) it is off-putting for some reason. After all, it is a
programming language.
Alex
On Dec 11, 2008, at 12:55 AM, Timothy Pratley wrote:
>
> Hi Brian,
>
>
>> Rich talks about destructuring in the part about "let" on the
>> "special
&
before the "EOF" line in gorilla.vim, but I
imagine that shouldn't be necesssary.
Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to
On Mar 23, 9:55 am, ronen wrote:
> [... what] I actually need is a way of overriding specific methods (like the
> visit
> (MethodDeclaration n, A arg) and not all of them.
I keep running into this problem again and again myself, so I thought
I might post some notes. The short of it: doing anyt
How about the name: jecl
"jecl" breaks down:
(j)ecl = (j)ava
j(ec)l = (ec)lipse
je(cl) = (cl)ojure
jecl.net is not registered (yet)
"develop clojure on eclipse with jecl" has a ring to it, I think
..and of course there is the story of Jekyll(clojure) and Hyde(java) where
Jekyll is a good docto
I'm no expert but I love to argue, so this is what I would say:
On Wed, Jun 24, 2009 at 10:59 PM, Baishampayan Ghose
wrote:
>
>
> Their concerns are thus:
>
> 1. How do you get Clojure programmers? Lisp is not for the faint hearted.
There has been a lot of re-newed interest in lisp over the past
need to either find the link on the
clojure.org website or else make an educated guess.
Best regards,
Alex
On Fri, Jun 26, 2009 at 12:48 AM, Laurent PETIT wrote:
> Hi, this is an OT question, but since Rich encouraged git gurus here on the
> ml to on help non gurus, then I ask :-)
&
Thats great to hear, hope everything goes well, let us know how it turns
out!
Best regards,
agc
On Fri, Jun 26, 2009 at 1:55 AM, Baishampayan Ghose wrote:
> Laurent,
>
> > Out of curiosity, which (combination of) advice do you think 'closed the
> > deal' ?
>
> Well, the guy is a real startup v
Hello,
Undoubtedly it is not the best solution, but all I do is export a variable
called CLASSPATH
pointing to whichever directories I want to require or load.
# append to your .bashrc script
# Start
CLASSPATH=/home/user/aaa:/home/user/bbb:$CLASSPATH
export CLASSPATH
# End
The only gotcha so far
Hi Rich,
Does this mean you're going to be moderating every post, or just posts from
new accounts?
Either way, perhaps you could start looking around for a couple of people
who would do this job of
moderating for you because I'm sure I'm not alone in thinking that your time
would be best used else
On Sun, Jun 28, 2009 at 10:21 PM, CuppoJava wrote:
>
> Thank you Denfer,
> That's a very interesting trick. I'm sure it'll be handy to me in the
> future. I really never considered trolls a possibility on this forum.
> It seems if that sort of thing interests you, there's much easier and
> satisfy
re or any Lisp to get involved, but more
experienced hands will be very welcome to guide us through the
learning experience.
All the info, including sign up link, here
http://londongeeknights.wetpaint.com/page/Clojure+Workshop
Hope to see some of you there,
Alex
--~--~-~--~~~--
eir source with that version
of clojure.jar (apparently an old Clojure 1.1.0-alpha-SNAPSHOT).
Used with either clojure.1.0.0.jar or an up to date clojure 1.1.0-
alpha built from GitHub, the clojure.contrib.repl-utils/source
function works fine.
Kind re
t let me post a
welcome message - does anyone know what I can do about this?
Alex
[1] http://londongeeknights.wetpaint.com/page/Clojure+Workshop
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" gro
@Andrew, glad you enjoyed it :-)
@Jim, sorry you missed it :-(
There was quite a lot of interest in organising something to follow on
from last Monday's event, so I've created a mailing list for London
Clojure activity [1].
The next TW geek night is a pairing workshop [2] on September 8.
[1] h
ot; to it. This means that you have to qualify lcm with the full
namespace, like this:
user=> (clojure.contrib.math/lcm 4 5)
20
You probably want "use" instead of "require", like this:
user=> (use 'clojure.contrib.math)
nil
user=> (lcm 4 5)
20
Hope that
s that are functions.
So something like:
(defn ns-functions [ns]
(for [[n, v] (ns-publics ns)
:when (and (.isBound v)
(instance? clojure.lang.Fn @v))]
n))
(ns-functions 'clojure.xml)
=> (star
On Oct 12, 11:55 am, Angel Java Lopez wrote:
> I just discovered that maps support duplicated keys:
> What is the rationale behind this behaviour?
No, maps don't support duplicate keys. What you're seeing is due to
an implementation detail in how array-maps are created from literals.
You'll not
gt; more idiomatic way?
(nth (lex-permutations [0 1 2 3 4 5 6 7 8 9]) 99)
[Indexing starts at 0 so we use 99 instead of 100.]
Cheers,
Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure&quo
Garth Sheldon-Coulson wrote:
> In his blog post Rich mentioned his JVM Language Summit talk
> on state, identity, value, time, etc.
>
> Does anyone know if audio or video was recorded, or (if Rich is reading
> this) if there are more comprehensive notes to be gotten?
The conclusion of it is her
DemAS wrote:
> I'm just wondering if there is any difference between 'into' and
> 'concat' ?
There are actually more differences than similarities in my opinion.
For starters, 'concat' can take more than 2 arguments:
(concat [1 2] [3 4] [5 6])
=> (1 2 3 4 5 6)
'into' returns whatever col
Meikel Brandmeyer wrote:
> Maybe you can do:
>
> (reduce (fn [[sales upgrades demo :as v] data]
>(cond
> (is-sales? data) [(conj sales data) upgrades demo]
> (is-upgrade? data) [sales (conj upgrades data) demo]
> (is-demo? data)[sales upgra
Alex Osborne wrote:
> If the three output lists themselves are too large, I'd just explicitly
> sum your units with reduce:
>
> (reduce
> (fn [counts data]
> (let [type (record-type data)]
> (assoc counts type (+ (units data)
>
David Powell wrote:
> It uses the Java Attach API to let you connect a Clojure REPL to any running
> Java or Clojure process, without them requiring any special startup.
Exceedingly cool!
> It probably requires a Sun 1.6 JDK. And currently the startup script is a
> batch file, so if anyone ca
Dmitry Kakurin wrote:
> I actually like your "tag them then group them" approach.
> But what if the same record can have multiple tags?
> E.g. :sales and :upgrades?
>
Hmmm. the first way that occurred to me is just make your tagging
function return a set:
(defn record-types [x]
(disj
#{(w
Gorsal wrote:
> I was wondering how to used the java keyword synchronized in clojure?
http://clojure.org/api#locking
Java: synchronized(foo) { ... }
Clojure: (locking foo ...)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
mbrodersen wrote:
>> Using atoms is not a good idea. Unless you don't mind if the same
>> message is sometimes printed more than once. Atoms are implemented
>> using spin locks with automatic retry.
>
> Hmmm...unless add-watch => observer is called only once.
Looking in clojure/lang/Atom.java:
Raoul Duke wrote:
> apparently one has to manually write ones agents to log the exceptions
> out to stderr or stdout? i guess my personal principle of least
> surprise implementation would have been to at least spit out the first
> exception once.
The problem is where do you throw the exceptions?
nchubrich wrote:
> I need to make a data structure for a query such as "find everything
> that is priced $3.27 - $6.12" (and perhaps sum up the total revenue
> for all items in that price range).
That's one of the things sorted maps are for:
(let [objects-by-price (sorted-map 0.50 :cookie, 5.0
Alex Osborne wrote:
> nchubrich wrote:
>> I need to make a data structure for a query such as "find everything
>> that is priced $3.27 - $6.12" (and perhaps sum up the total revenue
>> for all items in that price range).
>
>
> That's one of the thin
Gorsal wrote:
> I'm trying to redirect the input i receive from a BufferedInputStream
> to the repl. I'm trying something like this:
>
> (defmacro with-thread [nm & body]
> `(let [thread# (Thread. (fn [] (do ~...@body)))]
> (if ~nm (.setName thread# ~nm))
> (.start thread#)
> thread#
Dmitri wrote:
> I notice that certain sequence operations such as concat and cons will
> not retain the original type of sequence, for example if you combine
> two vectors together a list will be returned:
>
> user=> (concat [1 2] [3 4])
> (1 2 3 4)
>
> is this intentional behavior, and wo
Oops, looks like the end of my message got cut off. Appended below.
Alex Osborne wrote:
> Dmitri wrote:
> > I notice that certain sequence operations such as concat and cons will
> > not retain the original type of sequence, for example if you combine
> > two vectors to
I'm not really a vim user, but I just tried this out as I was curious to
see what vimclojure was like. It sounds like the nailgun server can't
find clojure.jar, try checking the classpath you're using to launch the
server. I get the exact same error if I set a bad classpath on purpose.
eyeri
John Harrop wrote:
> On Tue, Oct 20, 2009 at 12:07 AM, Alex Osborne <mailto:a...@meshy.org>> wrote:
>
> Gorsal wrote:
> > However, this raises the CPU to about 50 percent. This is due to the
> > infinite recursion, I'm assuming?
>
>
Dmitry Kakurin wrote:
> Thanks Alex, this is a VERY elegant solution.
Hehe. I think I got a bit carried away generalising mine, but I found
it interesting. :-) I think your way or Meikal's juxt (which is really
neat, I didn't know about juxt) is much better for this specific
Dmitry Kakurin wrote:
>> Stylistic: you should not put the closing parens on dedicated lines.
>> They are normally collected on the last line. While this is only a
>> style issue, you should get used to it, since 99.9% of all code at in
>> the wild will use that style...
>
> I've read it many tim
samppi wrote:
> Are private multis possible? I notice that clojure.contrib.def does
> not have a defmulti-, which doesn't bode well, but it's still worth a
> question at the mailing list.
Yes, you can make any symbol private. If you look at the definition of
defn- you'll see all it does is set
> So you could do the same when defining a multimethod, just give the
> name (symbol) of the method the metadata ":private" with the value
> "true":
>
> (defmulti #{:private true} my-multi my-dispatch)
I'm having a bad day for typos, the example should of course be:
(defmulti #^{:private true}
John Harrop wrote:
> I think we need some notion of semi-private as well. It would be ignored
> by :use and by automation like tab-completion of symbols, doc
> generation, and the like (except it would show in tab-completion inside
> of its namespace) but would not actually be illegal to invoke
Jeff Brown wrote:
> I can invoke a function using Java code that looks something like this...
>
> Reader reader = new FileReader("clj/demo.clj");
> Compiler.load(reader);
> Var var = RT.var("demo", "add_numbers");
> Object result = var.invoke(4, 7);
> System.out.println("Result: " + result);
>
John Harrop wrote:
> Probably the seq .hashCode should consider only the first N elements
> for some maximum N and if two longer (or even infinite) sequences
> collide so be it.
I strongly disagree. Choosing some arbitrary magic cutoff point just
seems cause for trouble and much confusion. Put
Tiago Antão wrote:
> Again, the point here is to be able to construct method names (full
> call signatures, really) on runtime.
>
> I am lost. As in newbie clueless :(
As others have suggested you need to use either Java's reflection or
Clojure's eval. Here's some examples:
Using reflection:
Chick Corea wrote:
> What is wrong with this code? I want to instantiate a Java String
> from a Java character-array.
> But I want it to be fast, hence the need to cast per the "warn on
> reflection" message.
>
> user=> (set! *warn-on-reflection* true)
> true
> user=> (new String #^
David Powell wrote:
>
>> Under Linux I had to fix the paths in liverepl.sh to include the
>> build folder:
>>
>> java -cp "$LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar"
>> net.djpowell.liverepl.client.Main "$CLOJURE_JAR"
>> "$LIVEREPL_HOME/build/liverepl-agent.jar"
>> "$LIVEREPL_HOME/build/
youngblood.carl wrote:
> When I try and call createFile from clojure:
> (.createFile path)
>
> I get an exception that there is no field named createFile.
If I remember correctly variable argument Java methods, which is what
that "..." syntax means:
abstract Path createFile(FileAttribute...
John Harrop wrote:
> On Wed, Oct 28, 2009 at 9:35 PM, Alex Osborne wrote:
>
> Choosing some arbitrary magic cutoff point just
> seems cause for trouble and much confusion.
>
> For the specific case of hashCode, no; identical values must have
> identical hashes but
Daniel Simms wrote:
> On Thu, Oct 29, 2009 at 4:34 PM, Rayne wrote:
>> but I would highly recommend that you just pull it from the github
>> repository.
>
> Especially if you're going to use clojure-contrib ...or is there some
> "release" of contrib synch'd to clojure releases that I missed
> so
timc wrote:
> I think I know how to do fileLines, but not socketLines. (Each
> received packet should contain one line as it would have been written
> to a file, I think).
Something like this?
(use 'clojure.contrib.duck-streams)
(read-lines (.getInputStream socket))
> My problem is not how to
John Harrop wrote:
> Was something wrong with this?:
>
> (defn my-zipmap
> "Returns a map with the keys mapped to the corresponding vals."
> [keys vals]
> (into {} (map vec (partition 2 (interleave keys vals)
>
> :)
One reason might be that the original zipmap is 5-10 times faster for
Chouser wrote:
> On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
>> John Harrop wrote:
>>> Was something wrong with this?:
>>>
>>> (defn my-zipmap
>>> "Returns a map with the keys mapped to the corresponding vals."
>>> [
Chick Corea wrote:
> Is everything in Clojure immutable?
Most things. Clojure tries very hard to be thread-safe by default.
> how does one modify the value of 'x' ?
>
> (let [x nil] (def x true))
One does not, at least not in a let-binding. If you really want a
lexical variable you
Alex Osborne wrote:
> Chick Corea wrote:
>> If I understand correctly, the "(binding ...)" macro specifically
>> applies to
>> "Variables", one of Clojure's STM types, thus has dynamic, thead-local
>> scope. Is that right? In which case, it ma
Chick Corea wrote:
> The corresponding Java code (w/ the hash-insert omitted in the clojure
> version)
> runs in 5.5sec and uses 290MB.
>
> This code runs (which omits the hash-insert) runs in 17.8sec and uses
> 353MB.
>
> I thought that I added all of the casts and "warn-on-reflections" that
>
Luke VanderHart wrote:
> On Oct 29, 4:01 am, Mark Engelberg wrote:
>> I see your point that hashCode could be made to work on infinite
>> sequences, but since hashing is almost always a prelude to testing for
>> equality, I'm hard pressed to think of an example of why you'd want to
>> be able to
msappler wrote:
> user=> (doc update-proxy)
>
> It says:"the first arg corresponding to this"
>
> What is meant with "this"?
"this" means the proxy object itself (like the "this" keyword in Java).
--~--~-~--~~~---~--~~
You received this message because you are s
nchubrich wrote:
> Is there any way to access the clojure parser, i.e. something that
> gives you all the elements contained in an expression? I.E. (parse (+
> 1 2)) would give you something like [:list [[:symbol +] [:literal 1]
> [:literal 2]]].
Do you mean the reader?
user=> (read-string "(+
Andrew wrote:
> 1. Can I have compile time evaluation forms like in Lisp? For example,
> I want to obtain current namespace during macro expansion, or make
> Java imports in compile time. Is it possible?
Unless I'm misunderstanding what you want, sure. Just access *ns* or
(import 'whatever) in
Sean Devlin wrote:
> This is slightly unrealted, but how does one pronounce ->, ->> and the
> like? Is this documented?
The doc-strings usually give you a nice hint. I usually use "thread"
for -> and "thread last" for ->>. The actual symbols I think of as
"arrow" and "double arrow".
Then -?
Paul Mooser wrote:
> Good job tracking down that diff -- upon looking at it, unfortunately,
> I obviously don't understand the underlying issue being fixed (the
> inter-binding dependencies) because the "old code" basically matches
> what I would think would be the way to avoid introducing this in
Stefan Arentz wrote:
>
> I'm trying to do this:
>
> (defmacro my-defn [name & body]
>`(defn- #^{ :foo-tag "blah" } ~name []
> ~...@body))
>
> The idea is that foo will be defined and that {:foo-tag "blah"} is
> added to its meta-data.
>
> But that does not seem to work:
Try this:
[fns ['greet 'groan]]
(macroexpand (list 'get-xxx fns)))
=> [1 2]
Or we can just quote the whole vector:
(let [fns '[greet groan]]
(macroexpand (list 'get-xxx fns)))
=> [1 2]
But at this point get-xxx may just as well have been a function:
(defn get-xxx-fn [syms]
Wilson MacGyver wrote:
> Does Clojure have a function like Haskell's group?
>
> In Haskell,
> Input: group [1,2,2,1,1,1,2,2,2,1]
> Output: [[1],[2,2],[1,1,1],[2,2,2],[1]]
(use 'clojure.contrib.seq-utils)
(partition-by identity [1 2 2 1 1 1 2 2 2 1])
=> ((1) (2 2) (1 1 1) (2 2 2) (1))
--~--~---
Mark Engelberg wrote:
> 2009/11/9 Tiago Antão :
>> What is the rationale for even? and contains? having different
>> behaviors for the exact same error (ie, one throws the other works
>> fine and just returns false on a type error)?
> I imagine the rationale is efficiency.
Here's the function
Michael Jaaka wrote:
> How to convert HashMap to Clojure map, sorted-map,
> tree-map
>
> How far I'm able only to do it with
>
> (let [a (HashMap. { "abc" "def"}) ]
>(zipmap (keys a) (vals a)))
>
> Note that HashMap. { ... } is here only as example, cause in fact it
> is a result from J
mbrodersen wrote:
> In this simple recursive expression:
>
> (def t (fn [x] (if (zero? x) 0 (+ x (t (dec x))
>
> The fn special form is evaluated within a context where t is not yet
> bound.
>
> t is only bound AFTER fn has captured its environment.
>
> In other words, the closure captured
John Ky wrote:
> How to I print without spaces?
(println (str "a" "b" "c"))
--
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 patie
John Ky wrote:
> Hi all,
>
> I'm looking for a way to write a defkw macro so that (defkw ABSENT)
> expands to
> (def ABSENT (kw "ABSENT" :ABSENT )).
>
Just use `(...) as a template and use ~ to unescape, like so:
(defmacro defkw [sym]
`(def ~sym (kw ~(str sym) ~(keyword sym
(defkw ANSE
John Ky wrote:
> I had to ~(keyword (str sym)) instead of ~(keyword sym), but now it
> works well.
Hmm, odd. Must have changed since Clojure 1.0. (keyword 'some-symbol)
works for me on the "new" branch.
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
nchubrich wrote:
> I'm curious what the best idiomatic way of handling events is (e.g.
> receiving a series of messages and dispatching functions on the basis
> of the messages). One could use the 'experimental' add-watch(er)
> functions. But it might also be nice to do something stream-oriented,
Mark Engelberg wrote:
> Protocols:
>
> I don't understand whether there's any way to provide a partial
> implementation or default implementation of a given
> protocol/interface, and I believe this to be an important issue.
>
> For example, a protocol for < and > that provides a default
> impleme
ajuc wrote:
> I would like to somehow hide the global hilbert-map into my function,
> but I can't see how to do that.
>
> Is this possible? I know that I can just inert literal into my let,
> but that degrades performance, when function is called many times.
>
> I would like to have something lik
1 - 100 of 2590 matches
Mail list logo