Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Sanity Check

Name: Anonymous 2009-09-25 19:16

Bad idea?
(defmacro letret (return-binding bindings &body body)
  `(let ,(cons return-binding bindings)
     ,@body
     ,(first return-binding)))

(defmacro letret* (return-binding bindings &body body)
  `(let* ,(cons return-binding bindings)
     ,@body
     ,(first return-binding)))

Name: Anonymous 2009-09-25 19:17

using lisp? yep

Name: Anonymous 2009-09-25 19:25

rename the file as .py and modify it accordingly

Name: Anonymous 2009-09-25 19:31

rename the file as .pl and modify it accordingly

Fixed that for you.

Name: Anonymous 2009-09-25 19:38

>>2
No.

>>3
Is that a yes or a no?

Name: Anonymous 2009-09-25 20:25

>>2
i second this.
it's a very very bad idea indeed

Name: Anonymous 2009-09-25 20:35

Wonderful example of how shitty the Lisp family is. Thanks guys.

Signed,
just another EXPERT C PROGRAMMER

Name: Anonymous 2009-09-25 21:34

I see /prog/ is filled with retards today.

As for the answer to OP's questions:

It doesn't seem like that bad of an idea, but it does seem limited, since you can only return the first binding, which may not always be possible. If it works for you, use it, otherwise you might want to look into some anaphoric macros (P.G's from On Lisp and this one: http://common-lisp.net/project/anaphora/ )

Name: Anonymous 2009-09-25 23:34

Okay, that's it. I'm buckling down, /prog/. After being here for over a year, I'm finally going to read SICP and get some Lisp under my belt.

I could probably query /prog/scrape to find out what the most useful utilities are, but that seems to be a pain without an application to produce entire threads from prog.db. This SQLite browser that I have is not very friendly for reading posts. Programming my own post display would be effective, but probably take an hour if I reuse the components from my BBCode editor.

Thus, in the meantime, I request help. I just looked at the CL wiki thing, and god damn, am I confused, there are like 20 dialects and countless development tools for myriads of platforms that look to be in varying states of completion and usefulness.

I already know what I'm going to do with Scheme, there's no Scheme I'd bother with other than The Sussman's Scheme.

But I'd also like to get some actual Lisp under my belt. Some sort of Common Lisp. My development platform is Windows XP, 32-bit. Does anyone have recommendations as far as dialect or tools to use?

Name: Anonymous 2009-09-26 0:00

Just get plt scheme, >>9. Chances are good you'll do what everyone else does, be amazed, have the odd epiphany or three, and then program in some other language anyway.

Name: Anonymous 2009-09-26 1:19

>>9
When it comes to ANSI Common Lisp, there's a few choices for your platform(Win32):
a) `Free' ones(come with source code):
 - SBCL,
    pros: very fast/good code quality, good extensions, based   on  CMUCL, but made to be much more portable. Most of the Lisp community prefers it
    cons: threading support is lacking on windows, but it's being worked on, same goes with interrupt support. I find it usable, but YMMV. These issues don't exist in the *nix port.
 - ClozureCL/OpenMCL, used to be a commercial lisp, now open source.
    pros: almost everything works if you use the latest SVN trunk.
    cons: not as good native code generation as SBCL, but still decent.
 - CLISP
    pros: good compatibility, good for debugging
    cons: Interpreted or JIT when compiled, no threading.

Commercial(have to pony up money or get a free trial):
 - Allegro CL
    pros: good code generation, lots of libraries come with it.
    cons: , and the license is  restrictive, but they can give you source code to parts of the implementation, has a free trial.
 - Lispworks
    pros: good debugger/code stepper, various interesting libraries, better license than ACL
    cons: haven't used it enough to know any
 - CormanCL
    pros: Good concurrency support, get full source code if you buy it.
    cons: Win32 only, are they even alive anymore?

All have excellent ANSI Common Lisp support, so your code is portable. FFI, Networking, Concurrency(SMP) are not standardized features, so things vary here, but for FFI and Networking you have compatibility layers which allow you to write de-facto portable code across any of these implementations ( when you use Emacs+SLIME, you can even run multiple ones at the same time, or you could even run an implementation in a VM or a remote machine and connect them via network seamlessly ). Code generation quality(speed/bloat/etc) varies as well. I'd say go with latest SBCL or SVN trunk CCL, they should be good enough for your needs. If you don't care about speed or concurrency just use CLISP. Pretty much all of them have an FFI, and you can use CFFI or UFFI as a compatibility layer if you want a portable FFI. Basically, you can't really go wrong, and if something doesn't suit you, you can just easily switch implementations, unless you wrote some very implementation specific code.

Name: Anonymous 2009-09-26 1:20

>>11
As for tools, you'll want Emacs+SLIME+Paredit, check this movie out to get started: http://common-lisp.net/project/movies/movies/slime.mov

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-26 1:52

hOLY SHIT YOU FUCKING FAGGOTS STILL TALK ABOUT "LEARNING LISP". wHY DON'T YOU ACTUALLY START READING A FUCKING BOOK YOU PHOOKKIN PHAGH?

Name: Anonymous 2009-09-26 4:18

>>11
I prefer GNU Guile.
No R6RS support but I like their module system more than the standardized one.

Name: Anonymous 2009-09-26 4:21

Name: Anonymous 2009-09-26 5:45

Is there some Scheme or Lisp that generates TINY executables?

Name: Anonymous 2009-09-26 5:49

>>16
No, because compiled versions are just a sticked-together version of the actual script and the interpreter itself.
Which is why most free interpreters use the LGPL.

Name: Anonymous 2009-09-26 6:11

>>17
I don't know about Schemes well, but this is incorrect for most modern Common Lisp implementations. Those that compile down to native code will get you clean nice functions, however they're not linked inside a normal executable, instead you can have code and data in the same [b]core image[/i], that is, similar to how normal executables look, but a bit more chaotic (this image can and is gc'ed usually), then you have a tiny executable which just loads the image in memory and runs the entrypoint, as well as provides a few services such as gc. That's how most serious Lisps work, and this is a fine model as the core image is very modifable (you can define and redefine just about anything in this image), Lisp's dynamic nature does not stop at just dynamic typing: the entire environment can be modified and extended at will. There are some interpreted Lisps, but I can only think of CLISP(which can compile to bytecode(JITable), so it's not a pure interpreter) and Lisps of old days. If this does not suit your needs, you may want to look at Lisps which compile to C code, and you can compile those as a normal executable(~1-2MB runtime most of the time), such an example would be ECL(Embeddable Common Lisp), but it surely isn't the only one. CL is large, but if you truly want tiny images, then select a subset of CL and treeshake your world, or use one of those tiny embedabble schemes. There's also Gambit-C for Scheme (compiles to C). Other ways to obtain small images involves tree shaking the image(removing symbols(and dependencies of them) which are not needed by you and gc'ing).

tl;dr: Most images are large, but you can get them small if you need them. They're large because they provide a lot of things(Most normal languages don't come with an entire compiler inside them).

Name: >>18 2009-09-26 6:20

>>17
Actually the LGPL isn't very suitable for a lot of CL implementations, which is why most are public domain or BSD or LLGPL. The thing about it is that the code gets linked into the main image, dynamic linking is uncommon (it can and is done in some cases, but as my previous post showed, most of the cases involve a form of static linking(for the lack of a better term)), so you need a special linking exception to the LGPL if you want to use it. Most free Lisp libraries end up being BSD/Public Domain or LLGPL. There's a few LGPL'ed ones, but that's mostly because originally the authors weren't aware of this issue, and it's too hard to contact everyone to change the license. Commercial Lisps also have special linking exceptions in their licenses (runtime licenses).

Name: Anonymous 2009-09-26 9:35

>>11
Tried Lispworks before. The interface is claustrophobic :(

Name: Anonymous 2009-09-26 9:37

>>20
It's probably fine if you want an IDE, but a bit minimalistic. It does work with SLIME like pretty much any other major Lisp implementation, so it shouldn't matter much.

Name: Anonymous 2009-09-26 9:39

>>21
Jaysus, it's got at least 20 miniature buttons (ten in a window, ten floating around in a toolbar) without descriptions I don't understand. I've switched to ABLE for a while but it's no DrScheme.

Name: Anonymous 2009-09-26 11:34

a lisp is fine too

Name: Anonymous 2009-09-26 17:31

>>19
This is why Lisp sucks.

Name: Anonymous 2009-09-26 19:29

>>24
What sucks for you, is good for me.

Name: Anonymous 2009-09-26 20:18

>>10-22
Thank you for your posts. Even you, >>13-san.

I'll go with SBCL.

>>12
This video is extremely helpful. Thank you.

Name: Anonymous 2009-09-26 23:23

>>8
it does seem limited, since you can only return the first binding, which may not always be possible.
OP here, yeah, that's technically a limitation. The idea was to rejigger the case where you have a long let operating on some data, and then just a variable name at the end to return it. It bugs me for some reason. I figure: why not make the intent explicit up front?

Name: Anonymous 2009-09-26 23:31

>>27
Sounds fine, and it's not like that "limitation" isn't present in CL: PROG1 PROG2 PROGN (of course you can write a PROG macro which doesn't exhibit such a limitation (search back for the PROGK from a few weeks ago), but the relative usefulness of it isn't that large)).

Name: Anonymous 2009-09-26 23:53

>>28
I remember PROGK...
(defmacro progk (k &body forms)
  (flet ((for-k (k)
           `(,k ,@(subseq forms 0 k)
                (multiple-value-prog1 ,@(subseq forms k)))))
    `(case ,k
       ,@(loop for case from 0 below (length forms) collect (for-k case)))))

Name: Anonymous 2009-09-27 0:50

>>29
I believe this works just as well, even with multiple values:
(defmacro progk (k &body) rest
  `(elt (list ,@rest) ,k))

