sorear | > log10 $ 26^8 |

lambdabot | Not in scope: `log10' |

narain | > log 10 |

sorear | > log 10 |

lambdabot | 2.302585092994046 |

narain | > log (26^8) / log 10 |

lambdabot | 11.319786783766544 |

sorear | so, more stars. barely |

dons | ?pretty let x = 1 ; y = 2 in x + y -- we ue it here, desp. |

lambdabot | "Unterminated end-of-line comment" at column 26 |

heatsink | fuzan, there are some tricks to count bits in an integer fast. The straightforward way is just to loop (shift right 1; if odd then increment count) |

desp | dons: thanks |

fuzan | heatsink: yah, that way's pretty obvious. |

chessguy | let's see, what other good questions were there? this was a good one, "if you want to keep a whole collection of ordered elements in sorted order, but be able to add to and delete from it in log n time, what data structure would you use?" |

desp | dons: I'm a real Haskel n00b; can you tell me how to feed a file into the pretty printer? |

sorear | i'm familiar with the smasher |

dons | ?pretty let x = 1 ; y = 2 in x + y |

lambdabot | i = let x = 1 y = 2 in x + y |

narain | fuzan,heatsink: there's a trick to do it in O(no of on bits) |

dons | desp, yep. hang on .... |

narain | which is ridiculously pointless |

dons | desp, http://www.haskell.org/haskellwiki/Indent |

lambdabot | Title: Indent - HaskellWiki |

desp | dons: thanks |

fuzan | narain: not if you had HUGE integer sizes. |

dons | desp, see sectoin 1.4 |

narain | fuzan: ok, here goes then |

dons | note you'll need to get haskell-src from hackage ?where hackage |

lambdabot | http://hackage.haskell.org/packages/archive/pkg-list.html |

narain | n & (n - 1) is 0 iff n is 0 or a power of two for unsigned n so... hmm how did it go after that |

sorear | > let smash x = x .&. 0x55555555 + ((x `shiftR` 1) .&. 0x55555555) ; foo = smash.smash.smash.smash.smash in foo 100 -- narain, 20 arith ops and 0 conditional branches |

lambdabot | Add a type signature |

sorear | > let smash x = x .&. 0x55555555 + ((x `shiftR` 1) .&. 0x55555555) ; foo = smash.smash.smash.smash.smash in foo (100 :: Int32) -- narain, 20 arith ops and 0 conditional branches |

lambdabot | 84 |