LINUX.ORG.RU

puzzle in mcclim

 


0

1

Вылетает ошибка, указал в теле кода. И как indent этот код в emacs?

;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Package: CLIM-USER; Base: 10 -*-

(in-package :clim-user)

(define-application-frame fifteen-puzzle-1 ()
  ((pieces :initform (make-array `(4 4) :initial-contents `((1 2 3 4)
							    (5 6 7 8)
							    (9 10 11 12)
							    (13 14 15 0)))))
  
(:menu-bar nil)
(:panes
 (display :application
	  :text-style `(:fix :bold :very-large)
	  :display-function `draw-the-display
	  :scroll-bars nil)
 (menu :command-menu))
(:layouts
 (main
  (vertically () display menu))))

;;; this draws the entire display
(defmethod draw-the-display ((application fifteen-puzzle-1) stream
			     &key &allow-other-keys)
(with-slots (pieces) application
(dotimes (y 4)
(dotimes (x 4)
(let ((piece (aref pieces y x)))
(if (zerop piece)
(format stream "
 ")
(format stream "~2D " piece))))
(terpri stream))))
;;; useful macrology - the body will be run with x and y bound to
;;; the coordinates of the empty cell
(defmacro find-empty-piece-and-do ((y x) &body body)
‘(block find-empty-piece
(dotimes `(,y 4)
(dotimes `(,x 4)
(when (zerop `(aref pieces ,y ,x))
  ,@body ;; как бороться сэтим
         ;; READ error during COMPILE-FILE:
         ;; Comma not inside a backquote.
         ;; Line: 41, Column: 3, File-Position: 1092
(return-from find-empty-piece))))))
(define-fifteen-puzzle-1-command (down :menu t) ()
(with-slots (pieces) *application-frame*
(find-empty-piece-and-do (y x)
(if (not (zerop y))
(rotatef (aref pieces y x) (aref pieces (- y 1) x))))))
(define-fifteen-puzzle-1-command (up :menu t) ()
(with-slots (pieces) *application-frame*
(find-empty-piece-and-do (y x)
(if (not (= y 3))
(rotatef (aref pieces y x) (aref pieces (+ y 1) x))))))
(define-fifteen-puzzle-1-command (left :menu t) ()
(with-slots (pieces) *application-frame*
(find-empty-piece-and-do (y x)
(if (not (= x 3))
(rotatef (aref pieces y x) (aref pieces y (+ x 1)))))))
(define-fifteen-puzzle-1-command (right :menu t) ()
(with-slots (pieces) *application-frame*
(find-empty-piece-and-do (y x)
(if (not (zerop x))
(rotatef (aref pieces y x) (aref pieces y (- x 1)))))))
#||
()
(setq fp1 (make-application-frame ’fifteen-puzzle-1
:left 200 :right 400 :top 150 :bottom 350))
(run-frame-top-level fp1)
||#
Ответ на: комментарий от ados

Или это просто эмакс так дико настроен?

Ты абсолютно прав, емакс прям из ящика, Debian 8. Если можешь подкинь свой .emacs.

Лисповая графическая оболочка.

Я никогда не видел. А если, ты работал/работаешь на лисп-машине, или в лисповой графической оболочке, поделись опытом, сбрось какие - нибудь скриншоты. Очень интересно.

saufesma
() автор топика
Ответ на: комментарий от saufesma

Я никогда не видел. А если, ты работал/работаешь на лисп-машине, или в лисповой графической оболочке, поделись опытом, сбрось какие - нибудь скриншоты. Очень интересно.

Я тоже не видел. Просто не понимаю что ещё может выставить вот такие идентификаторы клавиш:

<lisp> <ind-sexp>

У меня обыкновенное:

TAB (translated from <tab>) runs the command indent-for-tab-command
(found in global-map), which is an interactive compiled Lisp function
in ‘indent.el’.

It is bound to TAB.

(indent-for-tab-command &optional ARG)
ados ★★★★★
()
Последнее исправление: ados (всего исправлений: 1)
Ответ на: комментарий от ados

У меня там не один .emacs а целый проект.

Тогда ладно.

saufesma
() автор топика
Ответ на: комментарий от ados

Просто не понимаю что ещё может выставить вот такие идентификаторы клавиш: <lisp> <ind-sexp>

Подскажи куда залезть, я поковыряю.

saufesma
() автор топика
Ответ на: комментарий от ados

Смотря что тебе нужно от твоего эмакса.

Нужно максимум удобства программирования в Lisp, McCLIM

Покажи список установленных пакетов через elpa.

  ace-jump-mode      2.0          installed             a quick cursor location minor mode for emacs
  autopair           0.6.1        installed             Automagically pair braces and quotes like TextMate
  dash               2.16.0       installed             A modern list library for Emacs
  epl                0.9          installed             Emacs Package Library
  flycheck           31           installed             On-the-fly syntax checking
  let-alist          1.0.5        installed             Easily let-bind values of an assoc-list by their names
  macrostep          0.9          installed             interactive macro expander
  monokai-theme      3.5.3        installed             A fruity color theme for Emacs.
  nlinum             1.9          installed             Show line numbers in the margin
  pkg-info           0.6          installed             Information about packages
  seq                2.20         installed             Sequence manipulation functions
  slime              2.23         installed             Superior Lisp Interaction Mode for Emacs
  smex               3.0          installed             M-x interface with Ido-style fuzzy matching.
  switch-window      1.6.2        installed             A *visual* way to switch window
  undo-tree          0.6.5        installed             Treat undo history as a tree
saufesma
() автор топика
Ответ на: комментарий от saufesma

Нужно максимум удобства программирования в Lisp, McCLIM

Даже не знаю как помочь с твоей проблемой. Помню как на форуме очень давно один анонимус писал как ещё раньше писал другой анонимус что существует где-то в глубинах сети некий древний файл с кодом на эмакс лиспе. Говорили, что достаточно просто загрузить этот код в эмаксе и скомандовать M-x zdelay-zaebis-mode. Лично я считаю это всё байки старых эмаксеров, но мало ли что.

ados ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.