File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,9 @@ vector
386
386
387
387
; ; @@
388
388
(defn do-nothing [x] ___ )
389
+
390
+ (assert (= 42 (do-nothing 42 )))
391
+ (assert (= " wtf" (do-nothing " wtf" )))
389
392
; ; @@
390
393
391
394
; ; **
@@ -404,6 +407,10 @@ vector
404
407
405
408
; ; @@
406
409
(defn always-thing [__] ___ )
410
+
411
+ (assert (= :thing (always-thing )))
412
+ (assert (= :thing (always-thing 42 )))
413
+ (assert (= :thing (always-thing " wtf" 42 )))
407
414
; ; @@
408
415
409
416
; ; **
@@ -515,6 +522,8 @@ vector
515
522
; ; @@
516
523
(defn http-get [url]
517
524
___ )
525
+
526
+ (assert (.contains (http-get " http://www.w3.org" ) " html" ))
518
527
; ; @@
519
528
520
529
; ; **
@@ -531,6 +540,9 @@ vector
531
540
; ; @@
532
541
(defn one-less-arg [f x]
533
542
(fn [& args] ___))
543
+
544
+ (defn add-two-numbers [x y] (+ x y))
545
+ (assert (= 3 ((one-less-arg add-two-numbers 1 ) 2 )))
534
546
; ; @@
535
547
536
548
; ; **
@@ -546,8 +558,13 @@ vector
546
558
; ; @@
547
559
(defn two-fns [f g]
548
560
___ )
549
- ; ; @@
550
561
562
+ (defn add-two [x] (+ 2 x))
563
+ (defn times-ten [x] (* 10 x))
564
+
565
+ (assert (= 12 ((two-fns add-two times-ten) 1 )))
566
+ (assert (= 30 ((two-fns times-ten add-two) 1 )))
567
+ ; ; @@
551
568
; ; **
552
569
; ;; # Lab Solutions
553
570
; ;;
You can’t perform that action at this time.
0 commit comments