# -*- coding: utf-8 -*-
# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 1.7.0-beta3
#     language: julia
#     name: julia-1.7
# ---

using MetaUtils
VERSION

print_subtypes(Number)

print_subtypes(AbstractVector)

print_subtypes(AbstractMatrix)

print_subtypes(AbstractString)

print_subtypes(AbstractDict)

print_subtypes(AbstractSet)

ran = range(0, 1, 11)

dump(ran)

A = reshape(1:11^2, 11, 11)

dump(A)

A * ran

π

1π

1f0π

Float16(1)π

big(1)π

(1:10) .^ (0:3)'

using Plots
x = range(-π, π; length=20)
xlim = extrema(x) .* 1.1
y = @. sin(x) + 0.3randn()
X = x .^ (0:3)'
β̂ = X \ y
f(x) = evalpoly(x, β̂)
scatter(x, y; label="data", color=1, legend=:topleft)
plot!(sin, xlim...; label="y = sin(x)", color=1)
plot!(f, xlim...; label="degree-3 polynomial", color=2, lw=2)

[a ^ b for a in 1:10, b in 0:3]

[x^2 for x in -6:6 if iseven(x)]

sum(x^2 for x in -6:6 if iseven(x))

Tuple(x^2 for x in -6:6 if iseven(x))

Set(x^2 for x in -6:6 if iseven(x))

Dict(x => x^2 for x in -6:6 if iseven(x))

SharedArray{typeof((1, 2))}((10,))

# +
using Distributed
using SharedArrays

rmprocs(procs()[2:end])
addprocs(4)

S = SharedArray{typeof((1:2, 1:2))}((10,))
# -

for k in eachindex(S)
    remotecall_fetch(workers()[mod1(k, nworkers())]) do
        pid = myid()
        S[k] = (pid:2pid, 3pid:4pid)
    end      
end
S

F = remotecall(W[1]) do
    pid = myid()
    S[1] = (1:2, 3:4)
end

S

fetch(F)



StarcoderdataJupyterScriptsDedupFiltered