Skip to content

Instantly share code, notes, and snippets.

View CliffordAnderson's full-sized avatar

Clifford Anderson CliffordAnderson

View GitHub Profile
@CliffordAnderson
CliffordAnderson / 01-introduction.md
Last active April 23, 2024 07:44
Exploring the U-Bahn with Neo4j

Analyzing the U-Bahn Network with Neo4J

The goal of this exercise is to extract information about the Berlin metro system from Wikidata and to analyze its relationships with Neo4j.

Berlin U-Bahn Map

@CliffordAnderson
CliffordAnderson / brew-install-script.sh
Last active February 14, 2024 08:29
Brew script for installing packages and applications on OSX
#!/bin/sh
# Homebrew Script for OSX
# To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh`
echo "Installing brew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing brew cask..."
brew tap homebrew/cask
@CliffordAnderson
CliffordAnderson / example-hof.md
Last active January 3, 2024 15:40
Simple examples of higher-order functions and partial function application in XQuery

##Examples of Higher-Order Functions in XQuery

Here are a few examples of higher-order functions in XQuery. For more examples, see the very nice discussion of higher-order functions in XQuery 3.0 at the BaseX website.

N.B. In some implementations, these functions may not be implemented or may have different names/function signatures. The first four functions have been tested using Saxon PE and the second four using Zorba.

@CliffordAnderson
CliffordAnderson / news-topics.ipynb
Created October 23, 2023 20:50
News Topics.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CliffordAnderson
CliffordAnderson / convert.jl
Last active September 13, 2022 11:49
Binary and Hex Conversion in Julia
using Match
# Convert decimal to binary numbers
# Compare to bits() function in Julia
function tobin(num)
@match num begin
0 => "0"
1 => "1"
_ => string(tobin(div(num,2)), mod(num, 2))
end
@CliffordAnderson
CliffordAnderson / convert-date.xqy
Last active July 17, 2022 01:56
XQuery Puzzles from Week 1, Day 5, Session 4 of the Advanced Digital Editions NEH Institute at the University of Pittsburgh
xquery version "3.1";
let $date := "July 15, 2022"
let $tokens := fn:tokenize($date, " ")
let $month :=
switch ($tokens[1])
case "January" return "01"
case "February" return "02"
case "March" return "03"
case "April" return "04"
@CliffordAnderson
CliffordAnderson / fibC.xqy
Created June 29, 2022 00:54
Fibonacci w/continuations
(: Thanks to friends at NashFP, especially Mike K. and Mark Wutka :)
declare function local:fibC($n as xs:integer, $memo as map(*), $con) {
if (map:contains($memo, $n)) then $con(map:get($memo, $n), $memo)
else
local:fibC($n - 1, $memo,
(: n1 = fib(n - 1) :)
function($n1 as xs:integer, $memo as map(*)) {
local:fibC($n - 2, $memo,
(: n2 = fib(n - 2) :)
xquery version "3.1";
declare function local:fac($n as xs:int) as xs:int {
if ($n = 0) then 1
else if ($n = 1) then 1
else $n * local:fac($n - 1)
};
declare function local:hFac($n as xs:int) as xs:int {
fn:fold-right(1 to $n, 1, function($a, $b) { $a * $b })