Name: Anonymous 2009-09-27 0:51

>>30
Whoops, accidentally barfed the "rest" part out of the arg list when I was trying to copy :S

Name: Anonymous 2009-09-27 1:25

>>30
That doesn't handle multiple values. And obviously it involves saving useless values into a list then traversing the list.

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-27 3:36

hERE'S A HINT MOTHERFUKCERS:
(DEFMACRO PROG-LIST (&BODY BODY)
  '`(,@BODY))


nOW TAKE YOUR LIST AND DO WHATEVER THE FUCK YOU WANT TO DO WITH IT.

Name: Anonymous 2009-09-27 3:42

>>33
You know that that quote before the backquote breaks this macro right?

(defmacro prog-list (&body body)
  ``(,,@body))


might be closer to what you want, but why do this at all?


CL-USER> (prog-list 1 2 3)
(1 2 3)
CL-USER> '(1 2 3)
(1 2 3)

Name: TRUE TRUTH EXPERT !tQq1sLlmuk 2009-09-27 5:08

>>34
dUH, MISTAKE. wHAT I REALLY MEANT WAS

(DEFMACRO PROG-LIST ((&REST REST) &BODY BODY)
  `(PROGN
      .,(LOOP FOR I IN REST
              COLLECT `(PROGN .,(LOOP FOR J IN BODY COLLECT `(,I ,J))))))

Name: Anonymous 2009-09-27 5:11

lol, lisp looks ludicrous. I'm so glad I never believed any of the hype crap.

Name: Anonymous 2009-09-27 8:01

>>36
                       //`'''```,
             o        // LISP   `.,
       ,....OOo.   .c;.',,,.'``.,,.`
    .'      ____.,'.//
   / _____  \___/.'
  | / ||  \\---\|
  ||  ||   \\  ||
  co  co    co co

Name: Anonymous 2009-09-27 8:21

>>37
I never understood this pic, why does the head of that creature have a LISP tattoo? Where are its eyes and mouth?

Name: Anonymous 2009-09-27 8:21

So, is CL really that full of `'..`'`''`.`'`.'`s?

Name: Anonymous 2009-09-27 8:37

)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

Name: Anonymous 2009-09-27 9:23

>>40
LOLOL SO FUNNY XD

Name: Anonymous 2009-09-27 12:27

Name: Anonymous 2009-09-27 13:54

>>41
I know! :D

Name: Anonymous 2009-09-27 15:02

>>39
If you write it like that.

Name: Anonymous 2009-09-27 22:32

       (while (cdr cell)
         (if (and (null (car (car (cdr cell))))
             (not (eq (cdr (car (cdr cell))) 'set)))
             (setcdr cell (cdr (cdr cell)))
           (setq cell (cdr cell)))))

Name: Anonymous 2011-02-03 5:03

Name: Anonymous 2011-02-04 17:18

Don't change these.
Name: Email:
Entire Thread Thread List