このページは イスカンダルのトーフ屋ゲーム からリンクされています。
- Thinking Forth を (初めて)通読して、痛く反省したので refactoring してみた (tofu.fthのみ)
- ファイル構成等の詳細は、tofu.fth の heading comment を参照 (なお、旧版(2013,2019)のgist filesは 目の毒なので、このgist entryの表向きからは消した)
{- ported from and/or filled for | |
"Regular Expressions and Automata using Haskell, Simon Thompson (Jan 2000)", | |
by @nfunato on 2012/04/07 -} | |
{- this code is provided "as-is". -} | |
import Data.List (foldl', nub, sort, sortBy, groupBy, elemIndex, findIndex) | |
import Data.Set (Set, empty, size, singleton, fromList, toList, toAscList, | |
elems, member, findMin, insert, union, intersection,(\\)) | |
import qualified Data.List as L -- L.map |
(defvar undesirable-ws-cleanup-wo-choice-modes | |
'(lisp-mode)) | |
(defvar undesirable-ws-cleanup-w-check-modes | |
'(org-mode)) | |
(defun undesirable-ws-cleanup () | |
(interactive) | |
(save-excursion | |
(when (or (member major-mode undesirable-ws-cleanup-wo-choice-modes) |
;;; 2012/10/27 @nfunato | |
;;; Probably I first saw them at Xerox PCL about 25 years ago. | |
;;; I think almost same code can be seen in many places, including CLtL2. | |
;;; recons / relist / relist* | |
(defun recons (x a d) | |
(destructuring-bind (xa . xd) x | |
(if (and (eql xa a) (eql xd d)) | |
x |
import Data.List (transpose, unfoldr, intercalate) | |
import Data.Time.Calendar (gregorianMonthLength, fromGregorian) | |
import Data.Time.Calendar.WeekDate (toWeekDate) | |
-- utilities | |
dow y m d = pred $ trd $ toWeekDate $ fromGregorian y m d where trd(_,_,x) = x | |
groupsOf n | n>0 = unfoldr $ \x -> if null x then Nothing else Just(splitAt n x) | |
-- essential start of cal.hs -------------------------------------- | |
type Month = (Integer,Int) -- a local definition of handy month |
;;; -*- Mode: Lisp -*- | |
;;; The Tofu Shop Game in Iscandar | |
;;; Copyright (C) 1978-2012 by Nobuhide Tsuda | |
;;; (see also http://vivi.dyndns.org/tofu/tofu.html) | |
;;; | |
;;; Revision History: | |
;;; 1978 Design & Implemented by Nobuhide Tuda (ntsuda at beam.ne.jp), | |
;;; as a sort of business strategy simulation game, assuming | |
;;; MC6800(1MHz) and RAM 4-32K bytes w/o secondary storage |
Note: | |
The original document is a section of CLOS in "Google Common Lisp Style Guid", | |
http://google-styleguide.googlecode.com/svn/trunk/lispguide.xml (v1.17) | |
This translation is based on a Japanese translation | |
http://google-common-lisp-style-guide-ja.cddddr.org/?showone=CLOS#CLOS | |
as of 2013/01/05 23:00 JST | |
CC-By 3.0 License |
このページは イスカンダルのトーフ屋ゲーム からリンクされています。
<!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html lang="ja" dir="ltr"> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title> | |
Some Forth pages to go | |
</title> | |
</head> | |
<body> |
\ -*- Mode: Forth -*- | |
\ Conway's Game of Life | |
\ originally from http://rosettacode.org/wiki/Conway's_Game_of_Life#Forth | |
\ see also http://en.wikipedia.org/wiki/Conway's_Game_of_Life | |
\ ------------------------------------------------------------------- | |
\ The fast wrapping requires dimensions that are powers of 2. | |
\ (for playing just size, you may set terminal size to 64x17) |
with-gensyms, once-only (with-gensyms.lisp -- from Practical Common Lisp by Peter Seibel) | |
destructure-case (destructure-case.lisp) | |
and-let* (and-let.lisp) |