Fork me on GitHub
#beginners
<
2017-07-23
>
noisesmith01:07:51

@swizzard if the ns is test.mover, the file path should be test/test/mover.clj

noisesmith01:07:23

test/mover.clj implies an ns called mover (and top level namespaces aren't recommended)

timo08:07:13

Hi, when I want to manipulate the session to weaken the application, where would I go in ring? Where is the session created? I can't find it.

rorysmith14:07:48

hi all, i have the following function:

(ns digitizer.core)

(defn digitize [n]
  (->> n
       (str)
       (reverse)))
when i run (digitize 3210), (\0 \1 \2 \3) is returned. what are the backslashes for?

dpsutton15:07:58

Returns a seq of the items in coll in reverse order. Not lazy.

dpsutton15:07:08

try (seq "hello")

dpsutton15:07:29

reverse works on arbitrary collections which a string can become when you call seq on it, but it ends up as a sequence of chars, which reverse will happily reverse

dpsutton15:07:20

there's clojure.string that contains a reverse function for your needs as it knows you want the reversed sequence of characters as a string

rorysmith15:07:35

ah - i didn't know chars were prepended with \

rorysmith15:07:53

@dpsutton is there something i am missing?

dpsutton15:07:51

(defn int->digits
  [n]
  (map #(Integer/parseInt %) (map str (str n))))

dpsutton15:07:55

this is one i've done before

dpsutton15:07:19

if you already have the number as a string you don't need the last str

dpsutton15:07:50

but take a number, n, turn it into a string. Then map string across it, which, like in your example, gets a seq of the chars and turns them into strings

dpsutton15:07:00

then we map parseInt across that collection of single digit strings

rorysmith15:07:32

i didn't know about this Integer/parseInt

dpsutton15:07:29

i think its a static method in java

rorysmith15:07:07

incidentally here is the line i was missing to complete my original approach: (map #(Character/digit % 10))