jwodder's Scraps
jwodder's profile
| Scrap | Syntax | License | Created | Updated |
|---|---|---|---|---|
|
Two-argument function compositionLike (.), but for function pairings that take an extra argument on one side or the other
|
Haskell | Public Domain | 22 Jan 2010 | 2 years, 4 months ago |
|
indexGrid.hsAssign coordinates to the elements of a two-dimensional list. This is useful for composing Arrays.
|
Haskell | Public Domain | 22 Jan 2010 | 2 years, 4 months ago |
|
Splitting listsSplit a list at all occurrences of an element or a sublist
|
Haskell | Public Domain | 22 Jan 2010 | 2 years, 4 months ago |
|
findSublist.hsFind a sublist/substring in a list/string
|
Haskell | Public Domain | 16 Jan 2010 | 2 years, 4 months ago |
|
tcpConnect.cCreate a TCP connection in POSIX C
|
C | Public Domain | 15 Jan 2010 | 2 years, 4 months ago |
|
Ideas, suggestions, & bug reports for foo(book):This seems like the best place to put this.
|
Plain Text | Public Domain | 15 Jan 2010 | 2 years, 4 months ago |
|
bellrand.hsGenerate random numbers with a normal distribution
|
Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
| Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago | |
| Plain Text | Public Domain | 13 Jan 2010 | 2 years, 4 months ago | |
|
Ternary.hsTernary/conditional operator in Haskell (It's shorter than if/else/then)
|
Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
Combinators.hsVarious well-known lambda calculus combinators
|
Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
strlenDetermine the length of a NUL-terminated character string in Forth
|
Plain Text | Public Domain | 13 Jan 2010 | 2 years, 3 months ago |
|
Index.hsAssign contiguous indices to the elements of a list of ordered values
|
Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
uniq.ssReturn only the unique elements of a (pre-sorted) list
|
Scheme | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
slice.ssGet a sublist of a list
|
Scheme | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
final.ssGet the last element in a list
|
Scheme | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
flatten.ssConvert a list of lists to a flat list
|
Scheme | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
list-head.ssReturn an initial portion of a list
|
Scheme | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
Factorial, combinations, & permutationsCalculate factorials, combinations, & permutations in C
|
C | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
modInverse.cCalculate the multiplicative inverse of `a` modulo `n`
|
C | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
gcd.cGreatest common denominator/divisor function in C
|
C | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
mandelPoint.cDetermine how many iterations of the Mandelbrot function it takes a point to escape
|
C | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
pick.hsReturn an element from a list at random
|
Haskell | Public Domain | 13 Jan 2010 | 2 years, 4 months ago |
|
bellrand.cRandomly generate a number with a normal distribution
|
C | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
Copy to the heap (Forth)Create a copy of a section of memory on the heap
|
Plain Text | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
Reverse Forth stackReverse the top n elements of the stack in Forth
|
Plain Text | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
Exponentiation in ForthInteger exponentiation in Forth
|
Plain Text | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
GCD in ForthGreatest common denominator/divisor function in Forth
|
Plain Text | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
set<->listConvert a list to a set and vice versa
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
fragment.hsSplits a list into contiguous sublists of fixed length
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
cross.hsCartesian cross product of one or more lists
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
shuffle.hsRandomly reorder the elements of a list
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
binsearch.hsPerform a binary search on a list, returning either an element or an index
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
replaceElem.hsChange one or more elements of a list
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
Maybe list subscriptingLike (!!), but wrapped in a Maybe in case the index is beyond the bounds of the list
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
packBits.hsPack & unpack bits into bytes in ascending or descending order
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
trim.hsRemove leading & trailing whitespace from a String
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
xor in Haskell`xor` function/operator in Haskell
|
Haskell | Public Domain | 12 Jan 2010 | 2 years, 4 months ago |
|
wrapLineFold lines at 80 characters (or any other point)
|
Perl | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
tabs2spacesConvert tab characters to the appropriate number of spaces
|
Perl | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
uniqReturn only the unique elements of a (pre-sorted) list
|
Perl | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
parseEscapesParse common escape sequences in a string
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
shuffleArrayRandomly rearrange the contents of an array
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
memndupAllocates a copy of an arbitrary byte sequence
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
utf2wideConverts UTF-8 byte sequences into Unicode codepoints
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
wide2utfConverts a Unicode codepoint to its UTF-8 representation
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
issymlinkTests whether a given path is a symbolic link
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
isadirTests whether a given path is a directory (or a symlink to a directory)
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
fileExistsTests whether a given file path exists
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
lowestBitSetReturns the index of the lowest bit set in an int
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
highestBitSetReturns the index of the highest bit set in an int
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
bitqtysetCounts the number of bits set in an int
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
ungetsPushes a NUL-terminated string back into an input stream; returns the number of characters ungotten
|
C | Public Domain | 11 Jan 2010 | 2 years, 4 months ago |
|
UTF-16 surrogatizationConverts between Unicode codepoints and UTF-16 surrogate pairs
|
C | Public Domain | 10 Jan 2010 | 2 years, 4 months ago |