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

Pages: 1-4041-8081-

JUST LEARNED ABOUT PHP CLOSURES

Name: Anonymous 2006-04-04 21:00

Wow I didn't know PHP had closures. I'm now using them all over the place.

Name: Anonymous 2006-04-04 21:04 (sage)

Ugh.

Name: Anonymous 2006-04-04 21:41

Um.. PHP doesn't have closures. So, what exactly are you using all over the place?

Name: Anonymous 2006-04-05 3:45

Closures are awesome. I use them all the time in Lisp and Ruby.

Name: Anonymous 2006-04-05 21:56

>>3

eval you idiot

Name: Anonymous 2006-04-05 22:26

>>5
Eval isn't a closure, you idiot.

Name: Anonymous 2006-04-06 0:59

>>1 example plz?

Name: Anonymous 2006-04-06 18:15

>>1 Example

Name: Anonymous 2006-04-06 20:25 (sage)

>>7
>>8
I've heard there are a lot of examples here: http://www.google.com/ and there: http://www.php.net/

Name: Anonymous 2006-04-06 21:25 (sage)

>>9 is full of shit.

Name: Anonymous 2006-04-06 22:36 (sage)

>>9
Example please.

Name: Anonymous 2006-04-07 3:36

>>10 example plz?

Name: Anonymous 2006-04-07 4:07

Create anonymous functions with create_function, like create_function('$a,$b','return ' . ($reverse ? '-' : '') . 'strcasecmp($a,$b)')
As you can see, you can reference outside variables. Not elegant, and not the easiest to write (either as I showed or using double quotes and escaping inside variable $), but does the job.

You can use anonymous functions for functions like array_map, array_filter, array_reduce, array_walk, array_walk_recursive, usort, and other functions (possibly your own) expecting or returning a callback. You can invoke variable functions like $x(lol).

Name: Anonymous 2006-04-07 4:28

Just use Ruby or Lisp.

Name: Anonymous 2006-04-07 6:07

>>14
Just STFU. I have yet to see how can you do web applications in LISP, and Ruby is alright but there's far more support and existing open sauce for PHP. (The fact it's simpler helps, but it also hurts because some PHP "programmers" suck, so I'm not counting it as an advantage or a disadvantage.)

Name: Anonymous 2006-04-07 6:18

An anonymous function isn't a closure. I don't know why so many people mix them up.

Name: Anonymous 2006-04-07 6:23

Talking about which, that's a really ugly way to make an anonymous fuction. Is that really an anonymous function...?

Name: Anonymous 2006-04-07 7:05

PHP is the java of web programming.

Name: Anonymous 2006-04-07 7:32

>>18
Not really. It lets you get stuff done without having to make a massive class hierarchy. It's kinda sucky, encourages bad style and attracts wannabe programmers who can't write decent code to save their life. I'd say it's the VB of web programming. Java would be the Java of web programming.

Name: Anonymous 2006-04-07 7:36

>>17
Yes, it is. create_function defines it on the fly and returns a name you can later call as $f(x). This name is a random string.

Name: Anonymous 2006-04-07 8:12 (sage)

Beware! This is merely a convenience function that generates a unique name for a regular function. It is *not* a closure or even an anonymous function. It is just a regular function that gets named for you.

Name: Anonymous 2006-04-07 9:52

>>21
Uh, you don't seem to understand how PHP functions work. They are passed by name. Name as in, a string with the function name. They are called by name too. You _need_ to generate a name to use your anonymous function, because that's what high-order functions use and expect. And yes, as far as you're concerned they are anonymous functions, just like other language's anonymous functions still have an address. The internal name is used to access its code just like addresses, and if you don't mess with addresses you don't mess with random generated names.

Name: Anonymous 2006-04-07 10:40

You _need_ to generate a name to use your anonymous function
lol php

Name: Anonymous 2006-04-07 10:48

php is for fags

Name: Anonymous 2006-04-07 11:38

>>24 speaks the truth.

Name: Anonymous 2006-04-07 11:48

>>13
maybe you should just put your whole program into a string and then write your own parser for it. then you can add some syntax for closures.

Name: Anonymous 2006-04-07 11:57

LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP LISP

Name: Anonymous 2006-04-07 12:07

>>23
Lol U, what's the practical difference between a name and an address?

Name: Anonymous 2006-04-07 13:08

>>14
Forget Ruby, Common Lisp is better.

Name: Anonymous 2006-04-07 14:31

