Hi,
For Assembla, I first had to watch the Clojure space in order to
post a ticket. (It's a confusing interface.) Though it explicitly told
me I should, so perhaps that's not the problem you face.
For posting on clojure-dev, I asked about it on IRC and Rich added
me... I'm sure you can just
Hi Base,
Perhaps something like the following:
(defn normalize-creatures [creatures]
(letfn [(split [str] (seq (.split str \\s)))]
(for [{:keys [animal sound number-of-feet]} creatures]
(map (fn [a s n]
{:animal a :sound s :number-of-feet n})
(split animal)
})
; ({:number-of-feet 4, :sound howl, :animal wolf}
; {:number-of-feet 4, :sound oink, :animal pig}))
Of course, there's probably a better way to write that.
-Brendan
On Fri, Mar 5, 2010 at 4:36 PM, Tayssir John Gabbour
t...@pentaside.orgwrote:
Hi Base,
Perhaps something like
Hi,
I'm having problems with nested syntax-quotes, or something.
This works fine:
(use 'clojure.contrib.macro-utils)
(def *a* nil)
;; good
(defmacro my-macro [ body]
`(let [name# {#'*a* :new}]
(macrolet [(~(symbol 'with-my-macrolet) [ body#]
(concat (list
All the best,
Tayssir
On Feb 19, 2:56 pm, Tayssir John Gabbour tayssir.j...@googlemail.com
wrote:
Hi,
I'm having problems with nested syntax-quotes, or something.
This works fine:
(use 'clojure.contrib.macro-utils)
(def *a* nil)
;; good
(defmacro my-macro [ body]
`(let
On Feb 19, 1:12 pm, Chris Perkins chrisperkin...@gmail.com wrote:
On Feb 19, 4:32 am, timc timgcl...@gmail.com wrote:
Is #= an undocumented reader macro character?
Interesting - I had never heard of it either. It appears to allow you
to execute code at read-time.
user= (read-string (foo
Hi,
On Feb 19, 6:16 pm, Michał Marczyk michal.marc...@gmail.com wrote:
You missed a quote (~name# - ~'name#); this works fine:
(defmacro my-macro [ body]
`(let [name# {#'*a* :new}]
(macrolet [(~(symbol 'with-my-macrolet)
[ body#]
`(with-bindings
Hi!
I've been playing with error-kit, and like a ranting guy on the street
I'd like to share random thoughts...
* I'll probably come to rely on error-kit, or something like it.
Suppose you're playing with nakkaya's distributed computing thingie ¹;
you could hook simple listeners to do stuff
Hi!
Yesterday I installed Slime Clojure via ELPA. Unfortunately, the
REPL had no indent support for [] and {}. So this workaround runs in a
slime-repl-mode-hook:
(defun set-clojure-brackets ()
(interactive)
(set-syntax-table clojure-mode-syntax-table)
(set (make-local-variable
Hi,
On Feb 11, 1:46 pm, HB hubaghd...@gmail.com wrote:
Since Clojure is a LISP dialect, does this mean that it doesn't
support OOP?
Careful not to come to the conclusion that if something's a Lisp, it's
not OOP.
For instance, Common Lisp has a powerful OOP system which includes
On Feb 4, 3:31 am, wlr geeked...@gmail.com wrote:
(- #{{:a 1, :b 1, :c 1}
{:a 2, :b 2, :c 2}
{:a 3, :b 3, :c 3}}
(- (select #(= (:a %) 1)))
(project [:b :c]))
= #{{:c 1, :b 1}}
Ahhh.. what a tricky language. ;) This saves me from writing reverse-
args or
Hi,
On Feb 4, 3:08 pm, Sean Devlin francoisdev...@gmail.com wrote:
Do we have a concise way of doing this? Is it actually useful?
http://www.artima.com/weblogs/viewpost.jsp?thread=281160
Yep, see clojure.contrib.types/match.
I recently used it in an almost frivolous way in this thread,
On Feb 4, 3:28 pm, Tayssir John Gabbour tayssir.j...@googlemail.com
wrote:
I can't say I haven't used pattern matching as much as I probably
should,
Excuse me, I mean that I haven't used it much though I keep hearing
about it...
--
You received this message because you are subscribed
Hi!
set/select is hard to thread with the other clojure.set functions
using -, because its argument order is different.
I currently use a reverse-args function like the following:
(defn revargs [f]
(fn [ args]
(apply f (reverse args
((revargs select) xset pred)
Is there a better
Ah... thanks everyone, now I no longer have that creepy feeling that
reality went weird.
I now see why m-result looks so pointless -- it's maybe like when
I'm writing code which uses mapcat a lot and the base case is a
disturbing-looking [nil] rather than just plain nil. It's not really
Hi,
I have a problem with monads. Here's the first law which monads must
fulfill (taken from 2 different tutorials):
(= (m-bind (m-result value) function)
(function value))
--
http://onclojure.com/2009/03/06/a-monad-tutorial-for-clojure-programmers-part-2/
(m-bind (m-result x) f) is
On Dec 15, 1:23 pm, Baishampayan Ghose b.gh...@ocricket.com wrote:
PS - If you are worried about compile time type checking, I think it's
prudent to mention now that Clojure is a dynamically typed programming
language where types are checked at run-time and not compile time.
Actually, there
Hi!
Taking minor liberties with your code (for clarity), the following
gives pretty much the same result as your handle-xml function:
(ns blah
(:require [clojure.xml :as xml]
[clojure.zip :as zip])
(:use clojure.contrib.zip-filter.xml))
(defn my-test []
(doseq [x (xml-
the stuff that xml- accepts,
just note that much of it is syntactic sugar, for your convenience.
Tayssir
On Dec 2, 7:41 pm, Tayssir John Gabbour tayssir.j...@googlemail.com
wrote:
Hi!
Taking minor liberties with your code (for clarity), the following
gives pretty much the same result as your
Hi,
As an occasional Clojure user, and someone who's used Common Lisp a
lot, I'd venture that Clojure is a good first choice. But let me
metion areas of difficulty first. Geoffrey Teale discussed the big
things, so let me mention some little ones:
- Java's classpath currently demands that you
Interestingly, there's this book which is a crash course on building a
computer stack from the ground up: from logic gates, to a compiler, to
an OS. And the simulator, in which you build all these things, is in
Java.
Nisan/Schocken's _The Elements of Computing Systems_: http://
Interestingly, there's this book which is a crash course on building a
computer stack from the ground up: from logic gates, to a compiler, to
an OS. And the simulator, in which you build all these things, is in
Java.
Nisan/Schocken's _The Elements of Computing Systems_: http://
Hi,
Just chiming in a bit late -- just wanted to say that Clojure has
really been saving my butt these last three long days. My customer has
a codebase which is written in a language without any sort of fancy
REPL. I'm able to tap into that system and have Clojure draw out the
info, so I can
On Oct 22, 5:05 pm, Tayssir John Gabbour tayssir.j...@googlemail.com
wrote:
What's been very helpful is clojure.zip and clojure.set; I needed to
correlate data which came from a DB and an XML file -- and it was
immediately obvious that clojure.set/join and clojure.set/rename could
do it in 4
Hi!
Is anyone else working on a Common Lisp style loop? I'd hate to
duplicate effort.
I wrote one yesterday, though I still have to read that stuff on how
to decently package a lib. ;)
http://github.com/tayssir/cl-loop/tree/master
(I might not have written this, but I couldn't figure out a
not really on top of things.
http://common-lisp.net/project/iterate/
On Sep 7, 6:59 am, Tayssir John Gabbour tayssir.j...@googlemail.com
wrote:
Hi!
Is anyone else working on a Common Lisp style loop? I'd hate to
duplicate effort.
I wrote one yesterday, though I still have to read
On Aug 19, 1:08 am, tmountain tinymount...@gmail.com wrote:
Hi, I was wondering if there's a more idiomatic way to do the
following:
(defn flip-coin []
(int (rand 2)))
To add to CuppoJava's advice, (rand-int 2) is a synonym of (int (rand
2)).
All the best,
Tayssir
On this topic, how do primitives work? I heard something about
function boundaries. Which I interpret to mean that when a function
returns a primitive, Clojure boxes it in some Java object. And type
declarations can't stop this boxing from happening.
Is this a correct understanding? (I doubt it
+ disappears after
compiletime.
If correct, that makes sense.
Thanks for the enlightenment,
Tayssir
On Aug 12, 12:01 pm, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
On Aug 12, 11:54 am, Tayssir John Gabbour
tayssir.j...@googlemail.com wrote:
On this topic, how do primitives work? I heard
Hi Tim,
On Jul 11, 4:39 am, Tim Snyder tsnyder...@gmail.com wrote:
I've been experimenting with the idea of performing compile-time
partial evaluation of calls where possible, using a macro. I must
preface this discussion that I realize it is a bit of an abuse of
macros.
This isn't an
Hi Ben,
This is sitting in my .emacs file:
(set-language-environment UTF-8)
(setq slime-net-coding-system 'utf-8-unix)
(I don't know whether it'll work for you, just as I don't know whether
all the things sitting in my fridge are edible... Good luck. ;)
Tayssir
On Jul 2, 9:00 pm, B
Hi!
How should I approach serialization? I made a little test function
which serializes and deserializes Clojure objects. It works for
strings, integers, symbols, LazilyPersistentVectors and.. oddly..
PersistentHashMaps that have exactly one element. (My Clojure is about
a month old.)
But for
John Gabbour [EMAIL PROTECTED]
wrote:
Hi!
How should I approach serialization? I made a little test function
which serializes and deserializes Clojure objects. It works for
strings, integers, symbols, LazilyPersistentVectors and.. oddly..
PersistentHashMaps that have exactly one element. (My
Hi!
When I attempt to run Slime, this error pops up in *inferior-lisp*:
user= java.lang.UnsupportedOperationException: Vars are not values
(basic.clj:12)
user= java.lang.Exception: No such var: swank/ignore-protocol-version
(NO_SOURCE_FILE:5)
user= java.lang.Exception: No such var:
34 matches
Mail list logo