File tree Expand file tree Collapse file tree 1 file changed +41
-8
lines changed Expand file tree Collapse file tree 1 file changed +41
-8
lines changed Original file line number Diff line number Diff line change 1473
1473
clazz meth
1474
1474
^objects (into-array Object args)))
1475
1475
stack)))))
1476
+ #?(:clj
1477
+ (comment
1478
+ ((fn
1479
+ ([x] (/ 1 x))
1480
+ ([x y] (. clojure.lang.Numbers (divide x y)))
1481
+ ([x y & more]
1482
+ (reduce / (/ x y) more)))
1483
+ ##Inf 0.0 )
1484
+ (defn div [x y]
1485
+ (if (double? x)
1486
+ (let [x (double x)]
1487
+ (. clojure.lang.Numbers (divide x y)))
1488
+ (/ x y)))
1489
+ (f 0 0 )
1490
+ (f ##Inf ##Inf )
1491
+ (f 1 2 )
1492
+ (/ 1 2 )
1493
+ double?
1494
+ ))
1476
1495
1477
1496
(defn analyze-call [ctx expr m top-level?]
1478
1497
(with-top-level-loc top-level? m
1619
1638
:else (analyze ctx v top-level?))]
1620
1639
expanded)
1621
1640
(if-let [f (:sci.impl/inlined f-meta)]
1622
- (return-call ctx
1623
- expr
1624
- f (analyze-children ctx (rest expr))
1625
- (assoc m
1626
- :ns @utils/current-ns
1627
- :file @utils/current-file
1628
- :sci.impl/f-meta f-meta)
1629
- nil )
1641
+ (let [children (analyze-children ctx (rest expr))
1642
+ #?@(:clj [f (condp identical? f
1643
+ ; ; double arithmetic, e.g. no divide by zero
1644
+ / (let [div (fn [x y]
1645
+ (if (double? x)
1646
+ (let [x (double x)]
1647
+ (/ x y))
1648
+ (/ x y)))]
1649
+ (fn
1650
+ ([x] (div 1 x))
1651
+ ([x y] (div x y))
1652
+ ([x y & more]
1653
+ (reduce / (div x y) more))))
1654
+ f)])]
1655
+ (return-call ctx
1656
+ expr
1657
+ f children
1658
+ (assoc m
1659
+ :ns @utils/current-ns
1660
+ :file @utils/current-file
1661
+ :sci.impl/f-meta f-meta)
1662
+ nil ))
1630
1663
(if-let [op (:sci.impl/op (meta f))]
1631
1664
(case op
1632
1665
:resolve-sym
You can’t perform that action at this time.
0 commit comments