Jump to content

Haskell programs - beginer need help


boba22
 Share

Recommended Posts

Can someone write me the program for this: insert' 111 2 1 [[2..4],[3..5],[7..9]] = [[2, 3, 4],[3, 4, 111],[7, 8, 9]]

And a program for rotating the list for i places. Positive i rotates left for i places and negative rotates right for i places. Don't use Data.Bits

And also this: And also a function that is inserting an element on a i position in list , counting from 0, so that it replaces the existing element in the position i. If i is negative then the counting starts from the end of the list. The result must look like this:

insert2' "fine" 2 ["I","am","great"] = ["I","am","fine"] insert2i 3 (-7) [1..4] = [1,3,3,4]

 

Link to comment
Share on other sites

  • Developers

Welcome..

 

Can someone write me the program for

 

As this is a support forum, Your sentence is starting with the wrong words.

The intent is you code the script yourself and ask for help. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

i tried to do the codes a hunderd times but they dont work:

for the third one i have this:

insert2' :: a -> Int -> [a] -> [a]
insert2' x n [] = []
insert2' x n xs = f ++ [x] ++ drop (length xs - n) xs
 where f = (take (length xs - n) xs)

and for the first one i have this:

insert' xs ys = [[x y | x <- xs] | y <- ys]

Edited by boba22
Link to comment
Share on other sites

  • Developers

Maybe it would be a good idea for you to start looking at the helpfile and get yourself familiarized with the AutoIt3 syntax, since what you posted doesn't make much sense.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Because he's after Haskell.

understood and can only assume the OP wants to convert it to AutoIt3 syntax since he posted here. So a good start would be to understand the basics before asking questions. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...