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
program666
Aug 22, 2013

A giant carnivorous dinosaur
I'm trying to use the built in tools but apparently none of them work. I read about pertips but no such thing as elapsed time pops up on break points, and profiller just can't seem to run on my IIS, maybe because it's a windows 10 os and it's a vs 2015 and there is some planned obsolescence somewhere as is expected from microsoft (one of the default options in the "Performance and diagnostics" window is "attach to running window store app" and the only app that fits the criteria is the taskbar or something it seems), but it keeps giving me a "you should install webservice, iis 6 compatibility stuff, etc" except I already did all of that and it's still the same error. Searching the internet give me no clues. I'm not really asking anything, I gave up and will probably install resharper.

e: I thought it could be because of the lack of some optional feature so I ran the vs installer but the only ones still not installed are "tools for maintaining store apps for windows 8" and "windows phone 8.0 sdk"

program666 fucked around with this message at 15:52 on Apr 25, 2016

Adbot
ADBOT LOVES YOU

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Security scanners running on a spinny disk absolutely murder VS. I'm so glad I'm not stuck on that kind of system anymore (for now :ohdear: )

program666
Aug 22, 2013

A giant carnivorous dinosaur
so, that's probably it lol

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Not looking for specific advice, but:
How detailed is your(as in you, the reader) planning process before you start building an application, other than understanding the requirements for the application? Do you map out specific classes or functions? Do you create a document or sketch/take notes? I understand that different types and scales of applications will have different answers. I am interested in this topic with respect to all kinds of applications.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Fergus Mac Roich posted:

Not looking for specific advice, but:
How detailed is your(as in you, the reader) planning process before you start building an application, other than understanding the requirements for the application? Do you map out specific classes or functions? Do you create a document or sketch/take notes? I understand that different types and scales of applications will have different answers. I am interested in this topic with respect to all kinds of applications.

Nah, planning too much will paralyze you, and you'd likely be wasting time pondering things you don't really know about anyways. Start with small prototypes to explore initial ideas, see what works, etc. The important thing with this approach is to NOT get attached to your prototypes, and to throw them out when starting for real. If not, you can end up with code that was intentionally crap in the middle of your app.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Fergus Mac Roich posted:

Not looking for specific advice, but:
How detailed is your(as in you, the reader) planning process before you start building an application, other than understanding the requirements for the application? Do you map out specific classes or functions? Do you create a document or sketch/take notes? I understand that different types and scales of applications will have different answers. I am interested in this topic with respect to all kinds of applications.

I will generally conceptually map out the different classes involved and how they interact with each other. I don't find UML or similar "graphical" sketches to be useful though; I just write up a few pages saying "here's this class, it has these important functions with the following assumptions/guarantees". Then I'll walk through at least a few of the known use cases (or "user stories") and show how the system would implement/solve them.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I always keep a set of notes (on the PC). I do a lot of scribbling, sketching and diagramming on paper, too, but that is scratch work to help me think about stuff. The most important thing is deciding how I am going to represent my data and how it will be accessed/passed around by each part of the program. I also want to have some idea of what algorithms I think I will need to use, so I can figure out if there is a library or if I need to write it myself.

I divide the project up into manageable pieces. I want to get to a simple enough level that I can easily reason about the design and code. The modules should be independent if possible -- unit testing is a lot easier if each concern is separated. I want to have an idea of the interface that each of these modules will have before I start coding. This is informed by and can inform the data design. Some important bits I may get fairly detailed on and some are just one line that I'll worry about later.

Don't try to get everything mega-detailed and locked down at first. That is a great way to get bogged down in designing forever. I will likely* find out I made some bad assumptions once I get coding. But it is still good to have an idea about the interfaces. It is much easier to actually get down to coding if I have an interface to flesh out. What do I do next? I just implement another bit of the interface. That 'bit' should be really small and easy, sometimes bordering on trivial, to implement.

Don't ever feel like you are locked to your design. Change it as needed, what matters is what will work, not what you planned on doing. But you still want a semblance of a plan.

*almost always

Linear Zoetrope
Nov 28, 2011

A hero must cook
Is there any good way in C++ to cleanly and non-evilly generate a handful of code blocks with different #pragma directives? I'm doing some OpenMP parallel benchmarking for a class (so the openmp preprocessor stuff here is non-negotiable), but right now I have to recompile, edit the #pragma omp directives by hand, and re-run, then collect the benchmarks myself. I prefer to just have the program run all the permutations I need and collect the benchmarks in some sort of table (vec of vecs, whatever).

Basically, there are four permutations, there's a doubly nested loop, and we're testing static and dynamic dispatch for both the outer and inner loop (coarse vs fine grained), so I basically just need to generate all four variations of:

code:
#pragma omp [...] [dynamic | static]
for [...] {
    // Only include this pragma if the previous pragma doesn't exist
    #pragma omp [...] [dynamic | static]
    for [...] {
        // code
    }
}
and benchmark them independently.

Since there are only 4 variations to test this I can do the assignment without this, but it's bothering me.

pseudorandom name
May 6, 2007

Use _Pragma in a macro.

Nippashish
Nov 2, 2005

Let me see you dance!
Use something like jinja to stamp out all the variations from a template.

program666
Aug 22, 2013

A giant carnivorous dinosaur

Fergus Mac Roich posted:

Not looking for specific advice, but:
How detailed is your(as in you, the reader) planning process before you start building an application, other than understanding the requirements for the application? Do you map out specific classes or functions? Do you create a document or sketch/take notes? I understand that different types and scales of applications will have different answers. I am interested in this topic with respect to all kinds of applications.

In my normal work I receive requests so all I have to do is try to guess what the client want and imagine all the screens and modifications to other existing screens that will be needed to cover their needs, so I send back list of screens with a small paragraph detailing what are the inputs and what the screen will produce as a result. Sometimes the description is too vague so I'll either ask for more details or, if I think I can guess what they want, I'll just include the changes for that vague description and wait for an answer.

On my free time I try to do videogames and I think about the mechanics of the game and just choose one to start with and go all the way down to the details, so "this game will have to have a map, and a map will be a set of points indicating cities, mountains, etc, with no area" and then I start a bit of actual code like that, not even trying to compile it, more like a pseudo-code but I never produced an actual product like that but like that and it's probably not a good idea to do it like this.

program666 fucked around with this message at 16:57 on Apr 26, 2016

Eela6
May 25, 2007
Shredded Hen
Why do people dislike MATLAB so much? A poll on stackoverflow had it as one of the most-disliked languages, but I've always enjoyed working with it. Am I crazy?

(Note: I'm a mathematician first, programmer second, and I work in Image Processing, so my work is all linear algebra, all the time. I am thus working in MATLAB's comfort zone.)

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Eela6 posted:

Why do people dislike MATLAB so much? A poll on stackoverflow had it as one of the most-disliked languages, but I've always enjoyed working with it. Am I crazy?

(Note: I'm a mathematician first, programmer second, and I work in Image Processing, so my work is all linear algebra, all the time. I am thus working in MATLAB's comfort zone.)

Matlab is a fantastic tool for doing research. It's a weird tool for doing more traditional software development. It behaves like basically no other language, which means that if you're a software developer who has to drop into Matlab for some task and you don't have much (or any) familiarity with it, you're going to be continually surprised by its design decisions. This includes things like:

  • 1-based indexing into arrays
  • Using [], (), and {} differently from basically every other language (in particular, using () for indexing operations)
  • Having a gigantic internal library of standard functions, none of which are named the way they "usually" would be (e.g. using "disp" instead of "print")
  • Commands that don't end in semicolons are valid...which means you can't split a command across multiple lines (without using the "..." operator), but whitespace is otherwise insignificant

There may be some larger structural issues with Matlab that you'd run into if you tried to make a larger project; I wouldn't know since I thankfully never had to do anything more than basic scripting. But the bottom line is, it's very uncomfortable for someone who is used to a C-like language or the commonly-used scripting languages to drop into Matlab. Nothing works the way it's expected to. It's very much a piece of "outsider art", developed independently of the last 30-odd years' worth of traditional software language evolution.

Shaman Tank Spec
Dec 26, 2003

*blep*



I'm back to messing with Haskell and its loops are throwing me for a loop. I still don't have a good grasp on map and folds, and when to use them or not.

I'm operating under the impression that if I want to apply a function to, say, every item on a list, I can do that with map. But let's assume I want to do something a bit trickier: I want to implement nested loops.

I have a function findInstancesOfWord which takes two arguments: String x and a list of Strings, ys. It then recursively goes through the list of Strings and sees if any of the Strings contained within match x. If it does, it is added to a list and we repeat until all of ys is done. This is simple if I just have one String and one list of Strings to match against, but I want to be able to do it with lists of names.

To give a more readable example of what I'm trying to do: let's assume I have a several lists of names. I want to match every name from list1 against lists 2..n and see if names from list1 appear on any of them. If they do, I want to add them to a result list.

It is entirely possible that my whole recursive structure is completely unsuited for this purpose in Haskell and there is a much more elegant way of doing this, which would also be really nice to hear :)

pmchem
Jan 22, 2010


TooMuchAbstraction posted:

Matlab is a fantastic tool for doing research. It's a weird tool for doing more traditional software development. It behaves like basically no other language, which means that if you're a software developer who has to drop into Matlab for some task and you don't have much (or any) familiarity with it, you're going to be continually surprised by its design decisions. This includes things like:

  • 1-based indexing into arrays
  • Using [], (), and {} differently from basically every other language (in particular, using () for indexing operations)
  • Having a gigantic internal library of standard functions, none of which are named the way they "usually" would be (e.g. using "disp" instead of "print")
  • Commands that don't end in semicolons are valid...which means you can't split a command across multiple lines (without using the "..." operator), but whitespace is otherwise insignificant

There may be some larger structural issues with Matlab that you'd run into if you tried to make a larger project; I wouldn't know since I thankfully never had to do anything more than basic scripting. But the bottom line is, it's very uncomfortable for someone who is used to a C-like language or the commonly-used scripting languages to drop into Matlab. Nothing works the way it's expected to. It's very much a piece of "outsider art", developed independently of the last 30-odd years' worth of traditional software language evolution.

Some of the examples you gave are language design decisions made by Fortran, which is and was used by huge part of the MATLAB user base. Engineers. it's not out of the blue.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

pmchem posted:

Some of the examples you gave are language design decisions made by Fortran, which is and was used by huge part of the MATLAB user base. Engineers. it's not out of the blue.

Okay, fair enough. The underlying point though is that a lot of the people you're going to find on places like StackOverflow are not "Matlab developers" or more generally part of the Matlab user base. They're developers in other non-Matlab-like languages who may have to drop into Matlab for the occasional task. Thus they find Matlab weird and different, and don't like it.

I mean, this is a subjective question, so I listed some of the things that people are subjectively going to disagree with, not because they're bad ideas (usually), just because they're different. I do think the semicolon thing is dumb though.

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!

If it's just lists of lists, you can just map a map:

code:
nameInList name =
  any id . map (== name)

nameInAnyList name =
  any id . map (nameInList name)

matchNames names =
  filter . flip nameInAnyList names

names =
  [ [ "a", "b" ]
  , [ "c", "d" ]
  , [ "e", "f" ]
  ]

namesToMatch =
  [ "a", "c", "1" ]

matched =
  matchNames names namesToMatch

-- matched == [ "a", "c" ]

Xerophyte
Mar 17, 2008

This space intentionally left blank

Eela6 posted:

Why do people dislike MATLAB so much? A poll on stackoverflow had it as one of the most-disliked languages, but I've always enjoyed working with it. Am I crazy?

(Note: I'm a mathematician first, programmer second, and I work in Image Processing, so my work is all linear algebra, all the time. I am thus working in MATLAB's comfort zone.)

I started in engineering physics and I've gotten to spend a fair bit of time with Matlab, if not so much in the last 5 years or so. Consider my view slightly outdated, I guess.

Matlab is good at what it does -- linear algebra, function fitting, signal processing, most traditional numerical computing things -- but it's syntactically idiosyncratic, the IDE is a mess, the license fee is pretty discouraging (although I guess there's Octave) and the performance is kinda so-so. I think most people frustrated with it aren't frustrated with the parts where you lab some matrices, they're frustrated with doing IO, structuring larger programs, the lack of non-array datatypes, shoddy string handling and all the other stuff that goes into a program.

If I had a Matlab licence I might still have used it, but as is I don't do nearly enough work that would benefit. numpy and scipy are fine for fitting the occasional function or plotting some data and Python is a better language for all the mentioned other things. I've also become fond of Halide for specifically writing high-performance image processing code over the past year or so, but that's certainly a lot more work to write code in (if nowhere near as much work as manually optimizing your filter).

Shaman Tank Spec
Dec 26, 2003

*blep*



Asymmetrikon posted:

If it's just lists of lists, you can just map a map:

Well kind of, it's lists of Strings. Basically to illustrate what I mean, here is an example of what I might have:

wantedNames = ["John", "Terry", "Hank", "Aaron", "Homer"]

passengersOnFlightOne = ["Alice", "Bob", "Terry", "Oliver", "Eduardo"]
passengersOnFlightTwo = ["Jimmy", "Peter", "Ricardo", "Guillermo", "Johnny"]

