[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?
UBA - CienciaS
http://ubacs.com.ar/ubacs/

Como se saca la parte entera en funcional?
http://ubacs.com.ar/ubacs/viewtopic.php?f=43&t=587
Página 1 de 1

Autor:  Cloud [ 27 Sep 2008, 23:54 ]
Asunto:  Como se saca la parte entera en funcional?

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?

Autor:  thomas [ 01 Oct 2008, 16:56 ]
Asunto:  Re: Como se saca la parte entera en funcional?

floor n :D

Autor:  eivanec [ 02 Oct 2008, 00:50 ]
Asunto:  Re: Como se saca la parte entera en funcional?


Autor:  Cloud [ 03 Oct 2008, 12:21 ]
Asunto:  Re: Como se saca la parte entera en funcional?

gracias :)

Autor:  Nico? [ 04 Oct 2008, 23:24 ]
Asunto:  Re: Como se saca la parte entera en funcional?

jajaja
nos dejaran usar algo como lo q puso eivanec?
(es un lambda abstraction lo q hiciste con el igual o mande fruta?)

Autor:  thomas [ 05 Oct 2008, 20:42 ]
Asunto:  Re: Como se saca la parte entera en funcional?

jajaja si, es una lambda-abstraction parece, pero el takewhile es medio ilegal aca me parece XD

Autor:  eivanec [ 07 Oct 2008, 12:09 ]
Asunto:  Re: Como se saca la parte entera en funcional?

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!

Autor:  daniel [ 07 Oct 2008, 12:49 ]
Asunto:  Re: Como se saca la parte entera en funcional?


Autor:  eivanec [ 07 Oct 2008, 18:26 ]
Asunto:  Re: Como se saca la parte entera en funcional?

Sí, esa fue la primera respuesta y la correcta! El resto fue un off-topic por aburrimiento y densidad mía, jaja. Saludos.

Autor:  daniel [ 07 Oct 2008, 18:50 ]
Asunto:  Re: Como se saca la parte entera en funcional?

jaja, con tanto post me olvidé de que ya habían dicho esa respuesta, perdón por repetir y no leer! :P

Autor:  mbianchi [ 17 Oct 2008, 09:57 ]
Asunto:  Re: Como se saca la parte entera en funcional?

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...

Autor:  Nico? [ 17 Oct 2008, 10:34 ]
Asunto:  Re: Como se saca la parte entera en funcional?


Autor:  daniel [ 31 Oct 2008, 14:30 ]
Asunto:  Re: Como se saca la parte entera en funcional?


Autor:  eivanec [ 01 Nov 2008, 05:25 ]
Asunto:  Re: Como se saca la parte entera en funcional?

Sin duda burdo lo mío, no lo niego :D

Autor:  daniel [ 02 Nov 2008, 11:32 ]
Asunto:  Re: Como se saca la parte entera en funcional?

Perdón, no lo dije con el sentido de discriminar. Mejor lo edito así evitamos problemas.
Gracias por avisar!

Página 1 de 1 Todos los horarios son UTC - 3 horas
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/