Dave Pereira-Gurnell
Things that enable a "functional style" in Scala:
- Scala Language Features
- Higher Level Theory
| points = script.Parent | |
| --[[ | |
| This script creates 100 cubes representing "points" on a graph. | |
| It loops through the values of x from 0 to 100, and calculates the correct y value at each position. | |
| For each pair of values, it creates a cube at position x,y. | |
| ]] | |
| -- Create a variable called "x" and set it to 0 | |
| x = 0 |
| Functional Brighton Code of Conduct | |
| =================================== | |
| Welcome! | |
| -------- | |
| Functional Brighton is a Brighton UK based meetup group that aims to bring together people interested in functional programming. We hope that it will complement London-based groups (eg. the London Scala User Group, Hoodlums, F#unctional Londoners, etc.), giving Londoners an excuse for a trip to the seaside and Brightonians some relief from the train. | |
| The current admins are: | |
| * Dave Pereira-Gurnell (@davepg) |
| import MapboxGL from "@react-native-mapbox-gl/maps"; | |
| import { storiesOf } from "@storybook/react-native"; | |
| import React from "react"; | |
| import { StyleSheet, Text, TouchableNativeFeedback, View } from "react-native"; | |
| /* | |
| Gist to demonstrate an issue I had with @react-native-mapbox-gl/maps. | |
| I'm trying to display a button over a map and allow the user to click it without | |
| the event bubbling up to the map. However, calls to stopPropagation and preventDefault |
| package sandbox | |
| import cats.data.Kleisli | |
| import cats.implicits._ | |
| case class User(username: String, avatarUrl: String, profileId: Int) | |
| case class Avatar(url: String, monochrome: Boolean) | |
| case class Profile(id: Int, age: Int) | |
| object ComposingStuff extends App { |
| "ApplicationID","UCASCourse","RouteCode","StudentID","UCASID","UCASChoice","Surname","Forename1","Forename2","Forename3","ContactTelephone","ApplicationCategory","ApplicationStatus","Adjustment","CourseBlock","Decision1","Response1","Decision2","Response2","Decision3","Response3","ChangeCourse","DateOfBirth","HomeEmail","ApplicationCreated" | |
| "428215997106144","L2LW","UJECNFINA","568857580","3621037886","2","Moose","Jared","","","555-1008","HHP","A-RPL","","11","R","","","","","","N","2001-01-02","[email protected]","2021-01-28" | |
| "528576159287913","V301","USIHF","291416942","5700883392","0","Goldfish","Jamaal","","","555-0317","HHP","A-ZM","","11","","","","","R","","N","2004-01-01","[email protected]","2021-01-04" | |
| "713368803847975","H4N2","UMAERMAN","010983536","1840011905","3","Octopus","Krysta","","","555-0697","","","","11","C","D","","","","","N","2004-01-02","[email protected]","" | |
| "839009020641917","F302","USPWH","219697781","6913718958","0","Goat","Yolonda","","","555-1430","OOP","A-RPL","","11","","","","", |
| case class Color(red: Double, green: Double, blue: Double) { | |
| def isLight: Boolean = | |
| (red + green + blue) / 3.0 >= 0.5 | |
| def toGreyscale: Color = { | |
| val avg = (red + green + blue) / 3.0 | |
| Color(avg, avg, avg) | |
| } | |
| } |
| package basics | |
| import org.scalatest.matchers.should.Matchers | |
| import org.scalatest.wordspec.AnyWordSpec | |
| import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks | |
| import org.scalacheck.Gen | |
| import org.scalacheck.Arbitrary | |
| class MathSpec extends AnyWordSpec with Matchers with ScalaCheckDrivenPropertyChecks { |
| // OBJECTS -------------------------------------- | |
| object iceCream { | |
| val name = "Sundae" | |
| val inCone = false | |
| val numCherries = 1 | |
| def inGlass: Boolean = | |
| !inCone |