Головна сторінка Груп Google
Довідка | Записатися
I Need some serious help here
Занадто багато тем, що мають бути показані першими. Для того, щоб показати тему першою, зніміть цю опцію з іншої теми.
Під час обробки вашого запиту сталася помилка. Будь ласка, повторіть вашу спробу пізніше.
флаг
  5 повідомлення - Згорнути всі
Група, до якої ви додаєте допис, - група Usenet. Відтак, будь-хто в Інтернеті бачитиме вашу електронну адресу.
Вашу відповідь не було надіслано.
Ваш допис було надіслано
 
Від:
Кому:
Копія:
Продолжить:
Додати копію: | Додати продовження: | Редагувати тему
Тема:
Підтвердження:
З метою підтвердження введіть символи, які ви бачите на зображенні нижче або числа, які чуєте, натиснувши значок доступу. Прослухайте і введіть цифри, що чуєте
 
sandra_ba...@hotmail.com  
Переглянути профіль
 Більше налаштувань 2 Жов 2008, 00:58
Групи новин: comp.lang.haskell
Від: sandra_ba...@hotmail.com
Дата: Wed, 1 Oct 2008 14:58:21 -0700 (PDT)
Локально: Чт 2 Жов 2008 00:58
Тема: I Need some serious help here
Im studying haskell at the university and Im stuck with a binaretree.
There is something wrong with it but i cant find it :S

I need some help !!

data BinTree a = Empty | NodeBT a (BinTree a) (BinTree a) deriving
Show

treeMember :: Ord a => a -> BinTree a -> Maybe a
treeMember x Null = Nothing
treeMember x ( NodeBT x’ left right )
        | x == x’ = Just x’
        | x < x’ = treeMember x left
        | x > x’ = treeMember x right

creatBinTree :: Ord a => BinTree a -> [a] -> BinTree a
createBinTree []         = BinTree
creatBinTree (x:xs)
        = createBinTree ( createBinTree x BinTree ) xs

inorder :: BinTree a -> [a]
inorder Empty = []
inorder ( NodeBT x left right )
    = inorder left ++ [x] ++ inorder right

tSort :: Ord a => [a] -> [a]
tSort xx = inorder ( createBinTree Null xx)

tinsert :: Int ->

BinTree Int -> BinTree Int
tinsert a Empty = (NodeBT a Empty Empty)
tinsert a (NodeBT x lf rt)
                                        | a==x                  =       NodeBT x lf rt
                                        | a<x                        =       NodeBT x (tinsert a lf) rt
                                        | otherwise             =       NodeBT x lf (tinsert a rt)

t1 :: BinTree Int
t1= NodeBT 10 (NodeBT 7 (NodeBT 3 Empty Empty) (NodeBT 8 Empty Empty))
(NodeBT 12 (NodeBT 11 Empty Empty) (NodeBT 16 Empty Empty))

I also have to figure out a simple code for counting the number of
nodes and also treeMember to check if an element is in the tree.. im
really confused


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Dirk Thierbach  
Переглянути профіль
 Більше налаштувань 2 Жов 2008, 10:10
Групи новин: comp.lang.haskell
Від: Dirk Thierbach <dthierb...@usenet.arcornews.de>
Дата: Thu, 2 Oct 2008 09:10:16 +0200
Локально: Чт 2 Жов 2008 10:10
Тема: Re: I Need some serious help here

sandra_ba...@hotmail.com wrote:
> Im studying haskell at the university and Im stuck with a binaretree.
> There is something wrong with it but i cant find it :S

> I need some help !!

Homework? :-)

The usual question in this case is: What did you try, and where exactly
are you stuck?

There are a few rather obvious little mistakes in the code. The usual
way to fix them is to try to compile it, then move the cursor in the
editor to the place where the compiler complains, and think hard
about the compiler message and/or the type of the expression/pattern
that is supposed to be at this place. And that's something you'll have
to practice, so I'll only give you hints, not the solution.

You might also want to talk with some fellow students or your tutors
about your code -- that feedback loop has less latency than a
newsgroup :-)

- Dirk


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Achim Schneider  
Переглянути профіль
 Більше налаштувань 5 Жов 2008, 01:47
Групи новин: comp.lang.haskell
Від: Achim Schneider <bars...@web.de>
Дата: Sun, 5 Oct 2008 00:47:50 +0200
Локально: Нд 5 Жов 2008 01:47
Тема: Re: I Need some serious help here

Dirk Thierbach <dthierb...@usenet.arcornews.de> wrote:
> You might also want to talk with some fellow students or your tutors
> about your code

There's this legend of the MIT help desk requiring people to tell their
problems to a teddy before asking humans. The same legend also claims
that this practice reduced workload for the staff by magnitudes.

--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Dirk Thierbach  
Переглянути профіль
 Більше налаштувань 5 Жов 2008, 07:46
Групи новин: comp.lang.haskell
Від: Dirk Thierbach <dthierb...@usenet.arcornews.de>
Дата: Sun, 5 Oct 2008 06:46:43 +0200
Локально: Нд 5 Жов 2008 07:46
Тема: Re: I Need some serious help here

Achim Schneider <bars...@web.de> wrote:
> Dirk Thierbach <dthierb...@usenet.arcornews.de> wrote:
>> You might also want to talk with some fellow students or your tutors
>> about your code
> There's this legend of the MIT help desk requiring people to tell their
> problems to a teddy before asking humans. The same legend also claims
> that this practice reduced workload for the staff by magnitudes.

A friend of mine practiced her talks by giving them to a soccer ball.
Word got round, and soon people starting saying "I have to go to
talk to the soccer ball" when they meant "I've to think about that."

To get back to the original subject, that only works if you've already
some idea of the whole topic, and just need to sort your thoughts out.
If you have very little experience in programming, then talking to
living people is a lot better :-)

- Dirk


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Arne Dehli Halvorsen  
Переглянути профіль
 Більше налаштувань 5 Жов 2008, 12:47
Групи новин: comp.lang.haskell
Від: Arne Dehli Halvorsen <arne....@online.no>
Дата: Sun, 05 Oct 2008 11:47:27 +0200
Локально: Нд 5 Жов 2008 12:47
Тема: Re: I Need some serious help here

Dirk Thierbach wrote:
> Achim Schneider <bars...@web.de> wrote:
>> Dirk Thierbach <dthierb...@usenet.arcornews.de> wrote:

>>> You might also want to talk with some fellow students or your tutors
>>> about your code

>> There's this legend of the MIT help desk requiring people to tell their
>> problems to a teddy before asking humans. The same legend also claims
>> that this practice reduced workload for the staff by magnitudes.

Also known as rubber ducking. Discuss the problem with you rubber duck.


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Кінець повідомлень
« Повернутися до обговорень « Молодша тема     Старша тема »

Створити групу - Групи Google - Домівка Google - Правила користування послугою - Заява про конфіденційність і нерозголошення інформації
©2009 Google