This file contains hidden or 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
#| | |
Multiples of 3 and 5 | |
(https://projecteular.net/problem=1) | |
1,000以下の自然数で3か5の倍数である数の和を求める | |
|# | |
(defun sum-of-multipes-of-3-or-5 (m) | |
(loop for n | |
below m |
This file contains hidden or 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
#include <stdio.h> | |
int fib(int n){ | |
if(n<2)return n; | |
return fib(n-2) + fib(n-1); | |
} | |
int main(){ | |
printf("%d\n", fib(38)); | |
return 0; |
This file contains hidden or 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
(defmacro let1 (var val &body body) | |
`(let ((,var ,val)) | |
,@body)) | |
(defun fib-l (n) | |
(let1 l '(1 0) | |
(labels ((f (n l) | |
(if (equal (length l) (1+ n)) | |
(car l) | |
(f n (cons (+ (car l) (cadr l)) l))))) |
This file contains hidden or 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
#| | |
はじめてのAIプログラミング C言語で作る人工知能と人工無能 | |
のgenby2gram.cを参考にしました | |
テキストファイルから2-gram解析を行い,その連鎖によって文を生成します | |
Usage: ./malkov-chain p1 p2 p3 | |
p1: テキストファイル | |
p2: 開始文字 | |
p3: 生成する文の数 | |
|# |
This file contains hidden or 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
{ | |
"snippets": { | |
"variables": { | |
"lang": "ja" | |
}, | |
"html": { | |
"snippets": { | |
"col1": "<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n\t<meta charset=\"UTF-8\">\n\t<title>Document</title>\n\t<style>\n\t\t*{\n\t\t\tmargin:0;\n\t\t\tpadding:0;\n\t\t}\n\t\tbody{\n\t\t\tbackground-color: #ccc;\n\t\t}\n\t\t#wrapper{\n\t\t\tmin-height:100vh;\n\t\t\tdisplay:flex;\n\t\t\tflex-direction: column;\n\t\t}\n\t\theader{\n\t\t\theight:100px;\n\t\t\tbackground-color: #333;\n\t\t}\n\t\t#contents{\n\t\t\tflex:1;\n\t\t\tbackground-color: #fcfcfc;\n\t\t}\n\t\tfooter{\n\t\t\theight:100px;\n\t\t\tbackground-color: #333;\n\t\t}\n\t</style>\n</head>\n<body>\n\t<div id=\"wrapper\">\n\t<header>\n\t\t<nav>\n\n\t\t</nav>\n\t</header>\n\t<div id=\"contents\">\n\n\t</div>\n\t<footer>\n\n\t</footer>\n\t</div>\n</body>\n</html>", | |
"col2": "<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n\t<meta charset=\"UTF-8\">\n\t<title>Document</title>\n\t<style>\n\t\t*{\n\t\t\tmargin:0;\n\t\t\tpad |
This file contains hidden or 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
(defun get-input () | |
(parse-integer (read-line))) | |
(defun factorial (n) | |
(if (<= n 1) | |
1 | |
(* n (factorial (1- n))))) | |
(defun trim-zero-right (s) | |
(if (eq (elt s (1- (length s))) #\0) |
This file contains hidden or 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
(defun parse (str) | |
(loop for i from 0 below (length str) | |
if (eq (aref str i) #\Space) | |
return (values (subseq str 0 i) | |
(subseq str (1+ i))))) | |
(defun crz (x y) | |
(case x | |
(#\0 (case y | |
(#\0 #\1) |
This file contains hidden or 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
(ql:quickload :cffi) | |
(ql:quickload :alexandria) | |
(ql:quickload :trivial-main-thread) | |
(ql:quickload :cl-opengl) | |
(ql:quickload :cl-glu) | |
(ql:quickload :cl-glfw3) | |
(setf *random-state* (make-random-state t)) | |
(defmacro += (src dst) |
This file contains hidden or 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
static SHIFT:u8=3; | |
fn main() { | |
use std::env; | |
let args: Vec<_> = env::args().collect(); | |
if args.len() > 2 { | |
if args[1] == "encrypt" { | |
println!("encrypt!"); | |
for s in &args[2..] { | |
println!("{}", encrypt(&s, true)); |
This file contains hidden or 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
use std::io; | |
fn main() { | |
let mut sxi :f64 = 0.0; | |
let mut syi :f64 = 0.0; | |
let mut sxiyi:f64 = 0.0; | |
let mut sxi2 :f64 = 0.0; | |
let mut n :f64 = 0.0; |
OlderNewer