-
01_robots.lisp
古典的Robot Game.
本(Land of Lisp)にあるオリジナル(http://landoflisp.com/robots.lisp) は、
わずか42行の圧縮気味のコードなのを、読みやすく refactorしたもの. -
02a_robots.fs, 02b_prelude.fs
上記 01_robots.lisp を GForthに移植したもの. -
04_robots.go
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
anew =============================robots============================= | |
\ refactored the following a bit | |
\ https://gist.github.com/nfunato/39490e1e5d41a9a2d8b0f614a46feeea#file-02a_robots-fs | |
\ ------------------------------------------------------------------- | |
\ General utils | |
: not ( v -- f ) 0= ; | |
: 3dup ( a b c -- a b c a b c ) dup 2over rot ; |
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
;;; anaphoras and the like | |
(defmacro aif (tst thn &optional els) `(let ((it ,tst)) (if it ,thn ,els))) | |
(defmacro awhen (tst &body body) `(let ((it ,tst)) (when it ,@body))) | |
(defmacro aprog1 (f . fs) `(let ((it ,f)) ,@fs it)) | |
(defmacro acond (&rest cls) | |
(if (null cls) nil | |
(let ((cl1 (car cls)) (sym (gensym))) | |
`(let ((,sym ,(car cl1))) |
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
;; based on https://marui.hatenablog.com/entry/2022/12/13/222030 | |
(defun mapfn-into (arr fn &rest args) | |
(loop for i below (array-total-size arr) | |
do (setf (row-major-aref arr i) (apply fn args)) | |
finally (return arr))) | |
(defun box-muller-random-sampling () | |
"Return a pair of independent, standard, normally distributed | |
(zero expectation, unit variance) random number, using a random |
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
------------------------------------------------------------------ | |
以下の翻訳文は、Felix Winkelmann の Thoughts on Forth Programming | |
(http://call-with-current-continuation.org/articles/forth.txt) の | |
翻訳であり、原著者の許可を得て公開するものです。 | |
2021-09-01 Nobuhiko FUNATO (nfunato @ acm . org) | |
更新履歴: | |
2021-09-02(rev10): Shiro Kawaiさんにご指摘いただいた誤訳訂正/改善を反映 | |
2021-09-02(rev09): 公開初版 | |
------------------------------------------------------------------ |
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
;;; dunm.scm | |
;;; - cwd傘下のnode_modulesディレクトリのdisk usageを調べる | |
;;; - usageに基づいて、(確認後に)消せるようにする | |
;;; (report-stats [#f]) | |
;;; (report-stats #t) | |
;;; 傘下のnode_modulesディレクトリのdisk usageをプリントする。 | |
;;; arg1が#fのときは、1ヶ月以上アクセスしていないもののみを対象とする。 | |
;;; 結果の情報は、変数 *result* に格納されている。 |
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
\ FizzBuzz in OJ-FORTH ( on top of GFORTH ) | |
include oj-forth.fs | |
\ FORTHには、ほぼ文法が無い(ワードしかない)ということがよく分かると思う | |
\ なお以下の例で使っているワード 「を」 「まで」 「から」 は、純粋に飾り(NOP)である | |
わたくし で割り切れるの ( i n -- b ) を | |
mod 0= | |
と定義しましてよ |
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
\ FizzBuzz in Forth by @nfunato on 2015-04-30 | |
\ http://golf.shinh.org/p.rb?FizzBuzz#Forth | |
\ Execution rule: | |
\ 1. invoke shell | |
\ 2. exec gforth this-file -e bye | |
\ : x | |
\ 101 1 do | |
\ 1 |
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
import React, { createContext, useState, FC } from "react"; | |
import uuidv4 from "uuidv4"; | |
import { getInitialColorDataList } from "./ColorDataList"; | |
export type ColorDataTyp = { | |
id: string; | |
title: string; | |
color: string; | |
rating: number; | |
}; |
このgist entryには、 ここ(zenn) にある記事の参照用コードが含まれています。
- 1. README.org
このファイル
NewerOlder