Hi,
On 13 Okt., 08:56, Laurent PETIT wrote:
> So in short: calling eval from the macro, on its argument.
Beware the leopard!
user=> (defn f
[constant]
`(+ x# (* ~constant y#)))
#'user/f
user=> (defn variables*
[form]
(if (seq? form)
(reduce into [
basically the following is the macro that creates a function from the
expression calculated using mathematica.. it seems to be doing something
still not the whole thing.. hopefully some of you may be able to help me.
(defmacro sexp2fn [sexp]
(let [sym (eval sexp)
vars (eval (math (Varia
Hi,
On 13 Okt., 11:19, Sunil S Nandihalli
wrote:
> (defmacro sexp2fn [sexp]
> (let [sym (eval sexp)
> vars (eval (math (Variables sexp)))]
> (println [sym vars])
> `(fn ~vars
> ~sym)))
Try the following:
(defn evaled-variables
[form]
(eval `(math (Variables ~form)
On Wed, Oct 13, 2010 at 4:00 AM, Mark Engelberg
wrote:
> On Tue, Oct 12, 2010 at 6:41 AM, Moritz Ulrich
> wrote:
>> Regarding your error: Maybe you open too many sockets which don't get
>> closed and your process runs out of file descriptors.
>
> Yes, I think that's the problem. I found a blurb
Good to know... is this written somewhere ? I looked at Clojars yesterday
but did not find anything...
Luc P.
Saul Hazledine wrote ..
> On Oct 13, 5:31 am, lprefonta...@softaddicts.ca wrote:
> > As far a publishing to Clojars, I do not know the policy.
> > Uploading various jars maintained by ot
On Oct 12, 2010, at 3:02 PM, tonyl wrote:
> (defn palindrome? [s]
> (= s (reduce str (reverse s
One opportunity to micro-optimize is to replace "reduce str" with "apply str".
str uses a StringBuilder object to build a string from its arguments. When you
use reduce, the code walks down s a
On Oct 13, 1:21 pm, lprefonta...@softaddicts.ca wrote:
> Good to know... is this written somewhere ? I looked at Clojars yesterday
> but did not find anything...
>
Its mentioned near the end of the tutorial:
http://github.com/ato/clojars-web/wiki/tutorial
Saul
--
You received this message bec
Hi,
On 13 Okt., 07:59, Saul Hazledine wrote:
> As I understand it, its fine to put jars from other projects on
> Clojars. If you do this, it is recommended to use your own groupid or
> org.clojars. as the groupid. That way people know that
> the jar files aren't from the originating team. If the
I suppose it could be a way to unify both versions using (System/
getProperty "path.separator") and (System/getProperty
"file.separator")
I try to fix it like Leo but i get a regexp exception using (reval)
with \
--
You received this message because you are subscribed to the Google
Groups "Clojur
I need a new pair of eyes...
Saul Hazledine wrote ..
> On Oct 13, 1:21 pm, lprefonta...@softaddicts.ca wrote:
> > Good to know... is this written somewhere ? I looked at Clojars yesterday
> > but did not find anything...
> >
>
> Its mentioned near the end of the tutorial:
> http://github.com/a
I suppose it could be a way to unify both versions using (System/
getProperty "path.separator") and (System/getProperty
"file.separator")
I add the leo changes (to master vesion -lesses changes-) and it works
for me
thanks!!
On Oct 12, 2:53 pm, leo wrote:
> This works for me under Windows 7. I se
How can I override print-method for a map, defined with defstruct?
I have to create object hierarchy: one map is a parent for another,
i.e. it holds link to a child, and another is a child for the first
one, i.e. holds link to a parent. When I try to print it, I get
StackOverflowError since printe
On Tue, Oct 12, 2010 at 8:35 PM, cej38 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.
>
>
The only way to do so is to have numbers with infinite precision.
For example as lazy-seq of their digits.
But:
- it i
After thinking about it some more, I don't understand it either. I have
created a ticket for this:
https://www.assembla.com/spaces/clojure/tickets/457-lazy-recursive-definition-giving-incorrect-results.
As a workaround, eliminate the lazy intermediary "nums" sequence, e.g.
(def primes
(concat
Nice rant, I learned something here :) I somehow thought BigDecimal
wouldn't have any precision issues, but I probably never noticed because
I can only think in base-10 arithmetic. Has been good enough for my
humble precision problems so far though, never had a notable performance
issue with it eit
Hi,
I was reading the blog entry Seen in #clojure – October 7th [1] and
couldn't stop thinking it might be easier with monads. Since I'm new
to monads, Clojure and functional programming in general I'd
appreciate any comments on my solution, esp. with regards to maybe-m
monad's use. I guess there
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 understand infinity.
Of course, the problem arises when we truncate the string
I see. So instead of using interfaces and implementations of these, I
would simply use closures, one for mock and one for production? That was
actually my first attempt, but I didn't like it back then.
Take this code for example - passing a function just to have it called
feels weird:
(defn load-
A slight tangent, is there anyway to represent exact square roots?
I'd like to have an exact closed form fibonacci function.
On Oct 13, 1:28 pm, 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 counterint
Um, not if you're going to try and turn them into numbers first. But
if you store them as ['sqrt 5] or some similar operator/operand pair,
then you can manipulate them symbolically and wait for them to cancel
out, instead of evaluating them. This requires implementing some kind
of symbolic-algebra
You can add a :type metadata to your maps, and this can be catched by the
(type) method of multimethods.
But if you have parent -> child -> parent -> child ... relationships, I
guess that you're building a tree made of mixins of maps and refs to maps
... and indeed this should bell some rings in y
Thank you guys about all the valuable answers.
I've pushed the jars to Clojars on my group [1] and updated the wiki with a
simple tutorial on how to create a POM to non-clojure jars [2].
All the best.
[1] http://clojars.org/groups/org.clojars.automata
[2] http://github.com/ato/clojars-web/wiki/P
Thank you for all the work you've put into this!
On Oct 11, 5:39 pm, dmiller wrote:
> Check out the downloads area onhttp://github.com/richhickey/clojure-clr.
> Grabclojure-clr-1.2.0.zip. Unzip, start up Clojure.Main.exe and you
> should be running. The zip also contains Clojure.Compile.exe, w
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 understand infinity.
Felix~
You are correct that the sequence of numbers
0.9
0.99
0.999
...
asymptotically approaches 1; however, the number 0.... (with an infinite
number of 9s) is equal to 1. The formal proof of this is fairly tricky as
the definition of the real number is usually done as an equivalence class
Here's a slightly more informal argument. Suppose you challenge me that 1 is
not equal to 0.... What you are saying is that 1 - 0.... is not equal
to 0, i.e., the difference is more than 0. But for any positive value
arbitrarily close to 0 I can show that 0.999... is closer to 1 than tha
On Thu, 14 Oct 2010 00:27:39 +0200
"Felix H. Dahlke" 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.
>
The quick and dirty proof (not formal proof) for 1 = ....
1/3 = .33...
2/3 = .66...
3/3 = .99...
Think of 3/3 as 1/3 (that is .3...) times 3.
-Terrance Davis
www.terrancedavis.com
Felix H. Dahlke wrote:
On 13/10/10 22:28, David Sletten wrote:
On Oct 12, 2010, at 5:44
That works, thanks!
Yeah, I understand that it is not the best data structure to use. The
task is to create a tree, and it is needed to get all children and all
parents of specified node in this tree in a constant time. So, I
cannot see another way to do it except storing refs both from parents
t
Instead of using a ref, you might consider using a closure, which
seems a little more functional.
So every child would simply store a function that when called would
return the map of the parent, map you capture using a closure. This
would also reduce your printing problems because functions just
I think the indexing in all-combs may be off, causing it to miss
certain combinations/substrings.
user=> (all-combs "abc")
("a" "ab")
I used this instead:
(defn substrings [s]
(let [length (count s)]
(for [i (range length)
j (range (inc i) (inc length))]
(subs s i j
us
One thing that OOP and FP can have in common is the use of
polymorphism. With protocols and types you can implement your Java
design efficiently because you'll get basically the same interfaces
and classes. The thing about hiding the calls to instances of a data
type is only to make the client code
What's the status on Mono?
On Oct 11, 3:39 pm, dmiller wrote:
> Check out the downloads area onhttp://github.com/richhickey/clojure-clr.
> Grab clojure-clr-1.2.0.zip. Unzip, start up Clojure.Main.exe and you
> should be running. The zip also contains Clojure.Compile.exe, which
> you can invoke
OKay, I think I get it. Thanks :)
On 14/10/10 00:56, David Sletten wrote:
> Here's a slightly more informal argument. Suppose you challenge me that
> 1 is not equal to 0.... What you are saying is that 1 - 0.... is
> not equal to 0, i.e., the difference is more than 0. But for any
> positi
34 matches
Mail list logo