Greg Buchholz's blog
http://sequence.complete.org/blog/67
enSearch by Type
http://sequence.complete.org/node/134
Here's a random thought. What if we had a way to search for Haskell functions by type signature. Take the <a href="http://www.haskell.org/ghc/docs/latest/html/libraries/index.html">Hierarchical Libraries</a>, slice/dice/index the type signatures so that you could search for "Num b => a -> b" and it would present you with a list of functions like <code>length :: [a] -> Int</code>. You'd also probably want to allow swizzling of the input arguments so that you could find "map" with a search like "[a] -> (a -> b) -> [b]". Then the next step would be to analyze your existing code to see if you've reinvented any wheels.http://sequence.complete.org/node/134#commentsType SystemMon, 05 Dec 2005 10:37:39 -0800Greg Buchholz134 at http://sequence.complete.orgQuantum Programming
http://sequence.complete.org/node/133
<p>Lately I've been pondering the programming of quantum computers. Just because we don't have the hardware yet seems like an awfully bad excuse for not having languages and emulators/simulators. I really don't know much about quantum computing (book recommendations anyone?), but it seems to be based on a somewhat nondeterministic model. Is it going to be like programming in Prolog, but with backtracking that doesn't cost anything in terms of efficiency? Curious.</p>
http://sequence.complete.org/node/133#commentsResearchDiscussionFri, 02 Dec 2005 14:48:19 -0800Greg Buchholz133 at http://sequence.complete.orgDo lispers use macros often?
http://sequence.complete.org/node/129
<p>Do lispers use macros often, or is that a <a href="http://groups.google.com/group/comp.lang.functional/msg/e94cf9862a1e2c2c">misconception</a>? I don't know, but here's one data point. Since Peter Seibel's book <a href="http://www.gigamonkeys.com/book/">Practical Common Lisp</a> is online, I thought I'd do a little investigation. With a little wget, lynx, and perl magic I analyzed the word frequency of the book. The word "macro" or one of its forms (such as macrophobic and macrophobia) occur 810 times. For reference, here are the words which occur more often...</p>
<ul>
<li>854 => 1 </li>
<li>875 => name </li>
<li>876 => or </li>
<li>914 => an </li>
<li>944 => code </li>
<li>949 => list </li>
<li>951 => are </li>
<li>1033 => by </li>
<li>1114 => t </li>
<li>1126 => if </li>
<li>1261 => lisp </li>
<li>1279 => value </li>
<li>1337 => function </li>
<li>1351 => be </li>
<li>1402 => this </li>
<li>1532 => as </li>
<li>1609 => can </li>
<li>1700 => with </li>
<li>1781 => for </li>
<li>1963 => it </li>
<li>2433 => is </li>
<li>2583 => that </li>
<li>3329 => in </li>
<li>3452 => and </li>
<li>3836 => you </li>
<li>4774 => of </li>
<li>5951 => a </li>
<li>5970 => to </li>
<li>12616 => the </li>
</ul>
<p>*Note: For the record, I personally love macros. Well, <i>appropriate</i> macros. Reinventing a new language syntax should be a fairly rare event. A nice language will be built from a relatively small set of powerful axioms which will preclude the need to invent new axioms all the time. Certainly "until" isn't a good example of when they should be used.</p>
http://sequence.complete.org/node/129#commentsApplicationsFri, 11 Nov 2005 14:36:08 -0800Greg Buchholz129 at http://sequence.complete.orgComputer Assisted Programming
http://sequence.complete.org/node/124
<p>Thought I'd post a link to one of my <a href="http://kerneltrap.org/node/5591">static typing rants</a>, since there will probably be more "true believers" on this site.</p>
http://sequence.complete.org/node/124#commentsType SystemDiscussionThu, 20 Oct 2005 13:46:05 -0700Greg Buchholz124 at http://sequence.complete.orgdy/dx
http://sequence.complete.org/node/123
<p>Over on comp.lang.lisp we have someone <a href="http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/c7403e85c501acdf/3d393ba717465b03">trying</a> to use Haskell for a little symbolic differentiation problem. Since it doesn't even compile, I thought I'd throw my hat in the ring and clean it up a little (Is there a better way to display snippets on this site? I had to use <pre> tags instead of <code> tags)...</p>
<pre>
infixl 5 :+
infixl 6 :*
data Exp = Num Integer
| Var Sym
| Exp :+ Exp
| Exp :* Exp deriving (Eq,Show)
data Sym = X | Y deriving (Eq,Show)
main = do let exp = (Num 4 :* Var X :* Var X)
let deriv = d exp X
putStrLn $ "Original expression : " ++ (show exp)
putStrLn $ "Derivative : " ++ (show $ simplify deriv)
putStrLn $ "Derivative evaluated at X=10 : "
++ (show $ eval (d exp X) [(X,10)])
--take the derivative...
d (Num n) x = Num 0
d (Var y) x | x==y = Num 1
| otherwise = Num 0
d (f :+ g) x = (d f x) :+ (d g x)
d (f :* g) x = (d f x) :* g :+ f :* (d g x)
--evaluate an Exp...
eval (Num x) env = x
eval (Var x) env = case (lookup x env) of
(Just n) -> n
(Nothing) -> error $ "no variable "++(show x)++" in env"
eval (x :+ y) env = eval x env + eval y env
eval (x :* y) env = eval x env * eval y env
--a few algebraic simplification rules
simp (x :+ y) | x == y = simp (Num 2):*x
simp ((Num 0) :+ x) = simp x
simp (x :+ (Num 0)) = simp x
simp ((Num x) :+ (Num y)) = Num (x+y)
simp (x :+ y) = simp x :+ simp y
simp ((Num 0) :* x) = Num 0
simp (x :* (Num 0)) = Num 0
simp ((Num 1) :* x) = simp x
simp (x :* (Num 1)) = simp x
simp ((Num x) :* (Num y)) = Num (x*y)
simp (x :* y) = simp x :* simp y
simp x = x
--apply simplification rules until the expression doesn't change anymore
simplify x = let a = iterate simp x
fix = dropWhile (\(c,d)->c/=d) $ zip a (tail a)
in (fst.head) fix
</pre>http://sequence.complete.org/node/123#commentsMiscellaneousDiscussionThu, 20 Oct 2005 13:23:59 -0700Greg Buchholz123 at http://sequence.complete.org