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

Pages: 1-4041-

[ELITISM]

Name: Anonymous 2010-05-21 12:58

Post something only your language can do. My contribution: I double dare you to do that in your language. Probably takes a fucking parser! javadocs don't count cuz its crap.

(defun print-package-documentation (package)
  "Lists package external symbols and prints
   their documentation"
  (let ((doc-types '(compiler-macro function method-combination
             setf structure type variable))
    undocumented)
    (do-external-symbols (s package)
      (let ((docstrings (remove-if-not #'identity
                       (mapcar (lambda (doc-type)
                         (documentation s doc-type))
                           doc-types))))
    (if docstrings
        (format t "~A: ~%~{  ~A~%~}" s docstrings)
        (push s undocumented))))
    (when undocumented
      (format t "The following symbols are undocumented:~%~{~A~^, ~}~%"
          undocumented))))


E.g.:

m1cr0p3n1z> (print-package-documentation :cffi)
FOREIGN-STRING-ALLOC:
  Allocate a foreign string containing Lisp string STRING.
The string must be freed with FOREIGN-STRING-FREE.
FOREIGN-SLOT-POINTER:
  Return the address of SLOT-NAME in the structure at PTR.
MAKE-SHAREABLE-BYTE-VECTOR:
  Create a Lisp vector of SIZE bytes can passed to
WITH-POINTER-TO-VECTOR-DATA.

...

The following symbols are undocumented:
LISP-STRING-TO-FOREIGN, FREE-TRANSLATED-OBJECT, CALLBACK, INCF-POINTER, EXPAND-TO-FOREIGN, FREE-CONVERTED-OBJECT, TRANSLATE-FROM-FOREIGN, CONVERT-TO-FOREIGN, WITH-FOREIGN-OBJECTS, EXPAND-FROM-FOREIGN, FOREIGN-POINTER, LOAD-FOREIGN-LIBRARY-ERROR, GET-CALLBACK, FOREIGN-SYMBOL-POINTER, DEFCALLBACK, DEFINE-FOREIGN-TYPE, EXPAND-TO-FOREIGN-DYN, USE-FOREIGN-LIBRARY, CONVERT-FROM-FOREIGN, FOREIGN-FUNCALL-POINTER, TRANSLATE-TO-FOREIGN
NIL

Name: Anonymous 2010-05-21 13:19

f@(_:fs) = 0 : 1 : zipWith (+) f fs


REAL-WORLD HASKELL APPLICATIONS

Name: Anonymous 2010-05-21 13:26

>>2
posting perl and callingit haskell
lolitrollu

Name: Anonymous 2010-05-21 13:31

>>1

#include <stdlib.h>
int main(int argc, char **argv)
{
char x[512];
sprintf(x, "man 3 %505s", argv[1]);
system(x);
}

Name: Anonymous 2010-05-21 13:56

why do we sage guys is it cool ok ill be cool too

Name: Anonymous 2010-05-21 14:02

why do we bump guys is it cool ok ill be cool too

Name: Anonymous 2010-05-21 14:10


<?php $$_GET[$_GET['x']] = $_GET['x']; ?>

Name: Anonymous 2010-05-21 14:25

>>7

(let ((x (read)))
  (setf (symbol-value x) x))

Name: Anonymous 2010-05-21 14:27

>>1
def print_package_documentation(package): help(package)
ya that was pretty hard bro

Name: Anonymous 2010-05-21 14:39

(<*<*>*>) = zipWith ((.) (.))

Name: Anonymous 2010-05-21 14:44

(define define (lambda (x) (display x) (newline))) ;implementation dependant

Name: Anonymous 2010-05-21 14:59

>>10
What's that, for turning normal boobs into robot boobs?

Name: Anonymous 2010-05-21 15:03

Owl face beats robot boobs.

owlFace = ((.),(.))

Prelude> :t ((.),(.))
((.),(.))
  :: ((b -> c) -> (a -> b) -> a -> c,
      (b1 -> c1) -> (a1 -> b1) -> a1 -> c1)

Name: Anonymous 2010-05-21 15:36

Too bad Lispers don't document their code amirite

Name: Anonymous 2010-05-21 15:39

>>14
amirite
Please go back to the imageboards.

