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
def availableLocales: Array[Locale] = { | |
def availble(locale:Locale) = try { | |
println("trying to find: " + ("GUI_Strings", locale)) | |
val rb = ResourceBundle.getBundle("GUI_Strings", locale, Thread.currentThread.getContextClassLoader) | |
println("found it: " + rb) | |
rb | |
} | |
catch { case m: MissingResourceException => println("didnt find it"); false } | |
Locale.getAvailableLocales.filter(availble) |
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
package org.nlogo.hubnet.protocol | |
import org.nlogo.hubnet.connection.ClientRoles | |
import java.io.{DataOutputStream, DataInputStream} | |
import org.nlogo.api.LogoList | |
object TextProtocol { | |
val HANDSHAKE = 0 | |
val LOGIN_FAILURE = 1 |
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
package org.nlogo.hubnet.protocol | |
import org.nlogo.hubnet.connection.ClientRoles | |
import org.nlogo.api.LogoList | |
import java.io._ | |
case class BinaryProtocol(in:InputStream, out:OutputStream) extends Protocol { | |
val name = "Binary" | |
val dataIn = new DataInputStream(in) | |
val dataOut = new DataOutputStream(out) |
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
#lang racket | |
;; --------------------------------------------------------------------------------------------------- | |
;; a functional brain control implementation | |
(require 2htdp/universe 2htdp/image) | |
;; decide what is an event on the data stream from the headset | |
(define meditation? (make-parameter (lambda (prev-med curr-med) (not (eq? 0 curr-med))))) | |
(define attention? (make-parameter (lambda (prev-att curr-att) #false))) |
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
#lang racket | |
;; --------------------------------------------------------------------------------------------------- | |
;; a functional brain control implementation | |
(require 2htdp/universe 2htdp/image) | |
;; decide what is an event on the data stream from the headset | |
(define meditation? (make-parameter (lambda (meditation0 meditation1) #true))) | |
(define attention? (make-parameter (lambda (attention0 attention1) #false))) |
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 hw1 | |
(:use clojure.test)) | |
(defrecord StringLit [s]) | |
(defrecord Concat [l r]) | |
(defrecord RestAfter [l r]) | |
(defn parse [sexp] | |
(cond | |
(symbol? sexp) (StringLit. (str sexp)) |
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
scala> val pid = java.lang.management.ManagementFactory.getRuntimeMXBean.getName.takeWhile(_ != '@') | |
pid: String = 59747 | |
scala> def runProcess(command:String) = | |
| io.Source.fromInputStream(Runtime.getRuntime.exec(command).getInputStream).getLines() | |
runProcess: (command: String)Iterator[String] | |
scala> def findArraysIn_lsof = runProcess("lsof").filter(_.contains("array")).filter(_.contains(pid)) | |
findArraysIn_lsof: Iterator[String] |
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
Require Import Coq.Strings.String. | |
Require Export "Prop". | |
Require Export "Logic". | |
Inductive person: Type := personc : string -> string -> person. | |
Definition jc: person := personc "Josh" "Cough". | |
Inductive awesome : person -> Prop := | ajc : awesome jc. |
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
type ParseResult<'a> = | |
| Success of 'a * string | |
| Failure of string | |
type Parser<'a> = | |
abstract Parse: string -> ParseResult<'a> | |
type MappedParser<'a, 'b>(f: 'a -> 'b, m:Parser<'a>) = | |
interface Parser<'b> with |
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
> let f<'a>(a:'a) = match box a with | :? string as s -> s | _ -> "hi";; | |
val f : 'a -> string | |
> f(1);; | |
val it : string = "hi" | |
> f("hello") | |
;; | |
val it : string = "hello" |
OlderNewer