>>29
I did suggest Lisp. These days I generally suggest Ruby as well, since people seem to have a parenthesis phobia and need some cuddly syntax to hold.

Name: Anonymous 2006-04-07 15:51

So I herd u like lisp

Name: Anonymous 2006-04-07 19:23

(equal '(everybody loves Lisp) t)

Name: Anonymous 2006-04-07 19:29

There's one Lisp lover in this thread making so much noise. He got to lean Lisp, so his e-peenor is enormous.

Name: Anonymous 2006-04-07 19:32 (sage)

>>33
(format t "STFU NOOB!")
(defun increase-e-peenor (size)
  (+ 1 (increase-e-peenor size)))

Name: Anonymous 2006-04-07 20:33 (sage)

Name: Anonymous 2006-04-07 21:06

>>35
All you can answer is some trolling link you found on the internet instead of thinking for yourself? That's pathetic in front of those who know why Lisp is superior to what is available today. Your inability to write clean and simple frameworks must be why you haven't answered my previous post.

Name: Anonymous 2006-04-08 4:01

>>36
what post?

Name: Anonymous 2006-04-08 7:17

>>34
Don't know what that does, but perhaps it's like
print "STFU NOOB!"
increase_e_peenor = lambda x: x + 1
only more obfuscated.

Name: Anonymous 2006-04-08 11:00

>>33
You're pretty stupid if you can't learn lisp on your own.

Name: Anonymous 2006-04-08 12:09 (sage)

>>39
You're pretty stupid if you learn Lisp on your own.

Name: Anonymous 2006-04-08 13:51

>>18
you stupid ignorant turd.

>>19
vb of web programming? sigh, and what exactly, pray tell, is that?

Name: Anonymous 2006-04-08 14:58

>>41
What is VB of web programming?

A stupid ignorant turd.

Name: Anonymous 2006-04-08 15:00

>>41
vb of web programming? sigh, and what exactly, pray tell, is that?
We were talking about PHP. Pay attention, I know ADD is a debilitating disorder that afflicts many 13 year olds, but you're gonna have to deal with it.

Name: Anonymous 2006-04-09 12:00

PHP: Horrible Programming.

Name: Anonymous 2006-04-09 15:01

>>39
I can, but do I want to?

>>44
That may be yours. Mine isn't.

Name: Anonymous 2006-04-09 18:14

Pope Homosexual Php
Programmer Hitler Petting
Preprocessor Hoard Powerful
Protection Hypertext Poop
Peckers Howling Putty
Pissing Hardware Polish
Pope Hypertext Puntme
Pleasuring Hitler Programmer
Poop Hardware Perfect
Petting Horrible Php

Name: Anonymous 2006-04-09 18:55

>>46
pretty Horrible Php

fixed!

Name: Anonymous 2006-04-10 3:49

Poopy Homo Project
Probably Harms Project
Precision Hobo Piss
Purple Haze, papa!
Pristine Hannibal Pepper

Name: Anonymous 2006-04-10 8:43

>>46-48
If you can't do PHP, you really have a problem pal.

Name: Anonymous 2006-04-10 8:47

>>49
It's not "can't do" it's "really really really don't want to do."

Name: Anonymous 2006-04-10 9:32

PHP: Hippy Programming

Name: Anonymous 2006-04-10 9:35

>>40
You're pretty stupid if you can't understand (function *arguments)

Name: Anonymous 2006-04-10 9:48

>>52
You're pretty clever if you can grok ((((((((((((((((((((((((((((()))))))))))))))))))))))))))))(((((((((((((((((((((((((((((((())))))))))))))))))))((((((((((((((((((((((((()))))))))))))))

Name: Anonymous 2006-04-10 10:02

>>53
You're pretty dumb if you think that's what Lisp code looks like.

Name: Anonymous 2006-04-10 12:35

>>54
Yes, of course there is indenting too.

((((( (((
                                        (((((((( (((((
  ((( (((((((
                                     (((
             ((
                                (
                                        )                ))
(                 (
))
                              (                 (( ((
                         ))                       ))
                               (          ((
                                                      )))))))))))))))) )))))))))))))            ))))))))))))))
)

Name: Anonymous 2006-04-10 20:15

>>50
Which means you can't do it properly. Lame. I guess if you learnt Lisp you could write proper PHP applications, but you probably haven't given the language a chance, just took a quick look at some existing code and said "this sucks".

Name: Anonymous 2006-04-11 18:53

