Author Topic: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?  (Read 9577 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 723
DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« on: November 29, 2020, 11:27:59 AM »
DEFMACRO . . . in BRICSCAD LISP,  WORKS  ? ! ?
. . .
What else could work ?

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #1 on: November 29, 2020, 04:55:37 PM »
That looks like some code I used from Practical Common Lisp to demonstrate an embedded Common Lisp interpreter in BricsCAD - https://www.theswamp.org/index.php?topic=56283.msg601777#msg601777

That code probably won't run in BricsCAD as AutoLisp (which doesn't have macros) but the lisp editor doesn't know what defmacro is so assumes it's a user defined function.

As an aside, when my Lisp chops get a LOT better I'd like to try and define a 'defmacro' in AutoLisp but my fear is it would be painfully slow given the interpreted nature of AutoLisp, BricsCAD's version would fair much better though :)
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

domenicomaria

  • Swamp Rat
  • Posts: 723
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #2 on: November 30, 2020, 12:56:38 AM »
yes !
it is your code !

I tried to paste your code in BLADE
just to see if it was able to recognize the syntax ...

Do you have any doable plan
to improve and enhance
the BCAD LISP in BLADE ?
(for istance to make it fully or more COMMON LISP COMPATIBLE ?)

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #3 on: November 30, 2020, 05:13:19 AM »
Some of these function do work in BricsCAD Lisp. F.e. the let function.

But you should not rely on these functions for your code. They are not officially exposed, and therefore may be removed at some point in the future.

d2010

  • Bull Frog
  • Posts: 323
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #4 on: November 30, 2020, 06:03:39 AM »
yes !
Please  you do not put theQuestion/s here, in wrong Topic.
Please you do not spam the "the swamp-forum-lisp" .
You must any question for Briscad , only here, BricSys or Blade or BrisCADv2020, or DES...



domenicomaria

  • Swamp Rat
  • Posts: 723
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #5 on: November 30, 2020, 06:31:06 AM »
yes !

d2010, you are right !

Sorry !

I ask to the administrator
to MOVE these posts into
the right section ...
« Last Edit: November 30, 2020, 07:25:53 AM by domenicomaria »

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #6 on: November 30, 2020, 03:13:01 PM »
yes !
it is your code !

I tried to paste your code in BLADE
just to see if it was able to recognize the syntax ...

The plugin in that topic is for Common Lisp only, it is a completely different animal to AutoLisp in how it runs and while it is a Lisp very few of the native CL functions will run in AutoLisp as they're no catered for in the language.

Do you have any doable plan
to improve and enhance
the BCAD LISP in BLADE ?
(for istance to make it fully or more COMMON LISP COMPATIBLE ?)

From what I understand Blade is a very capable editor and only getting better with each release. Again, it's a totally different project with a different process/engine than the one I posted that hosts Common Lisp.
Incorporating Common Lisp into Blade, even with access to the source code, would be a huge project. One of the reasons I chose to write a new Lisp engine is because there is already very capable editors available for Common Lisp such as Emacs, Vim and even VSCode that can be 'plugged in' to the running process using 'Slime' to communicate with the built in 'Swank' server in my Lisp engine. This enables all the development goodies (debugging, stack traces, hot loading of code etc) available to the everyday Common Lisper in the running CAD process and it's probably just as powerful (or more?) than Blade due to its maturity (people have been professionally developing Common Lisp in Emacs/Slime for a 'long' time now).
Cheers.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

domenicomaria

  • Swamp Rat
  • Posts: 723
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #7 on: December 03, 2020, 11:36:17 AM »
and therefore we must expect that soon,
there will be a new development environment,
that communicates with the CAD (ACAD, BCAD ...)
and that it will be very powerful,
(even more then BLADE)
very compatible with the COMMON LISP?

And will it be possible to use
all those functions we already use?
(VL-XXX VLA-XXX VLR-XXX VLAX-XXX VLE-XXX DOS_XXX ACET-XXX and more ....)

Should we start studying a little bit Common Lisp?

What do you suggest to start with?

And what IDE have we  to use ?

EMACS ?  VIM ?

ciao

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #8 on: December 03, 2020, 02:30:10 PM »
and therefore we must expect that soon,
there will be a new development environment,
that communicates with the CAD (ACAD, BCAD ...)
and that it will be very powerful,
(even more then BLADE)
very compatible with the COMMON LISP?

Not too soon, this is just a toy project that I tinker with in my spare time :)
Like I said, Blade is very good and more of an IDE (GUI based development) than what I can provide using just a text editor with plugins (text based development).
The language used _is_ Common Lisp :)

And will it be possible to use
all those functions we already use?
(VL-XXX VLA-XXX VLR-XXX VLAX-XXX VLE-XXX DOS_XXX ACET-XXX and more ....)

I haven't thought about that but not really, the idea is to give users access to the lower level C/C++ API's for more intensive work in say 3D modelling with the Brep API.
The idea is to be able to write thin _wrapper_ code for a C/C++ API in Common Lisp using CFFI and use it without the need to write any C/C++ code. Basically it's a blank piece of paper at the moment.

Should we start studying a little bit Common Lisp?

What do you suggest to start with?

And what IDE have we  to use ?

EMACS ?  VIM ?

ciao

Sure, and you can use any editor you like but to get the most bang for your buck it should be able to use a Slime plugin for the best IDE like setup (but no GUI).
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

domenicomaria

  • Swamp Rat
  • Posts: 723
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #9 on: December 04, 2020, 04:19:18 AM »
The idea is to be able to write thin _wrapper_ code for a C/C++ API in Common Lisp using CFFI and use it without the need to write any C/C++ code. Basically it's a blank piece of paper at the moment.

This means that it will not be useful for ACAD and BCAD lispers ...
(so, BLADE is the best choice and it is continuosly growing !)
but it will be useful only for EXPERT COMMON LISPERS
...
So I believe that
instead of try to learn common lisp
the best choice is try to learn C# !

And however, because Blade is growing, it could be enough !


« Last Edit: December 04, 2020, 04:22:54 AM by domenicomaria »

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: DEFMACRO . . . in BRICSCAD LISP WORKS ? ! ?
« Reply #10 on: December 04, 2020, 04:48:42 PM »
Basically, at the moment yes :)

Once I get this running properly it will be a good tool for those who are proficient in lisp but want more speed and power (more of the native API is available). Going from AutoLisp to C# or C++ is a huge step for some and requires more tooling such as Visual Studio, moving from AutoLisp to Common Lisp is very easy by comparison.

Unless you plan on using C#/C++ for other non CAD projects[1], the time and effort you need to invest to learn them is not insignificant, the jump to Common Lisp on the other hand will have you productive very quickly      _and_     you will have DEFMACRO  :-D

[1] of course you can use Common Lisp for any other type of development outside of CAD as well ;)
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien