Need Help With LISP Program

I heard LISP was the programming language for Artificial Intelligence. So I installed it, and got a simple software running:

(loop for n from 1 to 100000
   do (print "LOOK AROUND YOU"))

So now that I have that down, my question is how to you make artificial intelligence with it? The input I have in mind is a simple string. For example:

 "DESIGN AN ERP SYSTEM FOR OUR COMPANY IN JAVA."

The output should be a completely bug-free set of Java source files that implements all of our requirements. It would be nice if the program could also compile it for us.

Please send me the codes.

5 comments · 95% upvoted · other discussions

comments

Sheepshow

Yes LISP is an AI language but it has a lot of parenthesis. This is why it is not very popular, although it is very powerful. Your first attempt is very, very close but has some syntactical issues.

"DESIGN AN ERP SYSTEM FOR OUR COMPANY IN JAVA."

should be written in LISP syntax as

(cons 'D 
 (cons 'E 
  (cons 'S 
   (cons 'I 
    (cons 'G 
     (cons 'N 
      (cons '  
       (cons 'A 
        (cons 'N 
         (cons '  
          (cons 'E 
           (cons 'R 
            (cons 'P 
             (cons '  
              (cons 'S 
               (cons 'Y 
                (cons 'S 
                 (cons 'T 
                  (cons 'E 
                   (cons 'M 
                    (cons '  
                     (cons 'F 
                      (cons 'O 
                       (cons 'R 
                        (cons '  
                         (cons 'O 
                          (cons 'U 
                           (cons 'R 
                            (cons '  
                             (cons 'C 
                              (cons 'O 
                               (cons 'M 
                                (cons 'P 
                                 (cons 'A 
                                  (cons 'N 
                                   (cons 'Y 
                                    (cons '  
                                     (cons 'I 
                                      (cons 'N 
                                       (cons '  
                                        (cons 'J 
                                         (cons 'A 
                                          (cons 'V 
                                           (cons 'A 
                                            (cons '. '())))))))))))))))))))))))))))))))))))))))))))))
[deleted]

(cons '. '())

10/10

republitard [OP]

That did something, but it doesn't look like a working Java implementation of our ERP system to me:

SB-INT:SIMPLE-READER-ERROR at 1439 (line 45, column 53) on #<SB-IMPL::STRING-INPUT-STREAM

                                                             {BC26B69}>:
  dot context error
   [Condition of type SB-INT:SIMPLE-READER-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {BA160E1}>)

Backtrace:
  0: (SB-INT:SIMPLE-READER-ERROR #<SB-IMPL::STRING-INPUT-STREAM {BC26B69}> "dot context error")
  1: (SB-IMPL::READ-TOKEN #<SB-IMPL::STRING-INPUT-STREAM {BC26B69}> #\.)
  2: (SB-IMPL::%READ-PRESERVING-WHITESPACE #<SB-IMPL::STRING-INPUT-STREAM {BC26B69}> T NIL T)
  3: (READ #<SB-IMPL::STRING-INPUT-STREAM {BC26B69}> T NIL T)
  4: (SB-IMPL::READ-QUOTE #<SB-IMPL::STRING-INPUT-STREAM {BC26B69}> #<unavailable argument>)

How do you instantiate a DotContext? I tried this:

 (dot context dc = (new (dot context)))

But it didn't work. Maybe it needs more factory? What is the L.I.S.P. equivalent of factory?

uardum

You idiots. You need to guard your space and period symbols with pipe quotes:

(cons 'D 
 (cons 'E 
  (cons 'S 
   (cons 'I 
    (cons 'G 
     (cons 'N 
      (cons '| |
       (cons 'A 
        (cons 'N 
         (cons '| | 
          (cons 'E 
           (cons 'R 
            (cons 'P 
             (cons '| |
              (cons 'S 
               (cons 'Y 
                (cons 'S 
                 (cons 'T 
                  (cons 'E 
                   (cons 'M 
                    (cons '| |
                     (cons 'F 
                      (cons 'O 
                       (cons 'R 
                        (cons '| |  
                         (cons 'O 
                          (cons 'U 
                           (cons 'R 
                            (cons '| |  
                             (cons 'C 
                              (cons 'O 
                               (cons 'M 
                                (cons 'P 
                                 (cons 'A 
                                  (cons 'N 
                                   (cons 'Y 
                                    (cons '| |
                                     (cons 'I 
                                      (cons 'N 
                                       (cons '| | 
                                        (cons 'J 
                                         (cons 'A 
                                          (cons 'V 
                                           (cons 'A 
                                            (cons '|.| '())))))))))))))))))))))))))))))))))))))))))))))
republitard [OP]

Now it's telling me to do it myself! And it yelled at me! Output:

(D E S I G N | | A N | | E R P | | S Y S T E M | | F O R | | O U R | | C O M P A N Y | | I N | | J A V A |.|)

I'm starting to see why LISP isn't very popular. He's an asshole.