Author Topic: LSharp v2  (Read 10862 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 7033
  • AKA Daniel
LSharp v2
« on: November 30, 2008, 07:10:54 PM »
http://www.lsharp.org/

Code: [Select]
namespace AcadLSharp
{
  public static class Commands
  {
    [CommandMethod("doit")]
    public static void doit()
    {
      Editor editor = AcAp.Application.DocumentManager.MdiActiveDocument.Editor;

      System.IO.StringReader sin = new System.IO.StringReader(string.Empty);
      System.IO.StringWriter sout = new System.IO.StringWriter();
      System.IO.StringWriter serr = new System.IO.StringWriter();
      try
      {
        LSharp.Runtime r = new LSharp.Runtime(sin, sout, serr);
        r.EvalString("(+ 1 2 3)");
        editor.WriteMessage(r.EvalString("(+ 1 2 3)").ToString());
        //editor.WriteMessage(serr.ToString());
      }
      catch (System.Exception ex)
      {
        editor.WriteMessage(ex.Message);
      }
      finally
      {
        sin.Dispose();
        sout.Dispose();
        serr.Dispose();
      }
    }
  }
}


MP

  • Seagull
  • Posts: 17664
  • Have thousands of dwgs to process? Contact me.
Re: LSharp v2
« Reply #1 on: November 30, 2008, 07:16:14 PM »
Interesting; bookmarked for later. :)
Engineering Technologist CAD Specialist Programmer Analyst
Design Drafting Document Control Automation.
cadanalyst@fastmail.com https://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 7033
  • AKA Daniel
Re: LSharp v2
« Reply #2 on: November 30, 2008, 07:45:26 PM »
Not sure how to use it yet, but it seems that this could be a really cool add-on for lisp
especially if I can work a way to pass a ResultBuffer to the LSharp evaluator and return a ResultBuffer to lisp.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 7033
  • AKA Daniel
Re: LSharp v2
« Reply #3 on: November 30, 2008, 07:59:51 PM »
Code: [Select]
;;; A minimal Windows Forms application

(reference "System.Windows.Forms")
(reference "System.Drawing")

(using "System.Drawing")
(using "System.Windows.Forms")

;; Create a form
( = form1 (new "Form"))
(.set_text form1 "Hello")

;; Create a label
(= label1 (new "Label"))
(.set_Text label1 "Hello World")
(.set_size label1 (new "Size" 224 23))
(.set_Location label1 (new "Point" 24 16))
(.add (.controls form1) label1)

;; Show the form
(.showdialog form1)


sinc

  • Guest
Re: LSharp v2
« Reply #4 on: December 01, 2008, 12:41:03 AM »
This makes me think of using a nuclear power plant to turn coal into diesel fuel for running a generator in order to produce electricity.   ;-)

But I suspect a number of people are drooling over the prospect of "Lisp.NET"...

MP

  • Seagull
  • Posts: 17664
  • Have thousands of dwgs to process? Contact me.
Re: LSharp v2
« Reply #5 on: December 01, 2008, 01:00:33 AM »
I think it's interesting but it's not drool worthy.
Engineering Technologist CAD Specialist Programmer Analyst
Design Drafting Document Control Automation.
cadanalyst@fastmail.com https://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: LSharp v2
« Reply #6 on: December 01, 2008, 03:25:29 AM »

I think it's another chance for some people to get capability and expectation mixed up.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

pkohut

  • Guest
Re: LSharp v2
« Reply #7 on: December 01, 2008, 05:43:02 AM »
I think, I won't comment :wink:

Paul

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 7033
  • AKA Daniel
Re: LSharp v2
« Reply #8 on: December 01, 2008, 11:58:36 AM »
Actually I think the idea of creating a lisp interpreter using Linq expression trees is very creative.  8-)

Feel free to post negative comments, but positive ones are more constructive.  :-P

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: LSharp v2
« Reply #9 on: December 01, 2008, 12:52:58 PM »
I'd be curious to hear what people really like about lisp.
For me, its mainly the fact that you can test lines of code at the command line, and that the list variables hold values that do not require casting to int or string...
In other words, a completely un-typesafe language is nice.  I can write my own checking stuff, but generally I don't mix up types.
This all stems from the fact that there are no classes in lisp.  There are only value types, and lists.

James Maeding

Spike Wilbury

  • Guest
Re: LSharp v2
« Reply #10 on: December 01, 2008, 01:07:40 PM »
I'd be curious to hear what people really like about lisp.
For me, its mainly the fact that you can test lines of code at the command line, and that the list variables hold values that do not require casting to int or string...
In other words, a completely un-typesafe language is nice.  I can write my own checking stuff, but generally I don't mix up types.
This all stems from the fact that there are no classes in lisp.  There are only value types, and lists.



short comment:

lisp it is easy....

i'm doing porting of lisp code to arx... not easy at all - but the software company it is what they want.... :)

sinc

  • Guest
Re: LSharp v2
« Reply #11 on: December 01, 2008, 02:27:56 PM »
I think some people like the "logic puzzle" aspect of Lisp.  The language has relatively few commands, but some of them are very flexible and powerful.  Coming up with the most-concise way of accomplishing a task is a lot like solving a puzzle, which some people enjoy.

That sort of programming isn't very ideal, though.  The code tends to be very obtuse, difficult to read, and difficult to maintain or expand.  Those are big drawbacks.

Spike Wilbury

  • Guest
Re: LSharp v2
« Reply #12 on: December 01, 2008, 07:24:54 PM »
I think some people like the "logic puzzle" aspect of Lisp.  The language has relatively few commands, but some of them are very flexible and powerful.  Coming up with the most-concise way of accomplishing a task is a lot like solving a puzzle, which some people enjoy.

That sort of programming isn't very ideal, though.  The code tends to be very obtuse, difficult to read, and difficult to maintain or expand.  Those are big drawbacks.

I spent so much time on lisp from 1987-2001/2002 - now I would like to go back and start with C++ (what I use now)  instead of lisp but yes that's not possible  :-(

sinc

  • Guest
Re: LSharp v2
« Reply #13 on: December 01, 2008, 07:46:19 PM »
It probably takes me at least twice as long to perform a task in C++, compared to C#.  The syntax of C++ is rather messy, which makes it easier to create errors that are difficult to find.  Not only is it faster/easier to write C#, I spend less time in the debugger.  And it's always possible to write some code in C++ and throw a managed wrapper around it, should you find something that can't be done (or doesn't perform well enough) in C#.

And of course, Boo makes C# look twisted...  The languages keep a'changin, and they usually get better.

But I'm sure there will still be lots of interest in that L# Lisp.NET thing...  Lisp's longevity is really rather impressive.  Isn't Lisp generally considered to be, like, the third computer language ever invented, or something like that?

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Be your Best


Michael Farrell
http://primeservicesglobal.com/