You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @JeffreySarnoff , I'd like to contribute some of the things I've been working on lately. First up:
""" random_namedtuple(width, depth; names='a':'z')Generate a random nested named tuple. This is useful for tests.Example: julia> randnt(3,3) (e = (o = (l = :l, e = :e, s = :s), d = (x = :x, e = :e, a = :a), a = (i = :i, u = :u, d = :d)), f = (b = (y = :y, k = :k, o = :o), a = (b = :b, f = :f, k = :k), z = (j = :j, b = :b, u = :u)), t = (b = (q = :q, k = :k, s = :s), c = (d = :d, u = :u, a = :a), h = (u = :u, c = :c, m = :m)))"""functionrandom_namedtuple(width, depth; names='a':'z')
k =unique(Symbol.(rand(names, width)))
if depth ≤1returnnamedtuple(k)(k)
else
nts =Tuple((randnt(width, depth-1; names=names) for _ in1:length(k)))
returnnamedtuple(k)(nts)
endend
Any thoughts on this? If you like it, where should it go?
The text was updated successfully, but these errors were encountered:
Hi @JeffreySarnoff , I'd like to contribute some of the things I've been working on lately. First up:
Any thoughts on this? If you like it, where should it go?
The text was updated successfully, but these errors were encountered: