Prev: Can this be "refactored"? A simple 'wrapper function' to display MySQL data sets in tabular form
Next: The correct choice for implementation (was: A simple web client library)
From: fortunatus on 9 Mar 2010 17:24 Hugh, definately do not neglect Scheme. In the beginning you'll only notice some difference in syntax and names. I personally use both Common Lisp and Scheme. If you are beginning (newbie), and especially if you want to move in to doing GUI work, I recommend PLT Scheme. They have an integrated GUI for development (editor and interpreter), and PLT Scheme also has really easy GUI libraries. Furthermore PLT Scheme has good online manuals. http://www.plt-scheme.org/ If you want to have a similarly easy experience starting up a Common Lisp environment, I recommend consider a Personal Edition LispWorks download, which should have benefits similar to PLT Scheme, with probably better debugger support. (I've never used it, though.) http://www.lispworks.com/ Using the Gnu Public Licensed software is great but you get into a lot of environmental issues setting up editors (emacs, slime) & so forth, and also the GUI library issue can get pretty sticky (there are many, but none simple nor already set up for you). PS: For the record, I use PLT on Windows for Scheme. For Common Lisp I use Emacs/SLIME with CLISP on WindowsXP or SBCL on Linux. I also use GCL on both Windows and Solaris; in that case I just use "inferior Lisp mode" in Emacs.
From: Slobodan Blazeski on 9 Mar 2010 17:39 On Mar 9, 11:18 pm, Hugh Aguilar <hughaguila...(a)yahoo.com> wrote: > On Mar 9, 1:33 pm, Slobodan Blazeski <slobodan.blaze...(a)gmail.com> > wrote: > > > I want to learn at least one concatenative language, since Joy is dead > > will have to choose between Forth and Factor but that will have to > > wait until we ship oops publish the app. > > I read about Joy but didn't try it. A problem with Joy was that it > used the same syntax for quotations (code) and sequences (data). > Factor uses square brackets for quotations and curly brackets for > sequences, which simplifies the compiler and makes the language more > powerful. Isn't it true though, that Lisp is like Joy in that there is > no syntactic difference between code and data? You use round brackets > for both. > > Your choice isn't entirely between Forth and Factor --- there is also > STAAPL. It is a Forth-like language written in PLT-Scheme and > targeting the PIC18. I've encouraged Tom Stoughton to upgrade to the > PIC24, but STAAPL is just for the PIC18 right now. I have a Forth for > the PIC24 on the back burner and may eventually release it. > > Forth is a very "thin" language. The ANS-Forth document is short > enough to read over a weekend. A lot of features were excluded from > the standard on the assumption that the users would implement these > features themselves. This is similar to the Scheme philosophy. Factor > is a fat language; this is similar to the Common Lisp philosophy. > Factor has also drifted a long ways away from Forth, with its emphasis > on quotations and its de-emphasis of compile-time code. As a practical > matter, Factor also has a huge footprint; Slava told me that the > ColdFire is the smallest processor he foresees Factor running on. By > comparison, Forth can run on processors such as the PIC24 or even the > 65c02. I wrote a program to crack a linear-congruential encryption > system in both Factor and Forth and obtained these times on my laptop: > assembly-language 17 seconds > SwiftForth 22 seconds > Factor 9 minutes 14 seconds > I expect that Common Lisp would be even worse than Factor, although I > haven't tried it yet. Could you post the problem and your code so we could try for ourselves? Slobodan
From: Hugh Aguilar on 9 Mar 2010 18:47 On Mar 9, 3:39 pm, Slobodan Blazeski <slobodan.blaze...(a)gmail.com> wrote: > > I wrote a program to crack a linear-congruential encryption > > system in both Factor and Forth and obtained these times on my laptop: > > assembly-language 17 seconds > > SwiftForth 22 seconds > > Factor 9 minutes 14 seconds > > I expect that Common Lisp would be even worse than Factor, although I > > haven't tried it yet. > > Could you post the problem and your code so we could try for > ourselves? The program is called LC53.4TH and is included with the novice package: http://www.forth.org/novice.html If you do write a Lisp program, please use the same algorithm and the same key value so the speed comparison will be meaningful. There is a lot of luck involved in how fast the encryption cracking works, as it is a recursive-descent search. I have a criteria (the HOW-FAR function) for deciding whether a 1 or a 0 bit is more likely, and I search the appropriate path of the tree first. The problem is that my criteria quite often provides equal results for the 1 and 0 bits, in which case I have to choose arbitrarily. If I were to upgrade the program from a 32-bit key to a 64-bit key I would have to make my criteria more sophisticated in order to avoid expensive dead-end searching. Right now my criteria is pretty simple. Forth calculates the linear-congruential prng quickly because Forth has mixed-precision integer arithmetic. Forth can multiply single- precision integers and obtain a double-precision product. Also, it can divide a double-precision numerator by a single-precision denominator to obtain a single-precision quotient and remainder. By comparison, in most languages, if your product is going to be double-precision you have to cast your parameters from single-precision to double-precision and then do the multiplication in double-precision. Similarly, if your denominator is double-precision you have to cast your numerator from single-precision to double-precision and then do the division in double-precision. If Lisp lacks mixed-precision and has to cast singles into doubles and do double-precision arithmetic, then I expect it will be pretty slow. That is what killed Factor's speed. My LC53 program was chosen because I knew that Forth would do well and that other languages would do badly. This kind of huge speed difference is not necessarily representative of desktop-computer programming though --- only programs that involve integer arithmetic. It is more representative of micro-controller programming, which tends to involve a lot of integer arithmetic. That is obviously not what Lisp and Factor are typically used for, which makes the test somewhat unfair for languages such as these that are more typically used for symbol manipulation.
From: Hugh Aguilar on 9 Mar 2010 19:17 On Mar 9, 3:24 pm, fortunatus <daniel.elia...(a)excite.com> wrote: > Hugh, definately do not neglect Scheme. In the beginning you'll only > notice some difference in syntax and names. > > I personally use both Common Lisp and Scheme. > > If you are beginning (newbie), and especially if you want to move in > to doing GUI work, I recommend PLT Scheme. They have an integrated > GUI for development (editor and interpreter), and PLT Scheme also has > really easy GUI libraries. Furthermore PLT Scheme has good online > manuals. Learning PLT Scheme would have the benefit of allowing me to work on STAAPL, as that is the language Tom used. Maybe it would be a good idea for me to start out with a thin language such as Scheme and then graduate to a fat language such as Common Lisp when I'm feeling more ambitious. At the risk of sounding like a wimp, I'll admit that I am intimidated by Common Lisp; that is a really huge mountain to climb! Does any Lisp implementation support lazy evaluation? I read about this in regard to Haskell and I was very impressed. I didn't want to tackle Haskell though --- the syntax was so alien I wondered if Haskell might be technology recovered from a crashed flying-saucer!
From: Thomas A. Russ on 9 Mar 2010 19:50
> Does this forum only support Common Lisp? I browsed through and didn't > find any mention of Scheme or Clojure or anything else, although there > was one brief mention of LFE. No. It supports other lisps as well, but most of the traffic is Common Lisp related. That is a consequence of the size of the user community as well as the presence of other, specialized forums for Scheme and Clojure. So most of what you see here is Common Lisp related. > I am leaning towards Common Lisp rather than Scheme primarily because > of the abundance of literature available. We have several books on > Common Lisp, but only one ("The Little Schemer") available on Scheme. Well, there is always "Structure and Interpretation of Computer Programs", which can be considered a very advanced Scheme book. It is an excellent read, by the way, particularly if your goal is broadening your view of programming techniques and ideas. Also along those lines I would recommend Peter Norvig's "Paradigms of AI Programming: Case Studies in Common Lisp" for the large set of interesting techniques that it illustrates. -- Thomas A. Russ, USC/Information Sciences Institute |