LISP & Scheme User Community's Journal
[Most Recent Entries]
[Calendar View]
[Friends]
Below are the 20 most recent journal entries recorded in
LISP & Scheme User Community's LiveJournal:
[ << Previous 20 ]
| Monday, April 6th, 2009 | 12:45 am [vestimo2] |
How to do this on Common Lisp ?
Hello. I want to write function using "do" cycle (NO recursion) which can convert any list to (a b c d ...) view, but don't know, how. For example, (f '((a b) d (c) e (g (h))))->(a b d c e g h). Please help me. | | Friday, January 23rd, 2009 | 8:35 pm [esgab26] |
Can any one help?-About the "cond" operator ----(novice)
Hi everyone, I've read this in SICP book from MIT-OCW: "A minor difference between if and cond is that the < e> part of each cond clause may be a sequence of expressions. If the corresponding < p> is found to be true, the expressions < e> are evaluated in sequence and the value of the final expression in the sequence is returned as the value of the cond. In an if expression, however, the < consequent> and < alternative> must be single expressions. " so i tried this in scheme: (define (test a b) (cond ((> a b) ( (- a 1) (- b 1))) ((< a b) ( (+ a 1) (+ b 1))) (else( (+ a b) (- a b))))) (test 3 2) it returned: procedure application: expected procedure, given: 2; arguments were: 0What I'm trying to do is: given a single predicate, evaluate multiple expressions (like the ones above, evaluate both (- a 1) and (- b 1) i thought this is possible: (because of what i've read- or maybe i just don't understand it) (cond <predicate> (<exp1> <exp2> <exp3>))- but it always result in an error Can some one help me with this? What is meant by sequence of expressions?Thank you very much Eljon Current Mood: confused | | Monday, December 22nd, 2008 | 5:44 pm [6ferrets]
 |
(Novice) How to do nothing in Scheme?
I'm teaching myself some Scheme using PLT Scheme and have been using it to write some scripts. Because Scheme isn't purely functional, I ran into a situation where I wanted the option of doing "nothing". In my mind, it looked something like this:
(if (eof-object? x)
(do-nothing)
(display message) )
PLT Scheme requires that (if ...) must have an else clause, which seems to be non-standard. In my working version, (do-nothing) is replaced by (display ""). (begin) is illegal. '() gets displayed on screen, which I don't want. Am I not thinking Lispily (or Schemingly) enough, or is there some way to tell PLT Scheme to do nothing and to move along?
P.S. Oh no—another learning experience! :-) Thanks, everyone. | | Friday, December 19th, 2008 | 10:52 am [marnanel]
 |
Dreaming in Lisp
Last night, I dreamed I was cleaning up the garden, and there was a violently living green weed I was trying to pull up. It was growing like knotweed, except tall and leafy, and the more I struggled with it (with a machete!) the less good it did. I began to be rather afraid of it as I fought it, and I jumped out of the way and flinched back when a branch came crashing down. On closer inspection I then discovered that the weed was implemented as an s-expression, so I merely (reverse)d it and it became nothing more than a little sprout in the ground I picked and threw away. Have you ever dreamed in any dialect of Lisp? | | Tuesday, December 9th, 2008 | 10:10 am [sebthecat]
 |
Spamming far and wide cl-php is out, in somewhat embryonic form. It's the start of a library that will hopefully make it as easy to write web apps in CL as it is in PHP. Ambitious, but all worthwhile goals are. Currently, it's only guaranteed to work on SBCL on Linux, because that's my development platform, and it only covers the cases I've needed myself so far. The versioning is a bit out of whack; it's marked 1.2.1, where 0.1.21 would be more apt, but I called it 1.0 when it became sufficient for my own purposes. The next public release will probably be 0.2, just to confuse everybody. Do feel free to play with it and let me know where it broke. It can use Postmodern, CLSQL or both, but I'm personally biased towards the former, so the CLSQL-related stuff is disabled by default. Current Mood: accomplished | | Sunday, November 30th, 2008 | 10:35 am [jkndrkn]
 |
