Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Roman Cheplyaka
Hi Johan,

this work is highly appreciated, thanks!

* Johan Tibell johan.tib...@gmail.com [2011-02-18 17:38:51-0800]
 Hi all,
 
 I am delighted to announce the release of preview versions of two new 
 packages:
 
 unordered-containers 0.1
 Efficient hashing-based container types.
 http://hackage.haskell.org/package/unordered-containers
 
 hashable 1.1
 Efficient hashing of common types.
 http://hackage.haskell.org/package/hashable
 
 These packages address a need for faster container types in Haskell,
 especially for string types like ByteString and Text. The package
 achieves better performance by using hashing and a Patricia trie (also
 known as a radix tree), instead of a balanced tree, in its
 implementation.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] linear and dependent types

2011-02-19 Thread Dan Doel
On Saturday 19 February 2011 1:11:23 AM Vasili I. Galchin wrote:
  BTW I was thinking of http://www.ats.org when I asked this question.

Technically speaking, if one considers ATS to be dependently typed, then one 
might as well also consider GHC to be dependently typed (with the right 
extensions enabled). ATS would easily be a nicer language in that respect, 
though.

-- Dan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unable to get parallelism using `par`

2011-02-19 Thread Andrew Coppin

On 17/02/2011 05:20 PM, Brandon Moore wrote:


If you are using ghc 7.01, you need to compile with -rtsopts for the compiled
program to parse +RTS options.


That's true.


I don't know of any way to provide a default value at compile time.


That would be -with-rtsopts=-N2 (or whatever)

http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/runtime-control.html#id3095435

But note that with GHC 7.x, the RTS *automatically* chooses the correct 
number of threads now. You no longer need to specify this manually 
(unless you specifically want to use some other number of threads for 
some reason).


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unable to get parallelism using `par`

2011-02-19 Thread Edward Amsden
 But note that with GHC 7.x, the RTS *automatically* chooses the correct
 number of threads now. You no longer need to specify this manually (unless
 you specifically want to use some other number of threads for some reason).
Is that stated in the changelog or documentation somewhere? Do you
still have to specify -threaded at compile-time?
(Sorry for the dup Andrew, missed the 'reply all' button :\)

-- 
Edward Amsden
Undergraduate
Computer Science
Rochester Institute of Technology
www.edwardamsden.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Update2

2011-02-19 Thread Patrick M
Ok so I wrote and update function

   update :: Node - [Node] 
It takes in a Node and returns a list of the Nodes
that result from assigning True to an unassigned atom in one case and False in 
the other (ie. a case
split). The list returned has two nodes as elements. One node  contains the 
formula
with an atom assigned True and the model updated with this assignment, and the 
other contains
the formula with the atom assigned False and the model updated to show this. 
The lists of unassigned
atoms of each node are also  updated accordingly. This function makes use  of 
an 
assign function to make the assignments. It also uses the chooseAtom function  
to
select the literal to assign.
 
    update :: Node - [Node]
    update (formula, (atoms, model)) = [(assign (chooseAtom atoms, True) 
formula, (remove (chooseAtom atoms) atoms, ((chooseAtom atoms,True)) `insert` 
model)) , (assign (chooseAtom atoms, False) formula, (remove (chooseAtom atoms) 
atoms, ((chooseAtom atoms, False) `insert` model)) )] 

Now I have to do the same thing but this time I must  implement a variable 
selection heuristic.this should replace the chooseAtom and I'm supposed to 
write a function update2 using it


   
    type Atom = String
    type Literal = (Bool,Atom)
    type Clause = [Literal]  
    type Formula = [Clause]
    type Model = [(Atom, Bool)]
    type Node = (Formula, ([Atom], Model))
   update2 :: Node - [Node]
   update2 = undefined
So my question is how can I create a heurestic and to implement it into the 
update2 function ,that shoud behave identical to the update function ?




  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] skin info of haskellwiki

2011-02-19 Thread hanjoosten

Hi,

