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
Shaggar
Apr 26, 2006
idk what storm or scalding are but they sound stupid and pointless.

Adbot
ADBOT LOVES YOU

raminasi
Jan 25, 2005

a last drink with no ice
are we still doing this

  1. mutually recursive types have to live in the same source file. i want to list this twice, it's so bad.
  2. partial active patterns can only look for one case. if you've got a big honkin' active pattern you either have to write it as a big honkin' function or break it up into a billion little ones, rather than organizing your cases in a sensible way.
  3. communication with the rest of .net-land, while generally decent, is not wart-free; things like default arguments don't make it across the assembly boundary in the way you'd want. also, certain types sometimes magically have have (public!) bonus properties and get_*/set_* methods that you didn't know about. while these situations usually crop up when you're doing things you're not really supposed to be doing (like public discriminated unions) it's still pretty unpleasant to have your contract futzed with without your knowledge. (lots of this stuff is undocumented.)
  4. if you're in the .net-influenced part of the language, overloading works but automatic generalization doesn't. if you're in the ml-influenced part of the language, the reverse is true. this is annoying.
  5. advanced features of statically resolved type parameters (like constraints) are not documented super well because the designers apparently thought that nobody would want to use them for anything. while i hate jerkin' off over c++ template tomfoolery as much as the next guy, that kind of thing does have its uses, and it would be nice if it weren't treated as a weird curio if it's in the language in the first place.

Notorious b.s.d.
Jan 25, 2003

by Reene

Shaggar posted:

idk what storm or scalding are but they sound stupid and pointless.

storm is a pseudo-real-time distributed computing system that works with tuple streams. with hadoop you read big blocks of data and process them on a batch basis. storm just sets up consumers and emitters of streams. they can split and combine etc. same distributed concept but trickles of data being processed quickly

it's actually really cool.

scalding is a scala library that compiles scala code to sequences of hadoop jobs and manages them. it looks really cool but since it's a huge pain in the rear end i can't recommend it.

use cascading instead. it does the same job, it's not painful to use w/ scala, and it's mavenized!

Notorious b.s.d.
Jan 25, 2003

by Reene
tbh i have never used hadoop "in anger" i just spent a week in training and it was really fun to hack on the labs.

Notorious b.s.d.
Jan 25, 2003

by Reene
i have done the storm thing "for real" but i'm ashamed of the use case so i'm not gonna talk about it here.

suffice to say storm is pretty nifty in my book

a cyberpunk goose
May 21, 2007

Notorious b.s.d. posted:

i'm ashamed of the use case so i'm not gonna talk about it here.

:frogon: you are safe here, share with us

qntm
Jun 17, 2009
we're still doing this

1. list-flattening behaviour
2. sigils
3. packages and modules
4. context-sensitivity
5. BEGIN blocks

:toot: and many more

Opinion Haver
Apr 9, 2007

perl was one of the first languages i picked up and sigils were never unintuitive, even the whole '@array but $array[0]' thing. it's like conjugating a verb or something. the fact that you can have @var and $var and &var and %var at the same time is a bad idea though

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

storm and scalding are both way worse than hadoop

a normal java application has properties files, config files, and shell scripts to configure and boot the drat thing. in the worst case, you get like jetty, where the properties/config/shell just launches start.jar, which relaunches the jvm

storm and scalding turn this poo poo on their head. storm uses python scripts + yaml config + environment variables to launch. scalding uses ruby. it's impossible to turn a storm or scalding app into a normal deployable thing; no matter what you do you're gonna come back to their wretched scripting

yeah we know java has 10 years of deployment tooling but we thought "python storm.py deploy-my-poo poo" was somehow better

eh it's not hard to avoid using storm.py, all it does is set up a jvm invocation. which is a good thing because storm will piss itself over just about everything. idk about scalding

X-BUM-RAIDER-X
May 7, 2008
i like perl a lot, and c++

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

i have done the storm thing "for real" but i'm ashamed of the use case so i'm not gonna talk about it here.

suffice to say storm is pretty nifty in my book

storm is rly cool and i hope i can convince newjob to give it a try. they're using mysql + batch jobs to do work that a message queue + storm topology should have

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Notorious b.s.d. posted:

tbh i have never used hadoop "in anger" i just spent a week in training and it was really fun to hack on the labs.

should try cascalog. it's pretty sweet

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Shaggar posted:

so either run each hadoop in its own jvm or run it inside its own container. ez pz problem solved.

this is exactly the problem osgi solves, but without the hacks

PrBacterio
Jul 19, 2000

Notorious b.s.d. posted:

it's like they just dumped somebody's source tree + readme.md to github and called it done
Ive no clue about the particular program/library youre talking about, I just wanted to point out that:
in like 99.9% of cases where you get that feeling, it's accurate and that's exactly what they did
so in all likelihood, someone just *DID* dump their source tree and readme.md to github and called it a day

JewKiller 3000
Nov 28, 2006

by Lowtax
alright i'll do ocaml since nobody else is gonna (nice to see GrumpyDoctor's F# post though!)

1. global interpreter/gc lock. you cannot have multiple threads running ocaml code in parallel within a single process. concurrency works fine, since the runtime releases the lock before any syscall that may block. inria developed a parallel ocaml gc a long time ago and abandoned it due to performance impacts on single-threaded code. current efforts to fix the global lock range from new parallel gcs to hybrid solutions that run multiple ocaml runtimes per process and pass messages between them. these are coming together, but none are officially endorsed or supported yet afaik

2. lacking good namespace support. compilation units all live in the same global namespace, so you can't have name collisions at that level. but there are many common module names like "utils", so you have to either use a prefix like "proj_utils" which is no better than C, or package everything up into a single global module named "proj", which interferes with separate compilation. here again there are proposed solutions from the community, but technical disputes remain

3. no automatic instantiation of type classes a la haskell. ocaml modules can do everything type classes can do (in fact records suffice, you don't even need modules), minus the magic of picking the appropriate type class to pass into your function. you have to do that manually. as oleg would put it, the only difference is => vs ->. still, this difference is important enough that type classes have not taken off in the ocaml world

4. error messages could be better in certain cases for newbies. this has improved a lot recently, but type inference can still produce errors that are tricky to understand unless you know how the inference engine works. for example, a type error might point to chars 39-42 on line 16, and say "this expression has type foo, but we expected type bar". if i actually meant for the expression in question to have type bar, then this helps me. but what if foo is correct? then what i want to know is, where'd you get the idea that it should be bar? did another case of the same pattern-match have type bar? did i call a function that expects a bar? what led to the unification failure?

5. jon harrop still posts occasionally on the mailing list

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

for people that don't really like haskell typeclasses, what would you rather have instead?

JewKiller 3000
Nov 28, 2006

by Lowtax
i would read phil wadler's paper "how to make ad hoc polymorphism less ad hoc", and see if what you dislike is actually type classes themselves, or just some peculiarity of haskell's implementation, especially their tendency to choose names like Monad and Histozygomorphism

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i know there's an article floating around called "scrap your typeclasses" or something and it makes an argument for just using records i think? idk i just skimmed it like a year ago

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

woah this wadler paper is old

JewKiller 3000
Nov 28, 2006

by Lowtax
well from my perspective as an ocaml programmer, one typeclass i'd like to have is Num. in ocaml you cannot add floats with the (+) operator, it has type int -> int -> int. for floats there is a separate operator (+.), and yet another for arbitrary precision numbers. if i had a haskell-style typeclass, i could use just one operator, and the compiler would know how to instantiate it for the type i need. in ocaml the best i can do is explicitly pass the type to the operator, which is not really any better than just using (+.)

an alternative solution is to define the arithmetic operators inside each relevant module, so inside module Float i would have (+) = (+.) etc. then i could write Float.(3.14 + 2.71 - 6.9). so-called "delimited overloading" seems to solve the problem in a lot of cases, but i still can't write "type foo with show" without resorting to some camlp4 or at least parsetree-rewriting

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

just use floats for everything. problem solved.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

MeramJert posted:

just use floats for everything. problem solved.

hmm, according to the paper you recommended, this is literally what miranda does (did?)

Vanadium
Jan 8, 2005

Type classes to enable overloading arithmetic operators etc are pretty cool, type classes to enable Text.Printf are hilarious, type classes to enable Monad.Control.Trans.Control or w/e can go gently caress themselves.

Notorious b.s.d.
Jan 25, 2003

by Reene

qntm posted:

we're still doing this

1. list-flattening behaviour
2. sigils
3. packages and modules
4. context-sensitivity
5. BEGIN blocks

:toot: and many more

this list is good specifically because perl newbies will defend sigils to the end

sigils seem to make sense at the surface but once you learn how perl works and why the Std lib requires gloves on occasion sigils start to look like a mistake

Perl: minutes to learn, a lifetime to weep

Notorious b.s.d.
Jan 25, 2003

by Reene

Nomnom Cookie posted:

storm is rly cool and i hope i can convince newjob to give it a try. they're using mysql + batch jobs to do work that a message queue + storm topology should have

yeah, moving work from batch jobs to continuous event processing is a biggest win on lovely databases.
A trickle of data 24/7 is an easier workload to plan for than a late night batch job that hammers N corner cases for M hours

X-BUM-RAIDER-X
May 7, 2008
idk sigils make sense to me although idg why they are necessary

FamDav
Mar 29, 2008
sigils are bad in perl because they dont share namespaces and you end up with weird stuff like $array[0]

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

OBAMA BIN LinkedIn posted:

idk sigils make sense to me although idg why they are necessary
1. familiar to shell programmers
2. add new built-ins without breaking old scripts (in theory lol)

Soricidus
Oct 21, 2010
freedom-hating statist shill
Good things about perl:
1. it's not php
2. it's not javascript
3. it's not ruby
4. it's not ksh
5. it's still not php

shrughes
Oct 11, 2008

(call/cc call/cc)

coffeetable posted:

playing with the thrust CUDA library right now

code:
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>

#include <boost/format.hpp>
#include <ctime>

int main()
{
	std::cout << "Generating randoms..." << std::endl;
	thrust::host_vector<int> h_vec(pow(2, 26));
	thrust::generate(h_vec.begin(), h_vec.end(), rand);

	std::cout << "Transferring to device..." << std::endl;
	thrust::device_vector<int> d_vec = h_vec;
	
	std::cout << "Sorting..." << std::endl;
	auto start = std::clock();
	thrust::sort(d_vec.begin(), d_vec.end());
	double duration = (std::clock() - start)
            / static_cast<double>(CLOCKS_PER_SEC);

	std::cout << "Transferring back..." << std::endl;
	thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
	
	std::cout << boost::format("Sort runtime: %1%")
                     % duration
                  << std::endl;
}
64 million random integers sorted in 800ms and thirty lines of code. owns owns owns

clock() returns approximate processor time used by the program, not waiting time. And you didn't even count transfer times. Also, my CPUs are faster than your GPU.

code:
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

#include <algorithm>
#include <thread>
#include <vector>

template <class T>
void find_mids(T first1, T last1, T first2, T last2,
               T *mid1_out, T *mid2_out) {
    size_t n = ((last1 - first1) + (last2 - first2)) / 2;

    T w1 = first1;
    T w2 = first2;

    while (n != 0) {
        size_t m = n - n / 2;
        if (m > last1 - w1) {
            w2 += m;
        } else if (m > last2 - w2) {
            w1 += m;
        } else {
            if (*(w1 + (m - 1)) < *(w2 + (m - 1))) {
                w1 += m;
            } else {
                w2 += m;
            }
        }
        n -= m;
    }
    *mid1_out = w1;
    *mid2_out = w2;
}

template <class T, class U>
void recombine(T first1, T last1, T first2, T last2,
               U dest_first, int levels) {
    T mid1, mid2;
    find_mids(first1, last1, first2, last2, &mid1, &mid2);

    auto first_part_size = (mid1 - first1) + (mid2 - first2);

    if (levels == 1) {
        std::thread t(std::merge<T, T, U>,
                      first1, mid1, first2, mid2,
                      dest_first);
        std::merge(mid1, last1, mid2, last2,
                   dest_first + first_part_size);
        t.join();
    } else {
        std::thread t(recombine<T, U>, first1, mid1,
                      first2, mid2,
                      dest_first, levels - 1);
        recombine(mid1, last1, mid2, last2,
                  dest_first + first_part_size,
                  levels - 1);
        t.join();
    }
}

template <class T, class U>
void do_fastsort(T first, T last,
                 U aux_first, U aux_last,
                 int levels) {
    if (levels == 0) {
        std::sort(first, last);
    } else {
        T mid = first + (last - first) / 2;
        U aux_mid = aux_first
            + (aux_last - aux_first) / 2;
        std::thread t(&do_fastsort<T, U>,
                      first, mid, aux_first, aux_mid,
                      levels - 1);
        do_fastsort(mid, last, aux_mid, aux_last,
                    levels - 1);
        t.join();

        if (levels % 2 == 1) {
            recombine(first, mid, mid, last,
                      aux_first, levels);
        } else {
            recombine(aux_first, aux_mid, aux_mid,
                      aux_last, first, levels);
        }
    }
}

template <class T>
void fastsort(T first, T last) {
    using V = typename T::value_type;
    std::unique_ptr<V[]> aux(new V[last - first]);

    do_fastsort(first, last,
                aux.get(), aux.get() + (last - first), 6);
}

double clock_secs() {
    struct timespec ts;
    clock_gettime(CLOCK_REALTIME, &ts);
    return ts.tv_sec
        + static_cast<double>(ts.tv_nsec) / 1000000000;
}

int main() {
    srand(time(NULL));
    puts("Generating randoms...");
    std::vector<int> vec(pow(2, 26));

    for (int& x : vec) {
        x = rand();
    }

    puts("Sorting...");
    double start = clock_secs();
    fastsort(vec.begin(), vec.end());
    double duration = clock_secs() - start;

    if (!std::is_sorted(vec.begin(), vec.end())) {
        printf("Oops, not sorted!\n");
    } else {
        printf("Sort runtime: %f\n", duration);
    }
}
Sort runtime: 0.422622

shrughes fucked around with this message at 15:52 on Oct 9, 2013

X-BUM-RAIDER-X
May 7, 2008

Soricidus posted:

Good things about perl:
1. it's not php
2. it's not javascript
3. it's not ruby
4. it's not ksh
5. it's still not php

Bad things about perl:
1. developers

tef
May 30, 2004

-> some l-system crap ->
1. there is no library or namespace system. there is only include files.
2. the standard library is sparse and undocumented, although at least there is one popular de-facto utility library, which changes core classes.
3. people write language extensions instead of libraries, so you can't compose things easily
4. good luck tracing a method to a class, to a file, to a package. the package names are routinely garbage.
5. the unicode and string handling is hilariously broken.


1. default arguments are built at definition time
2. the baked in threading model is terrible for concurrency
3. strings *almost* behave like lists, implying array like access (untrue),
4. although there is a nod towards immutability and functional composition, these are clunkier than they should be.
5. i'd rather have let than global. (i'd rather have dynamically scoped variables than global singletons in modules, for things like stdin, stdout, et al.)

tef
May 30, 2004

-> some l-system crap ->
1. there is very little in the way of building modules, but then again most programs are small
2. string handling, io handling, is painful and clunky.
3. nah i can't hate on prolog that much :3:

shrughes
Oct 11, 2008

(call/cc call/cc)
C++:

1. integers can silently overflow
2. pointers and pointer-like things can be null/empty, because it has std::move and rvalue references instead of real linear types
3. defaults to mutable instead of const
4. heinous amounts of syntax for things that should be simple like declaring a reasonably safe abstract class. no algebraic datatypes / pattern matching.
5. almost every library outside the STL is a horrible uninteroperable pile of poo poo

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

shrughes posted:

clock() returns approximate processor time used by the program, not waiting time. And you didn't even count transfer times. Also, my CPUs are faster than your GPU.

Sort runtime: 0.422622

yeah i discovered this a lil later in the book, welp -_-. when i get back to the comp next week ill try it again using device time

A Socialest
Jul 3, 2007

are there any good online courses or books for a python beginner?

hubris.height
Jan 6, 2005

Pork Pro

A Socialest posted:

are there any good online courses or books for a python beginner?

codecademy

Opinion Haver
Apr 9, 2007

tef posted:

1. there is no library or namespace system. there is only include files.
2. the standard library is sparse and undocumented, although at least there is one popular de-facto utility library, which changes core classes.
3. people write language extensions instead of libraries, so you can't compose things easily
4. good luck tracing a method to a class, to a file, to a package. the package names are routinely garbage.
5. the unicode and string handling is hilariously broken.


1. default arguments are built at definition time
2. the baked in threading model is terrible for concurrency
3. strings *almost* behave like lists, implying array like access (untrue),
4. although there is a nod towards immutability and functional composition, these are clunkier than they should be.
5. i'd rather have let than global. (i'd rather have dynamically scoped variables than global singletons in modules, for things like stdin, stdout, et al.)

what languages are these

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

A Socialest posted:

are there any good online courses or books for a python beginner?

learn python the hard way

Adbot
ADBOT LOVES YOU

Malcolm XML
Aug 8, 2009

I always knew it would end like this.
also (paging tef) whats a good intro to prolog/logic programming book

I wanna write me a logic dsl in haskell like miniKanren or something, that would be cool

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