Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% defines | |
function isabranch(numsary) | |
s = 0 | |
for (n1, n2) ∈ numsary | |
if n1 isa Int8 && n2 isa Int8 | |
s += 1 | |
elseif n1 isa Int8 && n2 isa Int16 | |
s += 2 | |
elseif n1 isa Int8 && n2 isa Int32 | |
s += 3 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(q = :(println("(q = $(repr(q))) |> eval"))) |> eval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ACS = Union{AbstractChar, AbstractString} | |
(l::ACS)(f::Function, rs::ACS...) = f(l, rs...) | |
(l::ACS)(rs::ACS...) = l(*, rs...) | |
'1'("23") # "123" | |
']' .|> collect("julia") .|> '[' |> join # "[j][u][l][i][a]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MacroTools | |
function decompose_forblk(forblk) | |
spec, body = forblk.args | |
i, itr = spec.args | |
return i, itr, body | |
end | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"version":1,"resource":"file:///Users/aviatesk/IoPLMaterials/textbook/interpreter/dune-project","entries":[{"id":"VJTx","timestamp":1652783352000},{"id":"6qkI","timestamp":1652783387886}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DataFrames, DataFramesMeta, Plots, StatsPlots, StatsBase | |
# HACK: | |
# integrate StatsPlots.@df into @linq chain in a way data frame keeps to be passed even after plot | |
# but, the `names` part might be too dangerous | |
for n in names(StatsPlots) | |
function DataFramesMeta.linq(::DataFramesMeta.SymbolParameter{n}, d, args...) | |
plotcall = Expr(:call, n, args...) | |
return quote let d = $d | |
display(@df d $plotcall) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# what I will do here: | |
# - dataframe chain | |
# - keep to pass dataframe while plotting with `StatsPlots.@df` | |
# - pass columns names as variables | |
using DataFrames, Pipe, StatsPlots | |
theme(:juno) | |
df = DataFrame(x = randn(100), y = rand(Int, 100)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function decompose_forblk(forblk) | |
@assert Meta.isexpr(forblk, :for) "for block expression should be given" | |
itrspec, body = forblk.args | |
@assert Meta.isexpr(itrspec, :(=)) "invalid for loop specification" | |
v, itr = itrspec.args | |
return body, v, itr | |
end | |
function recompose_to_comprehension(forblk, cond = nothing; gen = false) | |
body, v, itr = decompose_forblk(forblk) |
OlderNewer