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

Post Code

Name: Anonymous 2011-03-04 21:33

One recurring complaint is that nobody talks about code on /prog/. So everyone write go and write some code, any code, that does something, anything, and post it. A small explanation wouldn't go amiss either.

Name: Anonymous 2011-03-17 18:41

>>160
Nobody can read this line noise. Either release the source code to your DSL (documentation would also be nice) or stop trolling.

Name: >>161 2011-03-17 18:42

Oh, and if the implementation exists, go ahead and post the generated CL code of >>160

Name: Anonymous 2011-03-17 18:50

>>162

((LAMBDA (#:|\|t\|14770|)
   ((LAMBDA (#:|\|t\|14769|) (FC |st|::|*\|st\|identity*| NIL))
    (LOCALLY
     (DECLARE (SPECIAL |st|::|*\|st\|playMusic*|))
     (SETQ |st|::|*\|st\|playMusic*| #:|\|t\|14770|))))
 (NAMED-FN |st|::|\|st\|playMusic| (#:|\|t\|2010|)
           ((LAMBDA (#:|\|t\|14836|)
              (FC |st|::|*\|st\|vars*|
                  (LAMBDA (#:|\|t\|14835|)
                    ((LAMBDA (#:|\|t\|14834|)
                       ((LAMBDA (#:|\|t\|14832| #:|\|t\|14833|)
                          ((LAMBDA (#:|\|t\|14832| |st|::|\|st\|race|)
                             ((LAMBDA (#:|\|t\|14822|)
                                (FC |st|::|*\|st\|dataPrefix*|
                                    (LAMBDA (#:|\|t\|14831|)
                                      (FC |st|::|*\|st\|aest*|
                                          (LAMBDA (#:|\|t\|14826|)
                                            (FC |st|::|*\|st\|aest*|
                                                (LAMBDA (#:|\|t\|14830|)
                                                  (FC |st|::|*\|st\|conc*|
                                                      (LAMBDA
                                                          (#:|\|t\|14829|)
                                                        (FC
                                                         |st|::|*\|st\|asStr*|
                                                         (LAMBDA
                                                             (#:|\|t\|14828|)
                                                           (FC
                                                            |st|::|*\|st\|aest*|
                                                            (LAMBDA
                                                                (#:|\|t\|14827|)
                                                              (FC
                                                               |st|::|*\|st\|conc*|
                                                               (LAMBDA
                                                                   (#:|\|t\|14825|)
                                                                 (FC
                                                                  |st|::|*\|st\|asStr*|
                                                                  (LAMBDA
                                                                      (#:|\|t\|14824|)
                                                                    (FC
                                                                     |st|::|*\|st\|ls*|
                                                                     (LAMBDA
                                                                         (#:|\|t\|14823|)
                                                                       (FC
                                                                        (LAMBDA
                                                                            (#:|\|t\|14821|)
                                                                          (FC
                                                                           |st|::|*\|st\|keep*|
                                                                           (LAMBDA
                                                                               (#:|\|t\|14785|)
                                                                             (FC
                                                                              |st|::|*\|st\|rand*|
                                                                              (LAMBDA
                                                                                  (#:|\|t\|14784|)
                                                                                ((LAMBDA
                                                                                     (#:|\|t\|2010|
                                                                                      #:|\|t\|14739|)
                                                                                   ((LAMBDA
                                                                                        (#:|\|t\|14771|)

Name: Anonymous 2011-03-17 18:59

read SICP

Name: Anonymous 2011-03-17 19:11

I think >>162 just got fucking told.

On another note, what the fuck (>>163).

Name: >>161 2011-03-17 19:15

>>165
This at least shows that the implementation may exist (I'm not entirely convinced as >>163 does seem to miss some strings, but I can imagine those strings being stored in some of those gensyms or whatever - there's too many functions referenced there to which we have no access to actually guess if it's real or not). I still won't retract my view that the ``in LISP'' guy is not a troll unless he decides to post the full implementation of his DSL.

Name: Anonymous 2011-03-17 20:01

>>166
He is a troll. What you are really trying to determine is whether the DSL has an implementation.

Name: Anonymous 2011-03-17 21:14

>>163
BLOATALERT!

STOP USING THAT DSL IT WILL BLOAT YOUR CODE!

Name: Anonymous 2011-03-18 5:14

IMM' NOT TELLING TYUO MY POSTCODE!!!!!!!

Name: Anonymous 2011-03-18 5:56


print("hello. Parenthesis are killing me. Avenge me and fuck Guido")

Name: Anonymous 2011-03-18 6:00

>>170
I was a good change. They threw reduce into a separate module and added parenthesis to print. Now it's really more Lispy.

Name: Anonymous 2011-03-18 6:22

The 3000 changelog made me go "how could they have had that in a language in the first place?" and "how much of this insanity is still left in the language?" with regards to the mental things they removed from python2.
Also, the things that were introduced made me think "but this still isn't a proper language"

Name: Anonymous 2011-03-18 9:07

>>171
I'll not be trolled. I'll not be trolled. I'll not be trolled. Fuck, IHBT.

Name: Anonymous 2011-03-18 11:37

'first', /f??st/.

Motherfucker.

Name: Anonymous 2011-03-18 11:59

>>174

cat English.dict | grep -E "^f..st$"

feast
fiest
first
foist
frost

Name: Anonymous 2011-03-18 12:08

[n for n in range(100) if n%2==0]

Name: Anonymous 2011-03-18 12:12

>>175
cat | grep

thx i lol'd

Name: Anonymous 2011-03-18 12:19

>>177
IHBT.

Name: Anonymous 2011-03-18 12:19

alias curiosity='kill cat'

Name: Anonymous 2011-03-18 12:23

>>178

No, really.

Why you do that?

Name: Anonymous 2011-03-18 12:25

>>176

[n for n in range(0, 100, 2)]

Name: Anonymous 2011-03-18 12:29


#!/usr/bin/python
#!/usr/bin/env python

import os
import subprocess
import sys
import StringIO

def cmdtolist(str):
    cmdlist=[]
    current=[]
    gc=''
    last=''
    for c in str:
        if (c == '\\'):
            pass
        elif (last == '\\'):
            current.append(c)
        elif (gc != ''):
            if (c != gc):
                current.append(c)
            else:
                gc=''
        else:
            if (c.isspace()):
                cmdlist.append(''.join(current))
                current = []
            elif (c == '"'):
                gc = c
            elif (c == "'"):
                gc = c
            else:
                current.append(c)
        last = c
    if (len(current) != 0):
        cmdlist.append(''.join(current))
    return cmdlist

def pipe(*cmds):
    def func():
        pass
    def norm(cmd):
        if (isinstance(cmd, str)):
            return cmdtolist(cmd)
        return cmd
    def pipeobj(cmd, stdin=None):
        if (callable(cmd)):
            fp = Fpipe(cmd, stdin)
            fp.call()
            fp.stdout.seek(0)
            return fp
        if (stdin is None):
            return subprocess.Popen(norm(cmd), stdout=subprocess.PIPE)
        else:
            return subprocess.Popen(norm(cmd), stdin=stdin, stdout=subprocess.PIPE)
    if (len(cmds) == 0):
        return
    prev = None
    for cmd in cmds:
        if (prev is None):
            prev = pipeobj(cmd)
        else:
            prev = pipeobj(cmd, stdin=prev.stdout)
    return prev.stdout

class Fpipe:
    def __init__(self, fn, stdin=None):
        self.fn = fn
        self.stdin = stdin
        self.stdout = StringIO.StringIO()
    def call(self):
        self.fn(self.stdin, self.stdout)

Name: Anonymous 2011-03-18 12:31

>>181
What is this, Common Lisp?

Name: Anonymous 2011-03-18 12:33

this used to scrape photos
don't know if it works anymore

#!/bin/bash
echo go to 'http://www.facebook.com/profile.php?id=[fb_uid]&sk=photos' and get a tagged photo thumbnail list
echo download it to $PWD/profile.php
echo hit enter
read
echo "<html><body>" > index.html
cat profile.php | \
  sed -e '/data-src/!d;s/title=/\n/g'| \
  perl -pe 's|.*data-src.*(http:.*?)\"><i st.*|\1|' | \
  tr -d '\'| \
  egrep '^ht' | \
  sed 's/photos-./sphotos/;s/_a.jpg/_n.jpg/' | \
  sed 's/\(.*\)/<img src="\1" \/><br \/>/'  \
  >> index.html
echo "</body></html>" >> index.html
echo $PWD/index.html written, open it in your browser

Name: Anonymous 2011-03-18 12:36

>>183
That's the forced indentation of code.

Name: Anonymous 2011-03-18 12:39

>>184
perl -pe
Wtf. Why not to write it entirely in Perl then?

Name: Anonymous 2011-03-18 12:42

>>186
Would make more sense to write it entirely in sed, since none of that is doing anything more complex than handling one line at a time

Name: Anonymous 2011-03-18 12:43

>>181
Useless list comprehension detected.
list(range(0, 100, 2))

Name: Anonymous 2011-03-18 12:45

>>188
))
Lisp detected.

Name: Anonymous 2011-03-18 12:52

>>189
That would be:
(range 0 100 #:by 2)

Name: Anonymous 2011-03-18 12:55

>>190
; in: LAMBDA NIL
;     (RANGE 0 100 #:BY 2)
;
; caught WARNING:
;   undefined variable: #:BY
;
; caught STYLE-WARNING:
;   undefined function: RANGE
;
; compilation unit finished
;   Undefined function:
;     RANGE
;   Undefined variable:
;     #:BY
;   caught 1 WARNING condition
;   caught 1 STYLE-WARNING condition

debugger invoked on a UNBOUND-VARIABLE in thread #<THREAD
                                                   "initial thread" RUNNING
                                                   {AA89701}>:
  The variable #:BY is unbound.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((LAMBDA ()))
0]

Name: Anonymous 2011-03-18 12:57

>>191
You said ``Lisp'', not ``Common Lisp''.
> (range 0 100 #:by 2 #:map (λ (x) (/ x 2)) #:filter even?)
'(1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49)

Name: Anonymous 2011-03-18 13:06

>>190,192
(iota 0 50 2) ;; portable

Name: Anonymous 2011-03-18 13:14

>>177
wow fuck you you cock sucking faggot

I *always* use cat to pipe things into grep and wc and sed and whatever the fuck else. So eat shit and die. I fucking hate you

Name: Anonymous 2011-03-18 13:18

>>194 is the kind of programmer that does return bar >>= foo rather than foo bar

Name: Anonymous 2011-03-18 13:19

>>194

Wow shut up nerd I bet you cried like a bitch when your mother told you you couldnt suck her breasts anymore and you were like 15 years old when this happened making it even more pathetic fuck you kid you dont know me

Name: Anonymous 2011-03-18 13:21

>>193
iota isn't in CL, although defining it would be as trivial as something along these lines:
(defun iota (count &optional (start 0) (step 1))
  (loop repeat count for i from start by step collect i))

I just use LOOP, it works everywhere and has a lot of flexibility. At times I choose to use iter.

Name: Anonymous 2011-03-18 13:26

>>180
1. I often cat files before filtering them so I have the cat in my history so I just have to hit up.
2. It's easier to remove a single link from the pipeline.

Name: Anonymous 2011-03-18 13:33

>>196
ARE YOU FUCKING ANGRY FAGGOT? COME ON, SHOW ME YOUR FUCKING AUTISTIC RAGE NOW. WHY DON'T YOU GET THE FUCK BACK TO YOUR HUGBOX BEFORE I RAPE YOU IN THE ASS. OKAY YOU JUST FUQIN ANGERED AN COMPUTER NGER. GIVE ME BACK MY PASSWRD. AFAQKDJAKDJFAKFGAKGJ FUCK YOU SHIT BITCH TITS NAZI CANADA FUCKER. YOU STOLED MY PASSWORD!

Name: Anonymous 2011-03-18 13:39

>>199
Madd dogg

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