This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-11
Channels
- # adventofcode (52)
- # announcements (3)
- # aws (2)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (69)
- # biff (45)
- # calva (9)
- # cider (3)
- # clara (8)
- # clj-kondo (24)
- # clojure (20)
- # clojure-dev (12)
- # clojure-europe (12)
- # clojurescript (2)
- # conjure (1)
- # emacs (17)
- # lsp (69)
- # malli (12)
- # off-topic (32)
- # polylith (2)
- # re-frame (4)
- # releases (2)
- # scittle (6)
- # shadow-cljs (21)
- # tools-deps (10)
- # vim (11)
- # xtdb (11)
Wondering if this behavior change is considered a bug, undesired, or irrelevant:
Clojure 1.11.1
user=> (drop 1.5 [1 2 3])
(3)
user=> (drop 1.5 (seq "abc"))
(\c)
vs.
Clojure 1.12.0-alpha1
user=> (drop 1.5 [1 2 3])
(2 3)
user=> (drop 1.5 (seq "abc"))
(\b \c)
@mfikes There is a precedent in https://github.com/borkdude/speculative/commit/2460379417c0ac6d49327fef54a40a597ed0dcfd where we relaxed int to number for range
Can't find any discussion other than this: https://clojurians.slack.com/archives/CDJGJ3QVA/p1540381365000100
That seems to be a different discussion. Range supports all number types.
Ranges of non ints?
Range makes a series of numbers from start number to end number, stepping by numbers
I would consider non integers to be undefined behavior
It would also seem that if you tried to define the behavior you might go down an intractable rat hole.
I was messing with porting this (`IDrop`) to ClojureScript and that WIP implementation definitely exhibits undefined behavior.
cljs.user=> (drop 1.5 (seq "abc"))
(nil nil)
There have been cases in the past where these sorts of things have been pushed to have ClojureScript match Clojure, where reasonable, perf-wise.