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
(ns caesar.core) | |
(def secret "RVAWNUEVFGJVRQREIBEORVHAQRFUNGXHPURAORQVRAGRHPU") | |
(def text "EINJAHRISTWIEDERVORBEIUNDESHATKUCHENBEDIENTEUCH") | |
(defn encode | |
"Encodes the text with shifting each char shift positions" | |
[text shift] | |
(apply str (map char (map #(+ (mod (+ shift %) 26) 65) (map int text))))) |
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
import 'dart:io'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:collection'; | |
void main() { | |
print("Please, enter 'first name' and 'last name' finish with a empty line\n"); | |
Stream cmdLine = stdin | |
.transform(UTF8.decoder) | |
.transform(new LineSplitter()); |
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
square : Path | |
square = path [ (50,50), (50,-50), (-50,-50), (-50,50), (50,50) ] | |
blueSquare : Form | |
blueSquare = traced (dashed blue) square | |
rotateSquareBy : Float -> Form | |
rotateSquareBy deg = rotate deg blueSquare | |
degrees : [number] |
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
-- Read the whole book and save it to input_lines | |
input_lines = LOAD 'alice-im-wunderland.txt' using TextLoader() as (line:chararray); | |
-- Extract words from each line and put them into a pig bag | |
-- datatype, then flatten the bag to get one word on each row | |
words = foreach input_lines generate flatten(TOKENIZE(line)) AS word; | |
-- filter out any words that are just white spaces | |
filtered_words = FILTER words by word MATCHES '\\w+'; |
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
import Safe (readMay) | |
display maybeAge = | |
case maybeAge of | |
Nothing -> putStrLn "Could not read input." | |
Just age -> putStrLn $ "In 2020, you will be: " ++ show age | |
yearToAge age = 2020 - age | |
main = do |
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
import Mouse | |
import Window | |
import Signal as S | |
import Color exposing (..) | |
import List exposing (..) | |
import Graphics.Collage exposing (..) | |
main = S.map2 draws Window.dimensions stateSignal | |
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
import Mouse | |
import Window | |
main : Signal Element | |
main = lift2 scene Window.dimensions lastClickLocation | |
input : Signal (Int, Int) | |
input = sampleOn Mouse.clicks Mouse.position |
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
import Graphics.Element (..) | |
import Signal (Signal, map, map2, sampleOn) | |
import Mouse | |
import Text (asText) | |
import Window | |
main : Signal Element | |
main = map asText mousePos | |
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
import Signal | |
import Graphics.Element exposing (Element, show) | |
import Task exposing (Task) | |
main : Signal Element | |
main = | |
Signal.map show contentMailbox.signal | |
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
-------------------------- | |
-- CORE LIBRARY IMPORTS -- | |
-------------------------- | |
import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn) | |
import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2) | |
import Signal exposing (Signal, Mailbox, mailbox, send) | |
import List | |
--------------------------------- | |
-- THIRD PARTY LIBRARY IMPORTS -- |
OlderNewer