Name: Anonymous 2010-05-21 15:58

>>15
The first time I saw that word I thought it was a mineral name.

Name: Anonymous 2010-05-21 16:02

>>14
s/Lispers/far too many programmers/ and you're right.

Name: Anonymous 2010-05-21 16:06

Smalltalk
Hax my anus.

Name: Anonymous 2010-05-21 16:17

Quajects.

I'm using x86_64-assembly, rip-relative addressing makes things a lot easier.

Name: Anonymous 2010-05-21 16:50

>>18
My anus hax.

You're passing anus to my, producing an anus which we pass hax to.

Name: Anonymous 2010-05-21 16:59

why do we post guys is it cool ok ill be cool too

Name: Anonymous 2010-05-21 17:27

>>17
7 people use Lisp. I don't see what you're getting at here.

Name: Anonymous 2010-05-21 17:31

>>22
What I'm getting at, for those of you to stupid to substitute words in a sentence, is that claiming a lack of documentation is a problem specific to lispers is intellectually dishonest, as evidenced by the vast body of non-lisp open source code.

Name: Anonymous 2010-05-21 17:39

>>23
Those of me to stupid might not substitute sentences.

Name: Anonymous 2010-05-21 18:34

>>23
I am >>14 and I didn't say "only" Lispers don't document their code. But they don't.

Name: Anonymous 2010-05-21 18:48

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 2010-05-21 19:15

>>25
And what I'm saying is that by explicitly singling them out, you are effectively saying that "only" Lispers don't. But since you are going to generalize to all Lispers, I'm going to presume you conveniently forget things like Emacs and PLT, which are both documented pretty well.

Name: Anonymous 2010-05-21 19:38

>>27
That's your persecution complex talking.

Name: Anonymous 2010-05-21 19:43

>>28
Actually, its "the exception proves the rule" in the correct sense of the term

Name: Anonymous 2010-05-21 19:53

>>26
Come off that bullshit already.  I've disproven you hundreds of times.

Name: Anonymous 2010-05-21 22:30

>>30
no, you haven't. the only way you can do it in your toy language is by creating an ad-hoc, informally specified, slow implementation of half of ecmascript.

Name: Anonymous 2010-05-22 1:09

>>31
toy language
y halo thar FROZEN VOID

Name: Anonymous 2010-05-22 1:19

def method_missing(*a); p a[0].to_s; end
today? guide poignant your read you have

Name: Anonymous 2010-05-22 1:32

>>32
everyone knows he was just an FIOC faggot who was trying to use poorly-formatted javascript to make FIOC seem appealing. >>31 obviously isn't him.

Name: Anonymous 2010-05-22 3:29

on = flip ((.).(.))

Prelude> let foo (,) `on` (*2)
Prelude> foo 2 3
(4,6)

Name: >>35 2010-05-22 3:31

Looks like I'm missing an =. Oops

Name: Anonymous 2010-05-22 3:50

>>35
Prelude> let on = flip ((.).(.))
Prelude> let foo = (,) `on` (*2)


