Difference between revisions of "Talk:H-99: Ninety-Nine Haskell Problems"
(Another proposal) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
(defun decode-modified (list) |
(defun decode-modified (list) |
||
+ | (reduce #'append |
||
− | (mapcar (lambda (item) |
||
− | + | (mapcar (lambda (item) |
|
− | item |
+ | (if (atom item) |
− | + | (list item) |
|
− | :initial-element (cadr item)))) |
+ | (make-list (car item) :initial-element (cadr item)))) |
− | list)) |
+ | list))) |
-- roerd |
-- roerd |
||
+ | |||
+ | |||
+ | I am planning on going through the questions and rewording them so that the argument order is different. Often the lisp solution has the reverse order as a standard Haskell solution. It seems like asking for the more curry friendly solution would teach good coding style. |
||
+ | |||
+ | If you think you have a reasonable objection let me know.<br> |
||
+ | --[[User:Davorak|Davorak]] 19:53, 15 December 2010 (UTC) |
||
+ | |||
+ | Also I think it would be beneficial to change the example answers so that the functions that index lists naturally start at 0.<br> |
||
+ | --[[User:Davorak|Davorak]] 20:15, 15 December 2010 (UTC) |
Latest revision as of 20:15, 15 December 2010
What does "Lisp solution?" mean? Lots of them are listed "Yes", and lots are listed "No", but I can't detect a difference between these entries... -- dmwit
It's just whether or not there's a lisp solution available. If you go to the description of the problem, and click on the problem number, it'll either link you to actual lisp code, or a "not found" page. There are 25 of them which actually have lisp code available. -- chessguy
What is the meaning of that scoreboard? Even though there is no solution on the L-99 site, there may still exist a LISP solution, even a trivial one. And since that L-99 site is no wiki and this site is, the scoreboard seems just misleading to me.
Just an example for Problem 12:
(defun decode-modified (list) (reduce #'append (mapcar (lambda (item) (if (atom item) (list item) (make-list (car item) :initial-element (cadr item)))) list)))
-- roerd
I am planning on going through the questions and rewording them so that the argument order is different. Often the lisp solution has the reverse order as a standard Haskell solution. It seems like asking for the more curry friendly solution would teach good coding style.
If you think you have a reasonable objection let me know.
--Davorak 19:53, 15 December 2010 (UTC)
Also I think it would be beneficial to change the example answers so that the functions that index lists naturally start at 0.
--Davorak 20:15, 15 December 2010 (UTC)