let vs def in clojure

后端 未结 6 1777
日久生厌
日久生厌 2020-12-15 03:07

I want to make a local instance of a Java Scanner class in a clojure program. Why does this not work:

; gives me:  count not supported on this          


        
6条回答
  •  借酒劲吻你
    2020-12-15 03:44

    The syntax for them is different, even if the meanings are related.

    let takes a list of bindings (name value pairs) followed by expressions to evaluate in the context of those binding.

    def just takes one binding, not a list, and adds it to the global context.

提交回复
热议问题