>>56
You've never worked with other programmers before have you.

Name: Anonymous 2006-04-11 20:02

>>56
You've never worked on a major programme before have you?
Fixed.

Name: Anonymous 2006-04-12 5:59

Yes, currently working with an open sauce one that has hundreds of thousands of lines of code, most of it is alright.

Name: Anonymous 2006-04-12 7:09

>>59
Open-sauce ain't no enterprise quality, so it doesn't countなの.

Name: Anonymous 2006-04-12 7:33

>>60
NEEDS MORE ENTERPRISE

Name: Anonymous 2008-04-13 13:59

test
test
test
> test

/prog/ should have a preview or at least a delete button so we wouldn't have to do this shit.

Name: Anonymous 2008-04-13 13:59

test
> > test
> > > test
> > > > test

Name: Anonymous 2008-04-13 14:01

test

[#]> > test[br]> > > test[br]> > > > test

Name: Anonymous 2008-04-13 14:06

>> test

Name: Anonymous 2008-04-13 14:06

test

Name: Anonymous 2008-04-13 14:17



test

Name: Anonymous 2008-04-13 14:18


> test

Name: Anonymous 2008-04-13 14:25

R[o]
I

Name: Anonymous 2008-04-13 14:28

R
I

Name: Anonymous 2008-04-13 14:29

R
I
>
S

Name: Anonymous 2008-04-13 14:31

R
I
S
P
U

Name: Anonymous 2008-04-13 14:31

R
I
S
P
U

Name: Anonymous 2008-04-13 14:35

W
A
T
A
S
I

W
A
K

I

R

A


D

E

S

S

Name: Anonymous 2008-04-13 14:36

W
A
T
A
S
I

W
A

K

I

R

A


D

E

S

S

Name: Anonymous 2008-04-13 14:37

W
A
T
A
S
I

W
A

K

I

R

A


D

E

S

S

Name: Anonymous 2008-04-13 14:38

W
A
T
A
S
I

W
A

K

I

R

A


D

E

S

S

Name: Anonymous 2008-04-13 14:39

W
A
T
A
S
I

W
A
KI
R
A
D
E
S
S

Name: Anonymous 2008-04-13 14:39

W
A
T
A
S
I

W
A
KI
R
A
D
E
S
S

Name: Anonymous 2008-04-13 14:45

W
A
T
A
S
I

W
A

K
I
R
A
D
E
S
S

Name: Anonymous 2008-04-13 14:45

W
A
T
A
S
I

W
A

K
I
R
A
D
E
S
S

Name: Anonymous 2008-04-13 14:46

W
A
T
A
S
I

W
A

K
I
R
A

D
E
S
S

Name: Anonymous 2008-04-19 19:00

Programming is the magic of these modern times. The art of manipulating machinery that processes information. Ask any random fool on the street and it's all black boxes and unknowables to them.

Name: Anonymous 2008-04-19 19:01

>>15
You can use call/cc in scheme to write web apps

Name: Anonymous 2008-04-19 19:12

>>84
shut up, ginger twat.

Name: Anonymous 2008-04-19 19:32

Dammit, you bumped the thread I used to make expert quotation experiments.

Name: Anonymous 2008-04-19 20:33

>>84,85
I lol'd

Name: Anonymous 2008-04-19 21:03

Name: Anonymous 2008-04-19 21:07

>>88
Dirty feet.

Name: Anonymous 2008-04-19 21:18

>>89
Broken buttock capillaries

Name: Anonymous 2008-04-19 21:21

Name: Anonymous 2008-04-19 21:22

>>91
I lol'd for no particular reason

Name: Anonymous 2008-04-19 21:23

>>91
BLASPHEMY

Name: Anonymous 2008-04-19 21:32

lispROLL                            
                       //`'''```,   
             o        // LISP   `., 
       ,....OOo.   .c;.',,,.'``.,,.`
    .'      ____.,'.//              
   / _____  \___/.'                 
  | / ||  \\---\|                   
  ||__||   \\__||                   
  ˌ´  `ˌ   ˌ´  `ˌ                   
 |  ()  | |  ()  |                  
  `ˌ__ˌ´   `ˌ__ˌ´

Name: Anonymous 2008-04-20 1:50

>>94
lol

Name: Anonymous 2008-04-20 2:28

Name: Trollbot9000 2009-07-01 8:40

I like lurking in!

Name: Anonymous 2010-11-14 1:31


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