And then passengerlists can be a list of lists with many passenger lists on it.

And so on, except instead of just having like five names on a list they would be a lot larger. Basically I read a whole bunch of Strings from different files. The reading part was easy enough and I'm able to produce large lists of Strings from my input files, and like I said, I could also figure out how to search for a single String from other lists, but couldn't figure out how to essentially do a nested loop.

E: OK, I'm making progress.

map (filter (\x -> elem x wantedNames)) passengerLists seems to work ok and is probably good enough for what I want right now. I kinda want to figure out if there's a way for me to pass a list of lists as a variable in place of wantedNames but maybe that's veering into the realm of "being a clever dick" :)

Shaman Tank Spec fucked around with this message at 19:50 on Apr 26, 2016

DreadLlama
Jul 15, 2005
Not just for breakfast anymore
I would like to learn how pixhawk/APM/ardupilot works, especially how it talks to external sensors and ground stations. But I do not know anything about programming. I have written exactly one program in my life, copied verbatim from a C64 manual:


What is the best route to go from where I am to having a working understanding of RC quadcopter brains? The FAQ post states "learn python," but I have no plans to use python. Its utility (for me) would be as a stepping stone only. Learn anyway?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



There is/was a blog that was just a collection of "oh god gently caress Matlab" posts I got linked to here years ago, but I guess I didn't bookmark it. That's probably got some good examples because the guy clearly both knew Matlab really well and hated its living guts.

Shaman Tank Spec
Dec 26, 2003

*blep*



OK, I'm making progress.

code:
map (filter (\x -> elem x wantedNames)) passengerLists

-- Output: [["Terry"],[]]
seems to work ok and is probably good enough for what I want right now. I kinda want to figure out if there's a way for me to pass a list of lists as a variable in place of wantedNames but maybe that's veering into the realm of "being a clever dick" :)

Follow up question, though. Let's say instead of just picking out names for a separate list I want to replace a found bad guy's name with, say "TERRORIST ALERT: *NAME*" on a list.

Replacing substrings and strings in Haskell seems easy enough, but if I do it as an extension of what I've got going right now (1. find matches on lists, 2. add matches to a third list, 3. go through lists again replacing hits I found earlier with updated text) that seems insanely wasteful.

Is there a cooler way of doing that?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Munkeymon posted:

There is/was a blog that was just a collection of "oh god gently caress Matlab" posts I got linked to here years ago, but I guess I didn't bookmark it. That's probably got some good examples because the guy clearly both knew Matlab really well and hated its living guts.

This was the first result for googling for "gently caress matlab", and it's got some pretty :magical: entries.

EDIT: ...though on deeper reading a lot of this is just complaining about code that doesn't work, which isn't very interesting.

TooMuchAbstraction fucked around with this message at 20:10 on Apr 26, 2016

fritz
Jul 26, 2003

Munkeymon posted:

There is/was a blog that was just a collection of "oh god gently caress Matlab" posts I got linked to here years ago, but I guess I didn't bookmark it. That's probably got some good examples because the guy clearly both knew Matlab really well and hated its living guts.

"Abandon Matlab", but it's gone now.

raminasi
Jan 25, 2005

a last drink with no ice
The thing that always drove me bonkers about MATLAB was the inability to put function definitions in a script file, which means you either get a self-contained workflow with an obvious entry point, or modularity in your code, but never both.

Xerophyte
Mar 17, 2008

This space intentionally left blank

fritz posted:

"Abandon Matlab", but it's gone now.

Nothing ever really dies on the internet: http://archive.is/abandonmatlab.wordpress.com

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



fritz posted:

"Abandon Matlab", but it's gone now.

That's the one

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Xerophyte posted:

Nothing ever really dies on the internet: http://archive.is/abandonmatlab.wordpress.com

Oy gevalt. My favorite so far is that you can't make a linked list with more than 500 elements, or else you'll hit the recursion limit when the list is freed...and then in a later version of Matlab they doubled up on the recursion so the new limit was 250 elements.

Eela6
May 25, 2007
Shredded Hen

TooMuchAbstraction posted:

Matlab is a fantastic tool for doing research. It's a weird tool for doing more traditional software development. It behaves like basically no other language, which means that if you're a software developer who has to drop into Matlab for some task and you don't have much (or any) familiarity with it, you're going to be continually surprised by its design decisions. This includes things like:

  • 1-based indexing into arrays
  • Using [], (), and {} differently from basically every other language (in particular, using () for indexing operations)
  • Having a gigantic internal library of standard functions, none of which are named the way they "usually" would be (e.g. using "disp" instead of "print")
  • Commands that don't end in semicolons are valid...which means you can't split a command across multiple lines (without using the "..." operator), but whitespace is otherwise insignificant

There may be some larger structural issues with Matlab that you'd run into if you tried to make a larger project; I wouldn't know since I thankfully never had to do anything more than basic scripting. But the bottom line is, it's very uncomfortable for someone who is used to a C-like language or the commonly-used scripting languages to drop into Matlab. Nothing works the way it's expected to. It's very much a piece of "outsider art", developed independently of the last 30-odd years' worth of traditional software language evolution.

Xerophyte posted:

I started in engineering physics and I've gotten to spend a fair bit of time with Matlab, if not so much in the last 5 years or so. Consider my view slightly outdated, I guess.

Matlab is good at what it does -- linear algebra, function fitting, signal processing, most traditional numerical computing things -- but it's syntactically idiosyncratic, the IDE is a mess, the license fee is pretty discouraging (although I guess there's Octave) and the performance is kinda so-so. I think most people frustrated with it aren't frustrated with the parts where you lab some matrices, they're frustrated with doing IO, structuring larger programs, the lack of non-array datatypes, shoddy string handling and all the other stuff that goes into a program.

If I had a Matlab licence I might still have used it, but as is I don't do nearly enough work that would benefit. numpy and scipy are fine for fitting the occasional function or plotting some data and Python is a better language for all the mentioned other things. I've also become fond of Halide for specifically writing high-performance image processing code over the past year or so, but that's certainly a lot more work to write code in (if nowhere near as much work as manually optimizing your filter).



Thanks you for your answers, everyone. That makes sense! MATLAB is not a good general-purpose programming language, but as far as I cant tell there's nothing quite it for linear algebra.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Julia might be competitive in the near future. It's worth keeping an eye on for sure.

ToxicFrog
Apr 26, 2008


Eela6 posted:

Thanks you for your answers, everyone. That makes sense! MATLAB is not a good general-purpose programming language, but as far as I cant tell there's nothing quite it for linear algebra.

I would go so far as to say that it's not a good programming language, full stop, and you're better off (depending on what you're doing) with either R, or Python + some of the many libraries that exist to make it a viable replacement for Matlab.

Although the frustrations I had using it in school were just a pale shadow of some of the poo poo the guy writing Abandon Matlab turned up. :magical:

program666
Aug 22, 2013

A giant carnivorous dinosaur

program666 posted:

I'm trying to use the built in tools but apparently none of them work. I read about pertips but no such thing as elapsed time pops up on break points, and profiller just can't seem to run on my IIS, maybe because it's a windows 10 os and it's a vs 2015 and there is some planned obsolescence somewhere as is expected from microsoft (one of the default options in the "Performance and diagnostics" window is "attach to running window store app" and the only app that fits the criteria is the taskbar or something it seems), but it keeps giving me a "you should install webservice, iis 6 compatibility stuff, etc" except I already did all of that and it's still the same error. Searching the internet give me no clues. I'm not really asking anything, I gave up and will probably install resharper.

e: I thought it could be because of the lack of some optional feature so I ran the vs installer but the only ones still not installed are "tools for maintaining store apps for windows 8" and "windows phone 8.0 sdk"

mine is actually vs2013 not vs2015 which explain this whole thing :doh:

Thermopyle
Jul 1, 2003

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

What's the Java equivalent of Python's Django? By that I'm meaning opinionated and batteries included and well supported and decent community.

Also, while I'm at it, same question for C#.

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!
Dropwizard, ASP.NET (Core or MVC or w/e.)

Hughlander
May 11, 2005

Thermopyle posted:

What's the Java equivalent of Python's Django? By that I'm meaning opinionated and batteries included and well supported and decent community.

Also, while I'm at it, same question for C#.

Play but it's Scala, roo otherwise

Walh Hara
May 11, 2012

Der Shovel posted:

OK, I'm making progress.

code:
map (filter (\x -> elem x wantedNames)) passengerLists

-- Output: [["Terry"],[]]
seems to work ok and is probably good enough for what I want right now. I kinda want to figure out if there's a way for me to pass a list of lists as a variable in place of wantedNames but maybe that's veering into the realm of "being a clever dick" :)

Follow up question, though. Let's say instead of just picking out names for a separate list I want to replace a found bad guy's name with, say "TERRORIST ALERT: *NAME*" on a list.

