Author Topic: LSharp v2  (Read 17888 times)

0 Members and 2 Guests are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #45 on: December 08, 2008, 01:39:54 PM »
Sample

Code: [Select]
(def L#ADDLINE ()
 (= pDb (HostApplicationServices.WorkingDatabase))
 (= tm (.TransactionManager pDb))
 (= tr (.StartTransaction tm))
 (= id (SymbolUtilityServices.GetBlockModelSpaceId pDb))
 (= mode (OpenMode.ForWrite))
 (= blockTableRecord (.GetObject tr id mode))
 (= line (new "Line" (new "Point3d" 0 0 0) (new "Point3d" 100 100 0)))
 (= id2 (.AppendEntity blockTableRecord line))
 (.AddNewlyCreatedDBObject tr line true)
 (.Commit tr)
 (.Dispose tr)
 id2
)


Spike Wilbury

  • Guest
Re: LSharp v2
« Reply #46 on: December 08, 2008, 02:06:07 PM »
are you going to emulate what it is now in autolisp/vlisp or just something new that can be added ?

 No, I am trying to make Vlisp interact with L# so they can be used together.

thanks Daniel...

wonder how are you going to handle: list's, mapcar's, lambda's and when they have or are made of different types and are deep nested, if end up using as arguments - waiting for see that.

me too  :-D


 :lol:

and wait for: append, cdr, reverse, member - to mention a few..... (I am in this boat right now btw lisp->c++/arx)

TonyT

  • Guest
Re: LSharp v2
« Reply #47 on: December 09, 2008, 02:09:06 AM »
Sample

Code: [Select]
(def L#ADDLINE ()
 (= pDb (HostApplicationServices.WorkingDatabase))
 (= tm (.TransactionManager pDb))
 (= tr (.StartTransaction tm))
 (= id (SymbolUtilityServices.GetBlockModelSpaceId pDb))
 (= mode (OpenMode.ForWrite))
 (= blockTableRecord (.GetObject tr id mode))
 (= line (new "Line" (new "Point3d" 0 0 0) (new "Point3d" 100 100 0)))
 (= id2 (.AppendEntity blockTableRecord line))
 (.AddNewlyCreatedDBObject tr line true)
 (.Commit tr)
 (.Dispose tr)
 id2
)



Not terribly thrilled with that syntax, not at all.

(= var value) for assignment makes no sense to
LISP programmers for whom (setq) or (setf) are
second nature. If following more strictly, Common
LISP conventions, it would be (setf) that is used
to set properties of an object, but which form
the accessor should take seems to be the subject
of much debate.

The fact that they ended up with this contortion
(I'll call it 'LISP from hell'), which looks like it's just
a big ugly hack, largely out of sheer convenience,
pretty much seals the fate of L#.

My guess is that most hard-core LISPers would
have no part of it.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #48 on: December 09, 2008, 02:53:23 AM »

I certainly agree, some of the syntax is not like Autolisp at all, (= var value) is very weird.
The good news is that the author has made it very simple to change and add new items.
Once I further a long, I will dig in and see if I can make it more Autolisp like.
I did notice the SETQ and SET are already defined.
 

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #49 on: December 09, 2008, 03:52:17 AM »
Sorry SETQ was not defined, I have added it

Code: [Select]
(def L#DATE ()
  (setq a (Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable "date"))
  a
)

&&

Code: [Select]
(def L#ADDLINE ()
     (setq pDb (HostApplicationServices.WorkingDatabase))
     (setq tm (.TransactionManager pDb))
     (setq tr (.StartTransaction tm))
     (setq id (SymbolUtilityServices.GetBlockModelSpaceId pDb))
     (setq mode (OpenMode.ForWrite))
     (setq blockTableRecord (.GetObject tr id mode))
     (setq line
        (new "Line" (new "Point3d" 0 0 0) (new "Point3d" 100 100 0))
     )
     (setq id2 (.AppendEntity blockTableRecord line))
     (.AddNewlyCreatedDBObject tr line true)
     (.Commit tr)
     (.Dispose tr)
     id2
)
« Last Edit: December 09, 2008, 03:56:58 AM by Daniel »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #50 on: December 09, 2008, 05:54:31 PM »
Here is a list of functions, I suspect this list will change since L# is sill experimental

Code: [Select]
;;;Command: (L#EvalStr"(map (fn (x) (prn (+(.ToUpper(.ToString(.key x))) \"  \")))  environment)")

("ISO  LOAD  EVERY?  EXPT  NOT  BOUND  CAAR  TRUE  REST  REDUCE  OR  SEQ  DO1 
UNLESS  PR  DEF  LENGTH  LIST  PROGN  TESTIFY  TIME  MSEC  EVEN  +  COMPILE 
TOLIST  LET  CDDR  TYPE  LEN  LAST  MACEX1  SQRT  STDOUT  MOD  APPLY  EVAL  PRN
 REVERSE  -  *  NO  CADR  DEFUN  NOR  IDFN  ERR  CONS  T  NIL  FOR  <  TOARRAY 
SLEEP  >  NTH  USING  REFERENCE  STDERR  ISA  AND  WHILE  PAIR  MEMBER?  STDIN 
MACEX  RANGE  EMPTY?  UNIQ  FIRST  NEW  HELP  ATOM?  SET  WHEN  THROW  WITH 
NULL  COERCE  ENVIRONMENT  IS  DO  STR  FALSE  SAFESET  ODD  CDR  MAC  SEQ? 
SETQ  =  MAP  SOME?  /  INSPECT  TYPEOF  CAR  EACH  ")


kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2122
  • class keyThumper<T>:ILazy<T>
Re: LSharp v2
« Reply #51 on: December 09, 2008, 06:44:08 PM »
Which of those have you added and which are native Daniel ?
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #52 on: December 09, 2008, 07:11:28 PM »
I added SETQ and DEFUN.. Actually they are just synonyms for SET and DEF.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: LSharp v2
« Reply #53 on: December 10, 2008, 12:39:06 AM »
PFC  8-)

Code: [Select]
(reference "System.Xml")
(= news (new "System.Xml.XmlDocument"))
(.load news "http://www.theregister.co.uk/headlines.rss")
(map (fn (x) (.innertext x)) (.selectnodes news  "/rss/channel/item/title"))