deep thinking

2014-05-04 Thread Tim Daly
I read Simon Parent's thesis, How Programmers Comment When They Think Nobody's Watching. Simon is analyzing comments in source files. Simon quotes two other sources about comments to try to find a classification scheme. I've quoted the summaries Simon quoted from the sources [1] and [2]. I've

Functional programming and security

2014-05-04 Thread Cecil Westerhof
I heard the stand that functional programming made it difficult to write secure programs. I do not know enough of functional programming yet to determine the value of a statement like this. What is the take here about it? -- Cecil Westerhof -- You received this message because you are

What to use use for writing GUI's

2014-05-04 Thread Cecil Westerhof
I am mostly a back-end writer. I dabbled a little with Scala before going to Clojure. (And more on the back-end as on the front-end.) But there was a discussion (I do not remember if it was on a Java or Scala newsgroup) that Swing was not the right interface for writing GUI's. I settled for

Re: How aliased require is different?

2014-05-04 Thread Ivan Kozik
Hi Petr, Did you see this? https://github.com/clojure/tools.namespace#warnings-for-aliases Also mentioned: Aliases to reloaded namespaces will break if the namespace containing the alias is not reloaded also. I've been writing per-project wrappers over the refresh function to do the

Re: What to use use for writing GUI's

2014-05-04 Thread Colin Fleming
There's really no only way to do anything in Clojure, since you can always drop down to Java interop. So anything that's available to Java is available to Clojure, too. Not all the options have a nice Seesaw-like wrapper over it of course, but they're generally still quite usable. I do a

Re: What to use use for writing GUI's

2014-05-04 Thread Cecil Westerhof
2014-05-04 10:09 GMT+02:00 Colin Fleming colin.mailingl...@gmail.com: There's really no only way to do anything in Clojure, since you can always drop down to Java interop. So anything that's available to Java is available to Clojure, too. Not all the options have a nice Seesaw-like wrapper

Re: How aliased require is different?

