This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# GENERIC -- Generic kernel configuration file for FreeBSD/i386 | |
# | |
# For more information on this file, please read the config(5) manual page, | |
# and/or the handbook section on Kernel Configuration Files: | |
# | |
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html | |
# | |
# The handbook is also available locally in /usr/share/doc/handbook | |
# if you've installed the doc distribution, otherwise always see the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- file: ch03/Palindrome.hs | |
palindrome :: [a] -> [a] | |
palindrome [] = [] | |
palindrome xs = xs ++ myReverse xs | |
where myReverse (x:xs) = myReverse xs ++ [x] | |
myReverse [] = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interpret = fizzbuzz [1..100] | |
fizzbuzz [] = [] | |
fizzbuzz (x:xs) = checknum(x) ++ fizzbuzz(xs) | |
checknum x | both x = "FizzBuzz" | |
| three x = "Fizz" | |
| five x = "Buzz" | |
| otherwise = show x | |
where both x = three x && five x | |
three x = (x `mod` 3) == 0 | |
five x = (x `mod` 5) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- file:HuffmanEncoding/Frequency.hs | |
module Frequency where | |
import Data.List(nub,foldl') | |
frequencies :: (Eq a) => [a] -> [(a, Double)] | |
frequencies s = zip (nub s) (map divide qset) | |
where divide (_,d) = (d / (total qset)) | |
qset = quantities (nub s) s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn factorial [n] | |
(loop [iter n, res 1] | |
(cond | |
(zero? iter) res | |
:else (recur (dec iter) (* res iter))))) | |
(defn combination [n k] | |
(/ (factorial n) (* (factorial (- n k)) (factorial k)))) | |
(comment k = number of hot dogs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int clearBitsMSBthroughI(int num, int i) { | |
int mask = (1 << (i + 1)) - 1; | |
return num & mask; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<meta charset="utf-8"> | |
<style> | |
.node { | |
stroke: #fff; | |
stroke-width: 1.5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<meta charset="utf-8"> | |
<style> | |
.node { | |
stroke: #fff; | |
stroke-width: 1.5px; | |
} |
OlderNewer