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

Ruby is verbose, compared to Symta

Name: Anonymous 2014-12-21 18:14

Symta:
type person{Name Age} name/Name age/Age
person.`<` X = $age < X.age
person.as_text = "{$name} ({$age})"

Group = [person{'Bob' 33}, person{'Chris' 16}, person{'Ash' 16}]

say Group.sort.flip


Ruby:
class Person
attr_reader :name, :age
def initialize(name, age)
@name, @age = name, age
end
def <=>(person) # the comparison operator for sorting
age <=> person.age
end
def to_s
"#{name} (#{age})"
end
end

group = [
Person.new("Bob", 33),
Person.new("Chris", 16),
Person.new("Ash", 23)
]

puts group.sort.reverse

Name: Anonymous 2014-12-27 7:01

>>40
Props for going for an ACME module. I thought you were going to counter with use ACME::prog1419189250 that does everything in a BEGIN block to force a tie.

Name: Anonymous 2014-12-27 8:50

>>31-41
Looks like proper shit. Good job!

Name: Anonymous 2014-12-27 9:40

>>32
Symta is verbose, compared to Perl.
Nope.

Symta: ['Bob',33 'Chris',16 'Ash',23].sort{?1 < ??1}{(say "[?0] ([?1])")}
Perl 5: print "$_->[0] ($_->[1])\n" for sort { $a->[1] <=> $b->[1] } (['Bob',33],['Chris',16],['Ash',23],);

Name: Anonymous 2014-12-27 21:17

>>43
Symta is verbose, compared to Perl.
Yes

Symta: ['Bob',33 'Chris',16 'Ash',23].sort{?1 < ??1}{(say "[?0] ([?1])")}
Perl 5: map{split;say"$_[1] ($_[2])}sort'33 bob','16 chris','23 ash'

Name: Anonymous 2014-12-27 21:22

>>43
Fixed version.

Symta: ['Bob',33 'Chris',16 'Ash',23].sort{?1 < ??1}{(say "[?0] ([?1])")}
Perl 5: map{@r=split;print"$r[1] ($r[0])\n"}sort'33 bob','16 chris','23 ash'

Name: Anonymous 2014-12-27 21:25

>>44
Winning version, by using perl's feature say:

Symta: ['Bob',33 'Chris',16 'Ash',23].sort{?1 < ??1}{(say "[?0] ([?1])")}
Perl 5: map{@r=split;say"$r[1] ($r[0])"}sort'33 bob','16 chris','23 ash'

Name: Anonymous 2014-12-27 21:32

>>44
And I can make it EVEN SMALLER by using regex:

Symta: ['Bob',33 'Chris',16 'Ash',23].sort{?1 < ??1}{(say "[?0] ([?1])")}
Perl 5: map{/(.+) (.+)/;say"$2 ($1)"}sort'33 bob','16 chris','23 ash'
Perl 6: (<bob chris ash>Z=><33 16 23>).sort(*.value)

I guess we have a loser here.

Name: Anonymous 2014-12-27 21:53

>>31-41,44-47
Larry Wall go away.

Name: Anonymous 2014-12-27 22:36

>>48
nikita, stop wiggling your butt around in the air. you're the only homosexual here.

Name: Anonymous 2014-12-28 7:04

>>47
I can make it EVEN SMALLER by...
Sorry, but you cant.
Symta: [bob,33 chris,16 ash,23].sort{?1<??1}{(say"[?0] ([?1])")}
Perl5: map{/(.+) (.+)/;say"$2 ($1)"}sort'33 bob','16 chris','23 ash'

Name: Anonymous 2014-12-28 7:53

Can someone post a J version so we can be done with this?

Name: Anonymous 2014-12-28 8:02

>>51
Already posted:
Symta: qsort@r$[] H,@T = @T.keep{?<H}^r,H,@T.skip{?<H}^r
J: qsort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)

Name: Anonymous 2014-12-28 8:07

>>52
That's quicksort you dolt.

Name: Anonymous 2014-12-28 9:03

>>52
Symta: qsort@r$[] H, @T = @T.keep{? < H}^r, H, @T.skip{? < H}^r
J: /:~

Name: Anonymous 2014-12-28 23:05

Is it Nikita who's always doing the symta code ITT?

Name: Anonymous 2014-12-29 7:12

>>55
Shhh! we don't want putin to find him!

Name: Anonymous 2014-12-29 7:19

>>55
The syntax seems to always change so I don't know if other people can pull it off.

Name: Anonymous 2014-12-29 8:25

>>57
The syntax doesn't change anymore. It is defined by https://github.com/saniv/symta/blob/master/src/reader.s

Name: Anonymous 2014-12-29 11:27

>>56
I do

Name: Anonymous 2015-01-06 22:17

>>28
Thank you! That's actually much nicer. I've begun using Io only recently and don't know the standard library very well yet.

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