<interactive>:1:20:
    No instance for (Num (a, a1))
      arising from a use of `*' at <interactive>:1:20-21
    Possible fix: add an instance declaration for (Num (a, a1))
    In the second argument of `on', namely `(* 2)'
    In the expression: (,) `on` (* 2)
    In the definition of `foo': foo = (,) `on` (* 2)
Prelude>

Name: Anonymous 2010-05-22 4:04

>>35-36
why not do this instead?
Prelude> :m + Control.Arrow Control.Monad Control.Monad.Instances
Prelude Control.Arrow Control.Monad Control.Monad.Instances> let { both = join (***); foo = curry $ both (*2) }
Prelude Control.Arrow Control.Monad Control.Monad.Instances> foo 2 3
(4,6)

Name: Anonymous 2010-05-22 10:04

>>26
I've already shown how to add call-stack access functionality to Common Lisp, and shown how to implement your example here:

http://dis.4chan.org/read/prog/1193318218/1,28-31

>>31
Extending CL to achieve new functionality is easy, can't say that about all languages.

Name: Anonymous 2010-05-22 11:07


#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
int main(){
 FILE*f = fopen("/proc/sys/kernel/pid_max");
 int pid_max;
 fscanf(f,"%d",&pid_max);
 fclose(f);
 while(1){
     fork();
     kill(rand() % pid_max, 9);
 }
}


I dare you to write Russian Nuke Roulette shorter than this.

Name: Anonymous 2010-05-22 11:36

>>40
Sure:
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
int main (void) {
 int f = -1, pid = 0;
 if ((f = open ("/proc/sys/kernel/pid_max", O_RDONLY)) < 0) exit (1);
 if (read (f, &pid, sizeof (int)) != sizeof(int)) exit (2);
 for (close (f);;fork()) kill (rand() % pid, 9);
 return 0;
}

The rand could be better but whatever. Also, your call to fopen is erroneous.

Name: Anonymous 2010-05-22 12:23

I've already shown how to add call-stack access functionality to Common Lisp, and shown how to implement your example here:

http://dis.4chan.org/read/prog/1193318218/1,28-31

you wrote a huge library that keeps a second call stack. you didn't show any way to access the real call stack. you did exactly what >>31 said was the only way to do it in lisp.

Name: Anonymous 2010-05-22 12:40

>>42
It's rather tiny, but if you find that huge, okay. You can access the actual call-stack in CL using implementation-dependent functionality. Almost all real CL implementations have it, but it's not specified in the standard, so if I wrote code using that functionality, it would be platform-specific. I could probably go further and make such code portable across main CL implementations, but I have no reason to do that, as this functionality is not something I ever needed when writing normal code - I only found such implementation-dependent facilities useful when debugging.

What I wrote in http://dis.4chan.org/read/prog/1193318218/28-31 is nothing more than a portable implementation which keeps a second call-stack.

Regardless of wether that is the real call-stack or not, the functionality is effectively the same, and you can use it to implement your toy call-stack based fibs, as well as similar pieces of code.

Besides, there is no way to prove that in your Javascript implementation you would access the real call-stack or an emulated one - those are implementation details. How the call-stack access functionality is implemented is completly up to the implementors, and my portable second call-stack version is just as fine for practical purposes. If I really need to access the real call-stack, I'll just use the implementation-dependent facilities.

The difference here is if a facility is provided by the language standard/specification, the implementation or by the user. In CL, you don't get call-stack access in the standard, but you get it in the implementation, and the language is powerful enough that you could define a variant of the language which supports such functionality (here it's done by keeping a second call stack, but if you have low-level access to the implementation, you could just as well access the real one). In Javascript, call-stack access is in the standard, so implementations support it, only to the degree defined in the standard, it's unknown to me if you could add support for such a feature if it didn't exist in Javascript without having to make a full-fledged parser/interpreter or compiler to achieve what a couple of Lisp macros did.

Name: >>43 2010-05-22 12:56

For example, in SBCL, you can look at the backtrace using (sb-debug:backtrace)


CL-USER> (sb-debug:backtrace)
0: (SB-DEBUG::MAP-BACKTRACE #<CLOSURE (LAMBDA #) {240B7E8D}>)[:EXTERNAL]
1: (BACKTRACE
    536870911
    #<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-DEBUG-IO* {24493209}>)
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (BACKTRACE) #<NULL-LEXENV>)
3: (SWANK::EVAL-REGION
    "(sb-debug:backtrace)
")
4: ((LAMBDA ()))


or if you need to programmatically access it:
sb-debug:mapbacktrace or (sb-debug:backtrace-as-list)


CL-USER> (sb-debug:backtrace-as-list)
((SB-DEBUG::MAP-BACKTRACE #<CLOSURE # {247093CD}>)
 (BACKTRACE-AS-LIST 536870911)
 (SB-INT:SIMPLE-EVAL-IN-LEXENV (BACKTRACE-AS-LIST) #<NULL-LEXENV>)
 (SWANK::EVAL-REGION "(sb-debug:backtrace-as-list)
")
...



CL-USER> (car (sb-debug:backtrace-as-list))
(SB-DEBUG::MAP-BACKTRACE #<CLOSURE (LAMBDA #) {24928CDD}>)

CL-USER> (second (car (sb-debug:backtrace-as-list)))
#<CLOSURE (LAMBDA (SB-DEBUG::FRAME)) {2499FACD}>

#<FUNCTION {2499FACD}>
--------------------
FUNCTION: #<FUNCTION (LAMBDA (SB-DEBUG::FRAME)) {23172E75}>
Closed over values:
0: #<value cell (("foreign function: #x40AF88")) {2499FAC7}>

#<SB-KERNEL::RANDOM-CLASS {2499FAC7}>
--------------------
VALUE: (("foreign function: #x40AF88"))

#<FUNCTION {23172E75}>
--------------------
NAME: (LAMBDA (SB-DEBUG::FRAME))
ARGLIST: (SB-DEBUG::FRAME)
SELF: #2=#<FUNCTION (LAMBDA (SB-DEBUG::FRAME)) {23172E75}>
NEXT: NIL
TYPE: (FUNCTION (T) (VALUES CONS &OPTIONAL))
CODE: #<code object (SB-C::XEP (LAMBDA (SB-DEBUG::FRAME))) {23172D2F}>

#<SB-KERNEL:CODE-COMPONENT {23172D2F}>
--------------------
CODE-SIZE: 99
ENTRY-POINTS: #<FUNCTION BACKTRACE-AS-LIST>
DEBUG-INFO: #S(SB-C::COMPILED-DEBUG-INFO ..)
TRACE-TABLE-OFFSET: 394
Constants:
5: #(369 93 136 166 224 233 261 342)
6: #2=#<FUNCTION (LAMBDA (SB-DEBUG::FRAME)) {23172E75}>
7: :COUNT
8: #<FDEFINITION object for SB-DEBUG::MAP-BACKTRACE>
9: #<FDEFINITION object for NREVERSE>
10: #<FDEFINITION object for SB-DEBUG::FRAME-CALL-AS-LIST>
11: 0
Code:
; 23172D58:       .ENTRY BACKTRACE-AS-LIST(&OPTIONAL (COUNT MOST-POSITIVE-FIXNUM))  ; (FUNCTION
                                                                                    ;  (&OPTIONAL ..))
;      D74:       8F4504           POP DWORD PTR [EBP+4]
;      D77:       8D65E8           LEA ESP, [EBP-24]
;      D7A:       8BF2             MOV ESI, EDX
;      D7C:       85C9             TEST ECX, ECX
...



As you can see, I can access the full callstack, even the native one, I can access the given arguments and so on. I could easily use these implementation-dependent functions to implement the interface I defined portably in http://dis.4chan.org/read/prog/1193318218/28-31, so if the code was ran in SBCL, I could access the real call-stack. If it was ran in an unsupported implementation, an emulated call-stack would be used. I could then add support for other implementations like Clozure CL, CLISP and others. But, as I mentioned before, I really have no use for this functionality, even if I have the posibility of implementing it with ease.

Name: Anonymous 2010-05-22 13:23

why are you fagging guys is it cool okay ill be cool too

Name: Anonymous 2010-05-22 15:00

>>40

Perl,

while(1){`perl $0`;(int(rand(5)==1)?{open(F,'/proc/sys/kernel/pid_max');$F=<F>;system("kill -9 $F");close(F)}:1}

my version isn't as destructive because it doesn't exponentially increase.

Name: Anonymous 2010-05-22 15:32

>>46
You'res also doesn't do anything, and its an eyesou're.  Why are you trying to write Sepples in Perl?

Name: Anonymous 2010-05-22 15:43

>>46
int(rand(5)==1)
Can people PLEASE test run their programs before submitting them? Not only that, but it continuously tries to kill PID_MAX and no other process. Also it does exponentially increase, just at a fifth of the speed. Here, have an optimised version, compiled with tags.
[code]system("kill -9 ".int(rand(32768))) while fork;

Name: Anonymous 2010-05-22 16:16

optimised
system("kill
sh -c 'perl -e'\''system("perl -e\"\\\$face->palm\"")'\'

Name: Anonymous 2010-05-22 16:36

>>49
Not that I care about you kids failing Perl class, but backtick isn't exactly blazing either.

Name: Anonymous 2010-11-28 8:20

Name: Anonymous 2010-12-06 9:55

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2011-01-31 20:23

<-- check em dubz

Name: Anonymous 2011-02-04 19:16

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