# Pipeline question

**URL:** <https://discourse.julialang.org/t/pipeline-question/139130>\
**Category:** New to Julia\
**Created:** [September 1, 2026, 4:09am UTC](https://discourse.julialang.org/t/pipeline-question/139130 "2026-09-01T04:09:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [September 1, 2026, 4:09am UTC](https://discourse.julialang.org/t/pipeline-question/139130/1 "2026-09-01T04:09:32Z")

</div>

Continuing the discussion from [Structure and performance questions from a Fortran programmer: functions, global variables, array allocations, input files, and structs](https://discourse.julialang.org/t/structure-and-performance-questions-from-a-fortran-programmer-functions-global-variables-array-allocations-input-files-and-structs/137409/32):

Is this how you move stuff from place to place in everyday scientific pipelines? Or do you tend to do something else? If you do, sometimes you need to get rid of some fields in these NamedTuples. How do you do that?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [September 1, 2026, 4:17am UTC](https://discourse.julialang.org/t/pipeline-question/139130/2 "2026-09-01T04:17:51Z")

</div>

I think it’s best to think of named tuples as anonymous structs. Convenient, but if you’re always returning the same objects, creating a proper structure is the next logical step. There’s nothing wrong with having lots of small structs.

As for deletion and general modification, Accessors.jl is the way to go

```julia
julia> using Accessors

julia> nt = (; x=4, y=10)
(x = 4, y = 10)

julia> nt2 = @delete nt.x
(y = 10,)

```

(beware that it creates a _new_ named tuple)

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [September 1, 2026, 9:15am UTC](https://discourse.julialang.org/t/pipeline-question/139130/3 "2026-09-01T09:15:32Z")

</div>

I didn’t know how to delete an entry. Thank you, @cstjean .

To select a subset:

```julia-auto
julia> nt = (; a = "hello", b = 3.14, c = -999, d = :somesymbol)
(a = "hello", b = 3.14, c = -999, d = :somesymbol)

julia> nt[(:b, :c)]
(b = 3.14, c = -999)

```

This also creates a new `NamedTuple`, I think.

---

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [September 1, 2026, 12:52pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/4 "2026-09-01T12:52:34Z")

</div>

Great answers! But is this how data is typically moved around?

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [September 2, 2026, 5:29am UTC](https://discourse.julialang.org/t/pipeline-question/139130/5 "2026-09-02T05:29:15Z")

</div>

> [@mahmah](#):
>
> But is this how data is typically moved around?

I’m not sure exactly what you mean by that and I’m not sure whether what I do is “typical” or not, but here is what I do. Suppose you have a data-producing function. I usually write it as

```julia-auto
function read_or_produce_data()
   # ... read or calculate variables ...
   val1 = ... some calculation ...
   val2 = ...
   val3 = ...
   ...
   # NamedTuple shorthand
   return (; val1, val2, val3, ...)
   # return (; val1 = val1, val2 = val2, val3 = val3, . . .)
end

```

You can then use it in different ways. You get the whole thing:

```julia-auto
vals = read_or_produce_data()
func1(; vals...) # Send all values as keyword args
func2(; vals[(:val2, :val5)]...) # Send a subset
func3(vals.val2, vals.val4) # Send two as positional args

```

You get only a subset and discard the others:

```julia-auto
# Discard everything else
(; val2, val4) = read_or_produce_data()
# use val2 and val4

```

Sometimes, you want to ignore the original names:

```julia-auto
(par1, par2, ...) = read_or_produce_data()

```

because NamedTuples can be assigned to a regular Tuple ignoring the names.

In this way, `NambedTuples` are my main means of moving data around throughout my programs.

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [September 2, 2026, 3:29pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/6 "2026-09-02T15:29:08Z")

</div>

> [@mahmah](#):
>
> But is this how data is typically moved around?

I think what you’re asking isn’t really clear. Are you asking about movement from storage to memory (I/O), from one place in memory to another (e.g., passing a data structure from one function to another), or from one machine to another (over a network)?

---

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [September 2, 2026, 4:33pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/7 "2026-09-02T16:33:27Z")

</div>

@mthelm85 I’m asking the second question, sorry for the ambiguity.

Thanks @ryofurue for the great answer. I didn’t test this myself, but if I understand it correctly, this is pretty cool:

(; val2, val4) = read\_or\_produce\_data()

I mean, even if `read_or_produce_data()` can return a lot of stuff, I can choose to return specific things without having to remember their positions, i.e. no `_, _, val1 = ` syntax. Is this correct? And if so, I guess this is one of the things that make NamedTuples quite unique for passing data from function to function compared to other containers?

By the way, and regarding the name of that function, I’ve been using DrWatson.jl, which I find super useful and has a function called `produce_or_load` (I haven’t used that particular function, but it looks great.

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [September 2, 2026, 8:54pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/8 "2026-09-02T20:54:04Z")

</div>

> [@mahmah](#):
>
> I mean, even if `read_or_produce_data()` can return a lot of stuff, I can choose to return specific things without having to remember their positions,

Exactly. That’s the very reason I use a `NamedTuple` to return values from my functions. See the toy example below.

```julia-auto
julia> read_or_produce() = (; a = "hello", b = 3.14, c = -999, d = :somesymbol)
read_or_produce (generic function with 1 method)

julia> (; d, b) = read_or_produce()
(a = "hello", b = 3.14, c = -999, d = :somesymbol)

julia> b
3.14

julia> d
:somesymbol

julia> a
ERROR: UndefVarError: `a` not defined in `Main`
Suggestion: check for spelling errors or missing imports.

```

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [September 2, 2026, 9:15pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/9 "2026-09-02T21:15:24Z")

</div>

By the way,

> [@mahmah](#):
>
> I’ve been using [DrWatson.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/DrWatson), which I find super useful

Thank you for the information. It looks very helpful. That may be what I should use to manage my programs. I’ll explore it.

---

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [September 3, 2026, 5:49am UTC](https://discourse.julialang.org/t/pipeline-question/139130/10 "2026-09-03T05:49:15Z")

</div>

So far I have only used `initialize_project`, `savename`, and `datadir`/`plotsdir` etc. That’s the tip of the iceberg, but they are excellent in my opinion.

---

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [September 3, 2026, 6:12pm UTC](https://discourse.julialang.org/t/pipeline-question/139130/11 "2026-09-03T18:12:12Z")

</div>

Now back to the topic, I believe this issue is especially important for those of us coming from writing infinitely long MATLAB scripts (or functions that are simply obj = myfun(obj)) and entering a much more functional world in Julia.
