Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort assumes that < returns a boolean #254

Closed
StefanKarpinski opened this issue Nov 2, 2011 · 4 comments
Closed

sort assumes that < returns a boolean #254

StefanKarpinski opened this issue Nov 2, 2011 · 4 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@StefanKarpinski
Copy link
Sponsor Member

julia> v = [ [i,j] | i=1:5, j=1 ]
5x1 Array{Int64,1} Array:
 [1, 1]
 [2, 1]
 [3, 1]
 [4, 1]
 [5, 1]

julia> sort(v)
type error: non-boolean (Array{Bool,1}) used in boolean context
@JeffBezanson
Copy link
Sponsor Member

We could have < always return a boolean and use .< for vectorized comparison. Or use all(a<b) in sort.

@StefanKarpinski
Copy link
Sponsor Member Author

See my email: it's not quite that simple since all(a < b) isn't obviously the right comparison.

@ViralBShah
Copy link
Member

This seems to be more like a feature request than a bug to me.

@StefanKarpinski
Copy link
Sponsor Member Author

It's a bug because sort uses < for comparison assuming that < always returns a boolean, which it doesn't. We should use something else like sortlt or isless. We were working on all of this but kind of got stalled out on that work, which is tricky and slightly annoying.

StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
fix pipeline tests on windows julia-0.5
mbauman added a commit that referenced this issue Apr 23, 2018
* origin/master: (23 commits)
  fix deprecations of \cdot and \times (#26884)
  Support reshaping custom 0-dimensional arrays (#26870)
  fix some cases of dot syntax lowering (#26878)
  Pkg3: deterministically close the LibGit2 repo in tests (#26883)
  code loading docs: add missing graph edge (#26874)
  add news for #26858 and #26859 [ci skip] (#26869)
  Deprecate using && and || within at-dot expressions (#26792)
  widen `Int8` and `Int16` to `Int` instead of `Int32` (#26859)
  fix #26038, make `isequal` consistent with `hash` for `Ptr` (#26858)
  Deprecate variadic size(A, dim1, dim2, dims...) method (#26862)
  add using Random to example in manual (#26864)
  warn once instead of depwarn since we want to test it
  Revert "reserve syntax that could be used for computed field types (#18466) (#26816)" (#26857)
  Fix compilation on LLVM 6.0
  change promotion behaviour of `cumsum` and `cumsum!` to match `sum`
  [LLVM 6] add patch to diamond if-conversion
  add a precompile command that can be used to precompile all dependencies (#254)
  use registry if no version entry exist in project for developed pacakges
  make Pkg3 work as a drop in for the old CI scripts
  update registries when adding (#253)
  ...
cmcaine pushed a commit to cmcaine/julia that referenced this issue Sep 24, 2020
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Keno pushed a commit that referenced this issue Oct 9, 2023
More optimizations and a fix for `is_vararg_type`
Keno pushed a commit that referenced this issue Oct 9, 2023
- Fix for change in CodeInfo.slotnames type on julia master (#251)
- Add a way to break on throw (#253)
- Exclude Union{} from is_vararg_type (#254)
- Various performance improvements (#254)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants