Home
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 ]
    Wednesday, November 25th, 2009
    11:03 pm
    [veeman8]
    COND system with Define.
    Hey LISPers. I'm using Scheme. Please don't kill me.

    I have a question that I can't seem to answer. Here's the code:

    (define final '())

    (cond (
    (< frst scnd)
    (define final (cons final frst))
    (define final (cons final scnd))

    )

    This is what it's supposed to mean:
    First, final is defined to null.
    We have a condition statement. It states....

    If first is less than second, define final by concatenating the variable first to the end of final
    then, define final by concatenating the variable second to the end of final.

    Of course, it gives me the following error:

    define: not allowed in an expression context in: (define final (cons final first))

    Any idea why, and how to fix it? :\

    Thanks.
    Thursday, October 8th, 2009
    1:32 am
    [patrickwonders]
    Lisp Troubles: Fabricating a Closure...

    The short version of my problem is that I want to do this:

    (defun generate-setter (buffer pre post)
      (eval `(lambda (index value)
    	   (setf (aref buffer ,@pre index ,@post) value))))
    

    Except that I want the (lambda ...) to be a closure around buffer. Here, pre and post are lists generated at runtime (thus not available as lists at compile time) and hence the (defun ...) and (eval ...) instead of (defmacro ...). Alas, the (eval ...) form uses the null lexical environment, so I cannot capture buffer.

    The long form with some of the myriad failed attempts I have made is on this blog post. Please, anyone have half a cup of clue that I could borrow? I promise, I'm going to the store for more clues really soon. I'll pay you back.

    Edit: Here is exactly what I was looking for... (courtesy of tfb)

    (defun generate-setter (buffer pre post)
      (let ((make-closure
               (compile nil `(lambda (buf)
                               (lambda (index value)
                                 (setf (aref buf ,@pre index ,@post) value))))))
        (compile nil (funcall make-closure buffer))))
    
    Sunday, August 30th, 2009
    5:02 am
    [6ferrets]
    Scheme definition fork
    I'm surprised that there's been no comment on the double Scheme announcement from the steering committee.

    We believe the diversity of constituencies justifies the design of two separate but compatible languages, which we will (for now) call "small" and "large" Scheme.

    Small Scheme

    * Constituencies: educators, casual implementors, researchers, embedded languages, "50-page" purists
    * Think "IEEE/R5RS brought up to the current date."
    * ~ 90% supermajority to be required for final ratification

    Large Scheme

    * Constituencies: programmers, implementors
    * Think "R6RS with a happier outcome."
    * ~ 75% supermajority to be required for final ratification


    I suggest that "small" and "large" Scheme be named after Sussman (who co-wrote SICP) and Steele (who co-authored the Common Lisp standard) respectively. :-)

    (Cross-posted to [info]lisp and [info]schemers)
    Sunday, July 19th, 2009
    11:01 am
    [patrickwonders]
    TC Lispers, July Presentations Online

    TC Lispers, July Presentations Online

    The July meeting of the Twin Cities Lisp Users Group was this past Tuesday. There were four presentations on the agenda:

    The presentation slides and videos of the talks are available above. Enjoy!

    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: 0

    What 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 Friends

    My 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 Friends

    Lisp 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]
    Arc is out
    Paul Graham's new language, inspired by Lisp. Read more here..
    Sunday, December 23rd, 2007
    9:19 pm
    [xah_lee]
    some lisp logos
    A few lisp logos:

    LISP Logo
    http://xahlee.org/emacs/lisp_logo.html

    Qi Language Logo
    http://xahlee.org/emacs/qi_logo.html

    and on tangent recently wrote:
    The Purpose of Logos and Principles of Logo Design
    http://xahlee.org/UnixResource_dir/logo_design.html
[ << Previous 20 ]
About LiveJournal.com

Advertisement