What's the cleanest way to run a piece of code if any branch of a cond
statement succeeded, without relying on the return value of the
individual clauses not to be nil?
For example, if I have the following piece of code that says I can
only move left or up
(cond
(= dir :left) (move-left)
(=
On Sat, Nov 5, 2011 at 11:55 AM, Martin DeMello martindeme...@gmail.com wrote:
What's the cleanest way to run a piece of code if any branch of a cond
statement succeeded, without relying on the return value of the
individual clauses not to be nil?
For example, if I have the following piece of
On Nov 4, 11:49 pm, Baishampayan Ghose b.gh...@gmail.com wrote:
On Sat, Nov 5, 2011 at 11:55 AM, Martin DeMello martindeme...@gmail.com
wrote:
What's the cleanest way to run a piece of code if any branch of a cond
statement succeeded, without relying on the return value of the
individual
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
what about
(cond (= dir :left) ((move-left)(:ok)) (= dir :up)
((move-up)(:ok)) :else :nok)
or whatever the exact syntax is
Am 05.11.2011 08:22, schrieb Alan Malloy:
On Nov 4, 11:49 pm, Baishampayan Ghose b.gh...@gmail.com wrote:
On Sat, Nov 5,
Assuming that you meant (do (move-left) (:ok)), this is insufficient
except in the rare case where he doesn't care about the return value
of move-left.
On Nov 5, 2:18 am, Dennis Haupt d.haup...@googlemail.com wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
what about
(cond (= dir
Hi,
given a namespace sources
with [simplified definitions]
(defrecord Source [name url])
(def google (source Google google.com))
(def bbc (source BBC bbc.co.uk))
(def nbc ...
etc.
what would be the idiomatic way to implement
(defn get-all-sources)
cheers
Colin
--
You received this
Would something like:
(def ^:dynamic *SOURCES* (ref []))
(defrecord Source [name url])
(defmacro defsource [name url]
`(dosync (alter *SOURCES* conj (Source. ~name ~url
(defn get-all-sources [] @*SOURCES*)
(defsource Google google.com)
do ok?
Man - it's been too long since I've done
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
hi,
i'm half done with my asteroids clone. i stumbled over a few problems
and wanted to know how others already solved them :)
i am used to less concrete programming. i ask my tools to do the
actual analysis and coding for me:
* where is that used?
Hi there,
consider there exists foo.jar on Clojars which contains a bunch of asset files
i.e. png images. If I were to declare foo as one of my project's dependencies,
is it possible to get access to those asset files? I essentially want a path to
a non-zipped version of each asset.
Sam
---
On Sat, Nov 5, 2011 at 14:42, Sam Aaron samaa...@gmail.com wrote:
Hi there,
consider there exists foo.jar on Clojars which contains a bunch of asset
files i.e. png images. If I were to declare foo as one of my project's
dependencies, is it possible to get access to those asset files? I
Sam,
consider there exists foo.jar on Clojars which contains a bunch of asset
files i.e. png images. If I were to declare foo as one of my
project's dependencies, is it possible to get access to those asset files? I
essentially want a path to a non-zipped version of each
asset.
I think
Hi,
https://github.com/dbelikov/Mini-MVP
Introduction
The main goal for Mini-MVP (Model View Presenter) library is to
clearly separate your models from business logic and UI representation
while maintaining their relationships in a concise and well-defined
manner.
Let's say you have some data
My development environment on Windows 7 is as follows.
--
C:\work lein version
Leiningen 1.6.2-SNAPSHOT on Java 1.7.0 Java HotSpot(TM) Client VM
--
I created a new
On 04/11/2011, at 9:16 PM, Michael Fogus mefo...@gmail.com wrote:
Any thoughts about when / where these events can take place?
At this point it would be great if a Conj-planning heavyweight could
step in and provide some additional ideas... although solutions would
be great too. :-)
Interesting - thanks for this. So is it fair to assume that the JVM is ok with
reading URL resources that are zipped in a jar. I also assume to have an actual
non-zipped version of the resource I need to copy the file from inside the
zipped jar to an external path in my file system?
Sam
---
Hi,
I would like to use logic programing to describe permissions. The
definition is
We have set of triples which looks like:
Set of roles; set of operations; set of states
Triples are defined in scope of some entity with states, wildcard is
defined with _
All I need is to answer on some
could you not just use a map?
(def sources {:bbc bbc.co.uk :google google.com ...})
On Sat, Nov 5, 2011 at 6:14 AM, Mark Derricutt m...@talios.com wrote:
Would something like:
(def ^:dynamic *SOURCES* (ref []))
(defrecord Source [name url])
(defmacro defsource [name url]
`(dosync (alter
Hey Michael,
Here's a solution using core.logic.
;; We can define a permission relation with defrel.
(defrel permission roles ops state)
;; and a helper function to add each combination of permissions
(defn add-permision [roles ops states]
(for [r roles
o ops
s states]
I gave the wildcard requirement a bit of thought, no inspiration at the
moment.
Maybe someone else can suggest a strategy.
Ambrose
On Sun, Nov 6, 2011 at 1:14 AM, Ambrose Bonnaire-Sergeant
abonnaireserge...@gmail.com wrote:
Hey Michael,
Here's a solution using core.logic.
;; We can
For wildcards you can use symbol-macrolet from tools.macro
(macro/symbol-macrolet [_ (lvar)]
(all
(== [_ _ [_ _ 'milk _ _] _ _] hs)
))
On Sat, Nov 5, 2011 at 1:24 PM, Ambrose Bonnaire-Sergeant
abonnaireserge...@gmail.com wrote:
I gave the wildcard requirement a bit of thought,
Thanks, it gave me insight into that framework.
Unfortunately it doesn't look friendly in usage.
Looks like there is a place for a clojure lib or wrapper around
core.logic.
It would be nice if it could answer to questions also in terms of
truth.
On 5 Lis, 18:24, Ambrose Bonnaire-Sergeant
I would probably write the code like this:
(defrel permission role op state)
(defn add-permision [roles ops states]
(doseq [r roles o ops s states]
(fact permission r o s)))
(add-permision #{:admin :operator} #{:reject :accept} #{:applied})
(defn permissiono [role op state]
(run* [q]
Now is ok, easy to grasp. How the lein dep declaration and clj import
looks?
Thank you both.
On 5 Lis, 20:11, David Nolen dnolen.li...@gmail.com wrote:
I would probably write the code like this:
(defrel permission role op state)
(defn add-permision [roles ops states]
(doseq [r roles o
Btw. Is there any fine tutorial for core.logic? By fine I mean
something like learn haskell for great good.
On 5 Lis, 20:26, Michael Jaaka michael.ja...@googlemail.com wrote:
Now is ok, easy to grasp. How the lein dep declaration and clj import
looks?
Thank you both.
On 5 Lis, 20:11, David
There's nothing like a Learn You A core.logic, but Ambrose and Ryan
Senior's tutorials are pretty great.
https://github.com/frenchy64/Logic-Starter/wiki
http://objectcommando.com/
David
On Sat, Nov 5, 2011 at 3:34 PM, Michael Jaaka
michael.ja...@googlemail.comwrote:
Btw. Is there any fine
I think Colin's record may be more detailed that just a key/value, he
mentioned 'simplified definitions' so I'm guessing there things elided from
the post.
--
Great artists are extremely selfish and arrogant things — Steven Wilson,
Porcupine Tree
On Sun, Nov 6, 2011 at 6:03 AM, gaz jones
On Sat, Nov 5, 2011 at 6:57 AM, Young Kim philo...@gmail.com wrote:
The unexpected result was that the message Ran 5 tests containing 8
assertions.
The expected message was that Ran 3 tests containing 4 assertions,
because of two dertest- macros in my test code.
How can I block the
What times are available?
How can I choose a time for the literate session?
Tim Daly
On Sat, 2011-11-05 at 10:37 -0400, Doug South wrote:
On 04/11/2011, at 9:16 PM, Michael Fogus mefo...@gmail.com wrote:
Any thoughts about when / where these events can take place?
At this point it
Actually that does seem the most idiomatic approach
(def sources
{:bcc source(bbc.. ),
:google source(),
}
(defn all-sources []
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Actually that does seem the most idiomatic approach
(def sources
{:bcc source(bbc.. ),
:google source(),
}
(defn all-sources []
(vals sources))
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I'll plug Scripturian here, a library I wrote that has very good
thread-aware support for embedding Clojure, as well as other JVM languages
(JavaScript, Python, Ruby, PHP, Groovy):
http://threecrickets.com/scripturian/
I just recently wrote a detailed tutorial for it, which was missing for a
On Friday, November 4, 2011 9:16:08 PM UTC-4, Fogus wrote:
At this point it would be great if a Conj-planning heavyweight could
step in and provide some additional ideas... although solutions would
be great too. :-)
Oh, I guess that's me.
See the
So, to be specific, lets assume that the literate programming
session will meet in the presidential boardroom at 7pm on
wednesday evening. It will likely be a small group and I don't
expect it to take long. It is only scheduled for 15 minutes.
Tim Daly
On Sat, 2011-11-05 at 19:10 -0700,
Okay, I'm trying to understand records. I read this article:
http://freegeek.in/blog/2010/05/clojure-protocols-datatypes-a-sneak-peek/
(Clojure Protocols Datatypes - A sneak peek by Baishampayan Ghose. I
found it helpful, but the usage of datatypes and protocols looks/feels
very object-oriented
Protocols are a way to achieve polymorphism. Clojure protocols are similar to
Haskell types classes.
Here is a video that explains clojure protocols: http://vimeo.com/11236603
Matt Hoyt
From: stevelewis spiritm...@gmail.com
To: Clojure
On Nov 5, 2011, at 10:10 PM, Christopher Redinger wrote:
On Friday, November 4, 2011 9:16:08 PM UTC-4, Fogus wrote:
At this point it would be great if a Conj-planning heavyweight could
step in and provide some additional ideas... although solutions would
be great too. :-)
Oh, I guess
On Fri, Nov 4, 2011 at 6:16 PM, Michael Fogus mefo...@gmail.com wrote:
Any thoughts about when / where these events can take place?
At this point it would be great if a Conj-planning heavyweight could
step in and provide some additional ideas... although solutions would
be great too. :-)
Okay, I'm trying to understand records. I read this article:
http://freegeek.in/blog/2010/05/clojure-protocols-datatypes-a-sneak-peek/
(Clojure Protocols Datatypes - A sneak peek by Baishampayan Ghose. I
found it helpful, but the usage of datatypes and protocols looks/feels
very
38 matches
Mail list logo