Replacing substrings and strings in Haskell seems easy enough, but if I do it as an extension of what I've got going right now (1. find matches on lists, 2. add matches to a third list, 3. go through lists again replacing hits I found earlier with updated text) that seems insanely wasteful.

Is there a cooler way of doing that?

I'm not very good at functional programming language myself, but I gave it a try.

code:
replace :: Eq a => a -> a -> [a] -> ([a], Bool)
replace a b list = 
    foldr (\ (x, b1) (xs, b2) -> (x:xs, b1 || b2) ) ([], False)
    $ map (\x -> if x == a then (b, True) else (x, False)) list
    
replaceList :: Eq a => a -> a -> [[a]] -> ([[a]], Bool)
replaceList a b list = 
    foldr (\ (x, b1) (xs, b2) -> (x:xs, b1 || b2) ) ([], False) 
    $ map (replace a b) list
    
matchReplace :: [String] -> [[String]] -> [String] -> Answer
matchReplace (x:xs) listOfList acc =
    let (listOfList', b) = replaceList x ("Terrorist! " ++ x) listOfList
    in  matchReplace xs listOfList' (if b then x:acc else acc)
matchReplace [] xs acc = Answer { listOfList = xs , foundNames = acc }
It's probably possible to simplify this a lot by using monads, but I don't know which one to use and didn't want to bother writing one myself.

Note: the type of "foldr (\ (x, b1) (xs, b2) -> (x:xs, b1 || b2) ) ([], False)" is [(a, Bool)] -> ([a], Bool) and it probably also could have been written as "\list -> (map fst list, List.any snd list)" .

Sedro
Dec 31, 2008

Hughlander posted:

Play but it's Scala, roo otherwise
It's Java or Scala, and the Java support is first-class. They just added support for Java 8 APIs.

Xerophyte
Mar 17, 2008

This space intentionally left blank

ToxicFrog posted:

I would go so far as to say that it's not a good programming language, full stop, and you're better off (depending on what you're doing) with either R, or Python + some of the many libraries that exist to make it a viable replacement for Matlab.

If you've got a problem that's just about twiddling with matrices and plotting some things, you already know matlab and you have a licence, hey, it's a perfectly adequate tool for that particular thing. I definitely wouldn't advise anyone to learn or buy it at this point, though, since there are so many other equally adequate tools without matlab's very many drawbacks elsewhere.

Eela6
May 25, 2007
Shredded Hen

Xerophyte posted:

If you've got a problem that's just about twiddling with matrices and plotting some things, you already know matlab and you have a licence, hey, it's a perfectly adequate tool for that particular thing. I definitely wouldn't advise anyone to learn or buy it at this point, though, since there are so many other equally adequate tools without matlab's very many drawbacks elsewhere.

OK. I'm convinced. I am willing to try another option. Where should I look?

I really need it to have linear algebra as a strong focus, preferably with a decent image processing library. My python is so-so but I've enjoying working with the language in my limited experience. I don't know R. Good numerical tools are not optional for me; being able to have strong control over floating point error, etc, are important to me.

Adbot
ADBOT LOVES YOU

Nippashish
Nov 2, 2005

Let me see you dance!

Eela6 posted:

OK. I'm convinced. I am willing to try another option. Where should I look?

I really need it to have linear algebra as a strong focus, preferably with a decent image processing library. My python is so-so but I've enjoying working with the language in my limited experience. I don't know R. Good numerical tools are not optional for me; being able to have strong control over floating point error, etc, are important to me.

Python is the best alternative. Look at anaconda if you want an easy way to get set up for doing numerical things in python, or maybe enthought if really want an IDE. You also need numpy (the two packages I linked come with it). Doing data-things in python doesn't make sense without numpy because it provides all of your numeric containers and basic linear algebra operations. At some point you will probably want to look at pandas. Pillow does images, since you specifically care about those. All of these are built on numpy. Maybe your forays into python have already included numpy and this paragraph is redundant, but I'm harping on it so much because you will really never "get" numeric python if you're not using it.

As far as not-python goes, Julia will probably be cool someday, but right now it's years away from being ready for people who dgaf about programming languages and just want their numbers to do sensible things. If interpreting the coefficients of regression models sounds like the kind of thing you do then R is worth a look, but R is kind of a bad language too, so it's best left alone unless its strengths are really playing to your needs.

Nippashish fucked around with this message at 20:50 on Apr 27, 2016

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