Hi Timothy,
This is not really related to the current thread (sorry), but I want
to say thanks for this API examples page, it looks like it'll be a
great help, just what I need! Somehow I'd managed to completely miss
it until now when you mentioned it - either I'm partially blind, or it
could be
Mark Volkmann a écrit :
> For example, here's some code that I don't
> know how to rewrite in a way that I find self-explanatory:
>
> (every?
> #(<= (- (apple %) +grid-size+) (head %) (+ (apple %) +grid-size+))
> [+x-index+ +y-index+]))
>
> And here's another one:
>
> (assoc snake :body
>
Ah of course. Thanks a lot, your explanation makes things a lot
clearer! I guess because of the direct nature of the REPL I hadn't
thought about compile time vs runtime, but that makes perfect sense.
On Dec 29, 8:00 pm, Meikel Brandmeyer wrote:
> Hi Kees-Jochem,
>
> Am 29.12.2008 um 20:37 schr
Hi,
using namespaces also requires to layout
the files in a certain way. For the following
consider the directory cp to be in the
classpath.
Create a file cp/permutations.clj with your
functions:
(ns permutations)
(defn fun1 ...)
(defn fun2 ...)
Then create your second namespace in
the corres
On Tue, Dec 30, 2008 at 1:24 AM, falcon wrote:
>
> How's textjure coming along?
Not ready yet. :-/ Current sub-project: setting up sufficiently
flexible system to handle vi-style keybindings.
--Chouser
--~--~-~--~~~---~--~~
You received this message because you
On Dec 29, 8:08 pm, "Mark Engelberg" wrote:
> On Mon, Dec 29, 2008 at 12:40 PM, Rich Hickey wrote:
> > People who know what they are doing can do these things right now with
> > Clojure's array support. There really isn't any more value for Clojure
> > to add to that, so no special primitives.
On Dec 29, 7:02 am, Chouser wrote:
> > (defn split-string-in-two [s]
> > (let [chunk-size (quot (count s) 2)]
> > [(subs s 0 chunk-size), (subs s chunk-size)]))
>
> Might this cut a word in half and produce (slightly) incorrect
> results?
True, I decided to let it be for the sake of simplici
On Tue, Dec 30, 2008 at 4:21 AM, Christophe Grand wrote:
>
> Mark Volkmann a écrit :
>> For example, here's some code that I don't
>> know how to rewrite in a way that I find self-explanatory:
>>
>> (every?
>> #(<= (- (apple %) +grid-size+) (head %) (+ (apple %) +grid-size+))
>> [+x-index
Mark Volkmann a écrit :
>> (assoc snake :body
>>(cons
>> (map + dir (first body))
>>
>
> The previous line needs to be (vec (map + dir (first body))).
>
It works without the vec. Since we aren't using indexing anymore we
don't need to make a vector: a seq (or any collection type)
On Monday 29 December 2008 20:50, Stephen C. Gilardi wrote:
> > ...
>
> Here it is working with the current clojure.jar and
> clojure-contrib.jar:
>
> % java -cp clojure.jar:clojure-contrib.jar clojure.contrib.repl_ln
> Clojure
> 1:1 user=> (prn "hi")
> "hi"
> nil
> 1:2 user=>
I can't replicate t
Wow... that actually fixes it. Still a minor problem, since according
to the Sun website, it is legal to create a Swing object in another
thread as long as long as it is not "realized" yet...
Still, this definitely is a doable workaround. Thanks!
-Luke
On Dec 29, 9:17 pm, Rowdy Rednose wrote:
On Mon, Dec 29, 2008 at 4:10 PM, Chouser wrote:
> I believe the idiom for global values like this is to place asterisks
> around the name.
I thought the asterisk convention was for variables intended for
dynamic binding. It took me a minute to figure out where I got that
idea. "Programming Cloju
Hey Mark,
In addition to Meikel's explanation above, have a look at this
message
http://groups.google.com/group/clojure/msg/17ada41fcb5ef667
from the overall thread
http://groups.google.com/group/clojure/browse_frm/thread/ff80d120c996ba1a/9bfbfe1b08246035#
This was the post that finally made
On Mon, Dec 29, 2008 at 9:12 PM, Larrytheliquid
wrote:
>
> This is what I'm thinking, let me explain: http://gist.github.com/41468
> (If you are familiar with RSpec, here is the equivalent RSpec example
> http://rspec.info/examples.html)
I really like the look of this so far. Nice work!
> Anoth
I see what you are doing with the validations and defining them in the
init-modelcall.
I think that's a good idea actually and like it better than my solution to
putting the
callbacks in the model namespace.
A couple of small things that I noticed when starting to play around with
clj-record. In
Ah sorry I missed that.
However, you accomplished this only because there exists a constructor
in Thread that takes a String name argument.
As a general case, it's not usually that convenient...
ie.
public class MyThread extends Thread{
public MyThread(){
setName("This is my thread");
Sorry for this e-mail that could be more targeted to Jeffrey Chu, but
I was unable to find its direct e-mail address, and I know he is a
clojure ml member, so ...
It seems that swank-clojure license is a flavor of GPL ("License as
distributed with Emacs").
So I guess that if for clojure-dev (ecl
On Tue, Dec 30, 2008 at 11:52 AM, CuppoJava wrote:
>
> Ah sorry I missed that.
>
> However, you accomplished this only because there exists a constructor
> in Thread that takes a String name argument.
> As a general case, it's not usually that convenient...
>
> ie.
>
> public class MyThread exten
In an ideal world, standard functions like map, sort, reduce, filter,
etc. would know when to parallelize on their own, or even better, the
compiler will do it for them.
Meanwhile, I tried playing with the parallel lib (
http://clojure.org/other_libraries
) which has functions like preduce, psor
lpetit writes:
> So I guess that if for clojure-dev (eclipse plugin for clojure) we
> want to use it for interactivity with an external clojure environment,
> and we want to start the environment from the plugin, we have a
> problem : stop me if I'm wrong, but if any file of swank-clojure is
> e
I'm not sure. From what I remember, what you describe is more related
to LGPL ?
On 30 déc, 18:19, Phil Hagelberg wrote:
> lpetit writes:
> > So I guess that if for clojure-dev (eclipse plugin for clojure) we
> > want to use it for interactivity with an external clojure environment,
> > and we
If you guys can get these changes sorted out quickly (next few weeks)
I would love to cover them in the book. No pressure. :-)
Thanks,
Stuart
> On Mon, Dec 29, 2008 at 9:12 PM, Larrytheliquid
> wrote:
>>
>> This is what I'm thinking, let me explain: http://gist.github.com/41468
>> (If you are
I would be super interested in trying things out with textjure
whenever you are ready.
I don't want to give up emacs + slime, but I do think it is an
interesting concept to connect to a running process and change it.
One other thing that LISP had that was useful was saving the state of
the syste
What about some sort of lint program? I'm thinking about something
like pylint for clojure with configurable rules, but which will
default to the standards agreed upon bu the clojure community. Even
if you don't follow the rules 100%, it could be useful to see where
you are deviating to be sure
On Dec 30, 2008, at 9:53 AM, Randall R Schulz wrote:
Anyway, I guess it needs to be pointed that the invocation you
supplied
won't work unless the Clojure Contrib JAR file is built with pre-
compiled Java classes and that this only happens if you supply the
clojure.jar property ("-Dclojure.ja
Haha yeah... it's a rather poor API.
I'm making do with a temporary post-constructor hook that I manually
call after instantiating the object right now. But it's tedious and
error-prone.
Thanks for the help Chouser
--~--~-~--~~~---~--~~
You received this message b
lpetit writes:
> I'm not sure. From what I remember, what you describe is more related
> to LGPL ?
No, the LGPL allows using the code in another program that is Free but
not GPL-licensed. If you're just distributing some code from
swank-clojure, licensing conflicts will never come into play. It
Hi,
Is there anyway to access a static protected field from within
Clojure?
I've tried using :exposes in gen-class, however that gives me the
following error:
java.lang.IncompatibleClassChangeError: Expected non-static field
graphics.JMEGame.ALWAYS_SHOW_PROPS_DIALOG
Thanks for your replies
-P
On Dec 30, 2008, at 1:27 PM, CuppoJava wrote:
>
> Hi,
> Is there anyway to access a static protected field from within
> Clojure?
>
> I've tried using :exposes in gen-class, however that gives me the
> following error:
>
> java.lang.IncompatibleClassChangeError: Expected non-static field
> graph
Ah okay.
I'll dig through the clojure source today and see if I'm able to make
a patch myself.
Thanks for the reply Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send em
On Dec 29, 9:12 pm, Larrytheliquid wrote:
> As I get closer to something I like, it seems that what I will end up with
> will end up with will look look like where test-is seems to be heading.
Hi Larry,
You have laid out pretty clearly where I would like test-is to go
next. I've been experimen
On Dec 30, 9:18 am, Mibu wrote:
> In an ideal world, standard functions like map, sort, reduce, filter,
> etc. would know when to parallelize on their own, or even better, the
> compiler will do it for them.
The former is easier than the latter ;-) Even the smartest
autoparallelizing compilers
How do I find the arity of a given function?
I can get a list of all name spaces using
(all-ns)
I can get functions within each name space using
(find-ns 'clojure) ; so map find-ns over each value returned by all-ns
(doc fn) gives me a description of the function, and information about
function
On Dec 28, 7:50 pm, Piotr 'Qertoip' Włodarek
wrote:
> On 38MB file it takes 28s, compared to 38s of similar but sequential
> version.
Another good thing is to make a simple performance model, perhaps
aided by timings of individual components, before you start
parallelizing everything ;-) How lo
Hi,
Why do we need to specify the second argument(#'func) is a function,
not a variable?
the syntax of send-off required a function as the second arg?
thanks,
sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
On Dec 30, 10:29 pm, falcon wrote:
> (doc fn) gives me a description of the function, and information about
> function arity. I assumed the description and arity were part of
> metadata but (meta fn) only returns nil (for a few functions I tried).
Be sure to var-quote the function, i.e. don't
Impressive, source file and line numbers are already included!
I need to better understand reader macro (or where ever # comes from).
Thanks
>
> Be sure to var-quote the function, i.e. don't use (meta print), but
> (meta #'print).
--~--~-~--~~~---~--~~
You receiv
On Dec 30, 11:08 pm, falcon wrote:
> Impressive, source file and line numbers are already included!
> I need to better understand reader macro (or where ever # comes from).
You actually need to know two things regarding this issue.
In function-definitions, the meta-data is actually assigned to
On Tue, Dec 30, 2008 at 4:56 PM, wubbie wrote:
>
> Why do we need to specify the second argument(#'func) is a function,
> not a variable?
> the syntax of send-off required a function as the second arg?
The second argument will be called as a function -- if it's not
callable (doesn't implement
On Tue, Dec 30, 2008 at 4:29 PM, falcon wrote:
>
> Generally speaking, how can I get information about my environment:
> -which bindings exist
> -the source code for a given function (if source code is available)
pmf's explanations are solid, but for the source code in particular,
you may be int
Hi,
I'm just noticing some subtle threading problems when running a Jme
application from the REPL within inferior-lisp mode Emacs.
For instance this works:
(. jmetest.renderer.TestArrow main nil)
But this doesn't: (attempting to execute from a separate thread)
(def thread (proxy [Thread] []
On Dec 30, 10:26 am, Phil Hagelberg wrote:
> lpetit writes:
> > I'm not sure. From what I remember, what you describe is more related
> > to LGPL ?
>
> No, the LGPL allows using the code in another program that is Free but
> not GPL-licensed.
Actually the LGPL allows linking to the library (som
Makes sense, thanks
On Dec 30, 5:29 pm, pmf wrote:
> On Dec 30, 11:08 pm, falcon wrote:
>
> > Impressive, source file and line numbers are already included!
> > I need to better understand reader macro (or where ever # comes from).
>
> You actually need to know two things regarding this issue.
I was thinking of writing a poor man's enclojure (to get a feel for a
real clojure project). Looks like a lot of work is already done :)
I see many references to clojure contrib, perhaps this jar could be
made more prominent on clojure.org?
On Dec 30, 5:40 pm, Chouser wrote:
> On Tue, Dec 30,
Thanks for the reply Stuart, I thought about similar things. I'm still not
sure which approach is better myself, but let me clarify a few things.
In the current design of test-is, every test must be attached to
> the :test metadata of a Var. That's why "deftest" currently requires
> a symbol, eve
On Tue, Dec 30, 2008 at 5:53 AM, Rich Hickey wrote:
> Could you provide an example of when you would need/use that?
>
Sure.
Use Case #1: Implementing classic imperative algorithms
Consider the binary gcd algorithm on page 338 of The Art of Computer
Programmiing, volume 2. This is a very clever
On Dec 30, 2008, at 5:53 PM, CuppoJava wrote:
>
> Hi,
> I'm just noticing some subtle threading problems when running a Jme
> application from the REPL within inferior-lisp mode Emacs.
>
> For instance this works:
>
> (. jmetest.renderer.TestArrow main nil)
>
> But this doesn't: (attempting to e
Just curious - do both invokeLater and invokeAndWait work? Or only
invokeLater?
On 31 Dez., 00:39, levand wrote:
> Wow... that actually fixes it. Still a minor problem, since according
> to the Sun website, it is legal to create a Swing object in another
> thread as long as long as it is not "re
Luke,
I believe they don't promote the "as long as it's not yet realized"
rule anymore but rather say "do even creation of Swing objects in the
EDT" now:
http://java.sun.com:80/docs/books/tutorial/uiswing/concurrency/initial.html
Cheers
Rowdy
On 31 Dez., 00:39, levand wrote:
> Wow... that act
Thanks Matt,
I was actually hoping for you to reply. I found one of your earlier
posts mentioning that you got JME working properly interactively with
the REPL.
Unfortunately, your solution didn't seem to work. I seem to be having
the same problem as the guy in this post:
http://groups.google.com
On Dec 30, 2008, at 9:13 PM, CuppoJava wrote:
>
> Thanks Matt,
> I was actually hoping for you to reply. I found one of your earlier
> posts mentioning that you got JME working properly interactively with
> the REPL.
>
> Unfortunately, your solution didn't seem to work. I seem to be having
> the
Haha, I'm now seriously considering getting a Mac...
Anyway thanks for your help. I think I'll try installing Slime and
Swank and see if that helps at all.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" gr
Hi Larry, hi all,
Just a quick note: this is not a complete answer, but I just added the
"testing" macro, which lets you add nested documentation strings to
tests, as in RSpec. I've also removed the "T-..." gensyms for now;
every deftest must have a symbol name.
user> (use 'clojure.contrib.test
I want to add that it's not confined to just Swing applications.
I have the exact same problem using JME on an Emacs *inferior-lisp*
REPL.
The program hangs, until I enter subsequent commands on the REPL.
The SwingUtilities trick, and updating to the latest Java runtime
doesn't help.
I'm going
Timothy Pratley wrote:
>> I think if Clojure could do something like this (enforce a certain
>> kind of referentially transparent mutable local), that would be neat,
>>
>
> It is possible to achieve this behavior explicitly:
> (defn create-add-2 []
> (with-local-vars [x 1]
> (do
>
On Dec 30, 2008, at 6:29 PM, Mark Engelberg wrote:
> On Tue, Dec 30, 2008 at 5:53 AM, Rich Hickey
> wrote:
>> Could you provide an example of when you would need/use that?
>>
>
> Sure.
>
> Use Case #1: Implementing classic imperative algorithms
>
> Consider the binary gcd algorithm on page 33
On Tue, Dec 30, 2008 at 8:38 PM, Rich Hickey wrote:
> There's simply no value for Clojure to add to a simple mutable box.
> Clojure does provide the tools for low-level mutation - access to
> Java. You can wrap that in whatever functions/macros you like.
>
There's no way to use the @ dereferenci
Thanks, that helps dramatically. It took me a while to figure out how
to edit the SLIME startup to include my clojure files directory in the
classpath, but I got it working.
So it seems like you have to make sure the namespace always matches
the file. That means if you change the name of the fi
On Tue, Dec 30, 2008 at 11:25 PM, Mark Engelberg
wrote:
>
> Thanks, that helps dramatically. It took me a while to figure out how
> to edit the SLIME startup to include my clojure files directory in the
> classpath, but I got it working.
>
> So it seems like you have to make sure the namespace al
I would like to add that nope... installing SLIME didn't seem to help.
I'm on Clojure rev. 1160, and the latest SLIME and Swank sources as of
December 30 2008.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure
On 30 déc, 23:55, "Mark H." wrote:
> On Dec 30, 10:26 am, Phil Hagelberg wrote:
> Actually the LGPL allows linking to the library (somewhat different
> than "using the code") from any program, even one which is not under
> an open-source license. "L" used to stand for "library" and the
> canoni
lpetit writes:
> So swank-clojure will not be hard-linked (at compilation time) to any
> of clojure-dev code. Nor will it be dynamically linked to any clojure-
> dev code at runtime : it will be dynamically linked to the clojure
> environment launched by clojure-dev on behalf of the user.
>
> Bu
62 matches
Mail list logo