2010/8/1 doug <395curra...@gmail.com>

> Hey all!
>
> can't seem to get the last element to bind. tia -doug
>
> user> cj-mpdata
> ["0010335602       " "" "40.00" "" "1060.51" "6/23/2010" "DISCOVER E-
> PAYMENT 7796" "" "" ("DISCOVER")]
> user> (let [[[_ ck db cr _ dt _ _ _][dsc]]
>           [["Acct" "Chk" "Debt" "Crd" "Bal" "Date" "Desc" "Payee"
> "Catagory"]
> ["newDescript"]]]
>                 [dt ck  db cr  dsc])
> ["Date" "Chk" "Debt" "Crd" "newDescript"]
> user> (let [[[_ ck db cr _ dt _ _ _][dsc]] [cj-mpdata]]
>     [dt ck  db cr  dsc])
>
> ["6/23/2010" "" "40.00" "" nil]
> user>
>

The data you pass to the first let is structured like this:
    [[:a :b :c :d :e :f :g :h :i] [:j]]
i.e., a 2-vector with a 9-vector and a 1-vector in it.

But the data in cj-mpdata is structured like this:
    [:a :b :c :d :e :f :g :h :i [:j]]
i.e., a 10-vector with a 1-vector as its last element.

In your second let case, doing this should work:
    (let [[_ ck db cr _ dt _ _ _ [dsc]] cj-data]
      [dt ck  db cr  dsc])

Also, adding square brackets to both the left hand side and the right and
side in a let binding is a no-op, and can be removed.

// raek

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to