Skip to main content
added 675 characters in body
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38

Clean, 57 bytes

import StdEnv,Text
$b#[u,v:_]=split"/"b
=v==""<+10^size u

Try it online!

This one is a little shorter but breaks for large numerator/denominators.

Clean, 77 61 60 58 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv,Text
$b#[u,v:_]=split"/"b
=1<+[48\\_<-:u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.
There's some trickery with conversion overloading, where 1<+[48\\_<-:u] converts [Int] to [Char] and then to {#Char} (:== String), but Int directly to String.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 77 61 60 58 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv,Text
$b#[u,v:_]=split"/"b
=1<+[48\\_<-:u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.
There's some trickery with conversion overloading, where 1<+[48\\_<-:u] converts [Int] to [Char] and then to {#Char} (:== String), but Int directly to String.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 57 bytes

import StdEnv,Text
$b#[u,v:_]=split"/"b
=v==""<+10^size u

Try it online!

This one is a little shorter but breaks for large numerator/denominators.

Clean, 77 61 60 58 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv,Text
$b#[u,v:_]=split"/"b
=1<+[48\\_<-:u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.
There's some trickery with conversion overloading, where 1<+[48\\_<-:u] converts [Int] to [Char] and then to {#Char} (:== String), but Int directly to String.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

added 19 characters in body
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38

Clean, 77 61 6060 58 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv,Text
$b#(u$b#[u,v)=span((<)':_]=split"/')b"b
=['/1']++['0'\\_<=1<+[48\\_<-:u]==v

Try it online!Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.
There's some trickery with conversion overloading, where 1<+[48\\_<-:u] converts [Int] to [Char] and then to {#Char} (:== String), but Int directly to String.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 77 61 60 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv
$b#(u,v)=span((<)'/')b
=['/1']++['0'\\_<-u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 77 61 60 58 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv,Text
$b#[u,v:_]=split"/"b
=1<+[48\\_<-:u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.
There's some trickery with conversion overloading, where 1<+[48\\_<-:u] converts [Int] to [Char] and then to {#Char} (:== String), but Int directly to String.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

added 115 characters in body
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38

Clean, 77 6161 60 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv
$b#(u,v)=span((<><)'/')b
=['/1']++['0'\\_<-u]==v

Try it online!Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 77 61 bytes

import StdEnv
$b#(u,v)=span((<>)'/')b
=['/1']++['0'\\_<-u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

Clean, 77 61 60 bytes

-1 thanks to OMᗺ's tip on my other answer

import StdEnv
$b#(u,v)=span((<)'/')b
=['/1']++['0'\\_<-u]==v

Try it online!

This uses Neil's method, it's a bit shorter than doing it directly.

Clean, 91 89 bytes

import StdEnv,Text
t=toInt
$a b#[b,c:_]=map t(split"/"b)
#d=t(a<+b)
=d/c==t a&&d-d/c*c==b

Try it online!

Defines a function $ :: String String -> Bool which extracts the numerator and denominator, string-concatenates the integer part and the numerator, and checks equivalence.

added 737 characters in body
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38
Loading
added 11 characters in body
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38
Loading
Source Link
Οurous
  • 8.1k
  • 1
  • 16
  • 38
Loading