QUESTION 3 (18 MARKS) Given the following code snippet to transfer the funds from account1 to account2. 1. 2. 3. 4. 5. 6

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

QUESTION 3 (18 MARKS) Given the following code snippet to transfer the funds from account1 to account2. 1. 2. 3. 4. 5. 6

Post by answerhappygod »

Question 3 18 Marks Given The Following Code Snippet To Transfer The Funds From Account1 To Account2 1 2 3 4 5 6 1
Question 3 18 Marks Given The Following Code Snippet To Transfer The Funds From Account1 To Account2 1 2 3 4 5 6 1 (39.04 KiB) Viewed 8 times
QUESTION 3 (18 MARKS) Given the following code snippet to transfer the funds from account1 to account2. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. (def accountl (atom 0:validator # (>= 8 0))) (def account2 (atom 0 :validator # (>= % 0) ) ) (defn transfer [from-acct to-acct amt] (swap! to-acct + amt) (swap! from-acct - amt)) (future (transfer account1 account2 100)) (println (str "accountl: "@account1)) (println (str "account2: " @account2)) Determine the output of the given code and justify your answer. (5 markah/marks) Use Ref Clojure function instead of the atom in the given code and justify the reason of why Ref is more effective than the atom. (13 markah/marks)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply