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
$ clang -O0 curry.c -o curry | |
$ ./curry a 1 2 3 | |
pc = 0lx0000000000400cd9 | |
f1_f = 10 | |
c[48] = | |
[ 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x10, | |
0x48, 0xb8, 0x00, 0x07, 0x40, 0x00, 0x00, 0x00, | |
0x00, 0x00, 0x89, 0x7d, 0xfc, 0x48, 0x89, 0x45, | |
0xf0, 0x48, 0x8b, 0x04, 0x25, 0x50, 0x20, 0x60, | |
0x00, 0x48, 0x8b, 0x7d, 0xf0, 0x8b, 0x75, 0xfc, |
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
/* Popr code: | |
odd: 1 .& 1 == | |
__ acc x power -> if odd power, acc*x, otherwise acc | |
acc_odd_power: [[*] dip21 odd] ap20 ifdo | |
__ x power -> x*x power/2 | |
reduce_power: [dup *] [1 .>>] para |
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
/* | |
Popr source: | |
__ sums numbers in a list | |
sum_: [[+] .] [popr drop is_nil not] [head 0+] binrec | |
sum: 0 pushr sum_ | |
*/ | |
// compiled to C | |
int algorithm_sum(array func0) |
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
/* Popr source: | |
__ decreasing list from initial element | |
iota_: [[dup 1-] .] [head 0 >] iterate | |
iota: [1-] pushl iota_ | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
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
/* | |
calc_step: | |
strtrim | |
[<-str int_t pushr] | |
["+" =s [[+] .] dip11 !] | | |
["-" =s [[-] .] dip11 !] | | |
["*" =s [[*] .] dip11 !] | | |
["/" =s [[/] .] dip11 !] | | |
["swap" =s [[swap] .] dip11 !] | | |
["dup" =s [[dup] .] dip11 !] | |
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
/* | |
calc_step: | |
strtrim | |
[<-str int_t pushr] | |
["+" =s [[+] .] dip11 !] | | |
["-" =s [[-] .] dip11 !] | | |
["*" =s [[*] .] dip11 !] | | |
["/" =s [[/] .] dip11 !] | | |
["gcd" =s [[gcd] .] dip11 !] | |
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
/* | |
__ calc_func: [=s] dip21 [.] pushl dip11! | |
calc_step: | |
strtrim | |
[<-str int_t pushr] | |
["+" =s [[+] .] dip11 !] | | |
["-" =s [[-] .] dip11 !] | | |
["*" =s [[*] .] dip11 !] | | |
["/" =s [[/] .] dip11 !] | | |
["gcd" =s [[gcd] .] dip11 !] | |
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
module SelectBy (selectBy, medianBy, select, median) | |
where | |
import Data.List | |
splitEvery _ [] = [] | |
splitEvery n xs = xn : splitEvery n r | |
where (xn, r) = splitAt n xs | |
-- | O(n) kth smallest selection |
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
module top ( | |
input clk, | |
input [15:0] in, | |
output [15:0] out | |
); | |
reg [15:0] out_buf; | |
reg [3:0] addr; | |
reg [15:0] ring_in; | |
reg [15:0] ring_out; |
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
# command line go links | |
# just copy this to ~/.go.bash and source it | |
# add new commands below | |
function go () { | |
# self update | |
source ~/.go.bash | |
# indirect call | |
NAME="$1" |
OlderNewer