unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21510: output
@ 2015-09-18  5:58 igor denisov
  2015-09-18 14:41 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: igor denisov @ 2015-09-18  5:58 UTC (permalink / raw)
  To: 21510

; Contract: Number, Number->Number
(defun sub (a b)
	(- a b))

;; Contract: Number, Number->Number
(defun sum (a b)
	(+ a b))

(defvar height-list
	(let ((Hmc 4)
	(step 0.8))
	(setq Hcw (sum Hmc step))
	(setq Hcs (sub Hmc step))
	(setq Htr (sum Hmc step))
	(list Hmc Hcw Hcs Htr)))

(defvar tooth-height-list
  (let ((hmc 0.8)
	(step 0.2))
    (setq hcw (sum hmc step))
    (setq hcs (sub hcw step))
    (setq htr (sum hmc step))
    (list hmc hcw hcs htr)))

(defvar angle-list
  (let ((Amc 70)
	(step 5))
    (setq Acw (sub Amc step))
    (setq Acs (sub Amc step))
    (setq Atr (sub Amc step))
    (list Amc Acw Acs Atr)))

(defvar base-list
  (let ((Bmc 4)
	(step 0.8))
    (setq Bcw (sub Bmc step))
    (setq Bcs Bmc)
    (setq Bcw Bcs)
    (setq Btr Bmc)
    (list Bmc Bcw Bcs Btr)))

(defvar pitch-list
  (let ((Pmc 2)
	(step 1))
    (setq Pcw (sum Pmc step))
    (setq Pcs (sum Pcw step))
    (setq Ptr Pmc)
  (list Pmc Pcw Pcs Ptr)))


;; Number of tooth in a row per 1cm
(defun Nz (pitch-number)
  (100/pitch-number))

;; Number of rows per 1cm
(defun Nr (base-number)
  (100/base-number))

;; parts per square cm
(defun ppsc-calc (a b)
  (* a b))

;; List of numbers of tooth in a row per 1cm
(defun list-of-Nz (pitch-list)
  (if (not pitch-list) ; do again test
      nil
    (cons
     (Nz (car pitch-list))
     (list-of-Nz (cdr pitch-list))))) ;next step expression

;; List of number of rows per 1cm
(defun list-of-Nr (base-list)
  (if (not base-list) ; do again test
      nil
    (cons
     (Nr (car base-list))
     (list-of-Nr (cdr base-list))))) ;next step expression


(defvar list-of-ppsc)

;; List of part per square cm
(defun list-of-ppsc-calc (pitch-list base-list)
  (if (and (not pitch-list)
      (not base-list))
      nil
    (setq list-of-ppsc (cons
     (ppsc-calc (car pitch-list) (car base-list))
     (list-of-ppsc-calc (cdr pitch-list) (cdr base-list))))))

(list-of-ppsc-calc pitch-list base-list)

list-of-ppsc

(defvar PPSCmc)
(defvar PPSCcw)
(defvar PPSCcs)
(defvar PPSCtr)

On issuing the following
(defvar PPSCmc (car list-of-ppsc))
PPSCmc
output is quite strange
8 (#o10, #x8, ?\C-h)
why?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#21510: output
  2015-09-18  5:58 bug#21510: output igor denisov
@ 2015-09-18 14:41 ` Drew Adams
  2015-09-19  8:19   ` igor denisov
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2015-09-18 14:41 UTC (permalink / raw)
  To: igor denisov, 21510

> (defvar PPSCmc (car list-of-ppsc))
> PPSCmc
> output is quite strange
> 8 (#o10, #x8, ?\C-h)
> why?

Didn't bother to read the rest of your message, so apologies
if my guess is wrong.  My guess is that you are wondering
why a number (in this case 8) is shown that way.

If so, that's how Emacs shows a character interactively:
in decimal (8), octal (#o10), hexadecimal (#x8), and as a
character (?\C-h).  (In Emacs Lisp, a character is an
integer.)

So:

(setq foo ?\C-h) ; 8
M-: foo RET ; evaluate foo and print the value
8 (#o10, #x8, ?\C-h)

Same thing for (setq foo 8).





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#21510: output
  2015-09-18 14:41 ` Drew Adams
@ 2015-09-19  8:19   ` igor denisov
  2015-09-19 14:18     ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: igor denisov @ 2015-09-19  8:19 UTC (permalink / raw)
  To: Drew Adams; +Cc: 21510

Do not blame me for persistent as there is something else I stuck upon.

(defvar list-of-ppsc-var
  (list 'PPSCmc 'PPSCcw 'PPSCcs 'PPSCtr))
(defvar list-of-ppsc
   (list 1 2 3 4))

(defun apply-list-to-list (list-of-ppsc-var list-of-ppsc)
  (if  (and (not list-of-ppsc-var)
       (not list-of-ppsc))
       nil
       (setq (car list-of-ppsc-var) (car list-of-ppsc)
       (apply-list-to-list (cdr list-of-ppsc-var) (cdr list-of-ppsc)))))
when I issue the following
(apply-list-to-list list-of-ppsc-var list-of-ppsc)

Debugger entered--Lisp error: (wrong-type-argument symbolp (car
list-of-ppsc-var))
  (setq (car list-of-ppsc-var) (car list-of-ppsc) (apply-list-to-list
(cdr list-of-ppsc-var) (cdr list-of-ppsc)))
  (if (and (not list-of-ppsc-var) (not list-of-ppsc)) nil (setq (car
list-of-ppsc-var) (car list-of-ppsc) (apply-list-to-list (cdr
list-of-ppsc-var) (cdr list-of-ppsc))))
  apply-list-to-list((PPSCmc PPSCcw PPSCcs PPSCtr) (1 2 3 4))
  eval((apply-list-to-list list-of-ppsc-var list-of-ppsc) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

but when I issue
(symbolp (car list-of-ppsc-var))
it is t.

and I do not find any explanation in the manual not even a clue.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#21510: output
  2015-09-19  8:19   ` igor denisov
@ 2015-09-19 14:18     ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2015-09-19 14:18 UTC (permalink / raw)
  To: igor denisov; +Cc: 21510


> Debugger entered--Lisp error: (wrong-type-argument symbolp (car
> list-of-ppsc-var))
> 
> but when I issue
> (symbolp (car list-of-ppsc-var))
> it is t.

*Evaluating* (car list-of-ppsc-var) produces a symbol.

But the sexp (car list-of-ppsc-var) is itself not a symbol.
It is a list. 

You are trying to do (setq (car list-of-ppsc-var) SOMETHING)
- see the backtrace.  `setq' does not evaluate its first argument.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-19 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18  5:58 bug#21510: output igor denisov
2015-09-18 14:41 ` Drew Adams
2015-09-19  8:19   ` igor denisov
2015-09-19 14:18     ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).