Skip to main content
Rollback to Revision 2
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

Haskell, 45 43 3243 bytes

foldln#(\n h->n*10+fromEnum:t)=(n*10+fromEnum h-48)0#t
n#_=n
f=(0#)

Try it online!

it's the same as this but it with foldl it's is similar to a reduce-op:Try it online!

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 43 32 bytes

foldl(\n h->n*10+fromEnum h-48)0

Try it online!

it's the same as this but it with foldl it's is similar to a reduce-op:

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 43 bytes

n#(h:t)=(n*10+fromEnum h-48)#t
n#_=n
f=(0#)

Try it online!

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 43 4332 bytes

n#foldl(\n h:t)=(n*10+fromEnum->n*10+fromEnum h-48)#t
n#_=n
f=(0#)0

Try it online!Try it online!

it's the same as this but it with foldl it's is similar to a reduce-op:

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 43 bytes

n#(h:t)=(n*10+fromEnum h-48)#t
n#_=n
f=(0#)

Try it online!

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 43 32 bytes

foldl(\n h->n*10+fromEnum h-48)0

Try it online!

it's the same as this but it with foldl it's is similar to a reduce-op:

n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #
added 217 characters in body
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

Haskell, 4545 43 bytes

n#(h:t)=(n*10+fromEnum h-48)#t
n#[]=nn#_=n
f s=0#sf=(0#)

Try it online!Try it online!


n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #

Haskell, 45 bytes

n#(h:t)=(n*10+fromEnum h-48)#t
n#[]=n
f s=0#s

Try it online!

Haskell, 45 43 bytes

n#(h:t)=(n*10+fromEnum h-48)#t
n#_=n
f=(0#)

Try it online!


n#(h:t)=       - # -> infix function taking a number and a string(head:tail)
(n*10+fromEnum h-48)#t  
                 - compute first char and call recursively on tail

n#_=n          - end condition

f=(0#)         - apply 0 to #
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58
Loading