[Question]
  [
In this challenge you will be converting a mixed number to an improper fraction.
Because improper fractions use fewer numbers, your code will need to be as short as possible.
---
## Examples
```
4 1/2
9/2
12 2/4
50/4
0 0/2
0/2
11 23/44
507/44
```
## Specification
You may assume the denominator of the input will never be 0. The input will always be in the format `x y/z` where x,y,z are arbitrary nonnegative integers. You do not need to simplify the output.
---
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest code in bytes wins.
  
[Answer]
# LabVIEW, 29 [LabVIEW Primitives](http://meta.codegolf.stackexchange.com/a/7589/39490)
[![](https://i.stack.imgur.com/TvVku.gif)](https://i.stack.imgur.com/TvVku.gif)
[Answer]
## CJam, ~~16~~ ~~15~~ 14 bytes
```
l'/']er~:Xb'/X
```
or
```
l'/']er~_@b'/@
```
[Test it here.](http://cjam.aditsu.net/#code=l'%2F'%5Der~%3AXb'%2FX&input=11%2023%2F44)
## Explanation
```
l      e# Read input.
'/']er e# Replace the "/" with a "]".
~      e# Evaluate the string as code. If the input was "i n/d", this pushes [i n] d.
:X     e# Store the denominator in X.
b      e# Treat [i n] as base-d digits. This effectively computes i*d + n.
'/     e# Push a slash.
X      e# Push the denominator.
```
The other version avoids using a variable by using a bit more stack shifting.
[Answer]
## Mathematica, 58 bytes
```
ToExpression@StringReplace[#," "->"+"]~ToString~InputForm&
```
This returns the simplified result. If outputting a rational number instead of a string is fine, we can save 19 bytes:
```
ToExpression@StringReplace[#," "->"+"]&
```
[Answer]
## PowerShell, ~~47~~ ~~44~~ 42 Bytes
[Crossed out 44 is still regular 44 ;(](http://meta.codegolf.stackexchange.com/a/7427/42963)
```
$l,$n,$d=$args-split'\D';"$(+$l*$d+$n)/$d"
```
Golfed a couple bytes by using regex `-split`. Golfed a couple more thanks to [TessellatingHeckler](https://codegolf.stackexchange.com/users/571/tessellatingheckler) by swapping the regex.
The `$args-split'\D'` takes our input argument and splits on non-digit characters. Here it performs two splits, one on whitespace, the other on the `/` character. The results are then stored in the three variables using a simultaneous assignment. We then formulate the string output as (the `$l`eft number times the `$d`enominator plus the `$n`umerator) executed as a code block, a `/` slash, and then the `$d`enominator again.
[Answer]
# Java with [Ten Foot Laser Pole](https://github.com/SuperJedi224/Ten-Foot-Laser-Pole) 1.03, 79+25 (import) = 104 bytes
Requires `import sj224.tflp.math.*;`
```
String m(String[]a){return ""+new BigRational(a[0]).add(new BigRational(a[1]));}
```
This will almost certainly work with 1.04 as well, but so far I've only tested it with 1.03 because I already happened to have a java project set up with 1.03 in the build path.
[Answer]
# JavaScript (ES6), ~~44~~ 41 bytes
```
m=>([x,y,z]=m.match(/\d+/g),+y+x*z+"/"+z)
```
*Saved 3 bytes thanks to [@ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions)!*
## Explanation
Very simple.
```
m=>
  ([x,y,z]=m.match(/\d+/g), // x, y and z = numbers from input
    +y+x*z                  // numerator
    +"/"+z                  // denominator
  )
```
## Test
Test is without destructuring assignment to work in most browsers.
```
var solution = m=>+(p=m.match(/\d+/g))[1]+p[0]*p[2]+"/"+p[2]
```
```
<input type="text" id="input" value="11 23/44" />
<button onclick="result.textContent=solution(input.value)">Go</button>
<pre id="result"></pre>
```
[Answer]
# Japt, 10 bytes
Woohoo, currently beating CJam!
```
U*W+V+'/+W
```
[Try it online!](http://ethproductions.github.io/japt?v=master&code=VSpXK1YrJy8rVw==&input=MTEgMjMvNDQ=)
### How it works
```
       // Implicit: [U,V,W] = eval(input). This automatically discards the slash.
U*W+V  // Calculate the new numerator: (whole part * denominator) + numerator.
+'/+W  // Add the slash and the denominator.
       // Implicit: output last expression
```
[Answer]
# Julia, ~~58~~ 50 bytes
```
s->eval(parse((r=replace)(r(s," ","+"),"/","//")))
```
This is an anonymous function that accepts a string and returns a `Rational` type object. To call it, give it a name, e.g. `f=s->...`.
We can take advantage of the fact that the input can be manipulated slightly to be an expression that evaluates to a rational. In particular, an integer plus a rational is a rational, and rationals are denoted with double slashes. So if we turn `4 1/2` into `4+1//2`, the evaluated result will be `9//2`.
Ungolfed:
```
function f(s::AbstractString)
    # Replace the space in the input with a plus
    r1 = replace(s, " ", "+")
    # Replace the / with //
    r2 = replace(r1, "/", "//")
    # Parse the resulting expression as a rational
    return eval(parse(r2))
end
```
[Answer]
# Smalltalk – 76 characters
The input exactly matches the array delimiter and inherent fraction representation of Smalltalk. If it just weren't so verbose, it could have been a serious contender!
```
Compiler evaluate:'|p|p:=0.#(',FileStream stdin nextLine,')do:[:q|p:=p+q].p'
```
It's too bad simplification wasn't a requirement, Smalltalk does it automatically!
[Answer]
# Bash + coreutils, 28
```
dc<<<${@/\// }sarla*+n47Plap
```
`$@` expands to all command-line parameters, so `${@/\// }` expands to all command-line parameters with `/` replaced with , which is put on `dc`'s stack. The rest is simple stack manipulation and arithmetic.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~17~~ 15 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
#`'/¡R`Š©*+®'/ý
```
-2 bytes thanks to *@MagicOctopusUrn*.
[Try it online](https://tio.run/##MzBNTDJM/f9fOUFd/9DCoISjCw6t1NI@tE5d//De//9NFAz1jQA) or [verify all test cases](https://tio.run/##MzBNTDJM/W/i9l85QV3/0MKghKMLDq3U0j60Tl3/8N7/Ov9NFAz1jbgMjRSM9E24DBQMQBxDBSNjfRMTAA).
**Explanation:**
```
#`         # Split input by spaces and push all items to the stack
           #  i.e. "4 1/2" → "4" and "1/2"
  '/¡      # Push the second item by "/"
           #  i.e. "1/2" → [1,2]
     R`    # Revert the list, and also push all items to the stack
           #  i.e. [1,2] → [2,1] → 2 and 1
Š          # Triple-swap the stack
           #  [4,2,1] → [1,4,2]
 ©         # Store the 2 in the register
  *        # Multiple the top two items
           #  4 and 2 → 8
   +       # Add the top two items
           #  1 and 8 → 9
®          # Push the 2 from the register to the stack again
 '/ý       # Join the two items by "/"
           #  9 and 2 → "9/2"
```
---
With flexible input- and output-format, taking the integers in the order `x,z,y` and outputting the nominator and denominator on separated lines it would be **4 bytes** (which is why I added the [parsing](/questions/tagged/parsing "show questions tagged 'parsing'")-tag to the challenge..):
```
*+²»
```
[Try it online](https://tio.run/##MzBNTDJM/f9fS/vQpkO7//834TLiMgQA) or [verify all test cases](https://tio.run/##MzBNTDJM/W/i5ul5aOV/Le1D6w7t/q9zaJv9fxMuIy5DLkMjLhDDAIwNDblMgDxjAA).
**Explanation:**
```
*        # Multiply the first two inputs (x and z)
         #  i.e. 4 and 2 → 8
 +       # Add the third input (y)
         #  i.e. 8 and 1 → 9
  ²      # Take the second input again (z)
   »     # Join the stack by newlines and implicitly print it
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~74~~ ~~67~~ 63 bytes
```
r=read
f x|(a,(c,s:d):_)<-lex<$>lex x!!0=show(r a*r d+r c)++s:d
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/v8i2KDUxhStNoaJGI1FHI1mn2CpF0ype00Y3J7XCRsUOSCpUKCoa2BZn5JdrFCkkahUppGgXKSRramsDlf7PTczMsy0oyswrUUlTMjRSMNY3UfoPAA "Haskell – Try It Online")
## Explanation
As [H.PWiz](https://codegolf.stackexchange.com/users/71256/h-pwiz) figured out we can use Haskell's lexer here to break up the string into it's parts. (Earlier I was using `span(>'/')`) And Laikoni pointed out that `<$>` works just like `mapSnd` from `Data.Tuple`. 
The pattern guard breaks up our code into the three numbers we want using `lex`. `lex` invokes haskell's lexer to break off the first token. It returns a list with each element representing a possible way to parse the string. These elements are tuples with the first element being the first token and the rest of the string being the second element. Now since the input format is very regular we are only ever going to have exactly one parse, so we can always take the first one. The first thing we do is invoke `lex` on the input
```
lex x
```
Then we unwrap it from it's list giving us a 2-tuple
```
lex x!!0
```
The first token will be the whole part of the mixed fraction leaving the fraction prepended by a space to still parse. Then since tuples are `Functors` we can use `(<$>)` an alias for `fmap` to apply `lex` to the second element of the tuple.
```
lex<$>lex x!!0
```
This eats through the space and breaks off the next token, the numerator of our fraction. Now we bind this to a pattern match using `<-`. Our pattern is 
```
(a,(c,s:d):_)
```
`a` grabs the whole part of the fraction, our first token. `:_` unwraps the list resulting from our second `lex`. `c` grabs the second token we lexed, that is the numerator of the fraction. Everything that remains is bound to `s:d` which splits it into its first character, guaranteed by the format to be a `/` and the remainder which will be the denominator.
Now that we have parsed the input we do the actual computation:
```
show(r a*r d+r c)++s:d
```
Where `r` is the read function we bound earlier.
It is important to note that `lex` returns a list empty if it fails and non-empty if it succeeds. Why this is not a `Maybe` I do not know.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 1 byte
```
+
```
[Run and debug it](https://staxlang.xyz/#c=%2B&i=4+1%2F2%0A12+2%2F4%0A0+0%2F2%0A11+23%2F44&a=1&m=2) (although there's not much to debug)
The challenge specification says "You do not need to simplify the output." Assuming it's *allowed* to simplify, then there's a built-in instruction in stax to do this. The input is implicitly interpreted as an integer and a rational number. The `+` instruction widens both to rationals, adds, and simplifies. The result is implicitly printed.
[Answer]
# [Forth (gforth)](http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/), 92 bytes
```
: f 0 -rot 3. do 0 -rot >number 1 m+ loop 2drop + >r swap i * + r> <# 0 #s '/ hold + #s #> ;
```
[Try it online!](https://tio.run/##ZY3LCsIwFET3fsXQLARLzaNdqeRf1DRWaL3hJiJ@fbwuBNHNDOfAMJG4TN0lvqvWHSIMOqaCfotAH/C3@3IaGRZLi5kowQWWbOEZ@XFMuGIjxB4HJSOVsdaYaA4iBZTHvuYG1sL1ehga@SnPNOLMK9EDrHY/zsD8Oevg9Pe4vgA "Forth (gforth) – Try It Online")
The pain of parsing and formatting...
Takes a string as `pointer length` (gforth standard), and returns a string in the same format.
### How it works
```
: f ( addr u -- addr u )  \ take a string and return a string
  0 -rot      \ ( 0 addr u )
  3. do       \ repeat 3 times...
    0 -rot      \ ( ... 0 0 addr u )
    >number     \ ( ... num 0 addr u ) parse an integer;
                \ `addr` now points to right after the parsed int
    1 m+        \ increment the addr to point to the next integer
  loop        \ end loop ( x y z 0 addr u )
  2drop +     \ discard input string and zero on the top
  >r          \ ( x y R:z ) so the value of z can be copied by `i`
  swap i * +  \ ( x*z+y R:z )
  r>          \ ( x*z+y z )
  <#          \ start formatting the output from the end
  0 #s        \ push z to the output; formatting built-ins take double cells
  '/ hold     \ push a slash
  + #s        \ #s leaves two zeros at the top, so discard one and push x*z+y
  #>          \ finish formatting and get the string ( pointer length )
;
```
[Answer]
# Wolfram|Alpha, 0 or 1 byte
```
=
```
The challenge says it's not necessary to simplify the output, but doesn't disallow it. If it's not disallowed, then:
1)The online Wolfram|Alpha interpreter will automatically convert mixed numbers to improper fractions (0 bytes). E.g.:
[![enter image description here](https://i.stack.imgur.com/sm5uP.png)](https://i.stack.imgur.com/sm5uP.png)
2)The Wolfram|Alpha interpreter can be called within Mathematica by entering `=` followed by the input (1 byte):
[![enter image description here](https://i.stack.imgur.com/vJq6F.png)](https://i.stack.imgur.com/vJq6F.png)
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 18 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
OẸ'//ẸsNṭẊ,p+x,'/j
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPU8lRTElQkElQjgnJTJGJTJGJUUxJUJBJUI4c04lRTElQjklQUQlRTElQkElOEElMkNwJTJCeCUyQyclMkZqJmZvb3Rlcj0maW5wdXQ9JTIyNCUyMDElMkYyJTIyJTIwJTIwJTIwJTIwLSUzRSUyMCUyMjklMkYyJTIyJTBBJTIyMTIlMjAyJTJGNCUyMiUyMCUyMCUyMC0lM0UlMjAlMjI1MCUyRjQlMjIlMEElMjIwJTIwMCUyRjIlMjIlMjAlMjAlMjAlMjAtJTNFJTIwJTIyMCUyRjIlMjIlMEElMjIxMSUyMDIzJTJGNDQlMjIlMjAtJTNFJTIwJTIyNTA3JTJGNDQlMjImZmxhZ3M9Q2U=)
#### Explanation
```
OẸ'//ẸsNṭẊ,p+x,'/j  # Implicit input ("x y/z")
OẸ                  # Split on spaces, then dump onto the stack
  '//Ẹ             '# Split the fraction on "/", then dump again
      sN            # Swap and convert the numerator to integer
        ṭ           # Triple swap to get the order [y, x, z]
         Ẋ          # Copy z to the register without popping
          ,p        # Multiply x and z (implicit conversion to int)
            +       # Add this to y (which we converted earlier)
             x,     # Pair this with z (from the register)
               '/j '# Join this pair on "/"
                    # Implicit output
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 3 bytes
```
⌈E∑
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyIiLCIiLCLijIhF4oiRIiwiIiwiNCAxLzIiXQ==) -4 thanks to lyxal
```
⌈   # Split on spaces
 E  # Evaluate each
  ∑ # Sum
```
[Answer]
# [Factor](https://factorcode.org), 43 bytes
```
[ eval( -- x x ) + >fraction [I ${}/${}I] ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=JU29CsIwGNz7FEcQVEpJGzOIgrhJFxfRpXQIkmogJiVG8QefxKWLPoBv49sYDB_HHXfcfc93I7beuu67Wa_K5WICeRYaB-H3UMZL11otvMROGumEVjfhlTVHKItpkhCOgjKSkIKBUR5EjjwaBdiIck5eJ99k429a_YcHyDJcwg2RYta48DvMoSrRuz9oQFmjjpVPv8IcRqMGhxFtq68x6LrIPw)
Assumes the input must be a string, otherwise this can be shorter. Simplifies the output.
[Answer]
# Javascript ES6, 62 bytes
```
p=prompt;b=p(a=+p()).split`/`;alert((+b[1]*a+ +b[0])+"/"+b[1])
```
[Answer]
# Perl, ~~82~~ ~~61~~ 38 bytes
```
#!perl -paF/\D/
$_=$F[0]*$F[2]+$F[1]."/$F[2]"
```
This can probably be golfed more.
**Changes**
* Saved 16 bytes by using a regex in `split`, and 5 by using `<>` instead of `<STDIN>`.
* Saved another 16 bytes thanks to Dennis.
[Answer]
## Mathematica, 51 bytes
```
Interpreter["ComputedNumber"]@#~ToString~InputForm&
```
Interestingly, Mathematica supports this with a built-in. If outputting a number is allowed, than we only need 28 bytes:
```
Interpreter@"ComputedNumber"
```
[Answer]
# Java, ~~159~~ ~~148~~ ~~142~~ ~~120~~ 110 bytes
```
String m(String[]a){Long b=new Long(a[0]),d=new Long((a=a[1].split("/"))[1]);return b*d+new Long(a[0])+"/"+d;}
```
Saved a bunch of bytes thanks to FlagAsSpam.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 23 bytes
```
->x{eval x.split*?++?r}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf166iOrUsMUehQq@4ICezRMteW9u@qPZ/QWlJsUJatJKJgqG@kVLsfwA "Ruby – Try It Online")
[Answer]
# [ARBLE](https://github.com/TehFlaminTaco/ARBLE), 13 bytes
```
a*c+b.."/"..c
```
[Try it online!](https://tio.run/##SyxKykn9/z9RK1k7SU9PSV9JTy/5////hob/jYz/m5gAAA "ARBLE – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~78~~ 76 bytes
```
def f(s):a,b=s.split();b,c=b.split('/');return'%s/'%(int(a)*int(c)+int(b))+c
```
[Try it online!](https://tio.run/##TY3BDoIwEETvfMVezHaFUECMEdIvUQ6AJZIaIG09EOO3Y4uYuJfZmbydnWZ7H4fDstxkBx0zVNRRI0xspkdvGZVN1Ipmc8iRSi3tUw@4Mxx3rB8sq2nvpaXQS0MUtouVxhoQ8MIcUp5hAXh2EgGmGWQ898ExceqSBJIvkWxECtmB5xtz8ts76EYNCvoB1uZYydkwKgJwM2n/V7lLgKt1DStyUdWafKOOKfqzDKXWo8YIR4V0@R0I4bmKguUD "Python 3 – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) with -la -Mfeature=say, 32 bytes 25 bytes
```
m|/|;say$_*$'+$F[1],"/$'"
```
[Try it online!](https://tio.run/##K0gtyjH9/z@3Rr/GujixUiVeS0VdW8Ut2jBWR0lfRV3p/38TBUN9Iy5DIwUjfRMuAwUDEMdQwchY38TkX35BSWZ@XvF/3ZzE/7q@aamJJaVFqbZAcwA "Perl 5 – Try It Online")
*(-7 bytes thanks to Dom Hastings)*
`$_` is the whole input `x y/z`, which evaluates the value of `x` in numeric contexts (like the `*` here). `$'` is the regex post-match string, which here contains whatever comes after `/` - so, `z`. To get the `y` value, we use the `-a` flag which splits the input on spaces and places them in the `@F` array. So here, `@F = ("x", "y/z")`, which means `$F[1]="y/z"` which evaluates in `y` in numeric contexts (since `y` is the initial contiguous sequence of digits with `$F[1]`). 
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
Σmrw
```
[Try it online!](https://tio.run/##yygtzv7//9zi3KLy////mygY6hsBAA "Husk – Try It Online")
`ṁrw` is supposed to work, but there's some bug that returns an empty list. Anyway, hooray for native rational number support.
[Answer]
# [GNU AWK](https://www.gnu.org/software/gawk/manual/gawk.html), 5+16 = 21 bytes
Command-line argument: `-F |/`
Source code:
```
$0=$1*$3+$2"/"$3
```
[Try it online!](https://tio.run/##SyzP/v9fxcBWxVBLxVhbxUhJX0nF@P9/EwVDfSMuQyMFI30TLgMFAxDHUMHIWN/E5F9@QUlmfl7xf103hRp9AA "AWK – Try It Online")
The command-line argument sets the field separator to the regex `/ |\//`. Thus, it is easy to map the input as three fields.
[Answer]
# [Itr](https://github.com/bsoelch/OneChar.js/blob/main/ItrLang.md), 1 byte
`+`
Itr has built-in support for rational numbers, including for parsing input numbers.
[online interpreter](https://bsoelch.github.io/OneChar.js/?lang=Itr&src=Kw==&in=MTEgMjMvNDQ=)
## Explanation
```
   ; implicit input, by default numbers are separated by spaces
   ; two integers with a '/' between them are interpreted as a fraction
 + ; add the integer part to the fractional part
   ; implicitly output the fraction
```
[Answer]
# [Headass](https://esolangs.org/wiki/Headass), 80 bytes
```
-(----[]]]][]]][{{U]>)D^^D^^^^^R]^}:DON-)}:NE.U[UOUO{^)N+E:]OD-}.U^U[{U^)DPD]P:}
```
[Try It Online!](https://dso.surge.sh/#@WyJoZWFkYXNzIiwiIiwiLSgtLS0tW11dXV1bXV1dW3t7VV0+KUReXkReXl5eXlJdXn06RE9OLSl9Ok5FLlVbVU9VT3teKU4rRTpdT0QtfS5VXlVbe1VeKURQRF1QOn0iLCIiLCI0OSAvLyAxXG40OSAvLyAxXG4zMiAvLyBzcGFjZVxuNTAgLy8gMlxuNTEgLy8gM1xuNDcgLy8gL1xuNTIgLy8gNFxuNTIgLy8gNCIsIiJd) Takes character codes as input and outputs as two numbers Numerator, Denominator.
### Explanation:
Fairly straightforward, parses by looping through digits, subtracting 48, and then multiplying by 10 before adding each new number. when it hits a charcode less than 48, it knows to move on to the next number. There's not an easy way to multiply within a single code block to my knowledge, so the next two code blocks respectively copy a bunch of x onto the queue and then add them all up. Probably still golfable within the same approach, I found a few golfs while writing up the explanation, even.
```
-(----[]]]][]]][{{U]>)D^^D^^^^^R]^}:DON-)}:NE. block 0: parses input
-(                                             r3 = -1
  ----[]]]][]]][                               r2 = -48
                {                     N-)}:    while input remains
                 {U]>)            }:             while input + r2 > r3
                      D^^D^^^^^                    r1 *= 10
                               R]^                 r1 += input + r2
                                    DO           enqueue and reset r1
                                           NE  go to block 1
                                             . end block
U[UOUO{^)N+E:]OD-}. block 1: copies x z times onto queue
U[                  r2 = x
  UO                enqueue y
    UO              enqueue z
    U  ^            r1 = z
      {^)   :  D-}  while(r1--){
             ]O       enqueue x
                    }
         N+E        go to block 2
                  . end code block
U^U[{U^)DPD]P:} block 2: sums copies of x and adds y, prints x*z+y and z
U^              r1 = y
  U[            r2 = z
    {U )     :} while items remain unvisited on the queue (all of which are x)
     U^           r1 += x
        DP      print r1
          D]P   print r2
```
]