I would like to use a copy of the hawiki skin for  http://ampersand.sf.org
my projects mediawiki . I like the way the front page of www.haskell.org
works. It uses a mediawiki skin, that is customized for the haskellwiki.
However, it used to be 
http://www.haskell.org/haskellwiki/HaskellWiki:Site_software published , but
I find broken links. Is there anyone that could help me out? 

thanks!
-- 
View this message in context: 
http://haskell.1045720.n5.nabble.com/skin-info-of-haskellwiki-tp3392503p3392503.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-02-19 Thread Benjamin L. Russell

Jason wrote:

I remember when
I was a kid, I wanted to be able to write things to disk so badly (I
have no idea why), but to me that was what 'real' programming was all
about.


Actually, that reminds me of one of my motivations for programming when 
I first started programming (in N80-BASIC on an NEC PC-8001 mkII in 
Tokyo) in circa 1983.


Back then, I first became enamored of the concept of programming upon 
seeing an Apple II-plus running a music program at a computer show (in 
Tokyo) in 1981 (just outside, and on the 38th floor of, the Sumitomo 
Sankaku Building in Shinjuku).  There were a number of computers on 
display at that event, including Commodore 64s and other Apple II-series 
models, but the one that stood out the most was an Apple II-plus hooked 
up to an organ keyboard and a color monitor (many of the other computers 
were attached to monochrome displays).  When I played music on the 
keyboard, vertical color bars appeared on the display, and the idea that 
an inanimate object could respond in real time to human actions with 
color and sound somehow felt extremely gratifying.


Two years later, in 1983, when I borrowed an NEC PC-8001 mkII (from a 
computer store in Ginza) (the no longer existent Micom Base Ginza) and 
wrote a pocket book accounting program in N80-BASIC, I insisted on 
saving my data to disk.  For some reason, the idea of being able to 
leave an external trace of my program's efforts on a physical medium, 
where the results would remain even after the computer was turned off, 
somehow made me feel as if the program had bestowed upon me, the user, 
the ability to make a difference, however minor, to the outside world as 
a direct result of programming the computer.  For some reason, from my 
child's eye then (I was 15 years old at the time), this made me feel 
important.



I agree that sound, animations, etc... are very sexy and if done right
can increase their enthusiasm many fold, but it also has the ability to
turn them off from the simple elegance of what first hooked their
interest. So start simple and be attentive to what THEY enjoy and you
will give them the most valuable programming knowledge of all: passion.


While I understand this approach, when I was first exposed to computer 
science in college, I thought that, too often, issues of input and 
output and storage and graphics and sound were ignored in introductory 
classes.  Although such concepts may be trivial from a theoretical 
viewpoint, from the eye of a child (or even beginning computer science 
student), they are some of the aspects that can make programming 
exciting:  the ability to cause the computer to reach to human input in 
real time with color graphics and sound, and to leave a trace of the 
interaction in the outside world for a future session even after the 
computer has been turned off.  One of the reasons that I started 
reading, for example, Paul Hudak's _The Haskell School of Expression_ 
was the author's emphasis on multimedia.  One of the reasons that I 
started programming with N80-BASIC in 1983 was the language's support 
for color graphics and (albeit elementary) sound.


-- Benjamin L. Russell



Best of luck and keep us up to date on your blog/reddit posts!
--
Jason M. Knight



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-02-19 Thread Benjamin L. Russell

Chris Smith wrote:

Manuel,

Wow, that gloss package is really cool, and exactly the sort of thing I
was looking for.  As I've said before, I don't think I can prevent this
from becoming about how to write games eventually.  Gloss looks like
provides a nice way to approach graphics programming in a simple
functional style, with a clean interface consisting entirely of
high-level ideas, and which easily switches over to the game interface
later.  Awesome!


