Author Topic: ; error: bad argument type: numberp: "A-12345"  (Read 2807 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
; error: bad argument type: numberp: "A-12345"
« on: February 27, 2013, 01:11:04 PM »
can anyone tell me what this error means?
im trying to add 1 to a variable

(+1 var) and i get that error

kruuger

  • Swamp Rat
  • Posts: 637
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #1 on: February 27, 2013, 01:15:59 PM »
can anyone tell me what this error means?
im trying to add 1 to a variable

(+1 var) and i get that error
how do you want to add 1 (integer) to string "A-12345" ?
not +1 but 1+
convert string to number first and then add 1.
k.

andrew_nao

  • Guest
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #2 on: February 27, 2013, 01:22:12 PM »
ahhh

i see.. thanks for the heads up
its just 1 brain fart after another for me.

andrew_nao

  • Guest
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #3 on: February 27, 2013, 02:03:55 PM »
 error: bad argument type: consp "12345"

what does consp mean?

andrew_nao

  • Guest
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #4 on: February 27, 2013, 02:31:06 PM »
fixed my error but im curious as to what the error means

is there a list of what these errors mean?

kruuger

  • Swamp Rat
  • Posts: 637
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #5 on: February 27, 2013, 03:23:40 PM »
fixed my error but im curious as to what the error means

is there a list of what these errors mean?
http://lee-mac.com/errormessages.html
k.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #6 on: February 28, 2013, 02:00:48 AM »
Strange though. The consp means the function expects a list (not a number), like in the result of using the cons function. Is the +1 function some custom function in your system perhaps?

Both the + and the 1+ would give you an error of:
Code: [Select]
Command: (1+ "A-12345")
; error: bad argument type: numberp: "A-12345"
Command: (+ 1 "A-12345")
; error: bad argument type: numberp: "A-12345"
Notice: numberp, not consp.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

HasanCAD

  • Swamp Rat
  • Posts: 1423
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #7 on: February 28, 2013, 04:55:23 AM »
can anyone tell me what this error means?
im trying to add 1 to a variable

(+1 var) and i get that error
how do you want to add 1 (integer) to string "A-12345" ?
not +1 but 1+
convert string to number first and then add 1.
k.
is such as cases, Is there a way to delete characters from string and keep numbers before convert to real/int?

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England


andrew_nao

  • Guest
Re: ; error: bad argument type: numberp: "A-12345"
« Reply #10 on: February 28, 2013, 08:44:02 AM »
Strange though. The consp means the function expects a list (not a number), like in the result of using the cons function. Is the +1 function some custom function in your system perhaps?

Both the + and the 1+ would give you an error of:
Code: [Select]
Command: (1+ "A-12345")
; error: bad argument type: numberp: "A-12345"
Command: (+ 1 "A-12345")
; error: bad argument type: numberp: "A-12345"
Notice: numberp, not consp.

got it all sorted out.

the + 1 is just the math part, im adding 1 to the number.
 i totally ignored that it was a list that i converted to a string to add 1.
 i had to convert it to an integer to add 1, then convert it to list.
 instead of converting it to a list i was converting it to a string when the code was looking for a list.

thanks for everyones replies.