File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 302
302
(intern 'ys.std 'T to-type)
303
303
(intern 'ys.std 'V to-vec)
304
304
305
+ (intern 'ys.std 'V+ vector)
306
+
305
307
306
308
; ;------------------------------------------------------------------------------
307
309
; ; Math functions
516
518
(defmacro when+ [test & body]
517
519
(list 'when-let ['_ test] (cons 'do body)))
518
520
521
+
522
+ ; ;------------------------------------------------------------------------------
523
+ ; ; Function functions
524
+ ; ;------------------------------------------------------------------------------
525
+
526
+ (defn flip [f]
527
+ (fn
528
+ ([] (f ))
529
+ ([a] (f a))
530
+ ([a b] (f b a))
531
+ ([a b c] (f c b a))
532
+ ([a b c d] (f d c b a))
533
+ ([a b c d & rest]
534
+ (->> rest
535
+ (concat [a b c d])
536
+ clojure.core/reverse
537
+ (apply f)))))
538
+
539
+
519
540
; ;------------------------------------------------------------------------------
520
541
; ; String functions
521
542
; ;------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -219,6 +219,15 @@ test::
219
219
want: 42
220
220
221
221
222
+ #-------------------------------------------------------------------------------
223
+ - note: "Function functions"
224
+
225
+ - code: |
226
+ bus =: sub:flip
227
+ bus: 2 44
228
+ want: 42
229
+
230
+
222
231
#-------------------------------------------------------------------------------
223
232
- note: "String functions"
224
233
You can’t perform that action at this time.
0 commit comments