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

Perl6 thread

Name: Anonymous 2011-01-09 22:35

There are too many ways to do it.

The completely backwards way:

> sub foo(&f) { f() }
{ "hi".say }.&foo();
hi


On the other hand, closures are much nicer now (JavaScript needs this):
> say (1,2,3,4,5).reduce: { $^a + $^b };
15

Note about .reduce: it only supports binary functions.

A note on operators:
Hyperops, eg: (1,2,3,4) «+» (5,6,7,8)
These are permitted to auto-parallelize (implementation dependent.)
Lazy meta-ops, eg: 1,2,3,4 Z+ 5,6,7,8
These support lazy evaluation. The result is generated as needed.
Reduction meta-ops, eg: [+] 1,2,3,4,5
Triangular reduction: [code][\+] 1,2,3,4,5 # result is (1,3,6,10,15)[code]
These are basically .reduce(*[b][i]op[/i][/b]*) with the binary operator provided.

Name: Anonymous 2011-01-09 23:23

Jesus, this is crazier than even I expected

Name: Anonymous 2011-01-10 1:40

>>1
i liek perl6 cuz it reminds me so much of haskal hahahahahahahaha lol ^___^ i rly liek haskal (and i'm from /g/ hahaha nice to meet u haha lol hahahahaha lol)

Name: Anonymous 2011-01-10 2:25

>>1-
Do you understand why I say that Perl 6 has an operator for everything!, now?

Name: Anonymous 2011-01-10 6:02

say "hi";

Name: Anonymous 2011-01-10 10:14

>>4
I wouldn't go so far as to say it has an operator for everything, but it does have three operators for nothing:

{ ... }
{ !!! }
{ ??? }
(nullary, of course)

http://perlcabal.org/syn/S03.html

Name: Anonymous 2011-01-10 11:04

>>4
NB. whatever-star is not classified as an operator. I think it's classified as a type in the auto-currying form.

Name: Anonymous 2011-01-10 11:15

>>6
I praised the power of Perl's Yada Yada Operator many times.
It is actually useful:
1. Your sub function { ... } example codes will be actual VALID Perl 6 CODE.
2. When you're working on a complex function, you can implement part of it later, using The operator on that branch:
if (something) {
    ...; //TODO: we've got something, what to do?
} else {
  // Let me work on this first
}

3. It's cute.

>>7
I think it can be classified as meta-operator, like «»/»«.

Name: Anonymous 2011-01-10 11:18

>>6
The lol contextualizer

Name: Anonymous 2011-01-10 11:21

>>6
infix:<andthen>
It's not the same of Haska l's >>?

Name: Anonymous 2011-01-10 17:14

I for one would like to see the Hammer operator become more prominent.

--;

Name: Anonymous 2011-01-10 21:37

>>11

What does it do?

Name: Anonymous 2011-01-11 1:18

>>12
it mobilizes ur dorfs to reduce the preceding object by one unit after evaluation

Name: Anonymous 2011-01-11 1:25

These support lazy evaluation. The result is generated as needed.
No CSE, no sharing, just call-by-name.  Certain people fucking hate that myth that you can add some sort of primitively deferred computation to a strict applicative-order language and add "lazy evaluation" to your feature list.

Name: Anonymous 2011-01-11 1:45

>>14
Certain people need to get their heads out of their dog's ass.

Name: Anonymous 2011-01-11 2:38

>>15
U MENA HASKAL!

Name: Anonymous 2011-01-11 8:51

>>1
BSD vs System-V

Name: Anonymous 2011-01-11 8:52

>>17 fuck wrong thread

Name: Anonymous 2011-01-11 9:07

>>15
They did, after the said dog died ;_;

Name: Anonymous 2011-01-11 11:21

>>14
Take it up with Larry Wall. No really--you can, he hangs out on IRC all the time. And I don't mean that in the "go away" sense, I mean it in the We're doing The Whirlpool-Larry Wall sense, i.e. if you can make a good point about it the spec and implementation will be revised.

Name: Anonymous 2011-01-11 15:11

[fuck-off] >>1-20

Name: Anonymous 2011-01-11 15:50

if you can make a good point about it the spec and implementation will be revised.
I state that you are not a Perl programmer because you retain too much sanity, thus you are not eligible to participate in this discussion.

Name: Anonymous 2011-01-11 16:33

>>22
He obviously means »If you can show a cool one-liner that prints out `Just another Perl hacker,´«

Name: Anonymous 2011-01-11 23:41

>>22
Encouraging someone go visit IRC to be shot down by The Larry isn't exactly diagnostic of sanity (though it doesn't necessarily make one insane.)

One: there is a measure of call-by-need in Perl 6's lazy evaluation. Two: it is often an implementation detail according to the spec. Three: >>14 argues from some false sense of purity. Four: >>14 would throw out utility in order to promote that sense of utility. Five: Mr. Wall is very entertaining when he bursts peoples' respective bubbles.

Name: Anonymous 2011-01-11 23:56

>>24
It's called trolling, dipshit.

Name: Anonymous 2011-01-12 0:09

>>25
Don't take it so personal!!

Name: Anonymous 2011-01-12 5:39

Larry Wall is an awesome guy, and anybody who tells you otherwise is  DAMN EVIL LIAR and is probably jealous.  Ignore the rantings and ravings of JEALOUS, JEALOUS FAILURES.  The Ruby faggots, Guido, John McCarthy, Knuth, and the Jews have all been trying to take Larry Wall down for years but they can't because he's just too damn good.

Name: Anonymous 2011-01-12 6:02

>>24
It's misleading.  One would expect lazy evaluation to be, well, lazy evaluation, and not merely a nullary "thunk" that gets executed when "its value is needed".

Name: Anonymous 2011-01-12 8:17

Does perl 6 have nondestructive s///?

Name: Anonymous 2011-01-12 12:31

>>28
You might want to read up on it, because it sounds like you've got the wrong idea.

Name: Anonymous 2011-01-12 21:51

>>30
I don't know if a non-destructive version has been implemented yet, but I know f/e this works:

  my $a = "abcdef";
  my $b = $a.map: { ~~ s/a/z/; $_ }

  say $a; # abcdef
  say $b; # zbcdef

is copy is a great thing along similar lines:

sub foo($bar) { $bar = 'x' }; # error, read-only reference
sub foo($bar is rw) { $bar = 'x' }; # ok, rw reference
sub foo($bar is copy) { $bar = 'x' }; # ok, local copy

Name: Anonymous 2011-01-18 12:19

Recently seen on IRC (slightly modified):

subset Even of Int where * %% 2;
subset DivisibleByFour of Int where * %% 4;
say DivisibleByFour ~~ Even
    -> Bool::True


The type system is nicer than I thought.

Name: Anonymous 2011-01-18 12:49

>>29
Is it necessary?

Name: Anonymous 2011-01-18 12:52

>>32
    proto sub fib (Int $) {*}
    multi sub fib (Int $n where 0|1) { return $n }
    multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }

Name: Anonymous 2011-01-18 13:06

>>33
Perl 5 got it, apparently after much moaning.

>>34
I was hoping you'd pick up on the Halting-complete type system.

The above code is matching against the parent type. It's a bug or something, but %% 3 would have matched Even as well. I think the correct behaviour is that type comparisons should always result in False unless they are exactly equal or LHS is defined as a subset of RHS.

Name: Anonymous 2011-01-18 13:58

>>31
I still don't get the use of : ... for example on reduce or in assignments....

Anyone care to explain???

Name: Anonymous 2011-01-18 14:07

>>32
Oh god.

Name: Anonymous 2011-01-18 14:07

>>36
It's a placeholder.

Name: Anonymous 2011-01-18 14:12

>>36
It's the Yada Yada Operator. Means "not implemented, I'll do it later".

Name: Anonymous 2011-01-18 14:17

>>35
I was hoping you'd pick up on the Halting-complete type system.
I remember that in some version of Perl, simply parsing Perl code was not guaranteed to terminate.

Name: Anonymous 2011-01-18 14:20

>>31

Shit, sorry... i meant



:

Name: Anonymous 2011-01-18 14:26

>>41

Fuck, what's wrong with me

I meant >>36, and I meant the COLON : operator

Name: Anonymous 2011-01-18 15:32

>>42
I'd like to know that too.
It's especially weird since this seems to work fine:

sub testsub (&fun) {fun 1};

testsub &say      # => 1
testsub *.say     # => 1
testsub {$^a + 1} # => 1


So why do functions like map require the colon?

Name: Anonymous 2011-01-18 15:35

>>43
I meant to write testsub {say $^a} for the last one

Name: V15170R 2011-01-18 16:12

Here:

my $a = 5; my $b := $a; $b = 9; say $a;

That prints

9

:= binds $a and $b

Name: Anonymous 2011-01-18 16:15

>>43
They don't. It just saves you writing the parens.

@a.push(5) can be written as @a.push: 5

Name: V15170R 2011-01-18 16:17

From the IRC...

my @a; @a.push: 5 is the same as @a.push(5)

Name: Anonymous 2011-01-18 16:17

>>46,47

lol

Name: Anonymous 2011-01-18 16:19

>>46,47
There are n + 1 ways to do it.

Name: Anonymous 2011-01-18 16:20

These are this little things you like once you learn about them. It's nothing serious, it just looks pretty

Name: Anonymous 2011-01-18 16:22

>>46
Why can't you write it as @a.push 5 for methods like for normal functions?

In ruby for instance that works: [1,2,3].push 4

Name: Anonymous 2011-01-18 16:30

>>51
That'll result in something called TTIAR: Two terms in a row, forbidden by the standard grammar. But don't ask me about the rationale, I don't remember

Name: Anonymous 2011-01-18 16:38

>>52
What exactly is a term? I assume 'say' in 'say "foo"' is not a term then?

Name: Anonymous 2011-01-18 16:52

Name: Anonymous 2011-01-18 18:06

damn, perl6 is so cool.... we use a lot the Mod 11 Check Digit algorithm in my country for calculating the rut (the unique identifier for people in Chile)... now here is on one line!!!!!


my $rut = "1234567"; my $checksum = (0 .. 9,'K', 0)[ 11 - ( [+] $rut.split('').reverse <<*>> (2..7) ) % 11 ]; say $rut~'-'~$checksum;


Sauce:
http://en.wikipedia.org/wiki/MSI_Barcode#Mod_11_Check_Digit

Wanna test with other numbers?
http://joaquinnunez.cl/jQueryRutPlugin/generador-de-ruts-chilenos-validos.html

It has a bug, though. Does not work with, for example, "1", which should return "1-9". For real life applications is not important (such small rut numbers does not exists those days), but it's still a shortcoming.

Name: Anonymous 2011-01-18 19:03

APL is just a bunch of Perl 6 operators.

Name: Anonymous 2011-01-19 0:18

>>36
Are you talking about the colon, the ellipses, or $^a and the like?

The ^ is a secondary sigil (they call 'em 'twigils') which indicates the variable should be bound from arguments in roughly alphabetic order. So $^a gets the first argument, $^b gets the second and so on. They also serve to construct the signature:

{ $^a + $^b }.signature.perl.say
:(;; Mu $a, Mu $b)

... can be the sequence operator:
@a := 1, 4, 9 ... *; @a[5].say
16
Or yadda-yadda-yadda:
for ^10 { if $_ > 5 { ... } else { say "5 or less" } }

5 or less
5 or less
5 or less
5 or less
5 or less
5 or less


for ^10 { if $_ > 5 { ??? } else { say "5 or less" } }

5 or less
5 or less
5 or less
5 or less
5 or less
5 or less
Stub code executed


for ^10 { if $_ > 5 { !!! } else { say "5 or less" } }

5 or less
5 or less
5 or less
5 or less
5 or less
5 or less
Stub code executed


I don't think this behavior is quite spec, but IIRC ... is more or less silent, ??? is a warning, !!! is a die/exception.

The := in the sequence example is just variable binding (in this case, binding @a to the list generation instead of assigning the results to @a, which would never terminate normally.) In the reduce: call, the colon is an alternate form of providing arguments to a method call (note: this doesn't work on subs):
say (1,2,3,4,5).reduce: { $^a + $^b };
Is the same as:
say (1,2,3,4,5).reduce({ $^a + $^b });
It alleviates the ugliness of passing inline code as arguments. See also: whatever-star; this would also have worked:
(1,2,3,4,5).reduce(*+*);
Or even:
(1,2,3,4,5).reduce: *+*;

>>40
Yeah, there were some revelations about Perl 5's grammar at one point. It had to do with the semantics of the statement being relevant before it could be parsed.

>>51
You can for subs. The rules may seem a bit weird, but it makes sense. Without it, you would have a term (variable) followed by another term (variable) without an operator in between. That is bad for reasons that the grammar can answer. (It's also why grep {...} @list must be grep {...}, @list in Perl 6. Though you'd usually use a list expression, or the .grep method instead.

>>53
Generally speaking, I believe it is things that can be operated upon. Operators don't count (except when they do.)

Name: Anonymous 2011-01-19 0:36

>>55
my $rut = "1"; my $checksum = (0 .. 9,'K', 0)[ 11 - ( [+] $rut.split('').reverse >>*>> (2..7) ) % 11 ]; say $rut~'-'~$checksum;
IIUC that should fix it, but there seems to be a bug in Rakudo that is causing the evaluation to come out wrong for most numbers.

Name: Anonymous 2011-01-19 14:36

Name: Anonymous 2011-01-20 11:49

Name: Anonymous 2011-01-20 13:18

>>59
Shitty article, guy doesn't know Perl.

Name: Anonymous 2011-02-04 13:25

Name: Anonymous 2011-04-11 10:59

This code will show you the truth of Perl6


perl -e 'print "Perl6 has an operator for $_" foreach (qx[cat /usr/dict/words]);'

Name: Anonymous 2013-01-19 14:36

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Name: Anonymous 2013-06-04 9:20

bumping for interesting thread

Name: Anonymous 2013-06-04 9:23

checkem 6's

Name: Anonymous 2013-06-04 13:29

I prefer Perl5. There is no type.

Name: Anonymous 2013-06-04 15:57

>>1
Symta: say: [1 2 3 4 5] fold: A B => A+B

Perl:  say (1,2,3,4,5).reduce: { $^a + $^b };

Name: Anonymous 2013-06-04 15:59

Perl: https://github.com/perl6/std/blob/master/STD.pm6

Symta:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; READER

(defparameter  /base   nil)   ; beginning of input stream
(defparameter  /in     nil)   ; current position inside input
(defparameter  /src    nil)   ; source, from where input comes
(defparameter  /res    nil)   ; result
(defparameter  /row    nil)   ; current row
(defparameter  /col    nil)   ; current column
(defparameter  /off    nil)   ; current offset inside input
(defparameter  /last   nil)   ; last processed char

(to /error msg ! error "{/src}:{/row},{/col}: {msg}")

(to /top-char ! car /in)

(to /next-char
  ! c = (/top-char)
  ! if eq c #\newline
  ! ! do (setf /col 0)
         (incf /row)
  ! ! incf /col
  ! incf /off
  ! setf /last c
  ! setf /in (cdr /in)
  ! c)

(to /skip-ws
  ! c = (/top-char)
  ! cond
  ! ! find c '(#\space #\newline)
  ! ! ! (/next-char)
  ! ! ! (/skip-ws)
  ! ! and (eq c #\/) (eq (second /in) #\/)
  ! ! ! (/next-char)
  ! ! ! (/next-char)
  ! ! ! while and (/top-char) (not (eq (/top-char) #\newline))
  ! ! ! ! (/next-char)
  ! ! ! (/skip-ws)
  ! ! and (eq c #\/) (eq (second /in) #\*)
  ! ! ! (/next-char)
  ! ! ! (/next-char)
  ! ! ! o = 1
  ! ! ! while plusp o
  ! ! ! ! unless /in
  ! ! ! ! ! /error "`/*`: missing `*/`"
  ! ! ! ! a = (/next-char)
  ! ! ! ! b = first /in
  ! ! ! ! cond
  ! ! ! ! ! and (eql a #\*) (eql b #\/) :> (! (/next-char) ! decf o)
  ! ! ! ! ! and (eql a #\/) (eql b #\*) :> (! (/next-char) ! incf o)
  ! ! ! (/skip-ws)
  )

(to /take-prefix p
  ! rec r ys nil
  ! ! y = (/top-char)
  ! ! if funcall p y
  ! ! ! r (cons (/next-char) ys)
  ! ! ! nreverse ys)

(to /location match
  ! l = length match
  ! list
  ! ! list "Col" (- /col l)
  ! ! list "Off" (- /off l)
  ! ! list "Row" /row
  ! ! list "Src" /src)

(to /expect c
  ! if eq (/top-char) c
  ! ! (/next-char)
  ! ! /error "Expected `{c}`; Got `{or (/top-char) 'EOF}`")

(defmacro try ((var expr fail) &body body)
  `(! ,var = ,expr
    ! if eq ,var :fail
    ! ! ,fail
    ! ! do ,@body))

(to str-empty? o ! and (quote? o) (equal (second o) ""))

(to interp l e r ; interpolate expression into string
  ! l = (! if str-empty? l
         ! ! list "\"" e
         ! ! list "\"" l e)
  ! unless str-empty? r
  ! ! setf l (! if headed "\"" r
              ! ! q ''l ''(cdr r)
              ! ! q ''l ''(list r))
  ! l)

(to /read-string ic d s e
  ! l = nil
  ! while t
  ! ! c = (/top-char)
  ! ! unless eq c ic :> (/next-char)
  ! ! cond
  ! ! ! eq c #\\
  ! ! ! ! setf c (/next-char)
  ! ! ! ! cond
  ! ! ! ! ! eq c #\n :> push #\newline l
  ! ! ! ! ! eq c #\t :> push #\tab l
  ! ! ! ! ! eq c #\\ :> push #\\ l
  ! ! ! ! ! or (eq c #\n) (eq c ic) (eq c e) (eq c s) :> push c l
  ! ! ! ! ! eq c nil :> /error "EOF in string"
  ! ! ! ! ! or t :> /error "Invalid escape code: {c}"
  ! ! ! eq c s
  ! ! ! ! incf d
  ! ! ! ! push c l
  ! ! ! eq c e
  ! ! ! ! decf d
  ! ! ! ! if < d 0
  ! ! ! ! ! return-from /read-string (list "\\" (coerce (reverse l) 'string))
  ! ! ! ! ! push c l
  ! ! ! eq c ic ;interpolate
  ! ! ! ! try it (/term) (/error "`[`: missing argument")
  ! ! ! ! ! r = /read-string ic d s e
  ! ! ! ! ! return-from /read-string (interp (list "\\" (coerce (reverse l) 'string)) (cdr it) r)
  ! ! ! eq c nil :> /error "EOF in string"
  ! ! ! or t :> push c l
  )

(to /string
  ! case (/top-char)
  ! ! #\" (/next-char) (/read-string #[ 0 nil #\")
  ! ! #\' (/next-char) (/read-string #[ 0 nil #\')
  ! ! #\` (second (/read-string nil 0 nil (/next-char)))
  ! ! otherwise :fail)

(to /list &key r-op
  ! opening = (/top-char)
  ! op = (or r-op
             (find-if (fn (x) (eq (char x 0) opening))
                      '("()" "[]"))
             (return-from /list (/string)))
  ! ending = aref op 1
  ! row = nil
  ! col = nil
  ! setf row /row
  ! setf col /col
  ! unless r-op :> /expect opening
  ! rec r xs nil
  ! ! try x (/expr) (! if eq (/top-char) ending
                     ! ! (/next-char)
                     ! ! error "{/src}:{row},{col}: unclosed `{opening}`"
                     ;;! (meta-set (ns-set nil "Src" (/location nil)) xs)
                     ! xs = nreverse xs
                     ! when string= op "[]" :> setf xs (q "list" ''xs)
                     ! xs)
  ! ! ! r (cons x xs)
  )

(to hex-digit? x ! or (digit? x) (find x "abcdefABCDEF"))

(to /num
  ! cond
  ! ! digit? (/top-char)
  ! ! ! rec r i t
              ys nil
  ! ! ! ! y = (/top-char)
  ! ! ! ! cond
  ! ! ! ! ! and (eql y #\.) i (digit? (second /in)) :> r nil (cons (/next-char) ys)
  ! ! ! ! ! digit? y :> r i (cons (/next-char) ys)
  ! ! ! ! ! or t :> read-from-string (coerce (nreverse ys) 'string)
  ! ! eq (/top-char) #\#
  ! ! ! /expect #\#
  ! ! ! when eq (/top-char) #\{ :> return-from /num (list "#" (second (/list)))
  ! ! ! when /sym-body? (/top-char)
  ! ! ! ! s = coerce (/take-prefix #'/sym-body?) 'string
  ! ! ! ! when hex-digit? (aref s 0) :> return-from /num (read-from-string (concatenate 'string "#x" s))
  ! ! ! ! when string= s "yes" :> return-from /num :yes
  ! ! ! ! when string= s "no" :> return-from /num :no
  ! ! ! ! when string= s "void" :> return-from /num :void
  ! ! ! ! when string= s "head" :> return-from /num :head
  ! ! ! ! /error "`#{s}` is unexpected"
  ! ! ! /error "`#{(/top-char)}` is unexpected"
  ! ! or t :> :fail)

(to /delim
  ! (/skip-ws)
  ! c = assoc (/top-char) '((#\| :|\||) (#\: :|:|) (#\; :|;|))
  ! unless c :> return-from /delim (/list)
  ! (/next-char)
  ! second c)

(to /term
  ! (/skip-ws)
  ! x = (/top-char)
  ! if /sym-head? x
  ! ! coerce (/take-prefix #'/sym-body?) 'string
  ! ! try n (/num) (/delim)
  ! ! ! when /sym-head? (/top-char)
  ! ! ! ! setf n (list "*" n (/dot))
  ! ! ! n)

(defun left-curly () "{")
(defun curly-braces () "{}")

(to delim? x ! find x '(:|\|| :|:| "=" "=>") :test 'equal)

(to /op &rest ops
  ! (/skip-ws)
  ! c = (/top-char)
  ! when or (alpha? c) (digit? c) (not (find c ops))
  ! ! return-from /op :fail
  ! string (/next-char))

(defmacro /lop (name down &rest ops) ; left-biased op
  `(to ,name
     ! try a (,down) :fail
     ! ! rec r e a
     ! ! ! try o (/op ,@ops) e
     ! ! ! ! if string= o (left-curly)
     ! ! ! ! ! do
     ! ! ! ! ! ! xs = /list :r-op (curly-braces)
     ! ! ! ! ! ! when find-if #'delim? xs :> setf xs (list xs)
     ! ! ! ! ! ! r (q '(curly-braces) 'e ''xs)
     ! ! ! ! ! try b (,down) (/error "`{o}`: missing right operand")
     ! ! ! ! ! ! r (list o e b)))

(defmacro /rop (name down &rest ops) ; right-biased op
  `(to ,name
     ! try a (,down) :fail
     ! ! try o (/op ,@ops) a
     ! ! ! try b (,name) (/error "`{o}`: missing right operand")
     ! ! ! ! list o a b))


(defmacro /prop (name down &rest ops) ; prefix op
  `(to ,name
     ! try o (/op ,@ops) (,down)
     ! ! try a (,name) (/error "`{o}`: missing operand")
     ! ! ! if and (numberp a) (equal o "~") ;dangerous hack
     ! ! ! ! - a
     ! ! ! ! list o a))

(/prop /gs   /term #\^)
(/lop  /dot  /gs   #\. #\, #\{)
(/prop /pref /dot  #\~ #\\ #\$ #\! #\@ #\&)
(/lop  /mul  /pref #\* #\/ #\%)
(/lop  /add  /mul  #\+ #\-)

(to /expr ! (/add))

(to /line
  ! rec r xs nil
  ! ! try x (/expr) (! if-bind it (/top-char) (/error "Unexpected `{it}`")
                     ! nreverse xs)
  ! ! ! push x xs
  ! ! ! (/skip-ws)
  ! ! ! if and (eq /last #\newline) (not (eq (/top-char) #\|))
  ! ! ! ! nreverse xs
  ! ! ! ! r xs)

(to head-args? xs ! headed :head xs)
(to head-args-as-list xs ! if (headed :head xs) (cdr xs) xs)
(to list-as-head-args &rest xs ! q :head ''xs)

(to sioc xs ; processes symta indentation of code
  ! unless listp xs :> return-from sioc xs
  ! p = position-if #'delim? xs
  ! unless p
  ! ! unless headed :|\|| xs :> setf xs (mapcar #'sioc xs)
  ! ! return-from sioc xs
  ! text = elt xs p
  ! pref = subseq xs 0 p
  ! xs = subseq xs p (length xs)
  ! body = cdr xs
  ! zs = nil
  ! when equal text "=>" :> return-from sioc (sioc `("to" ,@pref :|:| ,@body))
  ! when equal text "=" :> return-from sioc (sioc `("my" ,@pref :|:| ,@body))
  ! when equal text :|:|
  ! ! pref = or pref '(:void)
  ! ! return-from sioc (sioc (q '(car pref) (:head ''(cdr pref)) '(sioc body)))
  ! while xs
  ! ! pop xs
  ! ! ys = nil
  ! ! while equal (car xs) :|\|| :> push (pop xs) ys
  ! ! while and xs (not (equal (car xs) :|\||)) :> push (pop xs) ys
  ! ! ys = nreverse ys
  ! ! if equal (car ys) :|\||
  ! ! ! push (append (pop zs) ys) zs
  ! ! ! push ys zs
  ! xs = map xs (nreverse zs) :> sioc xs
  ! if pref
  ! ! q '(car pref) (:head ''(cdr pref)) ''xs
  ! ! q do ''xs)

(to /read-toplevel xs src
  ! unless listp xs :> setf xs (coerce xs 'list)
  ! /src = src
  ! /base = xs
  ! /in = /base
  ! /off = 0
  ! /row = 0
  ! /col = 0
  ! /last = nil
  ! r = nil
  ! while /in
  ! ! l = (/line)
  ! ! when xs? l :> push (sioc l) r
  ! nreverse r)

(to /read xs ! first (/read-toplevel xs "<REPL>"))

Name: Anonymous 2013-06-04 16:14

>>69
You've managed to make a language uglier than Perl, congratulations.

Name: Anonymous 2013-06-04 16:17

>>69












               !

              !


  !
  !
  ! !

  ! !
  !
  !
  !
  !


  !
  !
  ! !
  ! ! !
  ! ! !
  ! !
  ! ! !
  ! ! !
  ! ! !
  ! ! ! !
  ! ! !
  ! !
  ! ! !
  ! ! !
  ! ! !
  ! ! !
  ! ! ! !
  ! ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! ! !                                 !              !
  ! ! ! ! !                                 !              !
  ! ! !



  !
  ! !
  ! !
  ! ! !
  ! ! !


  !
  !
  ! !
  ! !
  ! !
  ! !


  !
  ! !
  ! !


    !
    !
    ! !
    ! !

                 !


  !      !
         ! !
         ! !
  !
  ! !         !
              ! !
              ! !
  !


  !
  !
  ! !
  ! !
  ! !
  ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! !
  ! ! ! !
  ! ! ! !
  ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! !
  ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! !
  ! ! !



  !
  ! !
  ! !
  ! !
  ! !


  !
  !



  !
  !
  !
  !
  !
  !
  !
  ! !                !
                     ! !
                     ! !
                       !
                     !
                     !
                     !
  ! ! !


                 !


  !
  ! !
  ! ! !

  ! ! ! !
  ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! ! ! ! !
  ! !
  ! ! !
  ! ! !
  ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! ! !
  ! ! !
  ! !


  !
  !
  !
  !
  !


  !
  !
  !
  ! !
  ! !
  ! ! !
  ! ! ! !
  ! ! !




             !


  !
  !
  !
  ! !
  !



     !
     ! !
     ! ! !
     ! ! ! !
     ! ! ! ! !
     ! ! ! ! ! !
     ! ! ! ! ! !
     ! ! ! ! ! !
     ! ! ! ! !
     ! ! ! ! ! !



     !
     ! !
     ! ! !
     ! ! ! !




     !
     ! !
     ! ! !
     ! ! ! !
     ! ! ! !



                                 !



          !


  !
  ! !                !
                     !
  ! ! !
  ! ! !
  ! ! !
  ! ! ! !
  ! ! ! !

                  !
                         !
                               !


  !
  !
  !
  ! !
  ! !
  !
  !
  !
  !
  !
  !
  !
  !
  ! !
  ! !
  !
  ! !
  ! !
  ! !
  ! !
  ! !
  ! !
  ! ! !
  ! ! !
  !
  !
  ! !
  ! !


  !
  !
  !
  !
  !
  !
  !
  !
  !
  !
  ! !
  ! !
  !

             !

Name: Anonymous 2013-06-04 16:23

I still don't understand the purpose of the fucking !s, Jew. Must be a Jew thing.

Shalom, Nikita!

Name: Anonymous 2013-06-04 16:26

>>70>>71>>72

This talk is about why Perl 5 sucks (although Perl 6 became arguably worser, just it's grammar file is about 6500 lines: https://github.com/perl6/std/blob/master/STD.pm6).
- Abominable syntax: Perl's syntax is so non-orthogonal and hideous, it shades all other Perl warts (which are ugly). Perl's grammar isn't context free and can not be reduced to BNF. Perl's parser (perly.y) is 760 lines long (larger than C++ and Haskell), while the lexer (toke.c) is 11000 lines long, which gives a clue how many kludges Perl needs that the parser can't handle itself. Perl grammar is inherently ambiguous, and the resolved by using dodgy look-ahead heuristics. For example, is "print $f +$g" writing the positive value $g to the file $f, or printing ($f+$g) to STDOUT? Does `{ local $a => 1; ... "` start a scope block or a hash? Other example `f / 25 ; # / ; die "oops!";` can parse two different ways: if `f` takes no arguments, then first statement is a division in void context, and the rest of the line is a comment, otherwise it parses as a call to f() with the result of a match operator, then a call to die(). In general, Perl cannot be parsed, because Perl's syntax is undecidable: http://www.perlmonks.org/?node_id=663393
- Broken scoping: Perl doesn't require variables to be declared and just referencing a name introduces a variable, resulting into cluttered global scope and absence of undefined-variable warnings. Although Perl has my and local keywords, they are not enforced, so nobody uses them. All variables have to be prefixed with ugly $ @ % & sigils all time, just to disambiguate in case variable doesn't already hold a value. It is typical to see crazy code, like "my $fh = do {local(*FH);};", which creates a local typeglob named FH and immediately takes it out of scope, returning the now anonymous typeglob. Perl's broken scoping is a fundamental flaw, which cannot be fixed.
- Inconsistent type system: Perl implicitly coerces strings to integers, so "123abc"=="123def" and "  123xyz"==123, and even 0.0=="". Sigils everywhere make type system depend on scoping. No OOP encapsulation or overloading: Perl has a mess of unorganized global functions. Most typing mismatches, instead of generating error, return some nonsense value, so void+123 or @x+%y==0 would give you untraceable bug. Finally, Perl has no booleans, so there is no way to discern 0 from false; moreover "" and "0" are false too, but "00" isn't, despite "0"=="00". For some reason void acts as true, but referencing undefined variable returns false. Integers are represented as floating point values, so 99999999999999999999==100000000000000000000.
- Perl is hard to learn, due to non-orthogonality by design: Perl's goal of bundling basic Unix utilities into one language was achieved in haste, ending up producing numerous sublanguages loosely glued together, making Perl look like a deficient Unix clone, where all commands are builtins. Perl implements a lot of standard library on syntax level, making language enormous in size: for example, instead of being a library function, regular expressions are implemented as syntactic construct, allowed at unexpected places, like in "print if /regex/", which also gives no clue what it prints or takes as input. Or take "pos($x) = pos($x)", which does bizarre magic at resetting regex. Other example is ".." operator: "print 1..3" produces a sequence, but "print if 1..3" interpret 1..3 as a range of input lines. Then Perl has a lot of duplication: for example, Perl has `not` operator, but for some reason also includes `!` and `unless`, while keyword `if` is overloaded as infix operator, and don't forger about cryptic if?then:else operator. Having a myriad of these special cases, Perl rejects logic and appeals to humanities and theology students, who love learning random facts by rote memorization, and for whom $_ and <> are perfectly clear, even intuitive. The standard Perl documentation contains over 70,000 lines, add to that all the documentation on CPAN modules, and you face a pretty substantial base of prose just to begin with Perl. "Perl users were unable to write programs more accurately than those using a language designed by chance." -- http://ecs.victoria.ac.nz/twiki/pub/Events/PLATEAU/Program/plateau2011-stefik.pdf
- Perl is inefficient: broken scoping impedes efficient compilation and bad type system hinders any optimization, making Perl agonizingly slow. Aggravating Perl's condition are naive reference counting garbage collector and unparsable syntax, requiring solving halting problem just to parse a Perl source file.
- Perl code is unmaintainable, "clever", unreadable and obfuscated: Perl encourages packing unrelated concepts into a messy one-liner, impeding understanding and modification; TIMTOWTDI-redundancy guarantees style discrepancies, misunderstanding and pointless flame-wars among developers, which is aggravated by the size of the language. Finally, Perl isn't modular: it is common to see Perl script 6000 lines long.

Name: Anonymous 2013-06-04 16:26

! ! Shalom!

Name: Anonymous 2013-06-04 16:29

! ! molahS

Name: Anonymous 2013-06-04 16:31

>>75
Valid Symta code

Name: Anonymous 2013-06-04 16:38

>>72
CP payload, silly.

Name: Anonymous 2013-06-04 17:06

>>6
http://perlcabal.org/syn/S03.html
cabal

http://en.wikipedia.org/wiki/Cabal
The term cabal derives from Cabala (a word that has numerous spelling variations), the Jewish mystical interpretation of the Hebrew scripture.
Shalom, Hymie!

Perl is now officially Jewish. And Larry Wall is a crazy kike, obsessed with Bible and Apocalypsis.

Name: Anonymous 2013-06-04 17:23

>>31
Symta (works, because lowercase symbols are literal string):
A = "abcdef";
B = A map: a => z
say A // abcdef
say B // zbcdef


Perl6:
my $a = "abcdef";
my $b = $a.map: { ~~ s/a/z/; $_ }
say $a; # abcdef
say $b; # zbcdef

Name: Anonymous 2013-06-04 17:25

>>79
A = "abcdef";
And I forget to remove the `;`

Name: Anonymous 2013-06-04 17:46

(display (string-map (lambda (c) (if (equal? c #\a) #\z c)) (display "abcdef")))

Name: Anonymous 2013-06-04 17:50

>>81
Actually.

(define A "abcdef")
(define B (display (string-map (lambda (c) (if (equal? c #\a) #\z c)) (display A))))

Name: Anonymous 2013-06-04 18:12

>>78
Why are you on /prog/ if you're not even a Jew?

Name: Anonymous 2013-06-04 18:41

>>83
Fuck you, do u even know how to program, useless faggot?

Name: Anonymous 2013-06-04 18:42

>>84
Did you even get your dick cut, goy?

Of course, I can shoot streams of parentheses. ((()))

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-06-05 5:34

>>85
I suddenly felt the air shake. The knife began to fall upon me... At this moment, the ceiling gave out a loud cracking noise, followed by debris falling down. A loud booming hiss which seemed to sound like "Have you read your SICP today?" filled the air. I lifted my head and discovered... Standing in front, catching the blade with his crotch-snake, was the robed figure of The Sussman. Standing beside him, with flaming red hair, was Shana.

"You and your forced indentation." The Sussman said in his usual expressionless tone, "You think you can defy my power?"

"You want to get in my way?" Asakura sounded calm. "Once I open this Mystes, the Lord Anal Touring is bound to have some sort of reaction. Only then can we obtain more cudders."

"You are supposed to be my backup." The Sussman said in a mantra-like tone, "This sort of insubordination is forbidden; you must obey my commands."

"What if I refuse?"

"Then I will send you to the land of Java."

"Would you like to try? I have the advantage here, since this classroom belongs to MIT."

The Sussman removed his wizard hat and set it on the floor before removing a wand from a pocket on his robe. He pointed it at the knife in her hand and murmured. Shortly after, it started glowing brightly. Then, like the sugar cube being placed into a cup of tea, it slowly crystallized and dissolved and fell towards the floor like powder.

Shana walked over to me and told me not to move.

"We're in a fuzetsu," she explained. "You can move because you have the power of the Reiji Maigo. But hold still, I'll protect you while Lord Sussman takes care of her."

Asakura released the knife and jumped five meters away. Opening up the distance in an instant, Asakura landed elegantly and continued smiling as usual. The Sussman raised his wand and pointed it directly at the ceiling, not taking his eyes off Asakura. The wand released a wave of glowing white parentheses and the space around The Sussman began to distort.

"It's time for some ENTERPRISE QUALITY!" Asakura cheerfully cried as she conjured the spirits of the JVM, producing a flood of boiling-hot coffee that rushed its way towards The Sussman, who stood motionless, parentheses continuing to issue from his wand like electromagnetic radiation.

"You think your turkey solutions can stop me?" The Sussman said calmly before lowering his wand, forming the pool of parentheses now gathered around him into a sharp pointed cone aimed at Asakura. Suddenly he shouted "LIIIIIIIIIIIIIIIISP!" and the parentheses shot forward into the waves of coffee, pushing the boiling hot liquid back towards where it came.

"Nooooooo....." her cries became weaker as she became engulfed in the dark brown liquid. Everything turned black and I felt as though I had fainted.

Name: Anonymous 2013-06-05 5:51

OH GOD SHANA ISHOT

Name: Anonymous 2013-06-05 7:05

Back to /sha/, please.

Name: Anonymous 2013-06-05 7:31

>>85
Ur doin it wrong.
(((Racket)))

Name: Anonymous 2013-06-05 7:32

'LETS MAKE THIS#ENTERPRISE QUALITY

Name: Anonymous 2013-06-05 7:33

VIVA MEOWXICOCABRONES

Name: Anonymous 2013-06-05 7:35

#HAVE YOU#SEEN THIS BOY?

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