This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-12
Channels
- # admin-announcements (56)
- # beginners (67)
- # boot (159)
- # cider (5)
- # cljs-dev (16)
- # cljsjs (7)
- # clojure (142)
- # clojure-dev (15)
- # clojure-japan (1)
- # clojure-poland (1)
- # clojure-russia (33)
- # clojurebridge (2)
- # clojurecup (1)
- # clojurescript (56)
- # cursive (3)
- # datavis (2)
- # datomic (29)
- # devops (6)
- # editors (1)
- # emacs (3)
- # hoplon (95)
- # ldnclj (15)
- # leiningen (18)
- # off-topic (10)
- # om (12)
- # onyx (7)
- # parinfer (6)
- # proton (1)
- # spacemacs (3)
- # yada (2)
just started clojure recently as a javascripter, read this just now and it helped heavily: https://yogthos.github.io/ClojureDistilled.html
Has anyone found and good resources on deploying an app with Datomic, I’ve been teaching myself to use Docker this past week, trying make all the pieces fit together, dealing with a lot of dev-ops stuff I’d never encountered before. Starting to wonder if I would have been better off sticking with heroku. Anyone recently deploy for first time? https://github.com/opengrail/heroku-buildpack-datomic
Can anyone help me find out how I can make this work so I can calculate things like 2 ^ 3
my code so far is this :
(defn test-recursion
[ x y]
(reduce (fn [acc ] (* acc )) x (range 1 (+ y 1)))
)
Does anyone know where i can find the api of incanter? The normal site at http://liebke.github.io/incanter is 404ing for me...
Thanks, @alexmiller ! I guess the links on the readme in github and ond their site need to be replaced.
yeah, looks like it was moved
A maybe stupid beginners question . Lets say I have the number 81 and I want to place it into a list like this ( 8 1)
@roelof you could also map over a seq of powers of 10, div yr number by 'em then take-while >0 and reverse
oke, but then if a number is bigger then the greatest power the answer will not be right
I try to understand how I can solve this problem : http://www.4clojure.com/problem/99
@roelof: To add to your comment on having a problem with the biggest value: Clojure will promote to BigInteger, so no problems
That is if one of the arguments passed is a BigInteger already, for example: (type (+ Long/MAX_VALUE 1)) ;=> overflow
but (type (+ Long/MAX_VALUE 1N)) ;;=> clojure.lang.BigInt
@bloemelau: Character/getNumericValue is java ?
@roelof (iterate #(* 10 %) 1)
is an infinite sequence of powers of 10 - you can use that
@mccraigmccraig: oke, I have to think how that can work for me
lazy seq transformation can do that to a head 🙂🙃🙂🙃🙂
Is there a good blog or site with some examples of using clojure.test?
Just more proof that (not= "simple" "easy")
Oh...how did you do that?
Clojurebot - you can submit Clojure expression prefaced by /clj
:thumbsup:
Cool...thanks
@rantingbob: There are lots of examples in Clojure github repo's. Have a look at this too http://blog.jayfields.com/2010/08/clojuretest-introduction.html
I tried something like this (reduce (fn[acc it] (conj acc it)) () [(str(128))] )
but that does not work
(defn digs [n]
(->> (iterate #(* 10 %) 1)
(map (fn [p]
(when (<= p n)
(quot
(- n (* (* p 10) (quot n (* p 10))))
p))))
(take-while identity)
reverse))
and in any base (<=10)
(defn digs
([n] (digs n 10))
([n b]
(->> (iterate #(* b %) 1)
(map (fn [p]
(when (<= p n)
(quot
(- n (* (* p b) (quot n (* p b))))
p))))
(take-while identity)
reverse)))
much neater :
(defn digs
([n] (digs n 10))
([n b]
(->> n
(iterate #(quot % b))
(map #(when (> % 0) (mod % b)))
(take-while identity)
reverse)))
how can I get this test to pass to pass
(deftest tagged-test
(is (= true (l/tagged-list? (quote ((quote define) 32)) (quote define)))))
where tagged-list? is
(defn tagged-list?
[exp tag]
(= (first exp) tag))
or maybe this test makes it clearer:
(deftest tagged-test
(is (= true (l/tagged-list? '('define 32) 'define))))
this test passes on the contrary:
(deftest tagged-test
(is (= true (l/tagged-list? ['define 32] 'define))))
but I’d like to use lists instead of vectorsIt's because those aren't the same. You have an extra quote in there. Instead of '('define 32)
, try using '(define 32)
@tmtwd: Also, this is small, but the = true
isn't necessary. You can shorten it to:
(deftest tagged-test
(is (l/tagged-list? '(define 32) 'define)))
hm, this works
(deftest tagged-test
(is (= true (l/tagged-list? ['define 32] 'define))
(l/tagged-list? (list 'define 43) 'define)))
it appears they are equal at first but I guess they do very different things:
lisp-interpreter.server=> (= (list 1 2 3) '(1 2 3))
true
Right, those are equal. Using a quote for that instead of list
is perfectly okay, and very common.