| bos | even broken stuff like X11-extras and Crypto :-) |
| dons | X11-extras is broken? got today's release? maybe its unborked |
| bos | it has a few little packaging problems, such as no configure script in the tarball. |
| dons | yeah, that's fixed now. |
| narain | gregor: scanl transforms a list into a new list threading a value through it, such as my runningsum above |
| dons | grab X11-extras-0.1 from hackage |
| bos | ok, i grabbed it earlier today, but that was in the stale ancient age of 0.0 :-) |
| dons | yeah :-) we move fast in open source haskell land |
| sjanssen | bos: get with the times 0.0 is our allotted "oops" release |
| bos | i'll have to whack cabal-install a bit so i can use it as a library inside cabal-rpm, downloading automatically for me |
| dolio | > let dropAt n l = let (h, e:t) = splitAt (n - 1) l in h ++ dropAt n t; nth 1 = id; nth n = nth (n - 1) . scanl1 (+) . dropAt n in nth 3 [1..] |
| lambdabot | [1,8,27,64,125,216,343,512,729,1000,1331,1728,2197,2744,3375,4096,4913,5832,... |
| merus | > let del xs = zipWith (-) (tail xs) xs; cube = map (^3) [1..] in take 20 $ del $ del $ del cube |
| lambdabot | [6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6] |
| AStorm | BTW, does wxHaskell work now with ghc 6.6 and newest wxWidgets? (like 2.6.3.3) |
| gregor | > let runningsum a [] = [a]; runningsum a (x:xs) = a + x : runningsum (a + x) xs in runningsum 0 [1, 3, 5, 7, 9] |
| lambdabot | [1,4,9,16,25,25] |
| gregor | > scanl (+) 0 [1, 3, 5, 7, 9] |
| lambdabot | [0,1,4,9,16,25] |
| AStorm | so start from 1 |
| gregor | I tried doing a drop 1 on that scanl but still didn't get it right |
| dmwit | > scanl1 (+) [1,3,5,7,9] |
| lambdabot | [1,4,9,16,25] |
| AStorm | ?where scanl1 |
| lambdabot | I know nothing about scanl1. |
| narain | gregor: scanl1 is probably a better choice, also drop 1 == tail ?src drop |
| lambdabot | drop n xs | n <= 0 = xs drop _ [] = [] drop n (_:xs) = drop (n-1) xs |
| dmwit | > drop 1 [] |
| lambdabot | [] |
| AStorm | ?src scanl1 |
| lambdabot | scanl1 f (x:xs) = scanl f x xs scanl1 _ [] = [] |
| narain | well, almost ==. |
| AStorm | ?src scanl |
| lambdabot | scanl f q ls = q : case ls of |