[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 489: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
UBA - CienciaS • Ver Tema - Como se saca la parte entera en funcional?
UBACS Q&A Foro WikiCS
Fecha actual 18 Abr 2024, 10:39

Todos los horarios son UTC - 3 horas




 Página 1 de 1 [ 16 mensajes ] 
Autor Mensaje
 Asunto: Como se saca la parte entera en funcional?
NotaPublicado: 27 Sep 2008, 23:54 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 16:53
Mensajes: 273
Ubicación: José León Suárez :)
Como se saca la parte entera en funcional?

por ejemplo... en una funcion q recibe parametros de tipo Integer
quiero usar la parte entera de la raiz de un numero... como lo escribo?


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 01 Oct 2008, 16:56 
Estudiante

Registrado: 21 May 2008, 12:17
Mensajes: 37
Ubicación: BS As
floor n :D



_________________
Hay 10 tipos de personas en el mundo. Los que entienden binario, y los que no...
Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 02 Oct 2008, 00:50 
Ayudante de Primera
Avatar de Usuario

Registrado: 28 Jun 2008, 01:28
Mensajes: 104


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 03 Oct 2008, 12:21 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 16:53
Mensajes: 273
Ubicación: José León Suárez :)
gracias :)


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 04 Oct 2008, 23:24 
insert rank here!
Avatar de Usuario

Registrado: 13 May 2008, 23:34
Mensajes: 376
Ubicación: 45 07 23.73N 123 06 49.91W
jajaja
nos dejaran usar algo como lo q puso eivanec?
(es un lambda abstraction lo q hiciste con el igual o mande fruta?)


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 05 Oct 2008, 20:42 
Estudiante

Registrado: 21 May 2008, 12:17
Mensajes: 37
Ubicación: BS As
jajaja si, es una lambda-abstraction parece, pero el takewhile es medio ilegal aca me parece XD



_________________
Hay 10 tipos de personas en el mundo. Los que entienden binario, y los que no...
Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 07 Oct 2008, 12:09 
Ayudante de Primera
Avatar de Usuario

Registrado: 28 Jun 2008, 01:28
Mensajes: 104
No, creo que no; takeWhile toma una función que devuelve Bool y una lista:

Hugs> :t takeWhile
takeWhile :: (a -> Bool) -> [a] -> [a]

Y /=, el "operador" de desigualdad, es por supuesto simplemente una función:

Hugs> :t (/=)
(/=) :: Eq a => a -> a -> Bool

Que no cumple el tipo requerido, pero agregando su primer parámetro...

Hugs> :t (/= '.')
flip (/=) '.' :: Char -> Bool

La reducción da bien. Magias de haskell, jaja. Por cierto lo que posteé es una gran mentira, por supuesto, ya que devuelve chars:

Hugs> :t (takeWhile (/= '.') (show 423.1234))
takeWhile (flip (/=) '.') (show 423.1234) :: Fractional a => [Char]

Creo que el lambda en Haskell es siempre \, pero no me consta.

Saludos!


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 07 Oct 2008, 12:49 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 15:44
Mensajes: 164
Ubicación: 127.0.0.1



_________________
"If debugging is the process of removing bugs, then programming must be the process of putting them in." -- Dijkstra
Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 07 Oct 2008, 18:26 
Ayudante de Primera
Avatar de Usuario

Registrado: 28 Jun 2008, 01:28
Mensajes: 104
Sí, esa fue la primera respuesta y la correcta! El resto fue un off-topic por aburrimiento y densidad mía, jaja. Saludos.


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 07 Oct 2008, 18:50 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 15:44
Mensajes: 164
Ubicación: 127.0.0.1
jaja, con tanto post me olvidé de que ya habían dicho esa respuesta, perdón por repetir y no leer! :P



_________________
"If debugging is the process of removing bugs, then programming must be the process of putting them in." -- Dijkstra
Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 17 Oct 2008, 09:57 
Vago

Registrado: 04 Sep 2008, 00:02
Mensajes: 2
tengo una solucion alternativa... que esta buena cuando uno quiere hacer la funcion, y no utilizar las que vienen en el prelude....

parteentera :: Double -> Integer
parteentera n | n <= -1 = (-1) * laparteentera 0 (-n)
parteentera n | -1 < n && n < 1 = 0
parteentera n | n >= 1 = laparteentera 0 n

laparteentera :: Integer -> Double -> Integer
laparteentera x n | 0 > n = x-1
laparteentera x n | otherwise = laparteentera (x+1) (n-1)

obvio que es una forma... debe haber miles... y seguramente esta forma puede quedar mejor escrita... pero la idea está.... agarro un float, y le voy restando de a uno hasta que me de negativo... cuando llego a que me de negativo, devuelvo la cantidad de veces que le reste uno y listo....


espero que sirva de algo...


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 17 Oct 2008, 10:34 
insert rank here!
Avatar de Usuario

Registrado: 13 May 2008, 23:34
Mensajes: 376
Ubicación: 45 07 23.73N 123 06 49.91W


Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 31 Oct 2008, 14:30 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 15:44
Mensajes: 164
Ubicación: 127.0.0.1



_________________
"If debugging is the process of removing bugs, then programming must be the process of putting them in." -- Dijkstra
Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 01 Nov 2008, 05:25 
Ayudante de Primera
Avatar de Usuario

Registrado: 28 Jun 2008, 01:28
Mensajes: 104
Sin duda burdo lo mío, no lo niego :D


Última edición por eivanec el 17 Nov 2008, 23:48, editado 1 vez en total

Desconectado
 Perfil  
 
 Asunto: Re: Como se saca la parte entera en funcional?
NotaPublicado: 02 Nov 2008, 11:32 
Site Admin
Avatar de Usuario

Registrado: 09 May 2008, 15:44
Mensajes: 164
Ubicación: 127.0.0.1
Perdón, no lo dije con el sentido de discriminar. Mejor lo edito así evitamos problemas.
Gracias por avisar!



_________________
"If debugging is the process of removing bugs, then programming must be the process of putting them in." -- Dijkstra
Desconectado
 Perfil  
 
Mostrar mensajes previos:  Ordenar por  
 Página 1 de 1 [ 16 mensajes ] 

Todos los horarios son UTC - 3 horas


¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 1 invitado


No puede abrir nuevos temas en este Foro
No puede responder a temas en este Foro
No puede editar sus mensajes en este Foro
No puede borrar sus mensajes en este Foro
No puede enviar adjuntos en este Foro

Buscar:
Saltar a:  

cron