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