A few days ago, I posted my unfinished rendition of a PEG parser
generator on github, accessible at http://github.com/bmillare/simple-peg/
(Note, if you are looking for a working lib for parsing expression
grammars (PEGs), please refer to http://www.lithinos.com/clj-peg/ ) I
find writing parsers to
Below I present 'submit-future' which is similar to the existing
'future' call in that it spawns a thread to execute a task, but
differs in that it will block if n submitted futures are already
running, where n is the number of available processors. I think this
could be quite handy for the produce
On 30 January 2010 01:18, Alex Osborne wrote:
> Liam writes:
>
>> Could someone educate me about what developers normally do when faced
>> with having to create a lexer / parser / analyzer, say for clojure?
>
> For parsing something like Clojure I would probably do it by hand, as
> the syntax is
Lukas Lehner a écrit :
Now, imagine the chain of calling functions is relatively big. Here it
can all fall down on access-external-source causing an exception, but
further up, maybe the message is scrambled, or pretty much anything.
The question is, wrapping all function in try - catch does n
Thank you Meikel, I was aware of the nil issue but it's good that you
made that explicit.
I got rid of the 'symbol per your suggestion, and factored the closure
to take the stream as an input:
(defn init-features [stream]
(let [feature-stream (ref stream)]
(dosync (ref-set
Could someone with the necessary rights please apply the patches for
contrib tickets 44 and 58.
http://www.assembla.com/spaces/clojure-contrib/tickets/44
http://www.assembla.com/spaces/clojure-contrib/tickets/58
--
You received this message because you are subscribed to the Google
Groups "Cloju
>> in the repl when i (use 'foo) vs. (use :foo) they both return nil, so
>> it doesn't help me know that the former is right and the latter isn't.
>> i think. would it be sensible for use to return true or something more
>> positive than nil if it successfully brings in a namespace?
> Ok. Ticket (a
2010/1/30 Rich Hickey :
> Patches welcome for get-in, and my fnil.
Groovy! uploaded to:
https://www.assembla.com/spaces/clojure/tickets/256-get-in-optional-default-value
https://www.assembla.com/spaces/clojure/tickets/257-add-fnil-for-wrapping-functions-to-handle-nil
Regards,
Tim.
--
You recei
Roberto and Alex, thanks for your feedback. This is informative. I
appreciate your perspectives & links.
--
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
Well, with sources freshly pulled from github just now, I was able to
build contrib with no trace of the problem... Doing a (require
'clojure.contrib.jmx) followed by run-tests at the REPL also works.
Still no idea what it was about, hoping it's gone for good.
Thanks for the answers, it was reassu
The way most parser generators work is that you can attach arbitrary
pieces of code to be run at certain points during parsing. Usually you
use this to build up your abstract syntax tree (AST). No information
(except perhaps things like comments and whitespace if you don't need to
preserve them)
Liam writes:
> Could someone educate me about what developers normally do when faced
> with having to create a lexer / parser / analyzer, say for clojure?
For parsing something like Clojure I would probably do it by hand, as
the syntax is regular-enough that it's pretty easy to do. For parsing
I'll add that into my notes and my configuration.
Thanks,
Kyle
On Wed, Jan 27, 2010 at 4:07 AM, Lukas Lehner wrote:
> Hi Kyle
>
> Making a new ssh tunnel is a sure thing. The bad part was that the swank
> server got "deaf". I could see agents still running (unix screen is cool)
> but I could n
Hi,
Am 29.01.2010 um 22:12 schrieb Lukas Lehner:
> So, if they (monads) truly solve this kind of problems, then it's time to go
> back to study...
Maybe you also want to have a look at error-kit.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "C
Monads, I knew I cannot avoid them after all. I've tried digging into
the two main clojure-monad tutorials but got kinda lost, repeatedly.
So, if they (monads) truly solve this kind of problems, then it's time
to go back to study...
Thanks
On 1/29/2010 7:49 PM, Raoul Duke wrote:
On Fri, Ja
Hello!
On 29 Jan., 20:14, Meikel Brandmeyer wrote:
> CL find as I understand it: (some (partial = x) some-coll). Sufficiently ugly
> to show performance characteristics.
> CL member as I understand it: (drop-while (partial not= x) some-coll).
> Sufficiently ugly to show performance characterist
That's a great point. A contains? should be used in that case.
On Jan 29, 2:14 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 29.01.2010 um 03:49 schrieb Sean Devlin:
>
> > I'd do one thing differently than Tim. (partial = something) is a
> > clojure smell. It's more idiomatic to use a set
>
> > (i
Patch submitted
https://www.assembla.com/spaces/clojure/tickets/254-Expose-c-l-Ratio-s-accessors
--
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 modera
Hi,
Am 29.01.2010 um 20:45 schrieb Wilson MacGyver:
> I had assumed when he wrote "do not use iteration",
> what he meant is to "not use for/next loop"
That's how I understood it. Especially since all solutions at the pastie link
more or less use recursion. (Even when they cheat and call out to
On Jan 29, 4:24 am, Lukas Lehner wrote:
> The question is, wrapping all function in try - catch does not make is
> clearer (from a processing point of view). Returning nil from broken
> functions just adds a boilerplate code all the way up.
In my opinion one should only catch those exceptions
I had assumed when he wrote "do not use iteration",
what he meant is to "not use for/next loop"
otherwise, as you said, we can't solve the problem without
examining the sequence.
On Fri, Jan 29, 2010 at 2:38 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 29.01.2010 um 16:25 schrieb Wilson MacGyver:
>
Hi,
Am 29.01.2010 um 16:25 schrieb Wilson MacGyver:
> I saw this on twitter.
>
> http://pastie.org/796264
>
> The problem: given a list of strings, produce a list where sequential
> non-empty strings are concatenated
>
> # Conditions: Do not use iteration.
> #
> # Example: glom (["a", "b", "c"
Seconded. I have the same problem on win7, augmented by the fact that
emacs spawns thousands of cmdproxy.exe...
Depending on your machine capabilities, the only thing to do then is a
hot reboot (try killing 5000 processes with new ones starting off
every second).
Works fine on winxp though...
On J
Hi,
Am 29.01.2010 um 03:49 schrieb Sean Devlin:
> I'd do one thing differently than Tim. (partial = something) is a
> clojure smell. It's more idiomatic to use a set
>
> (if (some #{"foo"} ["foo" "bar"]) "yay" "humbug")
This will fail if the collection is allowed to contain nil or false.
Sin
Hi,
Am 29.01.2010 um 12:57 schrieb DanL:
CL find as I understand it: (some (partial = x) some-coll). Sufficiently ugly
to show performance characteristics.
CL member as I understand it: (drop-while (partial not= x) some-coll).
Sufficiently ugly to show performance characteristics.
Sincerely
Me
Just linking this diskussion to an earlier one:
http://groups.google.com/group/clojure/browse_thread/thread/b38a2754fd5b8104/fcd7c578238622f5
--
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
On Fri, Jan 29, 2010 at 4:24 AM, Lukas Lehner wrote:
> The question is, wrapping all function in try - catch does not make is
> clearer (from a processing point of view). Returning nil from broken
> functions just adds a boilerplate code all the way up.
>
> I could not find any guidelines of syste
On Thu, Jan 28, 2010 at 6:43 PM, Sean Devlin wrote:
> Check the apply-macro namespace in contrib
ah-hah! i really should have figured.
thanks.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups
In trying to figure out why clojure.contrib.seq-utils/flatten wouldn't
work on my data type, I discovered the Java interface
clojure.lang.Sequential and the associated test function clojure.core/
sequential?. However, the interface contains no methods. It is used in
the Clojure source code o
Using seq-utils...
1. Assume " " is NOT empty
2. Use partition-by to split
3. Use remove to clean up
4. Map!
user=>(map (partial apply str)
(remove (comp empty? first)
(partition-by empty? ["a" "" "b" "c"])))
("a" "bc")
I think this satisfies you conditions.
Sean
On Jan 29, 10:25 am,
I saw this on twitter.
http://pastie.org/796264
The problem: given a list of strings, produce a list where sequential
non-empty strings are concatenated
# Conditions: Do not use iteration.
#
# Example: glom (["a", "b", "c"]) = ["abc"]
# glom (["a", "", "b"]) = ["a", "b"]
# glom
On Jan 29, 9:04 am, Sean Devlin wrote:
> Rich,
> Your example didn't support a variadic signature. Is that the long
> term plan?
>
It's the short term plan. Let's see if there's any real need for more
than three. I've never needed more than one.
Rich
--
You received this message because you
On Fri, Jan 22, 2010 at 4:55 PM, ataggart wrote:
>
>
> On Jan 22, 1:30 pm, samppi wrote:
>> This is not a big deal: it is a quibble with a weird and inconvenient
>> behavior of list*: when given an empty sequence, it returns nil
>> instead of the empty list. Why is this? According to list*'s
>> d
On Fri, Jan 29, 2010 at 8:44 AM, Rich Hickey wrote:
> On Fri, Jan 22, 2010 at 8:57 AM, Chouser wrote:
>> On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin
>> wrote:
>>> Sometimes you don't want assoc-in to create a hash-map. Sometimes you
>>> wish it could create a sorted map.
>>>
>>> Just finishe
Rich,
Your example didn't support a variadic signature. Is that the long
term plan?
Sean
On Jan 29, 8:48 am, Rich Hickey wrote:
> On Dec 30 2009, 6:18 am, Timothy Pratley
> wrote:
>
> > On Dec 13, 1:24 am, Rich Hickey wrote:
>
> > > fnil seems to me to have greater utility than patching all f
On Fri, Jan 22, 2010 at 4:19 PM, Andreas Wenger
wrote:
> Hi,
>
> I read that deftype is often a better replacement for gen-class and
> defstruct. Indeed, it would fit for my purposes very well, except the
> following problem: deftype does not (yet?) use all the information
> from type hints.
>
> S
On Dec 30 2009, 6:18 am, Timothy Pratley
wrote:
> On Dec 13, 1:24 am, Rich Hickey wrote:
>
> > fnil seems to me to have greater utility than patching all functions
> > that apply functions with default-supplying arguments.
>
> Neat :) I like it.
>
> > The get-in function could be enhanced, and
On Fri, Jan 22, 2010 at 5:41 PM, Raoul Duke wrote:
> hi,
>
> if i have (deftype map-db [next-id id-to-item-map]) i have to then do
> (map-db 0 {}) any time i want to make a new one. it would be nice to
> be able to add a function in my deftype so i could use (map-db) to get
> the same effect.
>
>
On Fri, Jan 22, 2010 at 6:58 PM, Raoul Duke wrote:
>> So you just need to instead use (new Trec (+ 1 v)).
>
> thanks! that does work for me, too.
>
> (i'm hoping Clojure will be able to avoid having to do it that way in
> the long run.)
>
That's as designed, and documented.
Rich
--
You receive
The following doesn't currently work:
user=> (assoc [] 1 :a)
#
So I say this should be map only. Granted, assoc-in already has this
issue.
Also, what do you mean by your question "Where would the default go"?
I don't understand what you're getting at yet.
Sean
On Jan 29, 8:44 am, Rich Hickey
java.util.concurrent.LinkedBlockingQueue
Check out the put() method. That what I used for a program similar to
the original poster when I needed control over the number of threads.
On Jan 28, 7:15 pm, Paul Mooser wrote:
> This is something I run into with executors in Java periodically - I
> h
On Fri, Jan 22, 2010 at 8:57 AM, Chouser wrote:
> On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin
> wrote:
>> Sometimes you don't want assoc-in to create a hash-map. Sometimes you
>> wish it could create a sorted map.
>>
>> Just finished working on something with Alexy Khrabrov & Chouser on
>> IR
On Thu, Jan 21, 2010 at 2:51 AM, Raoul Duke wrote:
> hi,
>
> in the repl when i (use 'foo) vs. (use :foo) they both return nil, so
> it doesn't help me know that the former is right and the latter isn't.
> i think. would it be sensible for use to return true or something more
> positive than nil i
On Thu, Jan 21, 2010 at 7:57 AM, Jacek Generowicz
wrote:
> Clojure has a Ratio type; presumably there should be an easy way to
> find the numerator and denominator of a Ratio object.
>
> I didn't have much luck on clojure.org or with find-doc, but
>
> (show 1/2)
>
> taught me that there are num
Hi all
I am trying to figure out some systematic and clear way how to handle
exceptions in clojure and their bubbling up through the call chain.
Let me illustrate it on some code examples (not executable, just to show
the principle).
(defn get-from-io [p]
(access-external-source p))
(de
Hello!
On 29 Jan., 11:24, Meikel Brandmeyer wrote:
> http://groups.google.com/group/clojure/msg/f2585c149cd0465d
Rich has valid points but still, bad performance characteristics might
be something that I, the user, should take responsibility for. I'm not
sure if such considerations should preven
FYI: if anybody happens to be in berlin next week -- there is going to be an
interesting presentation about clojure "in the cloud" ...
tim
Begin forwarded message:
> From: Hans Hübner
> Date: 2010-01-29 11:53:25
> To: lisp-ber...@googlegroups.com, lisp-ber...@lists.bknr.net,
> lisp...@common-
Hi,
On Jan 29, 10:52 am, DanL wrote:
> > (if (some #{"foo"} ["foo" "bar"]) "yay" "humbug")
>
> In my opinion, there really should be something like CL's FIND or
> MEMBER in core (maybe both, since MEMBER is restartable but FIND
> immediately returns the found element). I think using a set to ach
I mean, the whole article: http://martinfowler.com/articles/codeGenDsl.html
> http://martinfowler.com/articles/codeGenDsl.html#UsingTemplatesForGeneration.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@g
Hello Liam
I'm neither an expert on this subject. :) Nevertheless I'll give you
my position.
Defining a new language, formally speaking, is very hard: you have to
define new symbols and rules. On many languages the same token can be
used in different contexts (think of "{" on Java: if blocks, meth
Hello!
On 29 Jan., 03:49, Sean Devlin wrote:
> I'd do one thing differently than Tim. (partial = something) is a
> clojure smell. It's more idiomatic to use a set
>
> (if (some #{"foo"} ["foo" "bar"]) "yay" "humbug")
In my opinion, there really should be something like CL's FIND or
MEMBER in c
Hello Laurent,
Thank you very much for your answers and maintaining CCW. I was
partially encouraged to use Eclipse (a while back) due to the
existence of CCW (or clojure-dev as it was then).
I wrote: […] sophisticated syntax based evaluation or inferences from
“cold code” [...] not node.
This is
On 29 Jan 2010, at 08:37, Mike Meyer wrote:
Which brings me to my question: how does clojure deal with concurrency
at the inter-process level? At the inter-system level? Are their
distributed versions of refs & atoms and the like available somewhere?
No. Or perhaps the answer should be "not ye
Hello,
2010/1/29 Liam :
> Could someone educate me about what developers normally do when faced
> with having to create a lexer / parser / analyzer, say for clojure?
>
> Why would people go with a canned solution, i.e. ready-made like soup
> out of a can, instead of by hand?
>
> E.g. why did the C
54 matches
Mail list logo