2014-05-04 Thread Ivan Kozik
Here's a wrapper over (refresh) that updates the aliases in the user namespace as well. You can put it in the :repl-options in your project.clj. :init (do (require '[clojure.tools.namespace.repl :refer [refresh]]) (defn r [] (refresh) ;

Re: How aliased require is different?

2014-05-04 Thread Petr Gladkikh
Thanks for the wrapper, that turned out to be the problem with 'user' namespace I was REPLing in (other namespaces were refreshed as expected). While resolving this I also found out that :after option of refresh function is indeed useful (my server was re-created with older version of ring

Re: What to use use for writing GUI's

2014-05-04 Thread Cecil Westerhof
2014-05-04 10:20 GMT+02:00 Cecil Westerhof cldwester...@gmail.com: 2014-05-04 10:09 GMT+02:00 Colin Fleming colin.mailingl...@gmail.com: There's really no only way to do anything in Clojure, since you can always drop down to Java interop. So anything that's available to Java is available

Re: Functional programming and security

2014-05-04 Thread James Reeves
I've never heard anyone express that sentiment before. If anything the opposite is true. A large part of writing secure code is about avoiding errors, so any language feature that helps you write error-free code is good for security. Functional programming eliminates mutable state as a source of

Re: What to use use for writing GUI's

2014-05-04 Thread Daniel Kersten
I'm a massive fan of Qt and have done a lot of Qt/QML in C++ in the past, but lately when I've needed to do a GUI (and could use Clojure), I've been making it Web based and using ClojureScript with Om. Since jetty/http-kit run nicely as embedded servers, you could have your application run locally

ClassCastException: Object arguments

2014-05-04 Thread Taegyoon Kim
How do you call a method which accepts Object arguments? String/format | http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...) user= (String/format %s foo) ClassCastException java.lang.String cannot be cast to [Ljava.lang.Object;

Re: What to use use for writing GUI's

2014-05-04 Thread Timothy Baldridge
I highly recommend taking a look again at JavaFX2. The latest version (released as part of Java 8 or as a separate jar with Java 7) has a very unified API and is a joy to work with. I've been hacking on a library that provides a data centric API to JavaFX2. The cool thing is that most of it is

Leiningen Clojure REPL in Windows doesn't accept arrow keys.

2014-05-04 Thread Taegyoon Kim
C:\lein repl nREPL server started on port 61472 on host 127.0.0.1 REPL-y 0.3.0 Clojure 1.5.1 Docs: (doc function-name-here) (find-doc part-of-name-here) Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit)

why is this failing on a list

2014-05-04 Thread Roelof Wobben
Hello, For 4clojure I have to find the second to last item. So I did this: (fn secondlast [v] (get v (-(count v)1))) Now it's only failing at this test : (= (__ (list 1 2 3 4 5)) 4) Can anyone tell me where I did take the wrong way. Roelof -- You received this message because you

devops-ish questions regarding Clojure webapp server-side REPL usage

2014-05-04 Thread Deyan Yotsov
Hello! I am working on a small Clojure web application, and while still in the early stages of development, I have been thinking, among other things, about a deployment plan. The production environment for the webapp will be a CentOS server (not virtual), the webapp will be sitting behind

Re: why is this failing on a list

2014-05-04 Thread Lee Spector
On May 4, 2014, at 10:42 AM, Roelof Wobben rwob...@hotmail.com wrote: For 4clojure I have to find the second to last item. So I did this: (fn secondlast [v] (get v (-(count v)1))) Now it's only failing at this test : (= (__ (list 1 2 3 4 5)) 4) Can anyone tell me where I did

Re: why is this failing on a list

2014-05-04 Thread James Trunk
Also, don't forget that vectors are zero indexed, so (- (count v) 1) will give you the last element, not the second last. Cheers, James On Sunday, May 4, 2014 4:49:45 PM UTC+2, Lee wrote: On May 4, 2014, at 10:42 AM, Roelof Wobben rwo...@hotmail.comjavascript: wrote: For 4clojure I

Re: why is this failing on a list

2014-05-04 Thread mynomoto
Roelof, The whole point of something like 4clojure is for you to try to understand how things work and learn how to fix the errors that happen along the way. Open a repl and see what the error tells you. Also, you should have the clojure cheat sheet open to help you find what each function

Re: why is this failing on a list

2014-05-04 Thread Roelof Wobben
oke, Then I think I have to work with a if then : The second test is already a vector but the thirth not (= (__ [a b c]) b) (= (__ [[1 2] [3 4]]) [1 2]) I tried already the nth but I was also failing on the first. I think because of count because you cannot know how many values you have.

Re: why is this failing on a list

2014-05-04 Thread James Reeves
Remember that indexes work from zero. So if you have a collection of 3 elements: (nth [a b c] 2) = c (nth [a b c] 1) = b (nth [a b c] 0) = a I'd encourage you to open a REPL and try the solution you have to see what you get if you get stuck. Often some experimentation will show

Re: ClassCastException: Object arguments

2014-05-04 Thread Stephen Gilardi
How do you call a method which accepts Object arguments? String/format | http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...) user= (String/format %s foo) ClassCastException java.lang.String cannot be cast to

Re: ClassCastException: Object arguments

2014-05-04 Thread Taegyoon Kim
Wow! Thank you very much, squeegee! Great success! user= (String/format %s %s (to-array (list foo bar))) foo bar 2014년 5월 5일 월요일 오전 12시 9분 3초 UTC+9, squeegee 님의 말: How do you call a method which accepts Object arguments? String/format |

Re: Leiningen Clojure REPL in Windows doesn't accept arrow keys.

2014-05-04 Thread George Oliver
Arrow keys (left/right movement and up for history) on my lein repl in Windows XP works fine. Sounds like something on your system. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note

Re: What to use use for writing GUI's

2014-05-04 Thread Gary Verhaegen
I'm no expert, but the arguments I have seen against Swing are almost always about the API, so they do not really apply to seesaw. The other arguments were about the non-native look, but I seem to remember that seesaw took care of that too. On Sunday, 4 May 2014, Timothy Baldridge

Re: Leiningen Clojure REPL in Windows doesn't accept arrow keys.

2014-05-04 Thread Taegyoon Kim
I'm in Windows 7. Not only me: REPL-y bug | https://github.com/trptcolin/reply/issues/121 Google search | https://www.google.com/#q=windows+7+lein+repl+arrowsafe=off 2014년 5월 5일 월요일 오전 12시 26분 49초 UTC+9, George Oliver 님의 말: Arrow keys (left/right movement and up for history) on my lein repl

Re: Functional programming and security

2014-05-04 Thread Evan Rowley
Most functional languages have design features that enhance their security. I'm referring to Clojure, Haskell, and Erlang, but this won't be limited to those three. As someone who was hired to handle cyber security needs of a contracting IT company, my personal and professional opinion is this: I

Re: Achieving structural sharing when composing data

2014-05-04 Thread Gary Trakhman
Have you looked at core.memoize, which uses core.cache under the hood? It allows for pluggable caching strategies that might suit your use-case. https://github.com/clojure/core.memoize On Sat, May 3, 2014 at 10:27 PM, Mike Fikes mikefi...@me.com wrote: Are there common techniques or idioms

Re: devops-ish questions regarding Clojure webapp server-side REPL usage

2014-05-04 Thread James Reeves
Hi Deyan, Modern web development tends to emphasise isolating system components into separate processes. Rather than use a monolith container like Tomcat, it's common practice to use an embedded web server combined with a reverse proxy like nginx. In the architecture I use, I have nginx running

Re: Leiningen Clojure REPL in Windows doesn't accept arrow keys.

2014-05-04 Thread Colin Jones
It's due to jline not handling virtual key codes on Windows (which fails in some [all?] non-US locales). This has been fixed on jline master by https://github.com/jline/jline2/pull/134, but there's no jline release available yet. It'll be in the next REPLy release, even if I need to depend on

Re: clojure.test parameterized tests

2014-05-04 Thread Reid Draper
Keep in mind too that since test.check/quick-check takes a property as an argument, you can construct a property by simply closing over some implementation. For example: (defn make-prop [impl] (prop/for-all [...] (= (impl ...) (other ...))) And then test with different properties

Core.logic appendo for string?

2014-05-04 Thread Adam Saleh
Hi, every once in a while I am toying with an idea of doing string manipulation in core.logic. Naively trying to use appendo doesn't really work. As far as I understand, most of the magic, that enables core logic to work with lists is in the type LCons, that holds a sequence with tail that is

Re: Functional programming and security

2014-05-04 Thread Adam Saleh
Well, what does it mean to write secure programs? Citation needed :) I remember a lengthy discussion with coleague of mine about writing cryptography primitives in haskell. I suggested, that haskells strong typing and syntax well suited for expressing mathematics, combined with good speed

Re: Functional programming and security

2014-05-04 Thread James Reeves
On 4 May 2014 20:59, Adam Saleh adamthecam...@gmail.com wrote: He thought, that using the language would make it harder to avoid cache based and timing attacks due to nature of strict/lazy sequences. That's a good point, and one I hadn't considered. However, I can't think of any timing or

Re: Functional programming and security

2014-05-04 Thread Magnus Therning
On Sun, May 04, 2014 at 09:24:08AM +0200, Cecil Westerhof wrote: I heard the stand that functional programming made it difficult to write secure programs. I do not know enough of functional programming yet to determine the value of a statement like this. What is the take here about it? It

Re: Functional programming and security

2014-05-04 Thread Evan Rowley
The most serious security vulnerabilities I've heard about for 2014 are Apple's SSL/TLS/HTTPS vulnerability, the OpenSSL Heartbleed vulnerability, FreeBSD's TCP bug, and of course the Mt. Gox bug that resulted in the company's bankruptcy. The Mt. Gox bug was caused by a flaw in the way they

Re: devops-ish questions regarding Clojure webapp server-side REPL usage

2014-05-04 Thread Akos Gyimesi
Hi Deyan, I also think that it's usually better to have a standalone Clojure app with a built-in HTTP server, and possibly with a reverse proxy as a frontend. You will have much more control this way, and Tomcat will not surprise you with wiping your hotfixes. About thread handling: it's

Re: Core.logic appendo for string?

2014-05-04 Thread David Nolen
There's no easy way to do this beyond making your own relational string type as you've suggested. On Sunday, May 4, 2014, Adam Saleh adamthecam...@gmail.com wrote: Hi, every once in a while I am toying with an idea of doing string manipulation in core.logic. Naively trying to use appendo

Tools.nrepl middleware-dependency sorting issues

2014-05-04 Thread Gary Trakhman
... inspired this workaround, is there a better way? Essentially, :expects and :requires are breaking the sort order when they shouldn't, causing certain middlewares to just be in totally the wrong place. I couldn't find the pattern after staring at for a bit. Since leiningen calls

Re: Tools.nrepl middleware-dependency sorting issues

2014-05-04 Thread Gary Trakhman
The conflict is introduced by trying constrain all the cider-middlewares to live between pr-values and session, with wrap-exceptions needing to be the first along the chain. This mostly looks good, except for wrap-exceptions/session: (wrap-describe interruptible-eval pr-values wrap-load-file

Re: Achieving structural sharing when composing data

2014-05-04 Thread Leif
The general technique in lisp is called hash consing (a.k.a. flyweight pattern, a.k.a. interning). Java strings, clojure symbols, and keywords are interned. And small integers, apparently. The basic idea is to create memoized versions of all the data constructors and only use them. This is

Re: Functional programming and security

2014-05-04 Thread Wei Hsu
Perhaps Cecil is referring to this article, Clojure web security is worse than you thinkhttps://hackworth.be/2014/03/26/clojure-web-security-is-worse-than-you-think/, describing the immature state of Clojure's web security libraries. I don't think the language itself has much to do with this,

Re: Managing State Changes, using Component

2014-05-04 Thread Atamert Ölçgen
Hello Timothy, On Sat, May 3, 2014 at 8:49 PM, Timothy Washington twash...@gmail.comwrote: Also, have you tried confirming that only one :a is instantiated? That one *:a* is not the same instance throughout all the dependant components. Seems that it's the [*:core :a*] bit that's passed

Idiomatic tokenizing and performance

2014-05-04 Thread Andrew Chambers
I've been trying to make a tokenizer/lexer for a project of mine and came up with the following code, I've modelled the stream of characters as seq/lazy of chars which is then converted to a lazy-seq of token objects. I'm relatively happy with how idiomatic and functional the code seems,

Re: Idiomatic tokenizing and performance

2014-05-04 Thread Atamert Ölçgen
I created a gist of your code for better readability, I hope you don't mind. https://gist.github.com/muhuk/7c4a2b8db63886e2a9cd On Mon, May 5, 2014 at 12:36 PM, Andrew Chambers andrewchambe...@gmail.comwrote: I've been trying to make a tokenizer/lexer for a project of mine and came up with

Re: Idiomatic tokenizing and performance

2014-05-04 Thread Andrew Chambers
Thanks, I should have done that tbh. my code is on github https://github.com/andrewchambers/ccc/blob/master/src/ccc/lex.clj . Don't think it compiles or runs on master currently though. If anyone is interested im trying to test the feasibility/size/maintainability of a clojure (or

C interop with Vertigo and clj-native

2014-05-04 Thread Olli Piepponen
Hello, I'm looking to formulate the inputs and analyze the outputs of a C program using Clojure. I can both create and manipulate the native data structures in Clojure using Vertigo[1], and for the JNA interop clj-native[2] seems to be the way to go. In all the examples of clj-native I have