Saltar al contenido
Underc0de /foro

[Código-Haskell] Típico Strlen - JaAViEr

Iniciado por JaAViEr, Julio 17, 2011, 03:34:11 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Avatar de JaAViEr
Julio 17, 2011, 03:34:11 AM Ultima modificación: Febrero 08, 2014, 05:34:43 PM por Expermicid
Averiguando sobre haskell, me topé con un code STRLEN
Código: haskell

strlen :: String -> Int
main = do
  putStrLn("String:")
  linea <- getLine
  let valor=strlen linea
  putStrLn("El String "++linea++" tiene "++show(valor)++" Caracteres")

strlen inputx=do
  let value=sum[1|_ <- inputx]
  value


Me di el ratito de disminuirlo
Código: haskell

main = do
  putStrLn("String:")
  linea <- getLine
  let valor=sum[1|_<-linea]
  putStrLn("El String "++linea++" tiene "++show(valor)++" Caracteres")
WhatsApp Telegram
Los enlaces son solo para miembros. Registrate o iniciá sesión

¿Te quedó una duda sobre Otros lenguajes?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp