Skip to content

Commit

Permalink
Sum of Pairs: Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Pauley committed May 27, 2010
1 parent f674621 commit 75522b3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CodeSnippets/SumPairs/SumOfPairs.java
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
// Solution by Etienne Labuschagne // Java solution by Etienne Labuschagne
// Edited by me to fit in with the other examples // Edited by me to fit in with the other examples


public class SumOfNeighbours { public class SumOfPairs {
public static int[] sumPairs(int[] a) { public static int[] sumPairs(int[] a) {
int[] newArray = new int[a.length-1]; int[] newArray = new int[a.length-1];


Expand Down
2 changes: 1 addition & 1 deletion CodeSnippets/SumPairs/sumpairs-map.py
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
# Solution by Pieter Nagel, based on the Clojure solution # Python solution by Pieter Nagel, based on the Clojure solution


from operator import add from operator import add
a = [1, 2, 3, 4, 5] a = [1, 2, 3, 4, 5]
Expand Down
2 changes: 1 addition & 1 deletion CodeSnippets/SumPairs/sumpairs-sumzip.py
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
# Solution by Dawie Strauss # Python solution by Dawie Strauss


a = [1, 2, 3, 4, 5] a = [1, 2, 3, 4, 5]
[sum(i) for i in zip(a,a[1:])] [sum(i) for i in zip(a,a[1:])]
2 changes: 1 addition & 1 deletion CodeSnippets/SumPairs/sumpairs.clj
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
; Solution by Timothy Pratley ; Clojure solution by Timothy Pratley
; http://groups.google.com/group/clojure/browse_thread/thread/ca3ad049fba7ee82 ; http://groups.google.com/group/clojure/browse_thread/thread/ca3ad049fba7ee82


(def a '(1 2 3 4 5)) (def a '(1 2 3 4 5))
Expand Down
2 changes: 1 addition & 1 deletion CodeSnippets/SumPairs/sumpairs.fx
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
// Solution by Etienne Labuschagne // JavaFX solution by Etienne Labuschagne


var originalArray = [1,2,3,4,5]; var originalArray = [1,2,3,4,5];
for (i in for (e in [0..3]){originalArray[e]+originalArray[e+1]}){println(i)} for (i in for (e in [0..3]){originalArray[e]+originalArray[e+1]}){println(i)}

0 comments on commit 75522b3

Please sign in to comment.