"🔒"
(load-file "my.clj")
#Result
##'user/...
#Complete the following expression so the address symbol is bound to a value with the following properties:
# a vector
# has length three
# the second element is a hashmap
# the hashmap has at least one key-value pair of (:hello, "world")
"✍️"
; @workUnit
(def address [3, {:hello "world"}, "time"])
#Result
##'user/address
"🔒"
; @check
; @title: check1
(vector? address)
#Result
#true
"🔒"
; @check
; @title: check2
(count address)
#Result
#3
"🔒"
; @check
; @title: check3
(map? (nth address 1))
#Result
#true
"🔒"
; @check
; @title: check4
(= (:hello (nth address 1)) "world")
#Result
#true
#Implement a function equivalent to the following Python program:
#def sum [numbers]:
# result = 0
# for n in enumerate(numbers):
# result += n * n
# return result
"✍️"
; @workUnit
(defn sum [numbers]
(reduce + (map * numbers numbers))
)
#Result
##'user/sum
"🔒"
; @check
; @title: check5
(sum [10])
#Result
#100
"🔒"
; @check
; @title: check6
(sum [10 9 8 7 6])
#Result
#330
"🔒"
; @check
; @title: check7
(sum [])
#Result
#0
To embed this program on your website, copy the following code and paste it into your website's HTML: