# How to integrate parse with split?

**URL:** <https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819>\
**Category:** New to Julia\
**Created:** [October 27, 2024, 9:24am UTC](https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819 "2024-10-27T09:24:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Post date:** [October 27, 2024, 9:24am UTC](https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819/1 "2024-10-27T09:24:00Z")

</div>

Hello,  
How can I correct the command `a, b, c = parse(Int,split(readline()))`? I want to receive three inputs and simultaneously convert it to an integer and assign it to each of the variables.

Thank you.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [October 27, 2024, 9:53am UTC](https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819/2 "2024-10-27T09:53:46Z")

</div>

Admittedly unsure what you’re inputting, but broadcast?

```julia
julia> a, b, c = parse.(Int,split(readline()))
2 3 1
3-element Vector{Int64}:
 2
 3
 1

julia> c, a, b
(1, 2, 3)

```

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Post date:** [October 30, 2024, 6:31am UTC](https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819/3 "2024-10-30T06:31:58Z")

</div>

Hi,  
Thank you so much.  
Why did you use `.` in `parse`? I had seen the general form of `parse` as follows:

`variable = parse(Type, readline())`

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [October 30, 2024, 9:00am UTC](https://discourse.julialang.org/t/how-to-integrate-parse-with-split/121819/4 "2024-10-30T09:00:52Z")

</div>

That is [dot syntax](https://docs.julialang.org/en/v1/manual/functions/#man-vectorized) for broadcasting a function or dotted sequence of functions over arrays of their inputs. The example is equivalent to the higher-order function call `broadcast(parse, Int, split(readline()))`, though dot calls (check `Meta.@lower`) actually lower to a different sequence of higher-order function calls.

Broadcasting is the go-to way to do elementwise operations, but it’s not simply that. `map` is the straightforward higher-order function for elementwise operations over sequences of inputs, and it has parallels in many functional languages and languages influenced by them. Broadcasting additionally involves expanding the output along the different but compatible dimensions of the input arrays, and it has parallels in MATLAB and NumPy. Unlike those languages however, Julia doesn’t have separate broadcasting versions of functions, we just put our functions into higher-order functions. Dot syntax helps make broadcasting easier to write.

```julia
julia> [10 100 1000] * [1,2,3] # matrix multiplication, NOT elementwise
1-element Vector{Int64}:
 3210

julia> 10 * 1 # scalar multiplication; elementwise methods below
10

julia> [10 100 1000] .* [1,2,3] # 1x3-matrix .* 3-vector = 3x3 matrix
3×3 Matrix{Int64}:
 10 100 1000
 20 200 2000
 30 300 3000

julia> map(*, [10 100 1000], [1,2,3]) # iterates as sequences
3-element Vector{Int64}:
   10
  200
 3000

```
