Difference between revisions of "Talk:99 questions/1 to 10"

From HaskellWiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:
   
 
: +1, especially the solutions on separate page. [[User:Oligomous|Oligomous]] 18:15, 8 December 2009 (UTC)
 
: +1, especially the solutions on separate page. [[User:Oligomous|Oligomous]] 18:15, 8 December 2009 (UTC)
  +
: +1, agreed. Having visible solutions on this page really takes the fun out of it. I think I will start moving the solutions to subpages of [[99 questions/Solutions]], after solving them myself of course :-) [[User:Wapcaplet|Wapcaplet]] 15:05, 13 July 2010 (UTC)
  +
  +
What is the meaning of star (*) in front of problem description?
  +
: Is it difficulty level indication? [[User:Wizzup|Wizzup]] ([[User talk:Wizzup|talk]]) 07:41, 8 February 2019 (UTC)
  +
  +
Should we remove Lisp example?
  +
: I think Lisp example is somewhat out-of-context. [[User:Wizzup|Wizzup]] ([[User talk:Wizzup|talk]]) 07:41, 8 February 2019 (UTC)
   
 
==Does the problem 1 example need correction?==
 
==Does the problem 1 example need correction?==
Line 23: Line 30:
   
 
[[User:Michael|Michael]] 16:40, 17 January 2008 (UTC)
 
[[User:Michael|Michael]] 16:40, 17 January 2008 (UTC)
  +
  +
== Change Questions+Answers to be curry friendly ==
  +
  +
I am not a long time Haskell user but it seems like many of these questions have not yet been reworded for Haskell. An example would be problem 3. The Haskell version should have the number of the element that you are getting then the list not the other way around.
  +
  +
Example#1
  +
  +
== Problem 3 ==
  +
  +
(*) Find the K'th element of a list. The first element in the list is number 1.
  +
  +
Example:
  +
  +
<pre>
  +
* (element-at '(a b c d e) 3)
  +
c
  +
</pre>
  +
  +
Example in Haskell:
  +
  +
<haskell>
  +
Prelude> elementAt 2 [1,2,3]
  +
2
  +
Prelude> elementAt 5 "haskell"
  +
'e'
  +
</haskell>

Latest revision as of 07:41, 8 February 2019

Bad format

The format of this page is awful. I'm collecting the problem descriptions, but having to be very careful not to look at the solutions.

The function signature and description of what it is to do should be given. The solutions should be on some separate page.

+1, especially the solutions on separate page. Oligomous 18:15, 8 December 2009 (UTC)
+1, agreed. Having visible solutions on this page really takes the fun out of it. I think I will start moving the solutions to subpages of 99 questions/Solutions, after solving them myself of course :-) Wapcaplet 15:05, 13 July 2010 (UTC)

What is the meaning of star (*) in front of problem description?

Is it difficulty level indication? Wizzup (talk) 07:41, 8 February 2019 (UTC)

Should we remove Lisp example?

I think Lisp example is somewhat out-of-context. Wizzup (talk) 07:41, 8 February 2019 (UTC)

Does the problem 1 example need correction?

The problem refers us to last as a Prelude function providing the same functionality. However, last has type [a] -> a which differs from the Lisp example's type [a] -> [a]. Should we revise the example or should we rephrase the reference to last to highlight the difference?

Chrycheng 12:02, 12 September 2007 (UTC)

I think the answer to problem 6 is kind of "cheating". I think something like this would be a nice alternate solutions:

isPalindrome        :: Eq (a) => [a] -> Bool
isPalindrome []     = True
isPalindrome [x]    = True
isPalindrome (x:xs) = x == last xs && isPalindrome (init xs)

Michael 16:40, 17 January 2008 (UTC)

Change Questions+Answers to be curry friendly

I am not a long time Haskell user but it seems like many of these questions have not yet been reworded for Haskell. An example would be problem 3. The Haskell version should have the number of the element that you are getting then the list not the other way around.

Example#1

Problem 3

(*) Find the K'th element of a list. The first element in the list is number 1.

Example:

* (element-at '(a b c d e) 3)
c

Example in Haskell:

Prelude> elementAt 2 [1,2,3]
2
Prelude> elementAt 5 "haskell"
'e'