I'm one of them :)
Nice to meet you...
vipex.id wrote:
>
> Hi, I'm new in Haskell & wondering is there Indonesian people using
> Haskell
> here.
>
> Nice meet* you all :)
>
> Regards,
> vipex
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haske
> I dont understand why the above functions are legal, and what arguments
they need. Could you please
> give an example of how to invoke it?
Huh? None of them are legal, at least in my WinHugs they're not. What tools
are you using?
Some good reading I found:
http://learnyouahaskell.com/higher-or
> This doesnt. But why?
Back to the definition of function composition: f . g is possible if g
returns a value that's compatible with f's argument. Now, let's check the
type of square and add3:
square :: Num a => a -> a
add3 :: Num a => a -> a -> a -> a
(square . add3 1 2) is actually seen by t
Haha... yes, thanks. It was a mistake, I thought I did it too fast.
--
View this message in context:
http://www.nabble.com/Expression-parsing-problem-tp23610457p23632282.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
___
I hope you're right. 7 pages... 1-2 nights should be enough. Thanks for all.
--
View this message in context:
http://www.nabble.com/Expression-parsing-problem-tp23610457p23614011.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
__
> Why is Symbol = (String, Token)? A more sensible token type would
> include values in the Value constructor and string identifiers in the
> Identifier constructor; the strings in everything else seem redundant.
Surely you didn't read my original post, do you? I have a very limited
knowledge of
> Indeed, the grammar does not admit "1*2/3" as a sentence ...
Huh? Why not? "1 * 2 / 3" should match factor "*" factor "/" factor.
Remember that { } is repetition, so it should be able to handle such term.
> expression ::= term | term "+" expression
> term ::= factor | factor "*" term
> factor
I'm writing a paper as a replacement for writing exam and decided to write
a simple compiler (got a little experience with it). However, I got trouble
in parsing expression.
The grammar:
expression = "get" | [ "+" | "-" ] term { ( "+" | "-" ) term }
term = factor { ( "*" | "/" ) factor }
Still struggling after almost year (I learn it along with Prolog, Lua, and
many other non-C family languages), because I'm not very good at "describing
solutions". My imperative background is quite strong, but I've been able to
switch more easily these days (after taking Functional Programming cla
So, what's the solution? This one:
(l::[Ord]) <- readLn
doesn't work (because Ord isn't a type constructor). It doesn't even comply
to Haskell 98 standard. I want to be able to read any list of ordered
elements.
--
View this message in context:
http://www.nabble.com/List-as-input-tp19987726p2
> How about a list of functions from int to int?
Hmm... it does make sense.
--
View this message in context:
http://www.nabble.com/List-as-input-tp19987726p20026222.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
___
Has
> ... If there isn't enough information to set a concrete type at the call,
type inference fails. This is what you get with strong typing.
In my case, where does type inference fail? Strong typing is good, but quite
confusing when combined with polymorphism.
> It isn't. The type of data in the
> The compiler doesn't know what kind of list you are trying to read,
sort, and print.
So, the type must be specific? Then why it's possible to call the sorting
function with any list?
> I'm curious as to why taking the pivot from the middle is an
'optimized' version.
Consider if it's used in a
module Main where
import Data.List
-- quicksort of any list
qsort [] = []
qsort (x:xs) = qsort(filter(=x) xs)
-- optimized quicksort, uses middle element as pivot
qsortOpt [] = []
qsortOpt x = qsortOpt less ++ [pivot] ++ qsortOpt greater
where
pivot = x !! ((length x) `div` 2)
le
consider this partial program:
if n>5 then
putStrLn "big"
else
putStrLn "small"
this works fine in hugs, but in ghc I must change it to:
if n>5
then
putStrLn "big"
else
putStrLn "small"
--
View this message in context:
http://www.nabble.com/if---then---else-layout-tp19663006p19
Does anyone have an explanation how Haskell implement this? Or a pointer to a
article describing this?
--
View this message in context:
http://www.nabble.com/Integer-%3D-infinite-precision-integer--How--tp18273875p18273875.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.
Hi, I'm back. I have some troubles understanding your code:
Chaddaï Fouché-2 wrote:
>
> findAllAns 0 0 = [[]]
> findAllAns 0 s = []
> findAllAns n s = [ x:xs | x <- [0..s], xs <- findAllAns (n - 1) (s - x) ]
>
Let's try a test case (CMIIW) for findAllAns 2 1:
findAllAns 2 1 = [ 0:(findAllAns 1
ate all lists (array of Byte) of length N which each element ranges
from 0 to C.
2. Filter which has sum=C.
>> seems that leledumbo found a new way to force us give the answers to
>> those homeworks LOL
Don't worry, I'm not gonna use it because it has to be done in procedural
ate all lists (array of Byte) of length N which each element ranges
from 0 to C.
2. Filter which has sum=C.
>> seems that leledumbo found a new way to force us give the answers to
>> those homeworks LOL
Don't worry, I'm not gonna use it because it has to be done in procedural
I give up %-|, I'll go back to Pascal instead. Thanks for your answers.
--
View this message in context:
http://www.nabble.com/Help-with-generalizing-function-tp18063291p18065206.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
__
>> tuples may contain any combination of types, use lists instead
I think so, too.
>> You can use <- in a list comprehension or list "do"-block to select a
>> single list from a list of lists.
Is it related with my question? I mean, instead of extracting, I need to
construct lists.
--
View this
I've successfully create a function to return lists of N-ple that satisfy the
following function:
x1 + x2 + x3 + ... + xN = C
But unfortunately, it's not generic. The N is supposed to be an input, too.
I don't know how to make a dynamic N-ple (is it possible anyway?).
Currently, here's the impleme
I don't know how Haskell should behave on this. Consider this function:
elemOf (x,y) = (x,y) `elem` [ (a,b) | a <- [0..], b <- [0..] ]
If I try to query elemOf (1,1), the program keeps searching and searching
but it never makes it. But if I query elemOf (0,1) (or anything as long as
the first ele
23 matches
Mail list logo