Posts by João Sampaio • 125 points
13 posts
-
1
votes1
answer41
viewsQ: Doubt in case of Stop
listasIguais :: (Eq a) => [a] -> [a] -> Bool listasIguais [] p = False listasIguais p [] = False listasIguais (x: xs) (y:ys) = x == y && (listasIguais xs ys) listasIguais…
haskellasked João Sampaio 125 -
0
votes0
answers36
viewsQ: Doubt about images in Latex
\begin{figure}[h!] \centering \graphicspath[scale = 0.2]{/Desktop/Universidade/2017li1g013/relatorio/Imagens/haddock.png} \caption{Documentação Haddock} \label{fig:my_label} \end{figure} I want to…
latexasked João Sampaio 125 -
2
votes2
answers366
viewsQ: Elements of a List are all the same
I made this function definition equal, which checks that all elements in a list are equal. iguais :: [Float] -> Bool iguais [x,y] = x == y iguais (h:t) = h == (head t) However the result is not…
haskellasked João Sampaio 125 -
0
votes0
answers194
viewsQ: Doubts about normalization of polynomials
I set the function normalizes that given a polynomial, returns the corresponding polynomial, after normalization. Example: normaliza [(1,2),(3,4),(3,2)] [(4,1),(3,4)] type Polinomio = [Monomio] type…
haskellasked João Sampaio 125 -
1
votes1
answer97
viewsQ: Place final line in a Latex Table
I’m building a Latex Table and it’s giving me an error in the final horizontal line I put. \begin{table}[t] \begin{center} \begin{tabular}{|c|r||l|} \hline \emph{Fases} & \emph{Descrição} &…
latexasked João Sampaio 125 -
1
votes0
answers38
viewsQ: Input and Output - Definition
What is the definition of the following predetermined functions of the System.Random :: to) randomRIO :: (Int,Int)-> IO Int b) putChar :: Char -> IO ()…
haskellasked João Sampaio 125 -
2
votes2
answers72
viewsQ: Tree Junction - joinTree
data BTree a = Empty | Node a (BTree a) (BTree a) data LTree a = Tip a | Fork (LTree a) (LTree a) data FTree a b = Leaf b | No a (FTree a b) (FTree a b) Also set the function joinTrees :: Btree a…
haskellasked João Sampaio 125 -
0
votes1
answer52
viewsQ: Transformation of Trees
Considering the structures: data BTree a = Empty | Node a (BTree a) (BTree a) data LTree a = Tip a | Fork (LTree a) (LTree a) data FTree a b = Leaf b | No a (FTree a b) (FTree a b) Set the function…
haskellasked João Sampaio 125 -
0
votes1
answer104
viewsQ: Leaf Trees - Height
It is customary to define trees where information is only on extermidities (Leaf Trees): data LTree a = Tip a | Fork (LTree a) (LTree a) Define the following function about this type: ltHeight ::…
haskellasked João Sampaio 125 -
1
votes1
answer155
viewsQ: Haskell - Higher Order Functions
(a) any :: (a -> Bool) -> [a] -> Bool that test whether a predicate is true for some element of a list; for example: any odd [1..10] == True (b) zipWith :: (a->b->c) -> [a] ->…
haskellasked João Sampaio 125 -
1
votes1
answer126
viewsQ: Recursive definition of the pre-closed Enumfromthento function
How to recursively define the Enumfromthento function
haskellasked João Sampaio 125 -
1
votes1
answer333
viewsQ: Haskell- List replacement function
They know if there is a predefined function in Haskell that, given an element, replaces it with another element of a given list position. For example: func 1 2 [1,2,3,4] [1,2,1,4]…
haskellasked João Sampaio 125 -
2
votes1
answer94
viewsQ: Recursiveness-elemindices
They know how to recursively define the elemindices function, predefined in Prelude. I defined it in a way, but it doesn’t give the expected result. myElemIndices :: Eq a => a -> [a] ->…
haskellasked João Sampaio 125