Skip to content

Instantly share code, notes, and snippets.

@tkf
Created July 29, 2018 07:25
Show Gist options
  • Save tkf/ca556aa6fb83bb6a2d8c450571fed428 to your computer and use it in GitHub Desktop.
Save tkf/ca556aa6fb83bb6a2d8c450571fed428 to your computer and use it in GitHub Desktop.

Julia 0.6

julia> collect(let x
           (x for y in 1:6
            if try
                x = y
                @assert x % 2 == 0
                true
            catch err
                if ! (err isa AssertionError)
                    rethrow()
                end
                false
            end)
       end)
3-element Array{Int64,1}:
 4
 6
 6

julia> versioninfo()
Julia Version 0.6.4
Commit 9d11f62bcb (2018-07-09 19:09 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=16)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Julia 0.7

julia> collect(let x
           (x for y in 1:6
            if try
                x = y
                @assert x % 2 == 0
                true
            catch err
                if ! (err isa AssertionError)
                    rethrow()
                end
                false
            end)
       end)
3-element Array{Int64,1}:
 2
 4
 6

julia> versioninfo()
Julia Version 0.7.0-beta2.48
Commit c6a949a9c3 (2018-07-19 18:28 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment