This file contains 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
JButton, JCheckBox, JComboBox, JToolBar, JTextField, JRadioButton, | |
JScrollBar, JWindow, JFrame, JButton, JCheckBox, JComboBox, JRadioButton | |
narišemo črto od spodnjega levega do gornjega desnega oglišča risalne plošče: | |
paintComponent({0,maxHeight,maxWidth,0}); | |
drawString(niz,x,y); | |
drawLine(x1,y1,x2,y2); | |
drawArc(x,y,sirina,visina,zackot,kot); | |
drawPolygon(p); Polygon p= new Polygon(); p.addPoint(10,10); |
This file contains 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 parsing | |
import util.parsing.combinator.RegexParsers | |
/** | |
* User: andraz | |
* Date: 8/25/12 | |
* Time: 4:05 PM | |
*/ | |
object ExpressionParsing { |
This file contains 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
/* | |
atoms | |
------------------------------------ | |
non local lazy val | |
"write once var" | |
externally pure, interanally mutable | |
remote attributes | |
*/ | |
class Atom[A] { | |
private var value: A = _ |
This file contains 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 java.io.{BufferedWriter, PrintWriter, FileWriter, File} | |
import java.util.Scanner | |
object Naloga3s { | |
def Reader(filename: String) = { | |
val sc = new Scanner(new File(filename)) | |
def loop(): Stream[Int] = { | |
if (sc.hasNextInt){ | |
sc.nextInt() #:: loop | |
} else |
This file contains 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
class Point{ | |
final double x,y; | |
Point(a,b){ | |
x=a; | |
y=b; | |
} | |
....... | |
//transformx lat,lon to unit circle with hard limit |
This file contains 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 java.util.Scanner | |
import collection.mutable.{Map,ListBuffer,Queue} | |
object Naloga6{ | |
def main(args: Array[String]){ | |
val start = args(0) | |
val pathMode = args.length == 2 | |
val end = if(pathMode) args(1) else start.sorted | |
val graph = new Graph() | |
This file contains 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 java.util.Scanner;import collection.mutable._;object A{type S=String;def main(a:Array[S]){val s=a(0);val p=a.size==2;val e=if(p)a(1)else(s.sorted);val c=new Scanner(System.in);while(c.hasNextLine){val w=c.nextLine;i(new N(w,if(p)(w==e)else(w.sorted==e&&w!=s)))};val q=Queue[N]();val k=y(s);k.c=0;def x(z:N){if(z.t)return;if(!z.v){z.e.map{e=>;if(e.c>z.c+1)e.p.clear();if(e.c>z.c){e.c=z.c+1;e.p.append(z)};if(!e.v)q.enqueue(e)}};z.v=true;if(!q.isEmpty)x(q.dequeue)};x(k);for{n<-y.values if(!n.p.isEmpty&&n.t)}n.P("")};val y=Map[S,N]();def i(n:N){for(m<-y.values;if(d(m.k,n.k)==1)){m.e.append(n);n.e.append(m)}};def d(s1:S,s2:S)=s1.zip(s2).filter{t=>t._1!=t._2}.size;class N(val k:S,val t:Boolean){val e,p=ListBuffer[N]();var c=Int.MaxValue;var v=false;def P(a:S){if(p.isEmpty)println(k+a)else(p.map(_.P("->"+k+a)))}}} |
This file contains 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
case class Node(left: Option[Node] = None, right: Option[Node] = None) { | |
lazy val size: Int = 1 + left.map(_.size).getOrElse(0) + right.map(_.size).getOrElse(0) | |
lazy val sum:Int = size +left.map(_.sum).getOrElse(0) + right.map(_.sum).getOrElse(0) | |
} | |
def tree(n: Int): Node = { | |
assert(n>0) | |
n match { | |
case 1 => Node() | |
case 2 => Node(Some(Node()), None) |
This file contains 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 sbt._ | |
import Keys._ | |
object DemoBuild extends Build { | |
val macros = RootProject(uri("git://github.com/edofic/reactive-macros")) | |
val main = Project("main", file(".")).settings( | |
scalaVersion := "2.10.0" | |
) dependsOn macros | |
} |
This file contains 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
trait Monad[M[_]] { | |
def apply[A](a: => A): M[A] | |
def flatMap[A,B](value: M[A], f: A => M[B]): M[B] | |
def map[A,B](value: M[A], f: A=>B): M[B] = flatMap(value, (v: A) => apply(f(v))) | |
} | |
object Monad { | |
def apply[A[_]](implicit f: Monad[A]) = f | |
} |
OlderNewer