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

Pages: 1-4041-

What's the appeal of LISP

Name: Anonymous 2007-08-31 17:49 ID:eOTcF6wL

Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in.

Name: Anonymous 2007-08-31 17:50 ID:eOTcF6wL

SQL, Lisp, and Haskell are the only programming languages that I've seen where one spends more time thinking than typing.

Name: Anonymous 2007-08-31 17:53 ID:SfSZ1UWw

>>2
Well, when you don't count typing parens maybe you're right

Name: Anonymous 2007-08-31 17:56 ID:itA3f2Zb

>>1
The way the parens make each sexp distinct is so pretty.

Name: Anonymous 2007-08-31 17:57 ID:Heaven

Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in.
I'd say it's more like fingernail clippings with oatmeal mixed in.

Name: Anonymous 2007-08-31 18:06 ID:Heaven

My other car is a cdr

Name: Anonymous 2007-08-31 18:27 ID:X7hY7Fyj

i'd love to see what this would look like in lisp...
function(n){
 return (function(i){
   return i==1?0:arguments.callee(i-1)+(function(i){
    return i==1?1:arguments.callee.caller(i-1)
   })(i-1)
  })(n+1)
}

Name: Anonymous 2007-08-31 23:30 ID:itA3f2Zb

>>7
I'd rewrite it in Lisp if I had some idea what it did.

Name: Anonymous 2007-08-31 23:35 ID:X7hY7Fyj

>>8
http://ling.ucsd.edu/~bpajak/articles/Rubio_Pajak_Fibonacci06.pdf
see figure 4.
basically that, but with all anonymous functions.

Name: Anonymous 2007-08-31 23:49 ID:IhPOGq6m

>>7
I dunno, I'm not sure if there is a lisp with arguments.callee or sumthin, and I'm not sure I want to have it.

(define (fib n)
   (define (baby i) (if (= i 1) 1 (adult (- i 1)))
   (define (adult i) (if (= i 1) 0 (+ (adult (- i 1)) (baby (- i 1)))))
(adult (+ 1 n)))

Name: haskell 2007-08-31 23:56 ID:Heaven

baby 1 = 1
baby (i+1) = adult i
adult 1 = 0
adult (i+1) = adult i + baby i
fib n = adult (n + 1)

Name: Anonymous 2007-09-01 0:17 ID:div4kVll

>>9
>>10
Oh, I see what that is now. It's definitely possible in Lisp, but it's going to involve six lambdas or so. I don't have it sorted out in my mind yet.

>>11
These functions are too nonymous.

Name: Anonymous 2007-09-01 0:19 ID:Heaven

>>2
this is because people who do not use lisp etc. do not think at all when they program

Name: Anonymous 2007-09-01 1:00 ID:div4kVll

Well, there you go. :/ sort of. The functions aren't created within one another (that would be more work), and using lambda forms to define temporary names feels like cheating.

(funcall ((lambda (c a) #'(lambda (n) (funcall a c a (1+ n))))
      #'(lambda (c a i)
          (if (= i 1)
          1
          (funcall a c a (1- i))))
      #'(lambda (c a i)
          (if (= i 1)
          0
          (+ (funcall a c a (1- i)) (funcall c c a (1- i))))))
      i)

Name: Anonymous 2007-09-01 1:01 ID:div4kVll

>>14
That i at the end is where you say you want the ith Fibonacci number.

Name: Anonymous 2007-09-01 1:10 ID:khcLzIi6

>>14
wow, that's ugly.
i bet it'd be even uglier with the functions created within each other.
is there a way to do it without defining temeporary names?

Name: Anonymous 2007-09-01 1:24 ID:LvwPmJgC

CL-USER> (defun fib (n)
           (labels ((aux (x y n)
                      (if (= n 0) y
                          (aux y (+ x y) (- n 1)))))
             (aux 0 1 n)))
FIB
CL-USER> (fib 6)
13
CL-USER> (lambda (recur x y n)
           (if (= n 0) y
               (funcall recur y (+ x y) (- n 1))))
#<FUNCTION (LAMBDA (RECUR X Y ...)) {11D62D25}>
CL-USER> (lambda (x a b c) (funcall x x a b c))
#<FUNCTION (LAMBDA (X A B ...)) {11D9324D}>
CL-USER> ((lambda (x a b c) (funcall x x a b c))
          (lambda (recur x y n)
           (if (= n 0) y
               (funcall recur recur y (+ x y) (- n 1))))
          0 1
          6)
13


please do not fail so hard in future
>>14

Name: Anonymous 2007-09-01 1:36 ID:div4kVll

>>16
Not that I can think of. It looks like whatever language >>7 is in lets you peek at the call stack and re-call functions from it, but that's really just another way of saying a name has been defined. You have to define names somewhere in order to be able to use those names later. Automating and hiding the actual definition in that way is pretty clever. CL doesn't provide a way to get at this info, as far as I know. The arguments.callee would be easy enough to hack into the lambda macro, but arguments.callee.caller (and more levels up?) would be hard.

Name: Anonymous 2007-09-01 1:42 ID:div4kVll

>>17
Labels is even more cheating. Notice that you did not do anything mutually recursive either.

Name: Anonymous 2007-09-01 1:57 ID:LvwPmJgC

>>19
You're a fucking idiot lol
It's trivial to extend the Y combinator (even though we don't even need or want it atm) to deal with mutually recursive functions.
Try understanding the Y combinator and you will see how fucking obvious it is.

Name: Anonymous 2007-09-01 2:04 ID:div4kVll

>>20
No you're a fucking idiot lol.

While the Y combinator is a perfect fit for making mutually recursive functions it's not what we're FUCKING TALKING ABOUT. It's just a way to pass a function's name to itself. Read >>7, realize that access to the call stack is the issue at hand.

Name: Anonymous 2007-09-01 2:09 ID:Heaven

>>1
When I make oatmeal it looks fine.

Name: Anonymous 2007-09-01 2:39 ID:LvwPmJgC

>>21
While the Y combinator is a perfect fit for making mutually recursive functions it's not what we're FUCKING TALKING ABOUT. It's just a way to pass a function's name to itself. Read >>7, realize that access to the call stack is the issue at hand.

You clearly need more background than you half arsed school computing course to understand this discussion. I strongly suggest you read SICP and GTFO.

Name: Anonymous 2007-09-01 2:48 ID:X+MHlWFr

>>1
you just described how RMS likes his oatmeal

Name: Anonymous 2007-09-01 2:50 ID:div4kVll

>>23
I'm not some loser who studies programming in school. You clearly need more background in this thread to understand this discussion. And that's pretty sad, since it's only 25 posts long. Quite frankly, I don't see how it's possible that you haven't caught on by this point. I think it's safe to say that while you may have read all the words in SICP, most of them were lost on you.

Name: Anonymous 2007-09-01 4:09 ID:LvwPmJgC

>>25
Hahahahah!

Name: Anonymous 2007-09-01 4:24 ID:khcLzIi6

>>18
>>7 is javascript.
here's how i'd do it in factor:
[ [ dup 1 = [ drop 0 ] [ [ 2dup ] swap slip 1- pick keep -rot slip + ] if ]
 [ dup 1 = [ 2drop 1 ] [ 1- swap call ] if ]
 rot 1+ pick call 2nip ]

i'd be surprised if you can't do it similarly in lisp.
i know there is a way to access the call stack in factor, but it's not nearly as easy as in javascript, and would probably be even uglier than all the stack shuffling in my version.

Name: Anonymous 2007-09-01 10:11 ID:jsGz2PE8

breaking lexical scope makes for incredibly slow code

Name: Anonymous 2007-09-01 19:12 ID:LvwPmJgC

>>28
No

Name: Anonymous 2007-09-02 0:16 ID:Heaven

>>29
Yes

Name: Anonymous 2007-09-02 16:24 ID:QTIFos7G

>>30
No, try a compiler you idiot lolk

Name: Anonymous 2007-09-02 16:45 ID:Heaven

>>31
Yes

Name: Anonymous 2007-09-02 18:29 ID:myFe6nh5

ONE WORD, THE FORCED SATORIZATION OF MIND, END OF THREAD

Name: Anonymous 2007-09-02 19:26 ID:QTIFos7G

SATORIZATION

Name: Anonymous 2007-09-03 5:06 ID:2wwYllzx

SATORIZATION

Name: Anonymous 2007-09-03 13:29 ID:h0dfmJdz

SATORIZATION

Name: Anonymous 2007-09-03 13:36 ID:7ofYMwk3

SATORIZATION

Name: Anonymous 2007-09-03 13:37 ID:rThARzTr

⎛SATORIZATION

Name: Anonymous 2007-09-03 13:41 ID:rThARzTr

⎛̅̅̅̅̅̅̅̅̅̅⎞
⎝⎠

Name: Anonymous 2007-09-03 13:41 ID:rThARzTr

>:⌇

Name: Anonymous 2007-09-03 13:43 ID:rThARzTr

s̅̅̅̅̅̅̅̅̅̅a̅̅̅̅̅̅̅̅̅̅t̅̅̅̅̅̅̅̅̅̅o̅̅̅̅̅̅̅̅̅̅r̅̅̅̅̅̅̅̅̅̅i̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 13:45 ID:rThARzTr

.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅s̅̅̅̅̅̅̅̅̅̅a̅̅̅̅̅̅̅̅̅̅t̅̅̅̅̅̅̅̅̅̅o̅̅̅̅̅̅̅̅̅̅r̅̅̅̅̅̅̅̅̅̅i̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅
̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅..........̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅
_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 13:47 ID:rThARzTr

.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅s̅̅̅̅̅̅̅̅̅̅a̅̅̅̅̅̅̅̅̅̅t̅̅̅̅̅̅̅̅̅̅o̅̅̅̅̅̅̅̅̅̅r̅̅̅̅̅̅̅̅̅̅i̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅
̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅..........̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ .̅̅̅̅̅̅̅̅̅̅
_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 13:47 ID:rThARzTr

.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅s̅̅̅̅̅̅̅̅̅̅a̅̅̅̅̅̅̅̅̅̅t̅̅̅̅̅̅̅̅̅̅o̅̅̅̅̅̅̅̅̅̅r̅̅̅̅̅̅̅̅̅̅i̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅
̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅..........̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ .̅̅̅̅̅̅̅̅̅̅
_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 13:48 ID:rThARzTr

.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅.̅̅̅̅̅̅̅̅̅̅s̅̅̅̅̅̅̅̅̅̅a̅̅̅̅̅̅̅̅̅̅t̅̅̅̅̅̅̅̅̅̅o̅̅̅̅̅̅̅̅̅̅r̅̅̅̅̅̅̅̅̅̅i̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅
̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅...........̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅ .̅̅̅̅̅̅̅̅̅̅
_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅_̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 13:50 ID:rThARzTr

I have managed to break the boundaries of posts and physically connect the content of them. Am I an EXPERT BBCODE PROGRAMMER?̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅

Name: Anonymous 2007-09-03 14:02 ID:Heaven

>>46
Nope, just retarded.

Name: Anonymous 2007-09-03 14:25 ID:Heaven

>>46
Expert Unicode Programmer.

Name: Anonymous 2007-09-04 6:44 ID:nteJvxuA

I remember some guy giving lectures at conferences about using Lisp to imitate other languages like Perl. So you could type Perl-like code and have this Lisp program understand it. Do any of you know about that?

Name: Anonymous 2007-09-04 10:21 ID:1lDhSzch

>>49
It can supposedly be done with Lisp macros, but I have so far not seen a single Lisp programmer than knows how to use macros beyond for-loops and other stupid stuff.

Name: Anonymous 2007-09-04 11:26 ID:eOpLdWqF

>>49
It's fairly simple in concept. Since macros don't evaluate their parameters, you can make a form like (perl $foo=3 ... ) expand to whatever, by parsing the symbols given as parameters to the perl macro (defmacro perl (&whole code) ... ).

Of course, the tricky bit is that such a macro definition will just give you a bunch of symbols like the above "$foo=3". You can make the situation a little bit better by stipulating spaces wherever possible ("$foo = 3"), but you're still stuck doing pattern matching on symbols for variable names (owing to sigils and such), which means you'll probably be treating them as strings and losing the ability to do simple backquote substitution of symbol values into literal text forms:

(defmacro mact (name val)
  `(let ((,name ,val))
     (print ,name)))
(macroexpand-1 '(mact foo 3))
(LET ((FOO 3))
  (PRINT FOO))

Basically, parsing something like perl code with a macro is pretty much akin to parsing it as plain text. Macros are great if you're implementing a language with no semantic content in its symbols, meaning that any given symbol either has a known meaning or is a new name for something, but when a given symbol may be a name and a programmatic instruction, it gets tricky fast. Take a look at the source for your favorite Lisp's loop macro and you'll see that, even when the language to be parsed is simple, constructing working code out of it is pretty hairy (1k - 2k LOC hairy).

On the plus side, if I were writing a parser for something Lisp would be more fun than C or something to write it in.

Name: Anonymous 2011-11-10 11:25

old thread is old

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