Actually, I've been wishing for a high-level way of creating an 
interactive three-dimensional virtual world in Haskell that doesn't 
require explicit knowledge of linear algebra.  Ideally, I'm looking for 
a Haskell way of creating a functional counterpart to, say, Open Cobalt 
(see http://www.opencobalt.org/) that is high-level-enough not to 
require explicit manipulation of row and column vectors.


One of the main problems, however, is the lack of reflection.  Ideally, 
I would like the project to be able to modify its own framework in real 
time, so that, for example, within the virtual world, users would be 
able to create portals to other virtual worlds, and then write code 
while the project was running to change the configuration without 
restarting the project.  Then users would be able to write code in the 
functional style to change the virtual environment _in situ._


Eventually, the project could be used as the egg for a much larger 
project that would allow users to work, study, shop, pay bills, and 
trade, all within a virtual city.  Users could program in Haskell in a 
virtual classroom, write code in real-time to reconfigure the behavior 
of the classroom, then work on-line (say, by doing translation work) to 
earn a living, then pay rent or online bills without leaving the virtual 
world, and, when bored, form parties or alliances with other avatars to 
complete quests, craft items, or battle mon^H^H^H bugs to earn 
experience points, blurring the borders between work/study and play.


-- Benjamin L. Russell



Thank you so much for pointing it out.

--
Chris Smith




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Update2

2011-02-19 Thread PatrickM

   1. Atom: The Atom is the datatype used to describe Atomic Sentences or
propositions. These are basically represented as a string.
   2. Literal: Literals correspond to either atoms or negations of atoms. In
this implementation each literal is represented as a pair consisting of a
boolean value, indicating the polarity of the Atom, and the actual Atom.
Thus, the literal ‘P’ is represented as (True,P) whereas its negation ‘-P’
as (False,P). 2
   3. Clause: A Clause is a disjunction of literals, for example PvQvRv-S.
In this implementation this is represented as a list of Literals. So the
last clause would be [(True,P), (True,Q), (True,R),(False,S)].
   4. Formula: A Formula is a conjunction of clauses, for example (P
vQ)^(RvP v-Q)^(-P v-R). This is the CNF form of a propositional formula. In
this implementation this is represented as a list of Clauses, so it is a
list of lists of Literals. Our above example formula would be [[(True,P),
(True,Q)], [(True,R), (True,P), (False,Q)], [(False, P),
(False,P)]].
   5. Model: A (partial) Model is a (partial) assignment of truth values to
the Atoms in a Formula. In this implementation this is a list of (Atom,
Bool) pairs, ie. the Atoms with their assignments. So in the above example
of type Formula if we assigned true to P and false to Q then our model would
be [(P, True),(Q, False)]

-- 
View this message in context: 
http://haskell.1045720.n5.nabble.com/Update2-tp3392490p3392589.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Louis Wasserman
A couple thoughts:

size takes O(n).  That's just depressing.  Really.

Do you think union, intersection, etc. could be supported?

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Johan Tibell
On Sat, Feb 19, 2011 at 11:58 AM, Louis Wasserman
wasserman.lo...@gmail.com wrote:
 A couple thoughts:
 size takes O(n).  That's just depressing.  Really.

This applies to all the container types. We could support O(1) size at
the cost of slowing down e.g lookup, insert, and delete a little bit.
I haven't measure how much yet. Would it be worth it?

 Do you think union, intersection, etc. could be supported?
 Louis Wasserman

Definitely. I plan to add most of the Data.Map API. We cannot support
the ordered operations (such as min) but we should be able to support
the rest.

Johan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Sterling Clover
On Sat, Feb 19, 2011 at 3:04 PM, Johan Tibell johan.tib...@gmail.com wrote:
 On Sat, Feb 19, 2011 at 11:58 AM, Louis Wasserman
 wasserman.lo...@gmail.com wrote:
 A couple thoughts:
 size takes O(n).  That's just depressing.  Really.

 This applies to all the container types. We could support O(1) size at
 the cost of slowing down e.g lookup, insert, and delete a little bit.
 I haven't measure how much yet. Would it be worth it?

Getting a bit picky, but for the record, Data.Map and Data.Sequence
provide O(1) size, and Data.HashTable I believe stores the information
but doesn't expose it from its tiny API. That's not an argument either
way for what a HashMap should do, however :-)

