Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Ankit Goel
Thanks a lot for the help Meikel and Jim. @ Meikel: it worked great as per your suggestion. I was just hoping it would be a bit more dynamic and infer the types!! On May 18, 11:48 pm, Jim - FooBar(); jimpil1...@gmail.com wrote: Try wrapping your if statement in a let with a binding : [k

Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Andy Fingerhut
Clojure does know the type -- it knows that it is a string, rather than a number, and it does not support doing arithmetic operations on strings, hence the error. Whereas Perl would automatically convert from a string to a number in a case like this, Clojure does not. One could argue that

Re: [ANN] Clojure Namespace Browser (clj-ns-browser 1.0.0)

2012-05-19 Thread Roberto Mannai
I got the error: *user= (use 'clj-ns-browser.sdoc) ClassNotFoundException com.fasterxml.jackson.core.JsonFactory* java.net.URLClassLoader$1.run (URLClassLoader.java:366) Should I add any jackson dependency? I followed these instructions on Windows / lein 1.7: ;; Leiningen version 1

Re: Clojure Bee iPhone app updated

2012-05-19 Thread Robert Stuttaford
Hey Kyle, I bought this, it looks great. However, browsing around I get a lot of Sorry, (doc string|Clojure source) not available messages. Was this intentional? If so, why? If not, will it be fixed sometime soon? Also, could I ask you a huge, massive favour and make the app universal? I'd be

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Matt Mitchell
Here's a parser: https://github.com/joshua-choi/fnparse Doesn't look like it's active, but could be a starting point? - Matt On Friday, May 18, 2012 8:46:19 AM UTC-4, Alexsandro Soares wrote: Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison

Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Michael Gardner
On May 19, 2012, at 3:19 AM, Andy Fingerhut wrote: Whereas Perl would automatically convert from a string to a number in a case like this, Clojure does not. One could argue that such auto-conversion of types, while convenient in many cases in Perl, is also a source of errors in programs.

Re: Clojure Bee iPhone app updated

2012-05-19 Thread Kyle Oba
Hi Robert, Thanks for the feedback. Also, thank you for using the app. I'm flattered. Doc strings and source code are only available (via Clojure for some of the items). As far as doc strings go, that's a limitation based on whether the author of the library attached that metadata to their

Re: Clojure Bee iPhone app updated

2012-05-19 Thread Robert Stuttaford
Awesome, Kyle, thank you. I'm looking forward to the iPad version with great anticipation! On 19 May 2012 16:19, Kyle Oba kyle...@gmail.com wrote: Hi Robert, Thanks for the feedback. Also, thank you for using the app. I'm flattered. Doc strings and source code are only available (via

Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Armando Blancas
Why is there this difference in behavior between interactive and compiled code? In case you'd wonder why it works at the repl since what we type there are strings, too. The repl gets them through a call to (read) which parses strings into data structures that are Clojure code. This step

Re: Lexer and parser generator in Clojure

2012-05-19 Thread John Szakmeister
On Fri, May 18, 2012 at 8:46 AM, Alexsandro Soares prof.asoa...@gmail.com wrote: Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison generating Clojure code? I'm interested in a lexer/parser in pure Clojure because I think  in use the same code

Re: core.logic, goals and facts

2012-05-19 Thread Brent Millare
Basic follow up question. I assumed that all facts must be grounded, but I never really found the answer to this. Is it true? -- 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 that posts

Re: core.logic, goals and facts

2012-05-19 Thread David Nolen
They probably should though I don't think that's a hard requirement. In Prolog you can write a fact that looks like this: likes(X,X). To say that everyone likes themselves. This is probably better expressed as a regular relation in core.logic and not as a fact. (defn likes [x y] (== x y))

Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
I'm just getting started with logic programming, and it is entirely possible I'm just approaching this incorrectly. Is it possible to use dynamically generated goals in run* ? For example, (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John

Re: Core.logic, dynamically generated goals

2012-05-19 Thread David Nolen
I don't think you need to generate goals for something as straightforward as this: (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John 'Algebra 'A) (fact grade 'John 'Art 'A) (fact grade 'Ricky 'Algebra 'D) (fact grade 'Ricky 'Art 'A) (defn

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
Hmm, I didn't explain it very well. What if I had more knowledge? Maybe I knew two grades sometimes. That could cut down on the list of possible students (assuming there are more than the three in my example). How could I write a function that worked for both of these cases? (matches [{:course

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Jason Jackson
Are you trying to see if a person meets multiple requirements? Here's how: (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John 'Algebra 'A) (fact grade 'John 'Art 'A) (fact grade 'Ricky 'Algebra 'D) (fact grade 'Ricky 'Art 'A) (defn

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
Oh, so instead of trying to unroll my requirements into a bunch of conditions, just make a single condition function that checks through the list. That helps a lot! Thanks! Alex On Sat, May 19, 2012 at 2:11 PM, Jason Jackson jasonj...@gmail.com wrote: Are you trying to see if a person meets

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Jason Jackson
I wrote a compiler in Clojure for a 4th year course. For parsing I used this combinator parser library: https://github.com/jasonjckn/clarsec which is modeled after haskell's parsec. However the performance was kind of bad, combinator parsers in general can be pretty slow. In retrospect, I

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Jason Jackson
I didn't read the part about clojure/clojurescript interop. Also, you could write a parser by hand in clojure[script], which takes a parse table as input. The parse table can be generated with from any language. On Saturday, 19 May 2012 15:44:28 UTC-4, Jason Jackson wrote: I wrote a

Re: Lexer and parser generator in Clojure

2012-05-19 Thread Brent Millare
I wrote a library on parsing expression grammars (PEGs). Its not completely independent from clojurescript since I use java's regular expressions for the token component, but technically it works on sequences and its easy to rewrite this for js's regexps. Performance hasn't been measured but

Re: algebra system core.logic

2012-05-19 Thread Brent Millare
That's more or less what I'm going to have to do anyways. It's great that clojure + core.logic make that as easy as possible. On Friday, May 18, 2012 10:42:16 PM UTC-4, David Nolen wrote: It might also be interesting to pursue a hybrid system - that's the whole point of core.logic - being

core.logic, comparators

2012-05-19 Thread Brent Millare
I understand how to construct goals using the primitives provided in core.logic, like a conjunction with fresh or all, and using relations defined with defrel. However, I don't really understand the protocols of goals once I no longer use these primitives. How would I define my own comparison

Re: core.logic, comparators

2012-05-19 Thread David Nolen
Such operators are available in core.logic.arithmetic. In general such operations are non-relational and require projection. cKanren offers a better story here. On Saturday, May 19, 2012, Brent Millare wrote: I understand how to construct goals using the primitives provided in core.logic, like