Provides extension methods for semantic string support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using System.Threading.Tasks; | |
using System.Xml; | |
using System.Xml.Linq; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This class explicitly implements the ConnectionCallbacks and | |
* OnCorrectionFailedListener interfaces. What this means is that | |
* this class will implement what happens when a connection to | |
* Google Play Services fails, and what happens when a connection | |
* succeeds. | |
*/ | |
public class MainActivity extends FragmentActivity implements | |
GooglePlayServicesClient.ConnectionCallbacks, | |
GooglePlayServicesClient.OnConnectionFailedListener { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Aliasing the string class to be more terse | |
(require '[clojure.string :as str]) | |
; As a 'def', this is evaluated once | |
(def vowel? (set "AaEeOoIiUu")) | |
; Given a word, converts it into a pig latin equivalent | |
(defn convert-word [word] | |
(let [first-letter (first word)] | |
(if (vowel? first-letter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun innerExpr(item: Int, mean: Int): Int { | |
return (item - mean) * (item - mean) | |
} | |
fun stdDev(items: List<Int>): Double { | |
val mean = items.sum() / items.size | |
val variance = items.map { innerExpr(it, mean) }.sum() / items.size | |
return Math.sqrt(variance.toDouble()) | |
} |
NewerOlder