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
#!/usr/bin/env ruby | |
puts ARGV.map {|x| x += '@tcd.ie'}.join(', ') |
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
bool has_left_recursion(Grammar g) { | |
for (vector<Rule>::iterator i = g.rules.begin(); i != g.rules.end(); ++i) { | |
if (i->mother == i->dtrs.front()) return true; | |
} | |
return false; | |
} |
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
public static int[] countLetters(String input) { | |
int[] results = new int[26]; | |
for (int i = 0; i < input.length(); i++) { | |
int cur = input.toLowerCase().charAt(i); | |
if (cur >= 'a' && cur <= 'z') {results[cur - 'a']++;} | |
} | |
return results; | |
} |
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
#!/usr/bin/env ruby | |
def y(n) | |
case n | |
when 0 then 1 | |
when 1 then 0 | |
when 2 then -4 | |
when 3 then 0 | |
else y(n - 4) | |
end |
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
array2string(a : ARRAY[G]) : STRING is | |
local | |
k : INTEGER | |
do | |
Result := "<< " | |
from | |
k := a.lower | |
until | |
k = a.upper | |
loop |
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
/** | |
* As described in 'updates' in the nodes | |
*/ | |
void CHART::do_cell(int i, int k) { | |
Rule r; | |
Category A, B, C; | |
int A_included, B_included; |
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
ón __todhchaí__ impórtaigh roinnt |
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
#!/usr/bin/env ruby | |
def mel(f) | |
include Math | |
(1000.quo(Math.log(2))) * Math.log(1 + (f.quo(1000))) | |
end | |
1.upto(1000) do |f| | |
puts "#{f} Hz --> #{mel(f).round(1)} mel" | |
end |
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
digraph CYK_parse { | |
rankdir=LR; | |
node [shape = point,height=0.3]; 0,1,2,3,4,5,6; | |
// k = 1 | |
// -------------------- | |
0 -> 1 [label = "DET",color=black]; | |
0 -> 1 [label = "the",color=red]; |
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
q = lambda l : l if len(l) <= 1 else (q([x for x in l[1:] if x < l[0]]) + [l[0]] + q([x for x in l[1:] if x >= l[0]])) |
OlderNewer