Is anything easier to do in java than in lisp?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher C. Stacy

    #61
    Re: Is anything easier to do in java than in lisp?

    >>>>> On Wed, 16 Jun 2004 09:56:02 +0200, Espen Vestre ("Espen") writes:

    Espen> André Thieme <address.good.u ntil.2004.aug.1 1@justmail.de> writes:[color=blue][color=green]
    >> You want to integrate SAP? No problem with Java with original drivers
    >> from SAP. In Lisp.. you would have to write them yourself.[/color][/color]

    Espen> I think there's a bootstrapping problem here: Such interfaces
    Espen> (don't know about SAP, but we're interfacing to a number of weird
    Espen> protocols where I work) are easy to write in lisp, so every active
    Espen> lisper who needs it writes his own and doesn't think of sharing
    Espen> his little hack, so the next lisper writes it himself too... and
    Espen> so on.

    If he writes a good implementation, why not sell it?

    Comment

    • Oliver Plohmann

      #62
      Re: Is anything easier to do in java than in lisp?

      Kenny Tilton <ktilton@nyc.rr .com> wrote in message news:<l%Yzc.188 757$WA4.103494@ twister.nyc.rr. com>...[color=blue]
      > Oliver Plohmann wrote:
      >[color=green]
      > > You were right. We were using Scheme back then ;-). Thanks for the
      > > answers. Usually ppl just start to flame you and your question remain
      > > unanswered. Okay then, maybe I have a look at Lisp again.[/color]
      >
      > Hang on, what happened to?:
      >[color=green]
      > > It makes probably more sense to compare
      > > Lisp and Smalltalk - they are more alike and both almost dead.[/color]
      >
      > Why look at a near-dead language?[/color]

      Well, I'm not really sure which of those two languages is the more
      dead one ... ;-). But I would say they are both quite dead, which is a
      pity for both of them. The only thing Lisp has that Smalltalk hasn't
      is macros. I'm not really sure I fully comprehend the power of macros.
      So I won't make a statement whether you can live without them or not.
      But I think Smalltalk is more organized than Lisp and in case of
      Squeak you can change the compiler/VM to add those macros to Squeak.
      [color=blue]
      > confusedly, kenny[/color]

      Comment

      • André Thieme

        #63
        Re: Is anything easier to do in java than in lisp?

        Oliver Plohmann schrieb:
        [color=blue]
        > Well, I'm not really sure which of those two languages is the more
        > dead one ... ;-). But I would say they are both quite dead, which is a
        > pity for both of them. The only thing Lisp has that Smalltalk hasn't
        > is macros. I'm not really sure I fully comprehend the power of macros.
        > So I won't make a statement whether you can live without them or not.
        > But I think Smalltalk is more organized than Lisp and in case of
        > Squeak you can change the compiler/VM to add those macros to Squeak.[/color]

        Did you know that Dr. Alan Kay, the inventor of Smalltalk said some few
        years ago, that Lisp is "the greatest single programming language ever
        designed"?
        (http://www.paulgraham.com/quotes.html)

        André
        --

        Comment

        • Oliver Plohmann

          #64
          Re: Is anything easier to do in java than in lisp?

          André Thieme <address.good.u ntil.2004.aug.1 1@justmail.de> wrote in message news:<cas87l$t8 2$1@ulric.tng.d e>...
          [color=blue]
          > Did you know that Dr. Alan Kay, the inventor of Smalltalk said some few
          > years ago, that Lisp is "the greatest single programming language ever
          > designed"?
          > (http://www.paulgraham.com/quotes.html)
          >
          > André
          >[/color]

          Hi André!

          I didn't know, but I'm not all that surprised. Smalltalk has many
          similarities with Lisp (e.g., Smalltalk blocks and Lisp lambda
          expressions, non-destructive programming, and other things).

          Cheers, Oliver

          Comment

          • RobertMaas@YahooGroups.Com

            #65
            Re: Is anything easier to do in java than in lisp?

            > From: Pete Kirkham <pete-kirkham-2004@cafemosaic .co.uk>[color=blue]
            > How would you see that in lisp without using the introspector running
            > in an interactive environment?[/color]

            If you use ordinary nested-list structures when first developing your
            new program, the ordinary read-eval-print loop is all you need to see
            the result of every step you key in manually. Only a poor teacher would
            insist on brand new students, never programmed before, using other
            kinds of structures from the very start. And any experienced lisp
            programmer would know to use ordinary nested-list structures when
            developing something that is really difficult to do, then switch to
            other kinds of structures later if there's a really good reason to do
            so. By comparison, in java generally you hardly ever use
            nested-linklist structures, you use instances of classes, for which
            there isn't a standard useful way to print them. So even with BeanShell
            you won't have the ease of lisp. (If BeanShell provides a useful
            printed representation of every class instance, somebody please correct
            what I said there. By the way, does anybody have a CGI interface to
            BeanShell so that I could play with it to get a feel for how nice it
            is?)
            [color=blue]
            > People expect more than can be delivered through an HTML form, let
            > alone VT100.[/color]

            Google does just fine with HTML forms, and it's pretty popular, both
            regular Web search, and Google Groups.
            Yahoo Groups does fine with HTML forms too, except for their live chat
            service which requires something more.
            [color=blue]
            > Or lambda, which is so old it's ancient Greek.[/color]

            Without changing the syntax, what word would you like in place of
            lambda? Maybe anonymous-function, or just anonfunc to keep it short?
            [color=blue]
            > programmers are taught that a program is 'like a recipe', so how can
            > a recipe take part of the cookbook as an ingredient?[/color]

            Actually I like that metaphor! Lisp allows you to write programs that
            not just follow recipies a human wrote, but write their own recipes and
            then follow them just the same! Macros are a crude beginning to that
            idea: You write a template that converts one kind of form into another
            kind of form, with the latter being a recipe that the computer can
            follow. So for example you could have the macro form:
            Fried eggs and toast <n>
            expand into:
            Put oil and <n> eggs into frypan and turn on burner.
            Put <n> pieces of bread into toaster-oven, set to high, and press on.
            When eggs are almost done, turn over.
            After toaster oven turns off, wait a few seconds then remove toast.
            When eggs are all done, remove from pan, place on top of toast, and
            turn off burner.
            So depending on the number you put for <n>, you get a different recipe.
            (With cakemixes etc. where you have to measure strange amounts of
            different ingredients proportionally, the parameterized recipe is much
            more useful than my trivial example above. Most such recipes give the
            amounts for a standard size such as to serve four, and tell you to us
            proportionally larger or smaller amounts to serve other numbers of
            people, which is a royal pain to do manually. So having the ability to
            have the computer generate the desired recipe could be seen as an
            advantage to anyone who ever cooks such recipes.) Then once the student
            understands that metaphor, and has written simple programs manually,
            combining the two ideas to write a macro that writes a program would be
            understandable.
            [color=blue]
            > too many people are taught to program rather than taught to think.[/color]

            Why do you assume it's an either-or situation, not both??
            [color=blue]
            > lisp/Prolog/SQL you say 'I want the first part of the rest of the list'.
            > C/C++/Java/CODASYL 'I have a list, I will navigate through it until I
            > have the second element, then return that element'[/color]

            I disagree. In either lisp or C you can do it either way.
            [color=blue]
            > Lisp syntax structures its calls starting with the result (though the
            > effect is still procedural), Java syntax structures its calls starting
            > with your arguments.[/color]

            For static methods, that's not true at all. Package and class and
            function name is first, arguments come later, making them the same as
            ordinary lisp function calls where package:functio nname precede
            arguments.

            For instance methods it's only partly true. The object reference comes
            first, then the dot, then the method name interpreted within the class
            that the object has at runtime, then the other arguments which are
            interpreted per their compiletime declared class not their actual
            runtime class in deciding which overloaded method to call.

            But there seems to be a fundamental difference in the *semantics*:

            ... OO systems which only allow you to
            specialize on the first argument. This argument is then given
            linguistic prominence, and the function call is given a new syntax to
            reflect that:
            Hmm, sounds like java is an example of such an OO language, am I correct?
            CLOS supports multi-methods - methods that can specialize on more than
            one argument.
            So that's why the same kind of syntax, one argument up front the rest
            later, isn't used in lisp (specifically CLOS).
            [color=blue]
            > the Java syntax fits in with the model of program-as-recipe[/color]

            Ignoring the point about how Java doesn't make it easy for programs to
            compose programs, whereas lisp does: I disagree. Either language can be
            programmed the same way: Define a function (method) which takes
            arguments, do some calculation based on them, do some more calculation
            based on those calculations, etc., until it has the finished result,
            then return that result. (Either can return multiple values: CL
            explicitly via an efficient mechanism, Java via allocatinging a vector
            and returning that, which is the old way lisp did it before
            multiple-value returns were implemented. That's just an efficiency
            issue.) You get some ingredients, do various mixing and cooking of
            them, and at the end you have something to eat. Function/method calling
            within a function/method is like a sub-recipe for making some difficult
            ingredient, such as won tons which are an ingredient in won ton soup.
            Again, I see no essential difference between Java and Lisp in having
            recipe as a metaphor.
            [color=blue][color=green]
            > > Anyway, back to lack of keywords, so every combination of what would be
            > > keywords in CL becomes a totally separate functionName and/or
            > > argumentList in java.[/color]
            > This is more a lack of optional arguments, rather than keyword arguments.[/color]

            Incorrect. Just yesterday I was working on a GUI program (AWT Applet)
            in Java, and needed to find the appropriate version of a particular
            method. I wanted to specify the message text, title, type of message,
            and nothing else. But that particular combination wasn't available, so
            I had to use a method that required additional arguments, and supply
            dummy values for each of them. Optional arguments wouldn't have helped,
            because the *first* argument of the method I used was one of the
            arguments I didn't want to have to specify myself. Optional arguments
            only let you stop supplying arguments from some point onward, they
            don't let you skip early arguments and include later ones. Keyword
            arguments would have allowed me to specify exactly the arguments I
            wanted, and let the rest default to reasonable values. Look at this
            mess:

            static String showInputDialog (Component parentComponent ,
            Object message)
            Doesn't let me specify title, hence useless for my need.

            static String showInputDialog (Component parentComponent ,
            Object message, Object initialSelectio nValue)
            Doesn't let me specify title, hence useless for my need.

            static String showInputDialog (Component parentComponent ,
            Object message, String title, int messageType)
            What I want, except I have to supply the first argument somehow even
            though it's a pain, but null seems to work (put dialog in middle of
            whole screen instead of centered within current Applet if I specify
            that as the parentComponent ).

            static Object showInputDialog (Component parentComponent ,
            Object message, String title, int messageType, Icon icon,
            Object[] selectionValues , Object initialSelectio nValue)
            Requires several arguments I can't supply, hence useless for my need.

            static String showInputDialog (Object message,
            Object initialSelectio nValue)
            Doesn't let me specify title, hence useless for my need.

            Oh if you're curious why I'm using a swing JOptionPane method within an
            AWT Applet: Because AWT doesn't have anything like that yet, a
            deficiency of Java'a GUI API.
            [color=blue]
            > IDEs also help in the other aspect that keywords do, by showing the
            > programmer what the names of the arguments are.[/color]

            But there are five different overloaded versions of the same-name
            method, so it's impossible for the IDE to know which of the five should
            have its argument names shown to programmer. By comparison with CL with
            keyword arguments an IDE could do the "right thing" of clearly
            indicating which arguments if any are required then what keyword
            arguments may be used, perhaps by a pull-down menu hanging from the
            cursor the way Visual Basic's IDE deals with a list of all the GUI
            controls that might be specified for an event handler.
            [color=blue][color=green]
            > > Indeed, in java working with linked lists must be an awful pain.
            > > Either your list can contain only one kind of element, so you declair
            > > your own class to include link-cells whose data pointer is of that
            > > type, or you use the generic Object type and deal with having to write
            > > code that explicitly checks the case of every element at runtime.[/color]
            > You tend to use the singly polymorphic dispatch mechanism. It's not as
            > elegant as generic functions, but it's not something you notice- the
            > main difference is that the generic function definition has to be placed
            > into an 'interface' and (if using Java version<1.5) you have to 'cast'
            > (coerce) the elements in the list to the interface type.[/color]

            It's a big loser: Suppose you want to have a list that can contain any
            mixture of twenty different types, mostly built-in types. You *cannot*
            create an interface for these twenty types, then make each of the
            twenty types implement your new interface, because you are not allowed
            to re-define system-supplied API classes to make them implement a new
            interface they didn't before. So you'd have to extend each of the
            system-supplied classes to be a version that was just like the system
            version but which implemented your new interface. Then you'd have to
            keep track of whether you were using your extension or the original
            type throughout your program, doing downcasting explicitly as needed.
            It's a waste of effort, probably easier to just use Object type which
            needs explicit typecase dispatch in your code, but Java doesn't have
            typecase, so daisy chain of:
            else if (obj instanceof type<n>) { ... }
            no big deal. Or better, have a single static method that maps from the
            twenty object types to an integer which is used as an index in your
            emulated typecases, so you can just use a switch select statement.
            Then when you start to use a 21th type of object in your list, you just
            modify the static method to include that new type, and you search for
            all calls to that static method to make sure all your code can handle
            the new object type. As for the actual code you run after you've found
            which type the object is: You can then cast to the actual type it is,
            and use method overloading to make the syntax parallel so it looks nice
            and can be eyeballed to see if it's all correct:
            else if (obj instanceof BigInteger) { return processObj((Big Integer) obj); }
            else if (obj instanceof Double) { return processObj((Dou ble) obj); }
            else if (obj instanceof Character) { return processObj((Cha racter) obj); }
            or equivalent with static function returning index which is named constant.
            switch (MyTypes.objToT ypeCode(obj)) {
            case MyTypes.TYPE_BI GINTEGER: return processObj((Big Integer) obj); break;
            case MyTypes.TYPE_DO UBLE: return processObj((Dou ble) obj); break;
            case MyTypes.TYPE_CH ARACTER: return processObj((Cha racter) obj); break;
            default: throw new MyTypes.unknown type... }

            Referring to the generic sequence functions in CL, specifically in this
            example used with a linked-list (although a general vector would work
            just the same, with different syntax in the example):[color=blue][color=green]
            > > In CL, if you pass an integer instead of a character, it looks for that
            > > integer, not the character with that ASCII code, for example:
            > > (position 65 '(#\A #\B 65 66))
            > > will find the 65 instead of the #\A, returning 2 instead of 0 as the
            > > index where it found that number.[/color][/color]
            [color=blue]
            > Strings are objects that wrap arrays of UTF-16 encoded characters, not
            > ASCII, nor are they lists of typed objects as in your example. You can't
            > create a string in Lisp with numbers in it, a string is a vector of
            > characters, ...[/color]

            That's irrelevant to my point, which was about generic sequences (lists
            or vectors of generic element type), not specialized sequences of
            characters-only. Suppose in java you make a linked list, or array, as
            the representation of a sequence of Objects of various types. Does the
            Java API provide any method(s) equivalent to this?
            position item sequence &key :from-end :test :test-not :start :end :key
            [color=blue]
            > java.util.Array s.asList(new Object[]{
            > new Character('A'),
            > new Character('B'),
            > new Integer(65),
            > new Integer(66),
            > }).indexOf(new Integer(65))[/color]

            The ugly part there is the creation of the list itself, in the absense
            of any parser such as READ in lisp. But I thought Java had software to
            handle serialization and deserialization of data for purpose of
            communicating across the network? How hard is it to set up a a Java
            equivalent to CL's READ-FROM-STRING function that created all the
            necessary stringinput/bufferedreader daisy chain and fed it through a
            deserialization method to allow something like:
            MyParser.deseri alizeLispSyntax ("(#\A #\B 65 66)").indexOf(n ew Integer(65))
            Too bad there's no way to add new methods to a system-supplied API
            class, in this case String, or else you could maybe do this:
            "(#\A #\B 65 66)".deserializ eLispSyntax().i ndexOf(new Integer(65))
            [color=blue]
            > (normally I'd use a script to generate such lists in Java, with lisp
            > being the scripting language of choice)[/color]

            I don't quite understand what you mean there. Do you mean you actually
            run CL as a sub-process under Java and pass it the s-expression as a
            string and somehow get back a linked list or array in the jvm, such as
            by CL doing callbacks to Java API methods to build up the Java object
            piece by piece? Or do you mean you'd run a CL program to convert the
            s-expresssion syntax to XML or other serial representation known by
            Java, and then use Java's built-in XML-or-whatever deserializer to load
            the object into the jvm?
            [color=blue]
            > Most languages, Java included, are destined to evolve into lisp or
            > remain niche languages.[/color]

            Hmm, that's the opposite of what a certain very opinionated DeAnza
            instructor said (LISP is an A.I. langauge, not useful for anything
            except that niche -- paraphrased to fit the current context).
            I agree with you, not him, of course, on this point. CL is the general
            purpose language, all other languages are niche languages, but some are
            evolving to escape their niche to become as general as CL.
            (I have to count Scheme as a niche language, sigh.)
            Still I would like CL to become even more general, such as including
            what PSL (Portable Standard LISP) called "SysLisp", which is a way to
            cross-compile s-expressions via LAP into low-level assembly code that
            can be included in ordinary assembly-language programs that can be
            assembled to run stand-alone as an application or as a module in some
            non-LISP environment, thereby allowing using SysLisp to write the main
            part of compilers and even operating systems, even the kernel,
            replacing C as the standard language for writing such. Maybe this has
            already been done but isn't and won't be in the ANSI standard because
            it's not of enough general use?

            Comment

            • RobertMaas@YahooGroups.Com

              #66
              Re: Is anything easier to do in java than in lisp?

              > From: Antonio Menezes Leitao <Antonio.Leitao @evaluator.pt>[color=blue][color=green]
              > > Are you referring to the Java API which is all nicely documented
              > > (module a few obvious mis-statements such as the one I found whereby it
              > > claims the arcsin etc. functions take an angle as an argument) on the
              > > WebSite? Or third-party libraries which can be difficult to find and
              > > even more difficult to get a license to use?[/color]
              > Both, actually. BTW, which third-party libraries are you talking about?[/color]

              Any that I am unable to find out about. In my search for Java libraries
              for a browser/spider to handle cookies for HTTP sessions, all I could
              find was Jakarta, a third-party library, nothing in standard libraries,
              and the documentation for Jakarta indicated there are three ways
              cookies are done and you have to just try different ways to see which
              way a particular server is using, so it's a pain even with Jakarta to
              write any software to handle cookies the server throws at you.

              I looked for interval arithmetic, but can't find what I want.
              [color=blue]
              > Java has been changing from the beginning. I know that the changes are
              > mostly backward compatible but I would hardly considered the language as
              > "stable" (and much less as "nice").[/color]

              Hmm. Does the jvm suddenly change out from under the user, causing old
              already-compiled code to suddenly stop working? Or is the jvm fine but
              the system library no longer supports the method you have been using,
              or the method no longer does exactly what it used to do? Or is it just
              that if you try to re-compile the old code that compiled fine before,
              it might no longer compile because some basic syntax it used has been
              depricated and expunged from the compiler? Or just that there's new
              stuff you haven't been using and you feel bad that your old program
              still does things the old way instead of taking advantage of new
              features?
              [color=blue]
              > Have you tried to run Java 1.2 on older browsers?[/color]

              I don't know what that question means. I run java on a computer, not on
              a browser. Please clarify the question.

              By the way, is there any way to ask javac or java what version it is,
              or to otherwise learn that information on a given system? On Unix, I
              can use the whereis command, which on this FreeBSD Unix shell account
              I'm using gives the directory as /usr/local/jdk1.2.2/bin/ so does that
              mean we have version 1.2.2 installed here? But there's no way to run a
              java-applet-enabled browser here (via VT100 dialup) as far as I know,
              so that info probably isn't usefully related to your question. But on
              campus where I'm taking a java class, they have jcreator on MicroSoft
              Windows 2000 Professional, or somesuch. Is there a way on that system
              to learn what version of java is installed?
              [color=blue]
              > Linj isn't available for FreeBSD yet.[/color]

              Sigh. (Both java and CL are platform independent, so I wonder why Linj
              can't be ported easily here?)

              Comment

              • RobertMaas@YahooGroups.Com

                #67
                Re: Is anything easier to do in java than in lisp?

                > From: "Alex Kay" <me2@spam.not >[color=blue]
                > Cookie is in javax.servlet.h ttp[/color]

                I'm looking at:

                but I don't see any mention of ...servlet..., guessing:

                no mention there either, also none here either:


                Ah, I looked in Enterprise Edition, and found it:


                Unfortunately that's not free, and it deals only with the server end
                which is the other end from what I'm wishing to program.
                On the off chance my ISP has j2ee, I tried to import it, no it fails:
                Package javax.servlet.h ttp not found in import.

                As I understand it, what I need is a static variable that holds a jar
                full of cookies (or a local variable I keep passing around everywhere),
                whatever the server has sent me so-far, a method that puts new cookies
                into the jar when parsing the header from the server, and a method that
                compares my next request URL with the cookies in the jar and transmits
                all appropriate cookies with my request, right? If I ever get the
                energy, I'll just have to write it from scratch using CL...

                Comment

                • I R T

                  #68
                  Re: Is anything easier to do in java than in lisp?






                  1 773 people who were attend the events learn more 17 conferences have already happened learn more 110 hours duration of all conferences learn more 13 speakers held our conferences on a variety of topics learn more Why us? These courses are for you if you: If you’re interested in getting a job in IT […]



                  Comment

                  • RobertMaas@YahooGroups.Com

                    #69
                    Re: Is anything easier to do in java than in lisp?

                    > From: oliver@plohmann .com (Oliver Plohmann)[color=blue]
                    > The major advantage of Java, C, C++, Pascal, etc. over Lisp is that
                    > solving anything that can be solved with an iterative solution easily
                    > is easy. To me that's the real advantage ...[/color]

                    That's the advantage of LISP! In those other languages, if you have a
                    linked-list, or vector (one-dimensional array), or other sequence of
                    data, origSeq, and you want to process each element in sequence, and
                    build up the list of results, resSeq, you need to do something like
                    this (this is Java, the easiest of those non-LISP languages to use):

                    Enumeration e = origSeq.toEnume ration();
                    Queue q = new Queue();
                    while (e.hasMoreEleme nts())
                    q.push(processD ata((sometype)( e.nextElement() )));
                    New restype resSeq = QueueToResSeqTy pe(q);

                    (For some appropriate toEnumeration method, some appropriate type of
                    data you are handling, some processData routine you want to use, and
                    some appropriate QueueToResSeqTy pe method for converting to the kind of
                    sequence you want at the end.)

                    In CL it's this easy:
                    (setq resSeq (map 'resSeqType #'processData origSeq))
                    And who says LISP has too many parens!! Java has more!!
                    [color=blue]
                    > I once took a Lisp class when I was studying. I was quite curious
                    > about Lisp. Then a programming task was given that would have been a
                    > peace of cake when solving it with an iterative approach. Looking for
                    > a recursive stack-based solution for Lisp caused big headaches. Since
                    > that day I was not that interested in Lisp any more.[/color]

                    I feel sorry for you having suffer such a droid of a teacher. But he's
                    not alone. Most books give really stupid examples of recursion, such as
                    factorial and fibonacci. Factorial isn't too bad, because if you don't
                    use the regular definition but instead carefully code it to be tail
                    recursive, then on some compilers the generated code is essentially a
                    tight iterative loop. But recursive factorial without a cache is
                    totally stupid because it's exponentially slower than iterating to
                    build a list of previous results, or even rotating three local
                    variables. Your instructor should have come up with some example where
                    recursion is *much* easier than doing it using an iteration loop and a
                    state machine with an explicit stack. For example, given a multi-level
                    list, full of strings, replace all occurances of the 'f' word with
                    "(expletive deleted)". OK to copy all structure so nothing except the
                    strings are shared between original and result.
                    (defun replace-naughty-words (naughtyWord listStructure)
                    (cond ((consp listStructure)
                    (cons (replace-naughty-words naughtyWord (car listStructure))
                    (replace-naughty-words naughtyWord (cdr listStructure)) ))
                    ((null listStructure) nil)
                    ((not (stringp listStructure)) (error "Not valid structure"))
                    ((string-equal listStructure naughtyWord) "(expletive deleted)")
                    (t listStructure)) )
                    Nah, that's too hard for a beginner. I'll have to think of something
                    easier. OK, how about this: Given a positive integer, if it's larger
                    than 9 then break it into two approximate halves and then if either of
                    those numbers is larger than 9 break again etc. until all the pieces
                    are less than or equal to 9, and express these partial sums as lists.
                    For example:
                    27 -> (13 14) -> ((6 7) (7 7))
                    (defun split-past-9 (n)
                    (if (> n 9) (list (split-past-9 (floor n 2))
                    (split-past-9 (ceiling n 2)))
                    n))
                    [color=blue]
                    > tell me why recursiveness and non-destructiveness in Lisp is such a
                    > holy thing[/color]

                    Your question is based on a false assumption. Recursiveness isn't holy,
                    it's just a useful way to decompose many kinds of problems that branch
                    in an unlimited number of directions. Non-destructiveness is useful
                    too, but again not holy. If you want more than one process, or more
                    than one time in a single process, to look at the same data, it helps
                    if one process or one time doesn't modify the data causing the later
                    process or time to see the modified data instead of the original when
                    it was supposed to see the original. You can get around this by making
                    a deep copy of the data structure, and handing a different copy to each
                    process, but if only a few changes are going to made, and most of the
                    structure is the same before and after, this wastes a lot of space
                    compared to sharing everything that didn't change. But it's a design
                    decision which way to go for any given application.

                    How would you write a deep-copy/clone function/method without recursion
                    anyway? If there are only a fixed number of levels of structure, you
                    can write a separate function for each level. But if the number of
                    levels deep is unlimited, that doesn't work, and you need the hassle of
                    using a stack to emulate recursion yourself, or just write the
                    function/method recursively in the first place.

                    By the way, the right way to demonstrate a recursive definition of
                    factorial is by splitting the product into two sub-products of nearly
                    the same length, not by splitting a single term off one end or the
                    other and recursing on all the rest.

                    By the way, Tower of Hanoi is nicely solved by a recursive algorithm,
                    but if you can figure out how to do it yourself then there's a nice
                    iterative demo of it where you cycle around mod 3 manipulating three
                    explicit stacks representing the three towers.

                    Comment

                    • RobertMaas@YahooGroups.Com

                      #70
                      Re: Is anything easier to do in java than in lisp?

                      > From: cstacy@news.dtp q.com (Christopher C. Stacy)[color=blue]
                      > If he writes a good implementation, why not sell it?[/color]

                      Because there's virtually no market for lisp software. I've never seen
                      anyone express an interest in purchasing lisp software from random
                      programmers such as myself. I've written lots of software, much in
                      lisp, that I'd like to sell, but there's no point in even inquring
                      about somebody to buy some particular piece of my software with the
                      whole market virtually non-existant in the first place.

                      Comment

                      • Christopher C. Stacy

                        #71
                        Re: Is anything easier to do in java than in lisp?

                        >>>>> On Fri, 25 Jun 2004 17:09:36 -0700, RobertMaas ("RobertMaas ") writes:
                        [color=blue][color=green]
                        >> From: cstacy@news.dtp q.com (Christopher C. Stacy)
                        >> If he writes a good implementation, why not sell it?[/color][/color]

                        RobertMaas> I've written lots of software, much in lisp, that I'd
                        RobertMaas> like to sell, but there's no point in even inquring about
                        RobertMaas> somebody to buy some particular piece of my software with
                        RobertMaas> the whole market virtually non-existant in the first place.

                        Simply writing your software in Lisp will not make it marketable.
                        What marketable software products have you produced that happen to
                        be written in Lisp, and what happened when you tried to market them?

                        Comment

                        • RobertMaas@YahooGroups.Com

                          #72
                          Re: Is anything easier to do in java than in lisp?

                          > From: Antonio Menezes Leitao <Antonio.Leitao @evaluator.pt>[color=blue][color=green]
                          > > I looked for interval arithmetic, but can't find what I want.[/color]
                          > My experience is that there are many more alternatives in the Java
                          > camp than in the Lisp camp. Some of the alternatives are crap, of
                          > course, but the probability of finding something that suits your needs
                          > is, IMHO, higher in the Java camp.[/color]

                          So how should I go about searching for something, for example interval
                          arithmetic, with high probability of actually finding something
                          suitable?
                          [color=blue]
                          > The syntax is changing and new language constructs are still being
                          > added.[/color]

                          So new source code might not compile under old compiler because it
                          happens to use some new syntax? Would any old syntax cease to work
                          under new compiler?
                          [color=blue][color=green][color=darkred]
                          > >> Have you tried to run Java 1.2 on older browsers?[/color]
                          > > I don't know what that question means. I run java on a computer, not on
                          > > a browser. Please clarify the question.[/color]
                          > Applets are Java programs intended to run on the browser. Obviously,
                          > the browser must contain a JVM. The problem is that you cannot use
                          > certain language features because older implementations of the JVM
                          > do not implement those features.[/color]

                          So what you really mean to ask was:
                          Have you tried to run Applets that use new language features, in
                          browsers that have old versions of the jvm?

                          No. The only Java-capable browser I've ever used for running an Applet
                          is Internet Explorer at DeAnza College, and that seems to be a recent
                          version of IE that had no trouble running my Applet.
                          [color=blue][color=green]
                          > > On Unix, I
                          > > can use the whereis command, which on this FreeBSD Unix shell account
                          > > I'm using gives the directory as /usr/local/jdk1.2.2/bin/ so does that
                          > > mean we have version 1.2.2 installed here?[/color]
                          > java -version[/color]

                          java version "1.2.2"
                          Classic VM (build jdk1.2.2-FreeBSD:root:20 00/11/25-02:08, green threads, nojit)

                          Thanks. Indeed what we have here is pretty old! But for my class work,
                          it seemed to work, except when I tried to run a GUI application here,
                          whereupon compilation ran just fine but a runtime exception occurred
                          because it was trying to find an X11 server, which of course doesn't
                          exist here. Too bad java doesn't support VT100 term the way lynx does
                          for HTML forms.
                          public class guiH {
                          public static void main(String[] args) {
                          JOptionPane.sho wMessageDialog( null, "Welcome", "Title",
                          JOptionPane.INF ORMATION_MESSAG E);
                          System.exit(0);
                          }
                          }
                          Exception in thread "main" java.lang.Inter nalError: Can't connect to X11 window
                          server using ':0.0' as the value of the DISPLAY variable.
                          at sun.awt.X11Grap hicsEnvironment .initDisplay(Na tive Method)
                          at sun.awt.X11Grap hicsEnvironment .<clinit>(X11Gr aphicsEnvironme nt.java:58)
                          at java.lang.Class .forName0(Nativ e Method)
                          at java.lang.Class .forName(Class. java:124)
                          at java.awt.Graphi csEnvironment.g etLocalGraphics Environment(Gra phicsEnvironmen t.java:63)
                          at java.awt.Font.i nitializeFont(F ont.java:262)
                          at java.awt.Font.< init>(Font.java :292)
                          at javax.swing.pla f.metal.Default MetalTheme.<ini t>(DefaultMetal Theme.java:59)
                          at javax.swing.pla f.metal.MetalLo okAndFeel.creat eDefaultTheme(M etalLookAndFeel .java:709)
                          at javax.swing.pla f.metal.MetalLo okAndFeel.getDe faults(MetalLoo kAndFeel.java:7 13)
                          at javax.swing.UIM anager.setLookA ndFeel(UIManage r.java:363)
                          at javax.swing.UIM anager.setLookA ndFeel(UIManage r.java:390)
                          at javax.swing.UIM anager.initiali zeDefaultLAF(UI Manager.java:85 0)
                          at javax.swing.UIM anager.initiali ze(UIManager.ja va:926)
                          at javax.swing.UIM anager.maybeIni tialize(UIManag er.java:948)
                          at javax.swing.UIM anager.getUI(UI Manager.java:55 9)
                          at javax.swing.JOp tionPane.update UI(JOptionPane. java:1318)
                          at javax.swing.JOp tionPane.<init> (JOptionPane.ja va:1281)
                          at javax.swing.JOp tionPane.showOp tionDialog(JOpt ionPane.java:63 0)
                          at javax.swing.JOp tionPane.showMe ssageDialog(JOp tionPane.java:4 98)
                          at javax.swing.JOp tionPane.showMe ssageDialog(JOp tionPane.java:4 78)
                          at guiH.main(guiH. java:4)
                          Apparently swing doesn't support VT100 term. I'm not trying to do any
                          actual graphics, just put up some text in a box. Why can't it put up
                          something like:
                          /===== Title =======\
                          | |
                          | Welcome |
                          | OK |
                          \============== =====/
                          with OK currently selected just like in lynx?
                          All these claims about java being platform independent are hooey!
                          [color=blue]
                          > Because I didn't found the time yet to install a FreeBSD system.[/color]

                          But if java were platform independent, as claimed, you could just
                          publish the compiled (.class) files and anybody could download them to
                          FreeBSD Unix and they'd just *work* from the start, right?

                          Comment

                          • Raymond DeCampo

                            #73
                            Re: Is anything easier to do in java than in lisp?

                            RobertMaas@Yaho oGroups.Com wrote:[color=blue]
                            >
                            > Thanks. Indeed what we have here is pretty old! But for my class work,
                            > it seemed to work, except when I tried to run a GUI application here,
                            > whereupon compilation ran just fine but a runtime exception occurred
                            > because it was trying to find an X11 server, which of course doesn't
                            > exist here. Too bad java doesn't support VT100 term the way lynx does
                            > for HTML forms.
                            > public class guiH {
                            > public static void main(String[] args) {
                            > JOptionPane.sho wMessageDialog( null, "Welcome", "Title",
                            > JOptionPane.INF ORMATION_MESSAG E);
                            > System.exit(0);
                            > }
                            > }
                            > Exception in thread "main" java.lang.Inter nalError: Can't connect to X11 window
                            > server using ':0.0' as the value of the DISPLAY variable.
                            > at sun.awt.X11Grap hicsEnvironment .initDisplay(Na tive Method)
                            > at sun.awt.X11Grap hicsEnvironment .<clinit>(X11Gr aphicsEnvironme nt.java:58)
                            > at java.lang.Class .forName0(Nativ e Method)
                            > at java.lang.Class .forName(Class. java:124)
                            > at java.awt.Graphi csEnvironment.g etLocalGraphics Environment(Gra phicsEnvironmen t.java:63)
                            > at java.awt.Font.i nitializeFont(F ont.java:262)
                            > at java.awt.Font.< init>(Font.java :292)
                            > at javax.swing.pla f.metal.Default MetalTheme.<ini t>(DefaultMetal Theme.java:59)
                            > at javax.swing.pla f.metal.MetalLo okAndFeel.creat eDefaultTheme(M etalLookAndFeel .java:709)
                            > at javax.swing.pla f.metal.MetalLo okAndFeel.getDe faults(MetalLoo kAndFeel.java:7 13)
                            > at javax.swing.UIM anager.setLookA ndFeel(UIManage r.java:363)
                            > at javax.swing.UIM anager.setLookA ndFeel(UIManage r.java:390)
                            > at javax.swing.UIM anager.initiali zeDefaultLAF(UI Manager.java:85 0)
                            > at javax.swing.UIM anager.initiali ze(UIManager.ja va:926)
                            > at javax.swing.UIM anager.maybeIni tialize(UIManag er.java:948)
                            > at javax.swing.UIM anager.getUI(UI Manager.java:55 9)
                            > at javax.swing.JOp tionPane.update UI(JOptionPane. java:1318)
                            > at javax.swing.JOp tionPane.<init> (JOptionPane.ja va:1281)
                            > at javax.swing.JOp tionPane.showOp tionDialog(JOpt ionPane.java:63 0)
                            > at javax.swing.JOp tionPane.showMe ssageDialog(JOp tionPane.java:4 98)
                            > at javax.swing.JOp tionPane.showMe ssageDialog(JOp tionPane.java:4 78)
                            > at guiH.main(guiH. java:4)
                            > Apparently swing doesn't support VT100 term. I'm not trying to do any
                            > actual graphics, just put up some text in a box. Why can't it put up
                            > something like:
                            > /===== Title =======\
                            > | |
                            > | Welcome |
                            > | OK |
                            > \============== =====/
                            > with OK currently selected just like in lynx?
                            > All these claims about java being platform independent are hooey!
                            >[/color]

                            I think you are expecting too much there. Java does thrive to be
                            platform independent. However, Swing is a GUI library, intended to run
                            in a graphical environment. A VT100 does not qualify. That does not
                            mean that Java is not platform independent. You should have no problem
                            running console applications in this environment.

                            Ray

                            --
                            XML is the programmer's duct tape.

                            Comment

                            • RobertMaas@YahooGroups.Com

                              #74
                              Re: Is anything easier to do in java than in lisp?

                              > From: Antonio Menezes Leitao <Antonio.Leitao @evaluator.pt>[color=blue]
                              > You google for it. Type "interval arithmetic java" on google[/color]

                              I already did that several weeks ago.
                              [color=blue]
                              > and you will get several promising links (they look promising to me,
                              > at least)[/color]

                              They looked promising to me too, until I actually clicked on the links
                              and started reading the details.
                              [color=blue]
                              > - the Brandeis Interval Arithmetic Constraint Solver (with Java
                              > source code)[/color]
                              [color=blue][color=green]
                              >>You need a java-enabled web brower to run the applet.[/color][/color]

                              I don't have any such browser here on VT100 dialup into Unix shell. By
                              the way, Java Applets don't usually work. I wrote one for a class
                              assignment and put it up here: http://www.rawbw.com/~rem/Lab7.htm and
                              it works fine from InterNet Explorer in the computer lab at De Anza
                              College, but it doesn't work in InterNet Explorer in the instructor's
                              office, and it doesn't work in the classroom adjoining the computer
                              lab. (In the latter two places, the main dialog comes up, but none of
                              the buttons do anything.)
                              [color=blue][color=green]
                              >>the current version is NOT sound since it relies on Java's underlying
                              >>math library which is not proven to be accurate to the last bit.[/color][/color]

                              I.e. they don't really implement interval arithmetic, instead they use
                              ordinary sloppy floating-point arithmetic for the guts of it, then
                              pretend it's accurate when running interval constraints on top of that,
                              so it's not at all what I'm looking for which is interval arithmetic
                              where it counts to guarantee bounds on results of arithmetic
                              operations.
                              [color=blue]
                              > - interval.source forge.net/interval (a 100% Java, verifiable
                              > implementation of interval arithmetic operations and constraint
                              > contractors for the arithmetic operations and elementary functions
                              > (exp,log,sin,co s,tan,asin,acos ,atan,sin2pi,.. .)[/color]
                              [color=blue][color=green]
                              >>Platforms supported
                              >> * RedHat Linux 6.1 on the PC and Macintosh OS X
                              >> Note: Porting to other architectures should not be hard. The only
                              >> non-portable code is that which deals with setting the rounding
                              >> modes![/color][/color]

                              The only java system I have access to from home is FreeBSD Unix, which
                              is neither of the above two systems. I have no idea what would have to
                              be done inside the jvm to set rounding modes on FreeBSD Unix.
                              [color=blue]
                              > Is adding annonymous inner classes a minor change?[/color]

                              No, that's a major sort of thing. If I try to port somebody else's
                              software that depends on that in a key place, I'd probably have to
                              rewrite the whole module to get it to work under an old version of
                              java.
                              [color=blue]
                              > Is adding automatic boxing and unboxing a minor change?[/color]

                              Yeah, it'd be a pain to explicitly box/unbox everywhere the compiler
                              gives an error message, if there are lots of places, but it's a simple
                              fix linear in number of such places, so I'd consider it a minor change.
                              [color=blue]
                              > Is adding generic types a minor change?[/color]

                              I don't know what that phrase means in java jargon. I know what
                              abstract classes and interfaces are, and how you can declare a variable
                              of the generic class and make it dispatch at runtime. Also I know about
                              the Object class and how LISP-like no-declared-type programming can be
                              done by passing everything as Object variables to static methods and
                              then having the static method do a typecase of the argument to dispatch
                              to all the specific methods. But I don't know whether the phrase you
                              used is anything like either of those.
                              [color=blue]
                              > I'm curious: what is your definition for "platform independent"?[/color]

                              If the desired task makes sense on a set of platforms, then the program
                              or whatever does that task on them all. For example, text-mode Web
                              browsing makes sense on both GUI systems and VT100 dialups, and indeed
                              some browsers work on GUI systems and some work on VT100 dialups so a
                              truly platform independent web browser would make sense, but in any
                              case using the appropriate web browser for each platform the text-mode
                              Web pages do indeed work on all such platforms. So text-mode Web pages
                              are in that sense platform independent. (They even work with
                              Web-by-email services!) There's no reason applets shouldn't work
                              everywhere HTML FORMs work, except the people in charge of java haven't
                              bothered to do that.
                              [color=blue]
                              > The Linj compiler that translates from Linj to Java is written in
                              > Common Lisp and it needs a Common Lisp environment to run. It is the
                              > Linj compiler that is not platform independent because binary Common
                              > Lisp code is not platform independent.[/color]

                              Oops, sorry, in all this discussion of java classes that people say I
                              can download and run anywhere, I forgot Linj isn't java code. But if
                              you generate fasl files and then load them into a CL environment,
                              although the contents of the fasl files themselves are dependent on the
                              CPU, the process of making them is system independent (compile-file
                              ...) so if you avoid calling anything from the SYSTEM package, if you
                              stick to making ANSI CL calls, it should be easy to make Linj run on
                              any ANSI-compliant CL system. I guess I'm overlooking something.

                              Comment

                              Working...