Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

qntm posted:

Perl 5 was and remains a massive, massive, wholly welcome improvement on Bash scripting.

so do a lot of other languages

Adbot
ADBOT LOVES YOU

Jerry Bindle
May 16, 2003
where does racket fall on the spectrum? i know where it places me on the spectrum, but there's basically no scripting language i can use at work besides windows .bat files that won't have someone calling me an rear end in a top hat

JawnV6
Jul 4, 2004

So hot ...
switch companies or otherwise stop caring about those coworker opinions??

Jerry Bindle
May 16, 2003
yeah almost definitely going to switch companies when "the time is right"

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Barnyard Protein posted:

where does racket fall on the spectrum? i know where it places me on the spectrum, but there's basically no scripting language i can use at work besides windows .bat files that won't have someone calling me an rear end in a top hat

can't you use wscript

Vanadium
Jan 8, 2005

i can't believe no one else is in disbelief that "1e6" == "1000000" in a new pl in 2015(or later who knows)

Jerry Bindle
May 16, 2003

Vanadium posted:

i can't believe no one else is in disbelief that "1e6" == "1000000" in a new pl in 2015(or later who knows)

especially crazy since one of the main usecases for perl is text / regex fuckery. don't other plangs get around this by having === operators

Jerry Bindle
May 16, 2003

Gazpacho posted:

can't you use wscript

i didn't know this was a thing, thanks!

JawnV6
Jul 4, 2004

So hot ...
"1e6" == "486"

Arcsech
Aug 5, 2008

Barnyard Protein posted:

where does racket fall on the spectrum? i know where it places me on the spectrum, but there's basically no scripting language i can use at work besides windows .bat files that won't have someone calling me an rear end in a top hat

racket is a v solid scripting language choice

only real issue as scripting langs go is that nowhere has it installed by default which if you're on windows doesnt matter anyway

it is a lisp, which lots of people have feelings about. but other than that its probably better than any other scripting language really

(semi-comedy option: https://github.com/Gabriel439/Haskell-Turtle-Library )

qntm
Jun 17, 2009

Thermopyle posted:

so do a lot of other languages

Sure, but the point is that in 1999 liking Perl was a 100% correct opinion.

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Barnyard Protein posted:

where does racket fall on the spectrum? i know where it places me on the spectrum, but there's basically no scripting language i can use at work besides windows .bat files that won't have someone calling me an rear end in a top hat
Racket is really nice. Tons of libraries, JIT, Lisp's trademark ridiculous flexibility tempered by a lot of hard-learned lessons on encapsulation, etc. Contains a lot of dialects implemented in itself, including Typed Racket which is pretty cool if you like finding your bugs ahead of time.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

qntm posted:

Perl 5 was and remains a massive, massive, wholly welcome improvement on Bash scripting.

the only thing worse than a plang is a blang

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
haskell makes me irrationally angry because it's really loving hard to visually parse

i mean look at this poo poo:
code:
qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]
what the gently caress does this poo poo even mean goddamn

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

qntm posted:

Ruby was and remains a massive, massive, wholly welcome improvement on Bash scripting.

JawnV6
Jul 4, 2004

So hot ...
ive never touched haskell but knowing the basics of quicksort, the only thing that isn't clear from those examples is the pivot selection?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Blinkz0rz posted:

haskell makes me irrationally angry because it's really loving hard to visually parse

i mean look at this poo poo:
code:
qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]
what the gently caress does this poo poo even mean goddamn

this is just python comprehensions with function overloading. are you having a hard time with x:xs?

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

fart simpson posted:

i think the haskell style guides recommend not using list comprehensions anymore

gently caress list comps do notation for life

:supaburn:

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Blinkz0rz posted:

haskell makes me irrationally angry because it's really loving hard to visually parse

i mean look at this poo poo:
code:
qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]
what the gently caress does this poo poo even mean goddamn

literally the most complicated thing here is the special cased pattern x:xs which is really a compact form of expressing head and tail. The rest is function application and list comprehension; the latter is basically deprecated


if data List a = Empty | Cons a (List a) were the form in the libs u would do
qsort Empty = Empty
qsort (Cons head tail) = ...

Brain Candy
May 18, 2006

Blinkz0rz posted:

haskell makes me irrationally angry because it's really loving hard to visually parse

i mean look at this poo poo:
code:
qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]
what the gently caress does this poo poo even mean goddamn

i used to feel like you feel until i put some effort into haskell

but now it looks like a clean (and naive) translation of the algo you'd find on wikipedia

brap
Aug 23, 2004

Grimey Drawer
i haven't really written any haskell but i was pretty much able to get what that's doing

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Barnyard Protein posted:

i didn't know this was a thing, thanks!
pretend that i said cscript though

and beware, there's no telling when microsoft might decide to stop maintaining it, but if you need a somewhat civilized scripting language that is standard in older versions of windows there it is

VikingofRock
Aug 24, 2008




Ericadia posted:

I'm learning it on my free time, any warnings or favorite bits of the language you'd care to share?

In addition to the resources that gonadic io has given you (and this thread), you might want to check out the functional languages thread in CoC. I've always gotten a good answer to my questions there, although it is significantly slower than this thread so you probably don't want to post there if you need a question answered *now* for whatever reason.

JawnV6 posted:

ive never touched haskell but knowing the basics of quicksort, the only thing that isn't clear from those examples is the pivot selection?

That happens in the x:xs part, which splits a list into its head (x) and tail (xs). Since x is what is used in the middle of the expression, that means that the pivot is always chosen to be the first element of the list.

Also, the standard disclaimer here is that this is not an in-place sort, so you can make a good argument that this is not a "true" quicksort. An in-place quicksort is possible in Haskell, but it's somewhat uglier.

VikingofRock
Aug 24, 2008




Malcolm XML posted:

gently caress list comps do notation for life

:supaburn:

Do notation with lists has always been kind of confusing to me for whatever reason. I always have to think very carefully about exactly how the list monad works before I get it.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
arrays in haskell make me lol

Xarn
Jun 26, 2015

fart simpson posted:

i think the haskell style guides recommend not using list comprehensions anymore

huh, why?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

qntm posted:

Sure, but the point is that in 1999 liking Perl was a 100% correct opinion.

oh, yeah, I see what you mean

VikingofRock
Aug 24, 2008




Gazpacho posted:

arrays in haskell make me lol

Data.Array's indexing is a little weird, but Vector works pretty well IMO.

VikingofRock
Aug 24, 2008




Xarn posted:

huh, why?

Usually they can be more succinctly expressed using map and a filter.

gonadic io
Feb 16, 2011

>>=

Malcolm XML posted:

gently caress list comps do notation for life

:supaburn:

gently caress do notation, monadic comprehensions are great (for clowns, writing clown syntax)

lord of the files
Sep 4, 2012

fleshweasel posted:

i haven't really written any haskell but i was pretty much able to get what that's doing

i think it's pretty much like any other language. you just have to be using it for a couple of weeks to start to see that that mess of symbols can actually make sense. though haskell can be one of the harder ones to make sense of.

lord of the files fucked around with this message at 00:09 on Nov 30, 2015

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

that qsort function is also written to be a clever 1 liner instead of written in a clear way. this is more like how i'd expect to see it:

gonadic io posted:

if you split that up using 'where' and use 'filter' instead of list comprehensions, it becomes a lot clearer imo

this is what i'd write it as (no actually I'd write it as data.list.sort which is a merge sort but let's ignore that for now). also i'd use data.list.partition instead of two separate filters but i'll leave that as an exercise
code:
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort lessThan ++ [x] ++ qsort greaterThan
    where
    lessThan = filter (< x) xs
    greaterThan = filter (>= x) xs
feel free to add extra parens if it makes it easier for you too.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
would there be actual interest in an APL/J/K thread in CoC, or would it just be pages and pages of "this is unreadable", "what's with the funny symbols", etc

triple sulk
Sep 17, 2014



Internet Janitor posted:

would there be actual interest in an APL/J/K thread in CoC, or would it just be pages and pages of "this is unreadable", "what's with the funny symbols", etc

yes

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i'd be interested in reading it but i imagine it would fade into the archives because i doubt many people are actually gonna start using those languages. we can barely keep a generic "functional programming" thread active in coc

jony neuemonic
Nov 13, 2009

Internet Janitor posted:

would there be actual interest in an APL/J/K thread in CoC, or would it just be pages and pages of "this is unreadable", "what's with the funny symbols", etc

do itttttttt.

VikingofRock
Aug 24, 2008




Internet Janitor posted:

would there be actual interest in an APL/J/K thread in CoC, or would it just be pages and pages of "this is unreadable", "what's with the funny symbols", etc

would read

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Malcolm XML posted:

literally the most complicated thing here is the special cased pattern x:xs which is really a compact form of expressing head and tail. The rest is function application and list comprehension; the latter is basically deprecated


if data List a = Empty | Cons a (List a) were the form in the libs u would do
qsort Empty = Empty
qsort (Cons head tail) = ...

my beef is the syntax not the algorithm

i look at that and i understand what it's supposed to do but i just can't visually parse the code

haskell may be a great language but it's biggest failing imo is how concise it is. it's just dense as gently caress

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

gonadic io posted:

if you split that up using 'where' and use 'filter' instead of list comprehensions, it becomes a lot clearer imo

this is what i'd write it as (no actually I'd write it as data.list.sort which is a merge sort but let's ignore that for now). also i'd use data.list.partition instead of two separate filters but i'll leave that as an exercise
code:
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort lessThan ++ [x] ++ qsort greaterThan
    where
    lessThan = filter (< x) xs
    greaterThan = filter (>= x) xs
feel free to add extra parens if it makes it easier for you too.

this is way more readable btw

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Blinkz0rz posted:

this is way more readable btw

well thats what it looks like when you arent trying to do one liners

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply