Author Topic: How to make a shortest expression return T?  (Read 1967 times)

0 Members and 1 Guest are viewing this topic.

baitang36

  • Bull Frog
  • Posts: 213
How to make a shortest expression return T?
« on: September 04, 2021, 08:42:22 PM »
An empty parenthesis returns nil
How to make a shortest expression return T?
(setq a T)  return T 
but it is too long

ronjonp

  • Needs a day job
  • Posts: 7528
Re: How to make a shortest expression return T?
« Reply #1 on: September 04, 2021, 11:13:39 PM »
An empty parenthesis returns nil
How to make a shortest expression return T?
(setq a T)  return T 
but it is too long
T

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: How to make a shortest expression return T?
« Reply #2 on: September 05, 2021, 04:39:53 AM »
(quote T) ?
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

baitang36

  • Bull Frog
  • Posts: 213
Re: How to make a shortest expression return T?
« Reply #3 on: September 05, 2021, 09:56:22 AM »
(quote T) ?
i found shortest expression is (and)
(= t)

JohnK

  • Administrator
  • Seagull
  • Posts: 10627
Re: How to make a shortest expression return T?
« Reply #4 on: September 05, 2021, 12:27:46 PM »
Thinking:
(t)
(eval t)
(and t)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

baitang36

  • Bull Frog
  • Posts: 213
Re: How to make a shortest expression return T?
« Reply #5 on: September 06, 2021, 02:20:55 AM »
Thinking:
(t)
(eval t)
(and t)
(and)   not need t

(t) is wrong,   t is not a function

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: How to make a shortest expression return T?
« Reply #6 on: September 06, 2021, 03:44:25 AM »
Code: [Select]
_$ T
T
_$ (T)
; errore: funzione errata: T
_$ (
_$ (and T)
T
_$ (and)
T
_$ (eval T)
T
_$

CodeDing

  • Newt
  • Posts: 51
Re: How to make a shortest expression return T?
« Reply #7 on: September 07, 2021, 10:37:12 AM »
baitang36,

...or you could just create your own short expression which will return T?

Code - Auto/Visual Lisp: [Select]
  1. (defun : () t)
  2. .....
  3. Command: (:)
  4. T
  5.  

Best,
~DD
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

JohnK

  • Administrator
  • Seagull
  • Posts: 10627
Re: How to make a shortest expression return T?
« Reply #8 on: September 07, 2021, 11:21:39 AM »
Glad one of them worked. Sorry, I want around a computer at the time so I was just guessing on some of them (still a bit rusty at lisp).

baitang36,

...or you could just create your own short expression which will return T?

Code - Auto/Visual Lisp: [Select]
  1. (defun : () t)
  2. .....
  3. Command: (:)
  4. T
  5.  

Best,
~DD

:) Nice.

Also in that spirt (not as short but much the same--result wise).
(set ': (lambda nil T))
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org