Skip to content

Instantly share code, notes, and snippets.

@Yidaotus
Yidaotus / adriens.py
Last active April 20, 2023 07:19
ADRIEN'S SIGNS
message = [67594220461269, 501237540280788, 718316769824518, 296304224247167, 48290626940198, 30829701196032, 521453693392074, <...> ]
p = 1007621497415251
exponent = int((p-1)/2)
bresult = [1 if pow(m, exponent, p) == 1 else 0 for m in message]
bresultgroup = [''.join(str(y) for y in bresult[x:x+8]) for x in range(0, len(bresult), 8)]
''.join([chr(int(x, 2)) for x in bresultgroup])
Scheme 過去◇現在◇未来 前編
bit/April 1996/Vol. 28, No.4 p4~9
Guy L. Steele Jr.
訳 井田昌之
----------------------------------------
はじめに ――― 訳者より
@hyotang666
hyotang666 / zundoko.lisp
Created March 18, 2016 21:32
zundokokiyoshi!
(defun zundoko()
(do((bit(random 2)(random 2))
(memory 0 (shift memory bit)))
((= #b11110 memory)(princ :kiyoshi!))
(if(zerop bit)
(princ :doko)
(princ :zun))))
(defun shift(memory bit)
(ldb(byte 5 0)(dpb bit(byte 1 0)(ash memory 1))))
; たとえばこんなライブラリがあったとして…
(define-library (my lib)
(import (scheme base))
(define foo 1)
(define bar 2)
(export foo)
(export (rename bar baz)))
@noqisofon
noqisofon / argparse.scm
Last active August 29, 2015 13:57
( ノ╹◡◡╹)ノ argparse.scm 書きかけ!
;; -*- coding: utf-8; -*-
(define-module argparse)
(select-module argparse)
;; <help-formatter> は --help 用の文字列をフォーマットするやつだと思います。
;; <argument-section> がその一部を管理する気がします。
(define-class <help-formatter> ()
;; prog はプログラムの名前を保持します。
;; help 用の文字列に使われたり、version 情報にも使われます。
@leque
leque / sc-cut.scm
Last active August 29, 2015 13:56
(define-syntax %cut
(sc-macro-transformer
(lambda (form use-env)
(capture-syntactic-environment
(lambda (mac-env)
(let ((rargs (cadr form))
(rbody (caddr form))
(rest (cdddr form)))
(define (id=? x y)
(and (identifier? x)
(use srfi-1)
;;; PEGタームは,入力文字列と解析位置を与えると,解析結果を返す関数.
;;; 解析に成功すると(次の位置 . 意味値)のペアを,失敗すると#fを返す.
;;; 解析結果ペア
(define (make-result pos value) (cons pos value))
(define (position result) (car result))
(define (value result) (cdr result))
anonymous
anonymous / test.py
Created May 26, 2013 14:27
python 理解度チェーック 各出力を頭で考えた後に実行して答え合わせしてみてね!
##Q.1
print "trats"[::-1]
##Q.2
print 8 not in range(7,8)
##Q.3
print 0.0 is 0
##Q.4
@syou6162
syou6162 / Difference_between_cl_and_clojure.md
Created August 19, 2012 11:09
On Lispを読んでいて分からなかったCommon LispとClojureの違いについて自分なりにまとめていきます

Common Lispの関数

dolist

(dolist (var init-form result) S式 ... )

dolist は名前が示すように、リストに関係があります。最初に init-form を評価します。このとき、評価結果はリストでなければいけません。リスト以外の場合はエラーとなります。dolist は、このリストの要素を順番に変数 var に代入して S 式を評価します。リストの要素がなくなったら result を評価し、その値が dolist の返り値になります。次の例を見てください。