Fun idea. Let's make our own programming language.
Conditions:
Must be somewhat useful like ABC.
Not limited to characters only. Can include words.
1 function per post.
Name:
Anonymous2008-08-15 9:48
wtf crack dat shit nigger
Name:
Anonymous2008-08-19 12:44
bump. keep em coming. :)
Name:
Anonymous2008-08-19 12:56
(goaway <line>) ; gets rid of <line>
(pleasecomeback <line>) ; May get the previously gotten rid of line back at position <line>, maybe not.
(iloveyou <line>) ; Copies <line> if called once, removes the whole subroutine if called twice.
(copypasta sha1_hash) - returns sjis art/copypasta/etc. the implementation should recurse through a folder of copypasta provided with the distro as well as a user's .copypasta/ directory.
(ircd port) - starts an ircd listening on the given port
(thread id) - fetches thread id from /prog/. the returned thread object formats itself when printed and has methods to print individual posts.
Name:
Anonymous2008-09-15 16:53
IN B4event
event trapping/handling
including errors, intervals &stuff KTHX
EXPERT PROGRAMMER
assembly program KTHX
I EETEDvar # or proc
nulls var/proc - integers/floats/whatsit set to 0, strings set to "", procs set to "end".
DO NOT WANTvar # or proc
clears var completely, including pointers. I EETED does this to booleans.
PROCproc CONSIDERED HARMFUL
stops any execution of proc, and future attempts at execution produce errors
VARvar CONSIDERED HARMFUL
for vehemently disusing variables
And, of course, attempts to use elements that are CONSIDERED HARMFUL, would be one of the events trapped by IN B4.
Name:
Anonymous2008-09-15 16:57
And of course, the space before /code just has to be removed, making the code look even uglier than intended!
(print (map (lambda (x) (x.upper)) 'This is the language of my dreams; the forcibly Lisped language Lython... Lisp syntax, Python semantics, object system and library.'))
Name:
Anonymous2008-09-15 20:05
>>88
Ew, extra paren after x.upper, sorry. No parens matching in browser.
Another example:
(for x (xrange 1 11)
(for y (xrange 1 11)
(print (% '%4d' (* x y)))))
As you can see, filthy statements are turned into beautiful expressions.
Name:
Anonymous2008-09-15 20:20
>>89
Wait. let's reserve ', ` and company for quote, quasiquote and company macros. Strings could be represented with " and nestable Tcl or Perl-like quotes with braces. Dictionaries and sets specified as (dict (k1 v1) ...) and (objectset e ...). . and [] should be advanced macro shorthands for get/set!, which in turn are macros for the actual double-underscore methods that get called behind the scenes. Variables are defined with (def var value) and rebound with (= var value) (a slight change from Python's semantics for better closures); use (== item ...) to compare. All filthy statements are now expressions and return the last evaluated value (e.g. the value of the last expression in the last iteration of a while loop). Lambdas are, thus, as powerful as defs. Tail-call elimination is guaranteed to happen.
This would probably be Guido's worst nightmare. And this is exactly what he'd need to do to the language; perhaps minus the Lisp syntax.
>>90
print is already a function in python 3.0, you can already do assignment without a var=value statement by setattr() and locals() (or even globals()), for and while loops aren't functional anyway, and the rest is just differences of syntax.
Name:
Anonymous2008-09-16 14:06
>>91
Python does need a better syntax to create multi-line closures. I think I remember hearing about a PEP to have a Ruby-like syntax for it (albeit with FIOC) though I don't know how well it went over.
Name:
Anonymous2008-09-16 18:12
>>90
Guido hates folds. "So now reduce(). This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly.
>>101 The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.1
>>103
Do it yourself. If you don't know how, RTFM.
Name:
Anonymous2008-09-17 9:27
Update:
LISP: Jump to the beginning of the stack
ifeelkindabadaboutit:(: Terminate program
>>X: Marks a line
goto considered harmful: Jump to mark >>X
Leah Culver: generating a random number between 0-100 and putting it on the stack
pee: increments top of stack
shit: decrement top of stack
(my-other [number] is-a [number]): Swap two positions of the stack
The Sussman: deletes stack
rape: pop stack
penis: push stack
(factor x): instantly returns the prime factors of x.
CFLAGS JUST KICKED IN YO: Replace next command with a random command.
DONTHELPHIM: Skip next command.
(goaway <line>) ; gets rid of <line>
(pleasecomeback <line>) ; May get the previously gotten rid of line back at position <line>, maybe not.
(iloveyou <line>) ; Copies <line> if called once, removes the whole subroutine if called twice.
IN B4event
event trapping/handling
including errors, intervals &stuff
KTHX
EXPERT PROGRAMMER
assembly program
KTHX
I EETEDvar # or proc
nulls var/proc - integers/floats/whatsit set to 0, strings set to "", procs set to "end".
DO NOT WANTvar # or proc
clears var completely, including pointers. I EETED does this to booleans.
PROCproc CONSIDERED HARMFUL
stops any execution of proc, and future attempts at execution produce errors
VARvar CONSIDERED HARMFUL
for vehemently disusing variables
And, of course, attempts to use elements that are CONSIDERED HARMFUL, would be one of the events trapped by IN B4.
Keep it going. :)
And we still need to homogenize the commands.
>>91 you can already do assignment without a var=value statement by setattr() and locals() (or even globals())
Sucks
for and while loops aren't functional anyway
But it's far nicer and more expressive to have them as first-class syntax. The whole statements thing is utterly retarded. And Python doesn't have tail-call elimination so either you do it with a decorator (which is going to be slow) or you use loops.
the rest is just differences of syntax
Making everything an expression so that you can do it from lambda is a big difference and improvement. Then you have homoiconicity, which alone makes my thing worth implementing.
>>92
def is a multi-line closure. But it's not anonymous, nor an expression.
>>93
Guido hates FP altogether. He wants to add just the bare minimum of support for it to Python so that we don't run away somewhere else, but he's never been an enthusiast about it. I think he's just being stupid here. Also, I can't believe the person who designed Python (which did otherwise a pretty good job) can't deal with folds like that. He was just being an asshole.
>>112 def is a multi-line closure.
Oh shit, I didn't know that. I'll have to putter around with that a bit -- I didn't know the parent environment was preserved.
Sage due to lack of additional constructiveness.
Name:
Anonymous2008-09-21 8:55
keep em coming. :)
Name:
Anonymous2008-09-21 9:53
>>113
Upon rereading my post, I realize that it looked as if I was saying by making everything an expression the language becomes homoiconic. Of course it doesn't. The first sentence said what a big improvement would no statements be. The second sentence meant beyond that, another good thing is homoiconicity, which my thing in >>90 featured.