Posts

erlang ! hello

On Tuesday while reading Programming Erlang on suggestion of Andreas Cardeneo from the Research Center for Information Technology of the University of Karlsruhe , I started to experiment in Haskell with typed channels and lightweight threads to imitate Erlang style processes and networks thereof. Here is the very early and raw code from a few hours of exploration. And here is a simple interactive session in which a server is created that reads strings into integers. These integers then get _distributed one at a time_/_dealt_ to a first layer of 3 parallel nodes and they then travel to a second layer: *Erlang> (server,out) ← serve (read :: String → Integer) *Erlang> l1ts ← create 3 :: IO ([Chan Integer]) *Erlang> did ← deal move ([(\y → y - x) | x ← [1..3]]) out l1ts *Erlang> l2ts ← create 3 :: IO ([Chan Integer]) *Erlang> tids ← sequence $ zipWith (link move (2 *)) l1ts l2ts *Erlang> server ·· [ show x | x ← [2..4] ] *Erlang> all_ flush l2ts -- [[2],[2],[2]]...

erlang ! hello

Here is the clock example from Programming Erlang (page 155) in Erlang [ clock.erl ] and its very rudimentary approximations!? in Haskell [ clock2.hs , general2.hs ].

Mono 2.0 binary package for Solaris 10/x86

Just received some fresh Mono 2.0 binaries for Solaris 10/x86 . Many thanks pablo! Mono 2.2 to follow after the weekend *^o^*!

Debugging Haskell: LFG, AVM → DAG

Image
A few days ago I had to do some debugging in Haskell while writing a function to draw directed acyclic graphs of attribute value matrices from LFG F-structures. UnsafePerformIO was great help there. I did most of this during a machine translation lecture given by Kurt Eberle of lingenio . Here are the debugging functions: deb1 :: Show a ⇒ a → a deb1 a = unsafePerformIO (print a >> return a) deb2 :: Show a ⇒ String → a → a deb2 msg a = unsafePerformIO (putStrLn (((msg ++) . show) a) >> return a) deb3 :: (Show a, Show b) ⇒ (a → Bool) → b → a → a deb3 p b a = unsafePerformIO $ esc p b a where esc p b a | p a = putStr ((show b) ++ (show a)) >> return a | otherwise = return a cond = (== "^OBL") dobj = deb3 cond And here is how I used them in context: core :: Integer → String → [(Integer,String)] → AVM → (String,[(Integer,String)],Integer) core i s ls (M att (A val)) = (s ++ x i ++ " [label=\"" ++ dobj s att ++ "\...

mono string hash code collisions

After reading the following blog post by David R. MacIver about hash code collisions in java strings: For reasons you either know about by now or don’t care about, I was curious as to how well String’s hashCode was distributed (I suspected the answer was “not very”). I ran a few quick experiments to verify this. For your amusement, here is a list of all hash collisions between alphanumeric strings of size 2: http://www.drmaciver.com/collisions.txt and here is a list of all which don’t collide with any others http://www.drmaciver.com/noncolliding.txt Some statistics: There are 3844 alphanumeric strings of size 2. Of these 3570 collide with at least one other string. That is, 274 of these strings (or about 7% of them) *don’t* collide with something else. Oh well. It’s a good thing no one would be stupid enough to rely on hashCode to distinguish the contents of two objects. I tested things with .NET 3.5 and MONO 1.9.1 on a 32-bit Windows Vista: running on .NET 3.5: 3844 two-char string...

Mono 1.9 binary package for Solaris 10/x86

Jonel Rienton has provided a Mono 1.9.0 binary package for Solaris 10/x86 ! I am thankful to him for his kindness^_^!

okitsune 狐

Image
I am working on a new project called: okitsune 狐 - it is going to be a simple theorem prover of sorts for logic students. Okitsune is being written in Haskell and open for contributions: okitsune.sourceforge.net code sample: analytic tableaux for propositional logic