Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Symbol name cleanup; don't shadow str function

  • Loading branch information...
commit 2d5560cdce1116df881ecb7bae33568d129ffbb9 1 parent f8b5dba
Matt Yoho authored

Showing 1 changed file with 17 additions and 17 deletions. Show diff stats Hide diff stats

  1. +17 17 src/tnetstring/core.clj
34 src/tnetstring/core.clj
@@ -3,21 +3,21 @@
3 3
4 4 (declare parse)
5 5
6   -(defn- parse-list [str the-list]
7   - (if (not (blank? str))
8   - (let [[element str] (parse str)]
9   - (recur str (conj the-list element)))
  6 +(defn- parse-list [s the-list]
  7 + (if (not (blank? s))
  8 + (let [[element s] (parse s)]
  9 + (recur s (conj the-list element)))
10 10 the-list))
11 11
12   -(defn- parse-dict [str dict]
13   - (if (not (blank? str))
14   - (let [[key value-and-rest] (parse str)]
15   - (let [[value str] (parse value-and-rest)]
16   - (recur str (assoc dict key value))))
  12 +(defn- parse-dict [s dict]
  13 + (if (not (blank? s))
  14 + (let [[key value-and-rest] (parse s)]
  15 + (let [[value s] (parse value-and-rest)]
  16 + (recur s (assoc dict key value))))
17 17 dict))
18 18
19   -(defn- parse-length [str]
20   - (let [[length-str remain] (split str #":" 2)]
  19 +(defn- parse-length [s]
  20 + (let [[length-str remain] (split s #":" 2)]
21 21 [(Integer/parseInt length-str) remain]))
22 22
23 23 (let [parsers
@@ -32,16 +32,16 @@
32 32 \] #(parse-list % [])
33 33 \} #(parse-dict % {})}]
34 34
35   - (defn- payload [str len]
36   - (let [payload-str (.substring str 0 len)
37   - remain (subs str (+ 1 len))
38   - payload-type (.charAt str len)
  35 + (defn- payload [s len]
  36 + (let [payload-str (.substring s 0 len)
  37 + remain (subs s (+ 1 len))
  38 + payload-type (.charAt s len)
39 39 parser (fn [] (get parsers payload-type))]
40 40 [((parser) payload-str), remain])))
41 41
42 42 (defn parse
43 43 "Parses a tnetstring"
44   - [str]
45   - (let [[payload-len payload-str] (parse-length str)]
  44 + [s]
  45 + (let [[payload-len payload-str] (parse-length s)]
46 46 (payload payload-str payload-len)))
47 47

0 comments on commit 2d5560c

Please sign in to comment.
Something went wrong with that request. Please try again.