haskell and prolog

Started by
10 comments, last by rholding2001 19 years ago
hi there. i have to do an assignment in these two langiages, ive looked for the compilers and only found one for haskell the ghc or something, this however doesnt seem to work, ive installed it and when i run it a dos screen pops up and disapears immediatly. can any of you guys give me a definate link to a working compi;ler for both these langauges it will be greatly appreciated. i dont know anything about these things so i need direct help please thanks people
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
Advertisement
What is probably happening is that you aren't providing the required parameters when you run your Haskell compiler, so the compiler issues an error message and exits. Because the compiler exits, the DOS window shuts and you don't get to read the error message.

Try running it in a dos window (Start menu->Run->"command"). Then the window won't close when the compiler does.

Here's the standard prolog interpreter.
http://www.swi-prolog.org/download.html
As for Haskell, I learnt Haskell with Hugs98, haven't had any experience with other compilers, but it worked :)
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
hi ive just typed in what all the help files i have looked at claim are the way you state a function in haskell, the line was

testWord = "testing" and i get
:ERROR - Syntax error in input (unexpected `=')

how do i make testWord = "testing"?

i dont understand
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
that is a correct haskell function, but you can't define functions in the interpreter. You need to create them in a file, and then load them.

foo.hs:

testWord :: String
testWord = "testing"

in hugs:
> :l foo.hs
> testWord
"testing"
>

(you don't have to define the types of functions, but it is good practice.)

/Nico
ahhh i think it may be coming clearer now. waw.
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
Day 3 of learn haskell.

Ive looked at a load of tutorials and quite frankly im fed up of reversing strings and removing certain characters from them

What i need is to (ill explain this how i would in pascal, c or c++, i know haskel does not work like this)

i need to create a record that holds say a name ::string, age :: int, on/off :: bool

how do i store something like this and then use a function to get the name of the thing, its age and is it turned on or off.

how would i answer a question like. is archibold turned on?

thanks

visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
look here
something like this, perhaps..

data Record = Record {                      name :: String,                      age :: Int,                      onoff :: Bool}myrecord = Record {                   name = "Nico",                   age = 666,                   onoff = True}myfunc :: Record -> Stringmyfunc rec = let r_name = name rec;                 r_age = age rec;                 r_onoff = onoff rec; in                 "Name: " ++ r_name ++ "\nAge: " ++ (show r_age) ++ "\nOn: " ++ (show r_onoff)

just remember you can't have truly mutable varibles in haskell without monads.

hope it helps..
/Nico
woah nico, thanks man.
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.

This topic is closed to new replies.

Advertisement