#clojure log - Aug 25 2008

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

13:10 fanda: hello everybody!

13:12 i have been wondering about creating Clojure In Examples

13:13 i just don't know where is an appropriate place to put it...

13:13 would it be ok to add to Clojure wiki?

13:13 http://en.wikibooks.org/wiki/Clojure_Programming

13:13 kotarak: "Clojure In Examples"? You mean some kind of Cookbook? It think the wiki would be a good place. There are some examples already.

13:14 fanda: actually it could be 2 things

13:14 every function => example of use

13:14 another

13:15 every common "use area" => cookbook example

13:15 cookbook examples might fit into wiki

13:15 kotarak: An example for every function should go to the reference docs, I think. clojure.org/API comes to mind.

13:15 Yep. The latter is a better candidate for the wiki.

13:16 Examples could also go to the docstrings.

13:16 fanda: yes, yes, that makes sense - put it into docstrings

13:17 kotarak: I think Parth Malwankar already started a great job in expanding the wiki with examples for the different areas of Clojure.

13:17 fanda: agreed :-)

13:17 kotarak: Feel free to add yours. :)

13:18 fanda: i am learning the fastest from examples

13:19 since clojure.org/api is automatically generated from docstrings, we should extend them

13:19 i wonder, what Rich's idea about that would be

13:19 kotarak: The EXAMPLES section is the first thing I look for, when starting something new. If you still have problems after reading them, they are either too trivial or the API is bad.

13:20 hmmm.. don't know. On the one hand it would be a perfect place, on the other having to scroll five screens up for a docstring. It's probably a point of discussion.

13:21 fanda: i guess so

13:22 kotarak: I managed to combine docstrings with naturaldocs. I can live with it. :)

13:22 fanda: i am comparing documentations of Clojure to newLISP

13:22 see for example:

13:22 http://www.newlisp.org/downloads/newlisp_manual.html#first

13:23 current http://clojure.org/api

13:23 is more like reference manual

13:23 than a real manual

13:23 I wouldn't mind help to extend it a little

13:24 kotarak: Yes. Clojure/API is the reference doc. The rest of clojure.org is more of a manual, introducing different things and stuff.

13:38 fanda: .......

13:38 i would like to ask about packaging clojure files

13:38 i know that they can be included in jar files

13:39 when developing commercial software it might be nice to include clojure files encrypted

13:39 has anyone tried that?

13:40 or second version is to compile clj files into binary data using clojure and save this binary data... ?

13:41 any experience with this?

13:48 hoeck: fanda: you could encrypt your clj files and decrypt them on the fly while loading

13:49 fanda: how would you do it? through clojure? or through Java (which gets generated into .class file)?

13:50 i just wonder what would be safer...

13:51 hoeck: mhh, you need to obfuscate the decryption key somehow, maybe in a compiled java class

13:53 or in a external library, but this is no *real* security, it just makes it more difficult

13:54 fanda: i think it would be enough for my purposes

13:55 if somebody wants to get they usually do :-)

13:55 otherwise it works very well

13:55 i am thinking about writing some bigger application

13:55 ... or actually rewriting one, which I wrote years ago

13:55 Clojure is a great candidate for this work

13:56 just have to finalize packaging and basic encryption

13:57 thanks for ideas!

13:58 hoeck: np, at work we use a windows-dll for keeping database passwords

13:58 fanda: :-)

14:01 hoeck: yeah, :)

14:02 kotarak: It's sometimes funny what people do to "hide" code. Some guy came to me because he had some VBA in his Excel to hide a certain worksheet. "The sheet cannot be seen or otherwise accessed by the user", claimed the VBA author. The guy had some info on the sheet he "secured", which he needed back. It took me 10 seconds to get the sheet back to normal user access. So much for "security"...

14:14 hoeck: yeah, sometimes, migrating data from a customers previous system is only possible due to forgotten default passwords or "uid=dbo;pwd=xxx" strings in the applications binary :)

14:15 kotarak: And then there is always the disassembler....

15:19 arohner: are nested for loops supposed to work?

15:21 I have (for [..] (let [..] (for [..]...)))

15:21 and it appears that the inner for is not being evaluated

15:23 ah, for returns a lazy seq

15:23 so to evaluate for side effects, I needed a dorun on the inner for loop

15:31 Chouser: yeah, "for" is lazy. If you want side-effects, you might look at "doseq"

15:33 arohner: ah

15:33 one thing I found slightly weird is that (let) and (for) look sort of the same

15:33 i.e. (let [var definition]), (for [var list])

15:33 but let takes multiple expressions, and for does not

15:34 and doseq doesn't look like either

15:34 i.e. I would expect (for) to take expressions

15:34 and doseq to look the same as for, but be lazy

15:48 oh, for is meant to return values, so it doesn't make that much sense that it would take multiple expressions

15:49 but doseq should look like for and let IMO

15:49 hoeck: arohner: "do" always implies something imperative, non-lazy in clojure

16:12 Chouser: for does take multiple expressions: (for [a (range 5) b (range 6 10)] [a b])

16:12 arohner: for binds multiple variables, but evaluates one expression

16:13 Chouser: ah!

16:14 Huh, I honestly hadn't noticed. I guess I've never felt the need for multiple expressions in the body of a for.

16:14 arohner: I think that was user error on my par

16:15 I wanted side effects, and I assumed for would give me that

16:15 Chouser: doseq is for side-effects, so multiple expressions makes a lot of sense. let is used in both contexts.

16:15 yeah, there's been some talk of renaming "for" since a lot of people seem surprised by its lazy behavior.

16:16 arohner: while rich is changing things, doseq should take a vector for variable bindings

16:16 so it looks like for and let

16:16 Chouser: yeah, it could even do comprehension like for

Logging service provided by n01se.net