Skip to content

Instantly share code, notes, and snippets.

Avatar
🍤
Working on Potigol Language (potigol.github.io)

Leonardo Lucena lrlucena

🍤
Working on Potigol Language (potigol.github.io)
View GitHub Profile
View fizzbuzz.poti
fizz(numero: Inteiro) = escolha numero
caso n se n mod 3 == 0 => "fizz"
caso _ => "{numero}"
fim
buzz(numero: Inteiro) = escolha numero
caso n se n mod 5 == 0 => "buzz"
caso _ => "{numero}"
fim
View gist:7832737
var numero := leia_inteiro
var r :=""
enquanto numero>0 faca
n = numero/2
resto = numero - n*2
r := r + resto.toString
numero := n
fim
escreva r.inverta
@lrlucena
lrlucena / Map.scala
Created Nov 12, 2012
Scala Dojo - ThoughtWorks
View Map.scala
package main.scala
import math.{ abs, min }
import Int.MaxValue
case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) {
def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds)
def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate)
@lrlucena
lrlucena / Map.scala
Created Nov 12, 2012
Scala Dojo - ThoughtWorks
View Map.scala
package main.scala
import math.{ abs, min }
import Int.MaxValue
case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) {
def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds)
def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate)