On 9 August 2010 22:16, Alan a...@malloys.org wrote:
Weird. I wonder if I was using an outdated version of Clojure or (more
likely) assumed from (doc drop-while) that it wouldn't handle false
the way I wanted. When doc says not nil should I assume it means
neither nil nor false, or should the
Hi all, I'm new to the group; I have some experience with both CL and
Java, though it's been a while for each. Anyway I really like Clojure
as a way of combining the best parts of the two languages, but I'm
still getting the hang of it and there are often things that confuse
me.
For example, I
you can do this using partition.
let's assume I first define a
user= (def a [:w :n :e :s])
#'user/a
user= (partition 2 1 (conj a (first a)))
((:w :n) (:n :e) (:e :s) (:s :w))
gives you the pairs you need.
then you just need to turn it into hash-map
by doing
(map #(apply hash-map %)
It works with booleans:
user= (drop-while neg? [-3 -2 -1 0 1 2 3 ])
(0 1 2 3)
user= (class (neg? -5))
java.lang.Boolean
On Aug 9, 12:09 pm, Alan a...@malloys.org wrote:
Hi all, I'm new to the group; I have some experience with both CL and
Java, though it's been a while for each. Anyway I
On Aug 9, 2:09 pm, Alan a...@malloys.org wrote:
Hi all, I'm new to the group
Welcome!
I wanted to define a ring function, which takes as input
N objects, and returns a hash table mapping object N to object N+1
(mod N). I intended to use this to describe a compass object:
(ring :w :n :e :s)
Also sorry the indentation is so awful. How do I get Google to let me
compose/edit in a fixed-width font?
On Aug 9, 12:09 pm, Alan a...@malloys.org wrote:
Hi all, I'm new to the group; I have some experience with both CL and
Java, though it's been a while for each. Anyway I really like Clojure
Weird. I wonder if I was using an outdated version of Clojure or (more
likely) assumed from (doc drop-while) that it wouldn't handle false
the way I wanted. When doc says not nil should I assume it means
neither nil nor false, or should the doc for drop-while be updated?
user= (doc drop-while)
When doc says not nil should I assume it means
neither nil nor false
Nope, false won't be taken as nil; in boolean expressions nil
evaluates to false. drop-while's doc mentions only nil but since it's
the predicate's return value it should be clear enough, I think.
--
You received this