by prollyignored · 13y ago · 0 comments
Now in,
while m+i is less than the length of S, do:
if W[i] = S[m + i],
if i equals the (length of W)-1,
return m
let i ← i + 1
....
How would I implement the `return m` part ?When you write:
(defn square [x]
(* x x))
You are really writing:(def square
(fn [x]
(* x x)))
and x * x is bound to the value of square. There would be no logical reason to have an explicit return value here. (loop [n 0]
(if (= n 10)
n ; true case: return n
(recur (inc n)))) ; false case: loop with n++
;=> 10