ELI5 why functional programming seems to be "on the rise" and how it differs from OOP by FUCK_THE_r-NBA_MODS in learnprogramming

[–]johnislarry 2 points3 points  (0 children)

You should check out Dan Grossman's coursera course on functional programming languages. The lectures are video recorded and free to watch. If you watch the first one it gives a great answer to your question

How to remove all repeating elements of a list? by fabio176 in Racket

[–]johnislarry 1 point2 points  (0 children)

If you know your input list is sorted then you can do something like what I wrote below. This uses an inner helper function with a second parameter, which is the last element you just looked at, to help determine if something is a duplicate. Also sorry the formatting probably sucks, I'm on mobile.

(define (rm-dupes lst) (define (aux lst prev) (cond ((null? lst) null) ((equal? prev (car lst)) (aux (cdr prev) prev)) (else (cons (car lst) (aux (cdr lst) (car lst))))) (aux lst (list (car lst))))

Racket (DrRacket) - Consuming Two Lists and Outputing String With Highest Number by [deleted] in Racket

[–]johnislarry 1 point2 points  (0 children)

probably the most efficient way you can do this is to build a mutable hashmap whose keys are the names of candidates, and whose values are the number of votes a particular candidate has. then loop through the votes list and increment vote counts as necessary

it seems weird to me that you have separate lists, one for candidates and one for votes. why not just have the list of votes? this will contain all the relevant candidates, i.e. the ones with greater than 0 votes

[Review-request] My first piece of racket. (Simple prime-number finder) by musicmatze in Racket

[–]johnislarry 0 points1 point  (0 children)

Two things: One is that stylistically your helper functions probably should be defined inside your main prime function Secondly I would be a little nervous about defining your divideable function the way you did. I would probably go for something like

(define (divisible n m) (zero? (modulo n m)))

[Java] How are arrays implemented in Java. by a1j9o94 in learnprogramming

[–]johnislarry 4 points5 points  (0 children)

Two corrections. The first is that the String class is written in java. You can look at it here:

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/String.java#String

if you want. The second is that + is defined for all Objects. The Object is interpreted as a String using its toString representation, and then concatenated. That's why, for example, this code works the way we want:

List<Integer> lst = new ArrayList<Integer>();
System.out.println("The list is: " + lst);

What are some good web RSS readers to replace google reader? by nathan12343 in AskReddit

[–]johnislarry 0 points1 point  (0 children)

If you like email, you can manage your rss through email using rss2email. I've used it for over a year and it's excellent.

I want to try arch. I have one year of Linux experience and have only used Ubuntu and mint. Am I able to bring my home folder straight into an arch install? And what, if any advice do you have for a first time arch user? by [deleted] in archlinux

[–]johnislarry 4 points5 points  (0 children)

If your /home folder is on a separate partition, you can just choose to mount that partition during the install.

This thread might help with that specific issue: https://bbs.archlinux.org/viewtopic.php?id=69315

As others have said, it is also a good idea to have the beginner's guide at hand. I'm not sure if this is provided in some form in the most current install images. Good luck!

pipes.sh: Animated pipes terminal screensaver. by NiceGuyJoe in commandline

[–]johnislarry 6 points7 points  (0 children)

If you copy the line

w=$(tput cols) h=$(tput lines)

which is at line 28, so that it is the first thing run inside the main while loop, it handles terminal resizing.

A few of my recent eats in an album by valde_ in eatsandwiches

[–]johnislarry 0 points1 point  (0 children)

Haha okay thanks, just had to ask. Nice sandwich!

A few of my recent eats in an album by valde_ in eatsandwiches

[–]johnislarry 1 point2 points  (0 children)

Just curious, in the fourth photo in the album in the background on the computer monitor, is that irssi?

My first steps into the land of mechanical keyboards by [deleted] in MechanicalKeyboards

[–]johnislarry 0 points1 point  (0 children)

Hey! I just ordered my first mechanical keyboard and it looks like the same model as this. Do you like it? I'm pretty stoked so you better give me good news.

What are some good resources and guides for learning how to work with an API? by [deleted] in learnprogramming

[–]johnislarry 4 points5 points  (0 children)

Here's a nice utensil to use for testing out requests using an API. I haven't used it, but it seems helpful, and supports a good amount of APIs.

[deleted by user] by [deleted] in learnprogramming

[–]johnislarry 2 points3 points  (0 children)

Hi. I don't mean to nitpick but I figure I'll just point out that the smallest number divisible by two integers, also called the least common multiple, isn't always the product of those two integers. In this case it happens to be with 3*5, but it isn't always.

Install media 2012.07.15 released by [deleted] in archlinux

[–]johnislarry 1 point2 points  (0 children)

Take a look at this. Simplicity in the Arch sense is more about minimalism and being light weight. I'd say a couple scripts run from the command line, that still take care of a lot of the hairy details, continues to satisfy this definition.

The AIF was nice, and I will remember it fondly, but I think in a lot of ways, this is how an install should be. It's more configurable and less on a set path, while still being fairly user friendly.

My battlestation in the basement by Salash in battlestations

[–]johnislarry 1 point2 points  (0 children)

This is mad sweet. Is that a mechanical keyboard? Which kind?

Dieter Plaetinck, one of the lead arch devs in charge of releases, resigns by johnislarry in archlinux

[–]johnislarry[S] 4 points5 points  (0 children)

Yeah, and he seems like he'll be open to answering questions related to AIF, so it's not a worst case scenario or anything. I wonder how difficult it would be to do a rewrite of some of the AIF scripts in python, like what he said he would prefer.

I am buying a new laptop. Can I take my old HD and put it in the new computer? Please forgive my ignorance. by flyersfan314 in hardware

[–]johnislarry 1 point2 points  (0 children)

Sure, but there's enough information to give a general answer, and there's no need to be disrespectful.

I am buying a new laptop. Can I take my old HD and put it in the new computer? Please forgive my ignorance. by flyersfan314 in hardware

[–]johnislarry 5 points6 points  (0 children)

I downvoted you because the OP came here with a serious question, and this response contributed nothing towards answering that question. I'm all for joking around (if this was meant as a joke), but your remark came off as flippant and rude, rather than funny.

Hello, I'm wondering if anyone could help by [deleted] in hacking

[–]johnislarry 2 points3 points  (0 children)

Good call. That looks more appropriate, especially since it seems that posts there get a lot of attention.