Lisp in Production Systems Hello FriendsMy road to Lisp started with a personal desire to learn Lisp due to its historical significance and recent renewed interest. The quality and clarity of Practical Common Lisp and the writings of Paul Graham were strongly motivating factors. I learned Lisp and began using it to solve problems in graduate level courses where the choice of implementation language was left to students, and was eventually motivated to use Lisp in its traditional role by taking a number of AI courses. I have a fairly solid understanding of the language and how to solve problems using it. However, my projects are relatively small and self-contained and do not interact with the outside world. I would like to develop some experience interfacing with the web and producing code that follows conventions frequently seen in modern Lisp production environments. What is the best way to go about learning the particulars of production-ready Lisp? It seems that the common route is to create some kind of web application and ensure that it follows conventions that make it easy for other experienced Lisp programmers to extend and redeploy. I've also long held a desire to program a super nerdy customization-heavy turn based combat strategy game. Are there any solid and portable free graphics packages that work well with Lisp? How have you been introduced to Lisp in production systems? | | Thursday, November 20th, 2008 | 10:03 pm [pete23]
 |
of interest?
(i have to admit that my lisp is largely of the e variety) anyone have any exposure to these things? clojure looks like the alternative to JRuby i've been looking for - finally, a decent lisp dialect to lie atop the JVM. otoh, his macro constructions for calling into java are pretty hideous, so i'm not sure. Qi is Mark Tarver's set of extensions to clisp to add the facilities that modern developers expect wrt to web programming etc... I have no idea if anyone has seen this; I suspect I only have because Mark was my tutor at Leeds Uni in 1995. I fear I may use the first one in anger shortly. I'll let you know how it works out. | | Thursday, September 18th, 2008 | 9:45 pm [sebthecat]
 |
Deep thoughts
I've been re-reading On Lisp, and a couple of thoughts finally collided (takes a while, in a head this empty). Graham makes the point that the plan-and-implement approach don't work so well, at least in its classic form. I finally made the connection with a couple of military quotes relating to planning: "Plan, plan and plan some more. Plan for every last contingency, every last possibility. Then, when you engage in battle, throw all the plans away." "Plans are useless, but planning is indispensible." "No battle plan ever survived first contact with the enemy." This may be obvious to those who actually code for a living, but it finally dawned on me that there's a natural conclusion to be drawn: that it could be a good idea to plan away and produce a nice, detailed technical spec for whatever software you're trying to write; to start off with that plan, but to use it as scaffolding instead of blueprints, and reshape it or abandon it altogether as the programme takes shape. But in the process of planning, you've gotten a big head-start on the details and considerations that need thinking through. The trick lies in not remaining attached to your plans. Am I on the right track here? Or have I managed (once again) to prophetically divine the bleeding obvious? (Oh, and lisp seems, of course, to be a language naturally suited to such an evolutionary approach) | | Monday, September 8th, 2008 | 8:40 pm [jkndrkn]
 |
Macro Trouble Hello FriendsLisp newbie here running into a bit of trouble when using Macros. (defun fun (args)
(mapcar #'(lambda (x) (print x)) args))
(defmacro macro (&rest args)
`(progn ,@(fun args)))
(defun test ()
(macro 'a 'b '(c d))) Trouble is, I can't get this code to compile. It seems that the compiler can't recognize that the function FUN is defined on line 1. When it attempts to compile the function TEST, SBCL/Slime throws the following error: CL-USER> (load (compile-file "macro.lisp"))
; compiling file "/home/jde/CAP5635/proj/numbrix/macro.lisp" (written 08 SEP 2008 08:38:21 PM):
; compiling (DEFUN FUN ...)
; compiling (DEFMACRO MACRO ...)
; compiling (DEFUN TEST ...)
; file: /home/jde/CAP5635/proj/numbrix/macro.lisp
; in: DEFUN TEST
; (MACRO 'A 'B '(C D))
;
; caught ERROR:
; (in macroexpansion of (MACRO # # ...))
; (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
; The function FUN is undefined.
;
; compilation unit finished
; caught 1 ERROR condition
; /home/jde/CAP5635/proj/numbrix/macro.fasl written
; compilation finished in 0:00:00
T The same test was causing clisp to abort with a stack overflow error! Got any ideas? Is there a fallacy in my approach? How do I convince the compiler that FUN really is defined before test is compiled? Thanks! | | Wednesday, July 9th, 2008 | 11:34 am [sebthecat]
 |
Tips for hosting in Europe?
Does anybody here have any experience with hosting SBCL on real or virtual servers in Europe? I've discovered the hard way that Xen is the only virtual server system that plays well with SBCL. Budget Dedicated have been doing a reasonable job with Xen so far, but the website's responsiveness just ain't there. I'm getting the itch to move to dedicated hardware (just as everybody's going the other way); anybody have any tips? I refuse to use USA-based hosting, because "adult" content is involved, and I don't need politically-motivated trouble from there, any more than I need it from here in Australia. At worst, I'll hire a server here until/unless I get actual problems, but I really don't need to scramble in response to a take-down notice. So... any tips? A quick initial search has turned up EasySpeedy, which looks promising. [Edit: FlexiScale also looks good. Might just test their offering and report back.] Current Mood: hopeful | | Friday, February 15th, 2008 | 3:50 pm [sebthecat]
 |
Flamewar? What flamewar?
Everybody agrees, at least in principle, that the right tool should be used for the job. It just so happens that for many people, their favourite tool is the right one for all jobs. An old saying about only having a hammer comes to mind. Given Lisp's famously protean ability to be adapted to the job at hand, even if command-line scripting is a bit awkward, I offer the following answer to Perl's nickname: Lisp - the Swiss-Army hammer of programming languages!Warning: tongue may need surgical extraction from cheek after use Current Mood: mischievous | | Sunday, February 10th, 2008 | 4:55 pm [xah_lee]
 |
pop langs website ranking
while doing my website's traffic report, i did some research on major computer lang or tech website ranking. Here's the result ranked by alexa.com (some non-lang tech sites are given just for comparison):
Php.net 550 (largely due to online doc and forum)
sun.com 900 (java doc and forum)
java.com 1122
slashdot.com 1223 (forum)
Mysql.com 1296 (online doc, forum)
gnu.org 7328 (massive docs, mailing list archives)
wolfram.com 9065 (online doc, mathworld etc)
Python.org 9410 (python doc and prob forums)
Perl.org 26067 (perl doc, forum)
paulgraham.com 48153 (lisp bigwig, but huh?)
Perl.com 49104
haskell.org 118703
novig.com 130568 (lisp bigwig)
franz.com 292598
lispworks.com 377906 (common lisp doc)
Gigamonkeys.com 529551 (pop common lisp book)
schemers.org 880284
The list is not that surprising. Many top ones are due to the popularity of the lang, but also because their site hosts the lang's documentation and discussion forum (or wiki,blogs). Hosting a web forum are likely to increase traffic some 10 or 100 fold. Questions: • paulgraham.com is unusually high. What's up with that? • python.org at 9k seems also unusally high, compare that perl.org with online doc and forum is only 26k. Python.org has mailing list archives... maybe blogs too but am not sure it has forums... still the gab seems surprising. Even perl is not much talked about these days, but i'm guessing its market share is at least still 10 or 100 times of python... If any one so wishes, add entries to the above list. | | Thursday, February 7th, 2008 | 4:11 am [xah_lee]
 |
| | Saturday, February 2nd, 2008 | 11:33 am [sunavatar]
 |
Returning nothing explicitly
It seems that in R5RS scheme it is possible to write a function that, in some circumstances, does not return anything. A short example: (define foo
(lambda args
(if (null? args) 'mumble))) will return nothing if passed at least one argument. Is there a built-in way of doing this explicitly? Something like: (define arc-if
(lambda args
(cond
((null? args) #nothing)
((= (length args) 1) (car args))
((car args) (cadr args))
(else (apply arc-if (cddr args)))))) EDIT: On further research, it seems the appropriate mechanism is (values). | | Wednesday, January 30th, 2008 | 2:08 pm [uniheliodem]
 |
| | Sunday, December 23rd, 2007 | 9:19 pm [xah_lee]
 |
| 9:14 pm [xah_lee]
 |
| | Saturday, December 22nd, 2007 | 5:31 pm [jkndrkn]
 |
Developer-friendly Hosting? Hello FriendsI am interested in exploring web programming via Lisp, Ruby on Rails, and several of the popular Python frameworks. Here are the features I am interested in: * Lisp hosting including access to web servers and/or mod_lisp * Ruby on Rails hosting * Python hosting * Configurable source control repository with public and private areas (SVN/Trac or better) * SSH access * MySQL or PostgreSQL database * PHP support (for third-party software packages) Has anyone here had similar needs? Would you recommend any particular hosting solution? Thanks, jkndrkn | | Wednesday, December 19th, 2007 | 6:54 am [xah_lee]
 |
| | Friday, November 30th, 2007 | 10:51 am [bootiack]
 |
wow
is it me or are exercises in computer programming books designed to torture you? damn sicp or k+r exercises are killers esp for a beginning programmer......jesus! Current Mood: annoyed |
[ << Previous 20 ]
|