Cheers,
Sterl.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread wren ng thornton

On 2/18/11 8:38 PM, Johan Tibell wrote:

Hi all,

I am delighted to announce the release of preview versions of two new packages:

unordered-containers 0.1
Efficient hashing-based container types.
http://hackage.haskell.org/package/unordered-containers


How does, or will, this package differ from Milan Straka's 
http://hackage.haskell.org/package/hashmap ?


--
Live well,
~wren

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Johan Tibell
On Sat, Feb 19, 2011 at 4:27 PM, Sterling Clover s.clo...@gmail.com wrote:
 Getting a bit picky, but for the record, Data.Map and Data.Sequence
 provide O(1) size, and Data.HashTable I believe stores the information
 but doesn't expose it from its tiny API. That's not an argument either
 way for what a HashMap should do, however :-)

We could support O(1) size. I have a design that doesn't waste one
word per node to store the size. I'll look into it as soon as I have
time.

Johan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Johan Tibell
On Sat, Feb 19, 2011 at 4:49 PM, wren ng thornton w...@freegeek.org wrote:
 How does, or will, this package differ from Milan Straka's
 http://hackage.haskell.org/package/hashmap ?

It's a continuation of that work. The unordered-containers
implementation is more space efficient and a bit faster. Milan also
uses a Patricia trie in his implementation. I plan to switch to a
hash-array mapped trie (HAMT) in the future. It's about 25% faster for
lookups but at the moment quite a bit slower for inserts. Once we got
some new faster array copy primops in GHC we can hopefully improve the
insert time a lot. A HAMT also has much lower space overhead per
entry.

Johan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Edward Kmett
On Sat, Feb 19, 2011 at 7:27 PM, Sterling Clover s.clo...@gmail.com wrote:

 On Sat, Feb 19, 2011 at 3:04 PM, Johan Tibell johan.tib...@gmail.com
 wrote:
  On Sat, Feb 19, 2011 at 11:58 AM, Louis Wasserman
  wasserman.lo...@gmail.com wrote:
  A couple thoughts:
  size takes O(n).  That's just depressing.  Really.
 
  This applies to all the container types. We could support O(1) size at
  the cost of slowing down e.g lookup, insert, and delete a little bit.
  I haven't measure how much yet. Would it be worth it?

 Getting a bit picky, but for the record, Data.Map and Data.Sequence
 provide O(1) size, and Data.HashTable I believe stores the information
 but doesn't expose it from its tiny API. That's not an argument either
 way for what a HashMap should do, however :-)


NB: Data.IntMap, which Data.HashMap is based on, actually only provides O(n)
size.

-Edward
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-19 Thread Louis Wasserman
I'd like to complain about that, too ;)

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis


On Sat, Feb 19, 2011 at 9:02 PM, Edward Kmett ekm...@gmail.com wrote:

 On Sat, Feb 19, 2011 at 7:27 PM, Sterling Clover s.clo...@gmail.comwrote:

 On Sat, Feb 19, 2011 at 3:04 PM, Johan Tibell johan.tib...@gmail.com
 wrote:
  On Sat, Feb 19, 2011 at 11:58 AM, Louis Wasserman
  wasserman.lo...@gmail.com wrote:
  A couple thoughts:
  size takes O(n).  That's just depressing.  Really.
 
  This applies to all the container types. We could support O(1) size at
  the cost of slowing down e.g lookup, insert, and delete a little bit.
  I haven't measure how much yet. Would it be worth it?

 Getting a bit picky, but for the record, Data.Map and Data.Sequence
 provide O(1) size, and Data.HashTable I believe stores the information
 but doesn't expose it from its tiny API. That's not an argument either
 way for what a HashMap should do, however :-)


 NB: Data.IntMap, which Data.HashMap is based on, actually only provides
 O(n) size.

 -Edward

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe