I've finished my MUD - 240 lines including blanks and comments
http://clojure.googlegroups.com/web/funmud.clj
http://clojure.googlegroups.com/web/funmud.PNG
Obviously it is in no way comparable as mine is a PvP whereas the OP
was a single player (not really a Multi User Dungeon you know!).
Anywa
> Your patch does fix the problem in Timothy's first post in that thread,
> though.
Not fully... it can still be defeated by:
(let [l nil]
(.accept l)
What I found when examining this previously was that the exception is
thrown from Relfector.java
Which is invoked from Complier.java:
FnExpr
Hi Brian,
Looks really good.
> My intro is meant as a
> sequential tour through the essential concepts, not a practical
> tutorial. In particular, my examples are deliberately cursory and
> abstract, and my API coverage is very minimal.
I have some comments which may go beyond your desired scop
Hi Brian,
> Rich talks about destructuring in the part about "let" on the "special
> forms" page.
Ah indeed, thanks for pointing that out :)
> If you have any examples to add, please add them yourself (it is a wiki
> page).
You've given some really good reasons why I shouldn't mess with it
*
> (map #(fif even? (fn [x] (* 2 x))) [3 4])
Your fif returns a function. So probably what you wanted to do was:
user=> (map (fif even? (fn [x] (* 2 x))) [3 4])
(nil 8)
fif is returning an unnamed function which accepts one argument and
can thus be mapped to [3 4]
#(...) creates an unnamed functi
Just thought of a better comparison:
(map (fif even? #(* 2 %1)) [3 4])
is indeed shorter than:
(map #(if (even? %1) (* 2 %1)) [3 4])
Regards,
Tim.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To
What is the meaning of:
('+ '1 '2)
On the surface it appears that '2 is simply the last evaluated, but
lets try some similar calls:
user=> ('+)
java.lang.IllegalArgumentException: Wrong number of args passed to:
Symbol
user=> ('+ '1)
nil
user=> ('+ '1 '2)
2
user=> ('+ '1 '2 '3)
java.lang.IllegalA
> user=> ('b '{a 10, b 11, c 12})
> 11
Ah, yes so the 1 arg version is the map lookup, which also works in
reverse
user=> ('{a 10, b 11, c 12} 'b)
11
That makes perfect sense...
What is the 2 arg version?
user=> ('{a 10, b 11, c 12} 'b 'c)
11
user=> ('b '{a 10, b 11, c 12} 'c)
11
user=> ('b 'c '
Neat :) Thanks for the in depth examination, that's a very clear
explanation!
--~--~-~--~~~---~--~~
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
To unsubscr
SS wrote a cells that works on refs quite a while ago:
http://groups.google.com/group/clojure/browse_thread/thread/d79392e4c79f8cde/f92eae422e4086c5?lnk=gst&q=cells+refs#f92eae422e4086c5
If you search the group for "cells" you'll find quite a bit of
discussion
--~--~-~--~~
> and perl has closure, so it looks commute uses closure concept
> > > My question is that conj takes two argument and how conj finds
> > > the first argument? Is it somehow provided by commute?
commute is passed conj as a function.
commute then calls conj messages msg,
and sets messages to be th
>>`{0~@(cons 0 (take-nth 2 %2))}
o_O I tried the `...@v} splice in but never imagined doing that!
nice :)
On the subject of splice in, am I alone in thinking
(str ~...@v) is more readable than (apply str v)?
Of course the former doesn't work as there is no preceding syntax-
quote, but bea
Hi Boris,
It seems to me that you have 1 global ref 'year', but have 8 agents
competing to update it... and then are applying functions which
dereference it also. That's a lot of contention and I don't think
models what you want. Maybe you would do better to have a year per
agent and let them beh
Hi Boris,
Just digging a little deeper into your code, and I'm convinced that
the global time ref is the problem:
; you currently have:
(defn do-year "Calculate one year" [_]
(send (agent nil) inc-year) ; this seems to be totally wrong
; global year gets updated to year+1
; you start 8 age
Hi Boris,
> * the global time ref might indeed be incorrect. I just half-
> understood how to make a global incrementing counter and implemented
> it in a way that seemed to work.
It is a fine globally incrementing counter. However...
You describe every agent to be calculating a different year.
> What's happening in the ActionListener code?
Actually this is more a question of how does load-file work I believe.
If I run your example with (read) added to the end to prevent the main
thread ending from the command line:
clj test.clj
it works as expected... ie: ok gets printed when clicking
Ah thanks Bill well that would explain it!
I added (println "DYN:" *ns*) to dyn.clj and (println "DEF:" *ns*) to
def.clj
and this is what I get:
>From the command line:
C:\java>clj def.clj
DEF: #
DYN: #
ok
>> both are in the same namespace
>From the REPL:
C:\java>clj
Clojure
user=> (load-file "d
Meikel's example works fine for strings:
user=> (doseq [s ["hi" "mum" "love u"]] (println s))
hi
mum
love u
nil
As does your map:
user=> (dorun (map println ["hi" "mum" "love u"]))
hi
mum
love u
nil
--~--~-~--~~~---~--~~
You received this message because yo
Just a simpler example to demonstrate that new threads have *ns* set
to clojure.core:
(def *value* 'ok)
(def *a* (agent nil))
(send *a* (fn f [x] (println "AGENT:" *ns*)))
(send *a* (fn f [x] (eval '(println "AGENT:" *value*
(try (await *a*) (catch Exception e (println e) (println (agent-erro
> > Anyone has a suggestion?
http://cybertiggyr.com/prm/prm.html
Might provide some insight? But its not clear to me how to do what you
want.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To pos
(neg? b-read)
(pos? b-read)
are not precisely opposites.
user=> (pos? 0)
false
user=> (neg? 0)
false
As you can see, the edge condition 0 is treated differently in you two
implementations.
This is the real difference, not the if.
Blocking streams that return 0 indicate that the stream is finish
If you aren't interested in the permutations themselves, just the
number of them (if I read you right)
> The only way I could think up to know exactly what
> fraction of the optimum (2x 5%: remember the diploidi)) a set of
> combined filters can present is by expanding these filters into a se
You could consider using a StreamTokenizer:
(import '(java.io StreamTokenizer BufferedReader FileReader))
(defn wordfreq [filename]
(with-local-vars [words {}]
(let [st (StreamTokenizer. (BufferedReader. (FileReader.
filename)))]
(loop [tt (.nextToken st)]
(when (not= tt Strea
> 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
(var-set x 2)
(let [z @x]
(fn
> (defn top-words-core [s]
> (reduce #(assoc %1 %2 (inc (%1 %2 0))) {}
> (re-seq #"\w+"
> (.toLowerCase s
"maps are functions of their keys" means:
user=> ({:a 1, :b 2, :c 3} :a)
1
Here we created a map {:a 1, :b 2, :c 3}, can then called it like a
funct
On Dec 30, 2:49 pm, wubbie wrote:
> Very criptic for newbie.
> What does "Threads the expr through the forms." mean?
Shameless plug, if you find learning from examples easier than textual
descriptions, you might want to look up
http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examp
> On Dec 30, 2008, at 6:29 PM, Mark Engelberg wrote:
> Use Case #1: Implementing classic imperative algorithm (GDC)
I replaced your (atoms) using (with-local-vars) and the function runs
perfectly fine. The local vars are not closed over, so they cannot
leak, and the code is cleaner. So this examp
> I assume you meant "are not possible". I think someone previously
> posted a letrec macro using something he called a "Y* combinator". I
> don't know what that is, but he said it was slow.
http://groups.google.com/group/clojure/browse_thread/thread/3259f09e08be4cfd/21f0e19fdce15ae9?lnk=gst&q=
cool :)
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.c
I suspect that *command-line-arguments* would have "myapp.clj" as the
0th element in the
clj myapp.clj
Can't test right now though sorry.
On Jan 3, 3:34 am, "Mark Volkmann" wrote:
> I have a file of Clojure code that I'd like to experiment with in the
> REPL. I use (load file-path) to do that a
Ah, another left field idea:
if you test the namespace you will find running from REPL the
namespace will be user
running from the command will be clojure.core
I'm certain that will work as I've tested it in the past.
Bit of a hack, but should do the job.
--~--~-~--~~~-
Just a small typo I came across in the doc for Delay,
I believe 'than' should be 'that'
clojure.core/delay
([& body])
Macro
Takes a body of expressions and yields a Delay object than will
invoke the body only the first time it is forced (with force), and
will cache the result and return it
Loop on 'result' instead of the 'parts':
(defn my-func [& args]
(map inc args))
(loop [args '(0 0 0)]
(println args)
(if (< (first args) 10)
(recur (apply my-func args
(0 0 0)
(1 1 1)
(2 2 2)
(3 3 3)
(4 4 4)
(5 5 5)
(6 6 6)
(7 7 7)
(8 8 8)
(9 9 9)
(10 10 10)
Regards,
Tim.
--~--~-
> I suspect that *command-line-arguments* would have "myapp.clj" as the
> 0th element in the
> clj myapp.clj
> Can't test right now though sorry.
I tested this and it does work for me. If it does not work for you is
most likely in your clj script or bat file. I noticed on the wiki the
incorrect a
Hi Meikel,
Firstly thanks for making VimClojure, it is really great! I especially
like the rainbow parenthesis, that's extremely useful.
Also just reporting a small syntax highlighting consideration
user=> (def f #(println @%1))
#'user/f
user=> (f (atom 5))
5
@%1 tricks it and %1 is not shown a
A while ago I wrote a short MUD which had to keep track of a changing
group of players, and other data. Retrospectively I've developed a
helper which can update in place any mutable map, handles nested
access, and behaves like assoc on immutables.
It allows usage like so:
; set up a mutable map o
Hi Meikel,
On Jan 3, 9:03 pm, Meikel Brandmeyer wrote:
> java -cp my.app
I can't seem to get this approach working:
I created a directory "my"
and a file "app.clj" containing:
(ns my.app)
(defn somefunc [])
(println "somefunc!" args))
(defn main [& args]
(somefunc))
C:\java>java -cp .;"c:
>From a cursory examination of "literate programming" central tenants
appear to be:
(1) order by human logic
(2) use descriptive macros
(3) program is a web
(1) Is not possible in Clojure because it resolves symbols as it reads
them. However that is easy to work around with a trivial patch (see
h
"As the saying goes, a program without side-effects does nothing more
than make your CPU hot."
http://en.wikibooks.org/wiki/Learning_Clojure
http://groups.google.com/group/clojure/browse_thread/thread/fe8e6f306b9891a7/3e35a075ad45571a?lnk=gst&q=learning+clojure#3e35a075ad45571a
Posted by Brian W,
On Jan 6, 11:21 am, Stuart Sierra wrote:
> You might be able to simplify this by having just one Ref containing
> the global "state" of the game.
Hi Stuart, yes I agree that is the better approach.
I went down the 'multi-mutable' path trying to improve relationship
handling. Consider two rooms
Rich: You make the distinction that streams are not non-caching seqs.
I read this as meaning that they wont implement ISeq, they will
implement IStream, but conceptually they would be a non-caching
"sequence" (in the English phrase sense, as opposed to seq in the
interface sense), and they should
> Most structures of this type would start life as a uniquely-referenced
> structure (either empty or a copy of an immutable), and have
> lots of mutations effectively applied to them in a safe environment,
> until they are ready to be "frozen" and released to the world as
> an immutable version o
http://groups.google.com/group/clojure/browse_thread/thread/82b88a7f6d9f993/0680a4f5dbf6ee61?lnk=gst&q=keyword#0680a4f5dbf6ee61
RH: "The symbol String can name a class but the keyword :String can't
As far as '.', that restriction has been relaxed. I'll try to touch
up
the docs for the next releas
> thread should own the memory that's created. Each thread should have
> its own asynchronous stack to push local variables onto that no one
> else is allowed to see.
Just for the record, Clojure does support local variable that behave
exactly as you would expect them:
(with-local-vars [x 3]
(
My point was that it is not a missing capability,
Say you want to accumulate some changes, in this case sum odd numbers:
In C++ someone might write this:
int x = 0;
for (int i=0; i<100; i++) {
if ( i%2==1 ) x+=i;
}
However in Clojure you have a choice:
(reduce + (range 1 100 2))
Or you could
> is the @ symbol the same as a var-get . . . or is that an atom.
@ is a reader macro that translates to (deref ) which works on vars,
atoms, refs, agents.
and yes is interchangeable with var-get.
> Your sentence about atoms was very compound. I'm not sure if you said that
>you
> used an atom
Hi Boris
> (something goes wrong when sending off a million agents, and for a
> while I am only using 1 of the four CPU's.)
> (using send or send-off doesn't seem to make a difference here,
> performance or crash-wise)
Your issue is not agent specific,
consider this code which for me blows up wi
> I just want to get this out of my system, but I'm getting some class cast
> exception and no useful line number.
In situations like these I find that looking at the entire stack trace
provides clues. The REPL by default does not print the entire stack
though I'm sure there is a way to achieve t
> by the way, Tim, I've seen NB before as comments in J. What's it stand for?
An abbreviation for nota bene, a Latin expression meaning "note
well".
> I need to learn how to run closure code as a script then.
http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started
first section shows
> (if (l2)
The problem is on this line. (l2) is a function call.
Replace with (if l2
and it works fine :)
java.lang.IllegalArgumentException: Wrong number of args passed to:
LazilyPersistentVector (NO_SOURCE_FILE:0)
The error message bears a little explaining:
vectors are functions,
user=> (
> {:x 0 :y 0 :z 0}
> I think a map would have too much overhead to retrieve and set keys.
> Is that correct? Although this is the most straight-forward
> conversion.
How about a structmap?
http://clojure.org/data_structures
"StructMaps
Often many map instances have the same base set of keys, for
On Jan 13, 5:57 pm, e wrote:
> Instead of that being an error, why not overload the vector function so that
> no args calls the version that returns the list. That seems like a good
> idea! I wonder if people will object.
Actually in your case that would not work, because l2 can also be nil.
BTW Rich,
The documentation http://clojure.org/data_structures hints that
accessors are faster than regular map lookups and provides the
following example:
(reduce (fn [n y] (+ n (:fred y))) 0 x)
-> 45
(reduce (fn [n y] (+ n (fred y))) 0 x)
-> 45
However I think it would be cle
I've written small wiki article which dives right into the look and
meaning of common Clojure constructs with examples. Personally I find
I learn best by examples and when starting out they were hard to find,
whereas formal descriptions were there but rather cryptic when you
don't understand the c
> With repeated runs, and my cpu frequency set to not change, I get very
> little speed improvement. I increased the size of the example range
> times 10 for these runs:
For me there is a very clear speed improvement of at least 40%, doing
quite a lot of repeated runs. I can't run with range tim
> ;; I defined my own access method so that an accessor is not required,
> ;; however then you need to type hint which makes it too clumsy
> ;; performs very similar to an accessor, in theory slightly faster
Actually there is a very simple way to make "by index" quite usable
without user type hin
Your omission of (apply await agents) is allowing the program to
terminate before all your created threads finish I think.
If I might further comment, your threading model is not quite right to
me...
You've created 5 agents and then used them to 'send-off' as many
threads as there are projects.
I
Hi Chris
> What exactly are you trying to measure?
I think what Boris is expecting is that for 4 CPUs, running 1,2,3,4
equal work threads will take the same amount of time.
This is true when he calls loopfib, but not true when he calls
loopmult:
threads: 1
"Elapsed time: 205.458949 msecs"
"Ela
> fuzzy in my mind how some functions interact well with macros while
> some others don't.
Good:
(some-function (some-macro stuff))
Bad:
(some-function some-macro stuff)
For me I find it easiest to remember as "macros are not first class
functions" ie: they cannot be passed to and executed by o
+1 (and a windows .bat file for the unwashed)
I strongly suggest that the script name needs to be retained in
*command-line-args*.
ie: clj myscript.clj 1 2
*command-line-args* should be ("myscript.clj" 1 2)
not (1 2) which is the current behavior of your script with the
current clojure.main
$0 or
> My question is how the first agent (agent nil) and *agent* used
> later in another nestedsend-offrelated?
Agents execute their function with *agent* bound to themselves, so the
example given chains itself. This is necessary because the function is
only passed in the value of the agent, not the
> There are two pools of threads servicing agent actions. The send pool
> is fixed in size and based on the number of available cores. The send-
> off pool is variable in size and grows as needed to accommodate the
> largest number of simultaneous pending send-off calls that your
> program p
> goes up by only %15 for 3 threads... I would expect it to go up by %50
Actually I would expect it to go up by %100
t1t2
t1
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this grou
On a hunch I rearranged such that the agents are not recreated for
each run, but instead are reused from a pre-established set:
http://groups.google.com/group/clojure/web/mt2.2.clj
Strangely (from my understanding of agents) this has a significant
impact on the result!!!
threads: 1
"Elapsed tim
ris I suggest you try to re-run your test on your quad-core with the
latest SVN, as I don't think my laptop is really representative.
On Jan 17, 1:20 am, Timothy Pratley wrote:
> On a hunch I rearranged such that the agents are not recreated for
> each run, but instead are reused from a
> So I guess two mysteries solved with one patch!
Actually I spoke too soon... the mt2.clj is still giving the
'unexpected' behavior... I am still mystified.
But going to bed now :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I guess another way would be to just rebind *command-line-script* to
nil on subsequent loads? It doesn't feel like an complete solution but
I believe it covers the use cases discussed so far.
--~--~-~--~~~---~--~~
You received this message because you are subscribe
> (defn death
> [host]
> (dosync
> (if (not (empty? @host))
> nil)))
The agents initial value is a ref. Sometimes you set it to nil. nil
cannot be dereferenced. Perhaps you meant to set the ref to nil (if
(not-empty @host) (ref-set host nil)).
However I think you've gone a little of
> - First, it seems from the api documentation that @x will work fine even if
> x is a var. I don't understand the following:
> Why isn't x a var?
vars automatically resolve to their value for convenience, however you
can access the var using (var x) or use the shorthand #' notation
which does th
> What still riddles me is why the above
> script with the first formula (with the deref problem) doesn't always
> cause a problem, but maybe one in every 5 times I run it.
Sometimes it manages to queue up all the send functions before the
exception is thrown, but sometimes the exception is throw
Hi Emeka,
On Jan 19, 11:17 pm, janus wrote:
> that's why I' ve decided to 'outsource' :).I invite your comments and
> any code that might make this toy to worth 2 cents in today's market.
Reducing the amount of repetition :)
http://groups.google.com/group/clojure/web/2c-calculator.clj
Regards
While it doesn't answer your more general question, just pointing out
there is a Clojure min:
user=> (min 0 0.2)
0
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to
> How would one go about fixing f1 (or b1)?
Depends what you want to achieve... here are two possible 'fixes':
; don't use lazy evaluation
(defn f1 []
(doall (map (fn [x] *num* ) [1])))
; use lazy evaluation, but preserve the binding when the lazy sequence
is created
(defn f1 []
(let [myn
> Feedback welcome
Brilliant! :)
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure
Hi Greg
Here is a proof of concept of one approach you could take:
http://groups.google.com/group/clojure/web/job-queue.clj
A set of agents are maintained to represent computation jobs. When the
results are gathered, the agent is thrown away. I think using multiple
agents in this way could be qu
> (both CPU and IO bound at different stages of processing) so
> it's ideal to have a thread pool to process different tasks in
> parallel, even though they are independent.
If you use the agents, the underlying implementation uses two thread
pools:
(1) static relative to your processors, use "se
On Jan 23, 11:24 am, e wrote:
> wow. I wonder if I could use this for the quicksort I was talking about.
Interesting question. I can't think of an elegant way to implement an
agent based parallel quicksort because await cannot be used
recursively. So I implemented a version using Futures inst
Hi Anand,
Here is an example from core.clj:
(definline doubles
"Casts to double[]"
[xs] `(. clojure.lang.Numbers doubles ~xs))
As you can see it is using macro magic as you would expect for in-
lining.
Regards,
Tim.
On Jan 25, 11:06 pm, Anand Patil
wrote:
> Hi all,
>
> I'd like to repea
On Jan 23, 10:43 pm, e wrote:
> Just to understand ... 'send-future' works too but you don't think that's
> the way to go?
The Agent send pool has a limited size, so doing recursive calls with
a stack greater than that size will result in a freeze (waiting for
new threads that can't be made ye
Here is one way:
(let [dbc (make-db)]
(defn get-apples []
(.query dbc "select * from apples")))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@go
> Can anyone point me to simple examples of how concurrency works in
> Clojure? (Not just one-liners, but examples that actually modify
> values from multiple threads, and hopefully print out some helpful
> information?
Rich's ants example is really good:
http://clojure.googlegroups.com/web/ants
> I read
> somewhere that I should do those things only in the "event dispatch
> thread", and that SwingUtilities.invokeLater(Runnable) would make that
> work. But I'm not sure if I get it yet; why would I need to do that?
The GUI runs in its own thread (the event thread). If you tried to
update
I want to grow a tree programmatically so have been trying zippers:
(defn insert-parent [loc n]
(clojure.zip/replace loc (clojure.zip/make-node
loc n loc)))
(println (clojure.zip/root (insert-parent (clojure.zip/seq-zip (list
1)) 2)))
(println (clojure.zip/root (clo
Thanks :)
That works great. I wrote a simple math precedence parser based upon
it:
http://github.com/timothypratley/strive/blob/195c350485a7f01c7ddef01a85d1fd4fc1652fd9/src/clj/math-tree.clj
Test expression [1 + 2 * 3 ^ 4 + 5 * 6]
(+ 1 (* 2 (^ 3 4)) (* 5 6))
Regards,
Tim
--~--~-~--~~
> I just wonder if there is a limit to how long the sequence can be,
> because apply should use the Java calling stack, right?
str is only called once, with many arguments:
user=> (apply str (range 1))
Only limit is total memory (like anything).
--~--~-~--~~~---
Great! That's really handy.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubsc
> Patch welcome for this.
http://code.google.com/p/clojure/issues/detail?id=55&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To p
On Jan 29, 6:03 am, janus wrote:
> While reading Programming Clojure the other night I found this code
> interesting (+), however, when I tried out (-) I got my fingers burnt.
> Why this? Or did I do something wrong which has nothing to do with
> the code in question?
You didn't do anything wro
Thanks for the detailed explanation Steve!
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
Hi Stuart,
On Jan 30, 1:43 pm, Stuart Sierra wrote:
> I have put together a another implementation of Cells.
Cool!
One of the things I really like about Cells is that it can really take
the pain out of MVC style GUI building:
http://github.com/timothypratley/strive/blob/8285ef1419601411797205d
Hi Stuart,
> One option would be to use a second agent as a flag. My really-long-
> action function could periodically check the value of that agent, and
> terminate if it's been set to true. But would it be possible to
> provide a generic interrupt mechanism that doesn't require modifying
> th
Hi Jeffrey,
On Feb 1, 4:50 am, Jeffrey Straszheim
wrote:
> However, I'm not sure if you can built your own predicates in Java
> code (and therefore in Clojure code). That seems like a feature we'd
> want. I've sent an email to their support folks to find out if this
> is possible.
I gave it a
Hi Vlad,
A very useful guide.
> PS: Comments welcome...
Ok great, let me nitpick! :)
The java class you posted doesn't compile (unless name is renamed
person_name, and location renamed person_location).
The quote symbol rendered is not copy+paste friendly.
You can call main very easily: (MainF
Just thought I'd share this link:
http://www.murat-knecht.de/schuerfen/irisdoc/html-single/index.html
Particularly Examples 1.2 and 1.6 show how the parts fit together.
I really wish I saw that before attempting anything :) Well now I know
for next time.
--~--~-~--~~~--
Hi Vlad,
> Options are good :-). Any objections on including your variant in the
> guide?
Feel free to use it as you wish.
> It looks that the main is class method? It can be called as above but
> I do not know if/how to call that after the MainFrame has being
> created (i.e calling it on res
> On further reflection, perhaps the best approach would use sorted-map:
Just curious, does the key need to be in the struct? (seeing you'll
get key-value pairs anyhow if you use first/last etc - the info will
still be there)
If you do need the key in both places, perhaps something like this
http
This works for me:
(def wrap-var)
(defmacro datalog-term
"Builds a term"
[relation & formals]
(let [wrapped-formals (map wrap-var formals)]
`(struct rule ~relation (hash-map ~...@wrapped-formals
ie: using (has-map ...) instead of {}
I believe this is because {} is handled at the re
> providing relations from clojure-sets and sql-queries.
Wow - this is really neat Erik - thanks for showing
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to cloj
> java.lang.ClassNotFoundException: gui2.MainFrame
To resolve gui2.MainFrame there needs to be MainFrame.class, in
directory gui2, in the current class-path.
Please check:
1) The directory name matches the namespace (If you can't get mklink
working, maybe just copy it instead?)
2) The current dir
> C:\Users\Mike\Documents\test-project>c:\clojure\clj.bat app.clj
> Exception in thread "AWT-EventQueue-0" java.io.IOException: Stream
> closed
The reason you are seeing this is that stdout has closed when the main
clj program reaches the end, but the Swing thread is still running. I
remember ha
1 - 100 of 452 matches
Mail list logo