That whole form is not something you would be likely to write. I think the
exercise is just trying to demonstrate that the version with the - is
equivalent to the version without the arrow and perhaps also that (= a b c)
can be used instead of (and (= a b) (= b c)).
--
Michael Wood
On 01 May
Is this a nice explanation about macros :
http://bryangilbert.com/code/2013/07/30/anatomy-of-a-clojure-macro/
or is there a better one for a beginner.
Roelof
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I think the confusion is because they used multiple values when comparing
the equality
(= (__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
5)
This can be seen as :
(def A (__ (sort (rest (reverse [2 5 4 1 3 6])
(def B (- [2 5 4 1 3 6] (reverse)
Op donderdag 1 mei 2014 15:20:38 UTC+2 schreef Erlis Vidal:
I think the confusion is because they used multiple values when comparing
the equality
(= (__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
5)
This can be seen as :
(def A (__
On Thu, May 1, 2014 at 3:51 PM, Roelof Wobben rwob...@hotmail.com wrote:
Op donderdag 1 mei 2014 15:20:38 UTC+2 schreef Erlis Vidal:
I think the confusion is because they used multiple values when comparing
the equality
(= (__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6]
The task is to replace __ with the function that makes this true in this
case makes [1 2 3 4 5] to 5
On Thu, May 1, 2014 at 4:23 PM, Maik Schünemann
maikschuenem...@gmail.comwrote:
On Thu, May 1, 2014 at 3:51 PM, Roelof Wobben rwob...@hotmail.com wrote:
Op donderdag 1 mei 2014 15:20:38
Look that (def A ...) won't compile as given, so you cannot say A is [1 2 3
4 5], A is something else once you make it compile filling the blank space
with the missing function.
On Thu, May 1, 2014 at 10:24 AM, Maik Schünemann
maikschuenem...@gmail.comwrote:
The task is to replace __ with the
oke,
I misunderstood everyone.
The right answer is last.
(def A (__ (sort (rest (reverse [2 5 4 1 3 6])
which would be :
(def A (last (sort (rest (reverse [2 5 4 1 3 6])
which resolves to 5
(def B (- [2 5 4 1 3 6] (reverse) (rest) (sort) (__)))
Which would be :
(def B (- [2 5 4 1
On 4 clojure there it this exercise:
(= (__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
5)
if I understand it right this is happen
reverse[ 2 5 4 1 3 6] gives [ 6 3 1 4 5 2 ]
Then rest [ 6 3 1 4 5 2] gives [ 3 1 4 5 2]
Sort this and you get [ 1
You have to replace the underscore with a function. The value of (= (_ [1 2
3 4 5]) 5) must be true. So the value of (_ [1 2 3 4 5]) must be 5. So the
function you are looking for will have to return the last element of the
array.
On Wednesday, April 30, 2014 5:28:26 PM UTC+2, Roelof Wobben
It looks like a quiz. Which function should stand in place of underscores
to give 5 in result?
On Wed, Apr 30, 2014 at 7:28 PM, Roelof Wobben rwob...@hotmail.com wrote:
On 4 clojure there it this exercise:
(= (__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest)
These two forms are equivalent:
(__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
The - macro turns the second form into the first. You can see this by
running macroexpand-all:
(require '[clojure.walk :refer [macroexpand-all]])
Op woensdag 30 april 2014 18:46:36 UTC+2 schreef James Reeves:
These two forms are equivalent:
(__ (sort (rest (reverse [2 5 4 1 3 6]
(- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
The - macro turns the second form into the first. You can see this by
running
Op woensdag 30 april 2014 19:12:24 UTC+2 schreef James Reeves:
The 5 is just the last part of the equality statement. This might be
easier to see by adding in a let:
(let [x (__ (sort (rest (reverse [2 5 4 1 3 6]
y (- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))]
(= x y 5))
The 5 is just the last part of the equality statement. This might be easier
to see by adding in a let:
(let [x (__ (sort (rest (reverse [2 5 4 1 3 6]
y (- [2 5 4 1 3 6] (reverse) (rest) (sort) (__))]
(= x y 5))
- James
On 30 April 2014 18:09, Roelof Wobben rwob...@hotmail.com
The __ needs to be replaced with a function. So essentially it boils down
to:
(= (__ [1 2 3 4 5]) 5)
What function when called with [1 2 3 4 5] returns 5?
- James
On 30 April 2014 18:18, Roelof Wobben rwob...@hotmail.com wrote:
Op woensdag 30 april 2014 19:12:24 UTC+2 schreef James
Op woensdag 30 april 2014 19:46:41 UTC+2 schreef James Reeves:
The __ needs to be replaced with a function. So essentially it boils down
to:
(= (__ [1 2 3 4 5]) 5)
What function when called with [1 2 3 4 5] returns 5?
- James
Thats a easy one . That is last.
But what I try to
17 matches
Mail list logo