Loading deps.edn Dynamically in Clojure 1.9

2017-12-12 Thread Asim Jalis
Is it possible to load deps.edn dynamically without restarting the REPL in Clojure 1.9? -- 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 from new members are moderated - plea

Re: Contribute Specter to Clojure core?

2017-03-06 Thread Asim Jalis
r words use a wildcard for :b1. (get-in {:a [{:b1 "X1"} {:b2 "X2"}]} [:a 0 :b1]) On Sat, Mar 4, 2017 at 1:14 PM, Moe Aboulkheir wrote: > > > On Sat, Mar 4, 2017 at 6:35 AM, Asim Jalis wrote: > >> What might be a Clojurey syntax for doing path navigation? I

Re: Contribute Specter to Clojure core?

2017-03-03 Thread Asim Jalis
What might be a Clojurey syntax for doing path navigation? In other words how could get-in be extended so that it could parse nested vectors like it parses nested maps? Thinking out aloud, an integer in the path when the data structure at that level is a vector should treat the integer as an index.

Clojure For Scripting

2016-12-08 Thread Asim Jalis
I wrote a blog post on how to quickly get started with Clojure. How To Use Clojure For Scripting http://asimjalis.github.io/blog/2016/12/07/clojure-for-scripting.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Handle error many lazy sequence

2016-05-24 Thread Asim Jalis
Another option: put the try catch inside the inner loop where you are doing the failing operation. > On May 19, 2016, at 5:36 AM, Fluid Dynamics wrote: > >> On Thursday, May 19, 2016 at 7:50:57 AM UTC-4, khairul isan wrote: >> Hello all, >> >> I have problem on handle many lazy sequence, >> >

Re: how to speedup lein uberjar?

2015-11-03 Thread Asim Jalis
are no problems in doing that. >> >> Regards, >> Sunil. >> >> On Tue, Nov 3, 2015 at 12:48 AM, Asim Jalis wrote: >> >>> Hi Sunil, >>> >>> Here is something to think about. Can you use the REPL for your workflow >>> inste

Re: how to speedup lein uberjar?

2015-11-02 Thread Asim Jalis
for asking. > Regards, > Sunil. > > On Mon, Nov 2, 2015 at 6:09 AM, Asim Jalis wrote: > >> Hi Sunil, >> >> I am wondering why you want to speed up lein uberjar. >> >> How frequently do you need to run this? >> >> What is your use case a

Re: how to speedup lein uberjar?

2015-11-01 Thread Asim Jalis
Hi Sunil, I am wondering why you want to speed up lein uberjar. How frequently do you need to run this? What is your use case and workflow around this? Thanks. Asim On Mon, Oct 26, 2015 at 2:04 AM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hi Everybody, > My lein uberjar ta

Re: automatically convert java to clojure

2015-10-31 Thread Asim Jalis
atus)) On Sat, Oct 31, 2015 at 1:37 PM, Asim Jalis wrote: > The code got mangled in the posting. Here it is again. > > TEST=$(cat <<"END" > String key1 = ""; > String key2= ""; > TwitterFactory factory =new

Re: automatically convert java to clojure

2015-10-31 Thread Asim Jalis
.*);/(def $1 $2)/; s/\s+\)/)/g; # Cleanup print qq{$_\n};' On Sat, Oct 31, 2015 at 1:35 PM, Asim Jalis wrote: > On Wednesday, June 18, 2008 at 4:32:01 PM UTC-7, kyle smith wrote: >> >> Is it possible to automatically convert java code to clojure? If so, >> wo

Re: automatically convert java to clojure

2015-10-31 Thread Asim Jalis
On Wednesday, June 18, 2008 at 4:32:01 PM UTC-7, kyle smith wrote: > > Is it possible to automatically convert java code to clojure? If so, > would someone like to volunteer to write it? I frequently want to quickly translate code snippets from Java to Clojure to test out an API. For example

Automate Lein-Exec Deployment

2015-10-30 Thread Asim Jalis
I have been using lein-exec a lot for writing quick Clojure scripts. I like it because: - It lets me use deps to pull in dependencies from the REPL. - It makes it easy to get started without creating a lot of stuff. The problem I am running into is this. I want to share these scripts with people

Re: Libraries for dealing with DNS

2015-10-24 Thread Asim Jalis
Hi Kyle, DNSJava is a stable implementation of DNS in Java. http://www.dnsjava.org/ Here is the JavaDoc for doing DNS lookups: http://www.dnsjava.org/doc/org/xbill/DNS/Lookup.html Asim On Tue, Sep 15, 2015 at 3:34 PM, Kyle Sexton wrote: > Does anyone have a recommendation or know of a good l

Re: ClojureScript and development workflow

2014-11-06 Thread Asim Jalis
Hi Laurent, For refreshing the browser, I call (.reload js/location) from the browser REPL. So this is the workflow: Terminal 1: lein cljsbuild auto dev Terminal 2: lein trampoline cljsbuild repl-listen Browser: localhost:9000/myapp.html 1. I make change to the CLJS file. 2. cljsbuild auto dev

Clojure In HTML

2014-10-28 Thread Asim Jalis
Is it possible to embed Clojure in HTML using the approach used in Brython for Python? https://news.ycombinator.com/item?id=4923530 Here is the correct link to the site: http://www.brython.info/ The idea is to embed Python code in the HTML and then have an interpreter that translates it to JavaS

Re: is their a Clojure framework for handling form validation?

2014-07-05 Thread Asim Jalis
For validation check out Bouncer [1][2]. It is elegant and minimal, and also lets you chain together validators using the threading macro. [1] https://github.com/leonardoborges/bouncer [2] http://www.leonardoborges.com/writings/2013/01/04/bouncer-validation-lib-for-clojure/ Asim On Sunday, Ju

Re: ANN: clj-tuple, efficient small collections

2013-08-26 Thread Asim Jalis
I believe this is what clj-tuple is doing under the hood with macros. On Aug 26, 2013, at 10:38 AM, Kevin Downey wrote: > A Tuple protocol that defines get0 get1 get3 etc for fast element access > that doesn't tie you to using field names might be a good idea. > > On 8/25/13 9:35 AM, Zach Tellm

Re: Hiring Clojure Programmer(s)

2013-08-03 Thread Asim Jalis
The area code suggests Seattle, WA. On Aug 2, 2013, at 2:14 PM, Marcus Blankenship wrote: > Unless that doesn't matter… > > > On Aug 2, 2013, at 12:27 PM, Andrew Stine wrote: > >> Might help if you said what part of the world you're in. >> >> On Friday, August 2, 2013 12:47:21 PM UTC-4, Qui

Clojure for Beginners eBook

2013-05-01 Thread Asim Jalis
I am planning to write a practical Clojure ebook for beginners, if there is an interest in this. If you want to get updates when it is finalized drop me an email. The goal will be to help people get productive in Clojure quickly, and start using it to solve real-world problems. I have taught thi

ANN: Clojure For Developers - Dublin, CA - Apr 13-14

2013-04-05 Thread Asim Jalis
to sign up* - You can sign up at http://clojuredev.eventbrite.com<http://metaprose.createsend1.com/t/t-l-afhiy-huiluihk-r/> . - This course can be offered on-site if several people at your company are interested. *Who is the instructor?* My name is Asim Jalis<http://metaprose.createsend1.

Re: [ANN]First toy-project : CYASUS

2012-12-11 Thread Asim Jalis
I tried to run this using git clone git://github.com/Yakulu/cyasus.git lein deps lein run And got a failure with this exception: Exception in thread "main" java.lang.ClassNotFoundException: cyasus.config, compiling:(cyasus/common.clj:8) Did you forget to check in a file? Also do you

Re: No show?

2012-12-11 Thread Asim Jalis
This is a good workaround—however, I still wish repl-utils/show was still there. It was nice to always have it there instead doing this defn every time I need it to explore a Java API. On Sat, Feb 11, 2012 at 6:30 PM, Michał Marczyk wrote: > On 11 February 2012 10:35, Ken Restivo wrote: > > => (

Re: Is There A Way To Exit ClojureScript REPL

2012-12-10 Thread Asim Jalis
Thanks! Just realized it says that when the prompt starts—I hadn’t noticed it. On Mon, Dec 10, 2012 at 1:47 PM, Devin Walters wrote: > cljs/quit -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Is There A Way To Exit ClojureScript REPL

2012-12-10 Thread Asim Jalis
Is there a way to exit the ClojureScript REPL? None of these worked: Ctrl-D, exit. (exit 1), quit, (quit 1). So eventually I killed the window. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-06 Thread Asim Jalis
On Thu, Dec 6, 2012 at 5:40 AM, Stuart Sierra wrote: > The data.generators library has versions of these functions that use a > fixed seed and a rebindable Random instance. > > https://github.com/clojure/data.generators Looking at https://github.com/clojure/data.generators/blob/master/src/main/c

Re: Destructuring a seq of maps

2012-02-07 Thread Asim Jalis
I frequently find myself passing around maps that are basically structs. I use this macro to destructure the fields into let variables. ; Macro. (defmacro def-fields [struct-name & fields] (let [field-symbol-vector (->> fields (map name) (map symbol) vec) arg (gensym) body (gens

Reload/Reimport Java Class

2011-08-27 Thread Asim Jalis
Is there a way to reimport a Java class into the REPL? This would be very useful in dynamically developing Java code from the REPL. Here is a specific example. Create a java class: cat << 'END_OF_FILE' > chk.java public class chk { public String hello() { return "Hello from chk (v1).";

Re: Apply concat and mapcat evaluate seqs unnecessarily

2011-08-24 Thread Asim Jalis
trating > on your f function. I've found that trying to special-case degenerate cases > (for empty collections, etc.) has actually hurt my performance, presumably > because my cleverness got in the way of hotspot optimizations. > > > On Aug 22, 2011, at 10:32 AM, A

Re: Apply concat and mapcat evaluate seqs unnecessarily

2011-08-22 Thread Asim Jalis
Nice. Are there any technical reasons this isn't the default implementation of mapcat in Clojure.core? On Mon, Aug 22, 2011 at 9:27 AM, Meikel Brandmeyer wrote: > Hi, > > Am 22.08.2011 um 16:32 schrieb Asim Jalis: > >> Is there a way to rewrite mapcat (or apply con

Apply concat and mapcat evaluate seqs unnecessarily

2011-08-22 Thread Asim Jalis
user=> (defn f [[x]] (println "computing x:" (inc x)) (vector (inc x))) #'user/f user=> (->> (iterate f [0]) (take 0)) () user=> (->> (iterate f [0]) (apply concat) (take 0)) computing x: 1 computing x: 2 computing x: 3 () user=> (->> (iterate f [0]) (mapcat identity) (take 0)) computing x: 1 compu

Using Lein with Local Jars on Heroku

2011-08-06 Thread Asim Jalis
I am trying to push a Clojure app on Heroku. I have a local jar file that the app needs. How can I get lein to use the local jar? When I have local jar dependencies on my personal machine I just install the jar into the local maven repository on the machine. It's not obvious to me how to do this o

Re: Bizarre ClojureScript issue

2011-07-27 Thread Asim Jalis
Is it possible that the new function called portal is overwriting the namespace called portal? Could you try renaming the function called portal to something else? Like portal2? On Wed, Jul 27, 2011 at 6:05 PM, Anthony Grimes wrote: > That's actually what I thought at first, but the node example

ClojureScript Demo

2011-07-25 Thread Asim Jalis
Just saw this neat ClojureScript demo, which can be used as a starting point to create a Javascript game. http://jng.imagine27.com/articles/2011-07-23-101007_clojurescript_demo_convex_hull.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Questions About Assoc-in, Dissoc-in, etc.

2011-07-17 Thread Asim Jalis
On Sat, Jul 16, 2011 at 9:16 PM, Alan Malloy wrote: > On Jul 16, 7:11 pm, Asim Jalis wrote: >> I've been using assoc-in and dissoc-in to navigate through nested >> associative structures (HTTP requests). Had some questions: >> >> 1. Why doesn't dissoc-in tak

Re: Increasing indent level in pprint

2011-07-16 Thread Asim Jalis
Okay. I see what you mean. On Jul 16, 2011, at 8:39 PM, Sean Corfield wrote: > On Sat, Jul 16, 2011 at 7:05 PM, Asim Jalis wrote: >> The position of the braces might be a red herring here. I was mostly >> interested in figuring out how to increase the indentation level from &g

Questions About Assoc-in, Dissoc-in, etc.

2011-07-16 Thread Asim Jalis
I've been using assoc-in and dissoc-in to navigate through nested associative structures (HTTP requests). Had some questions: 1. Why doesn't dissoc-in take multiple key-sequences? For example: (dissoc-in m [:a :b :c] [:a :b :d]) I can do this using a series of dissoc-in calls, but it might be ea

Re: Increasing indent level in pprint

2011-07-16 Thread Asim Jalis
: > On Sat, Jul 16, 2011 at 12:46 PM, Asim Jalis wrote: >> Is there an easy way to increase the indent of pprint data structures >> from 1 to something like 2 or 4? I've been searching on Google and >> going through the docs and don't see anything. >> >&

Increasing indent level in pprint

2011-07-16 Thread Asim Jalis
Is there an easy way to increase the indent of pprint data structures from 1 to something like 2 or 4? I've been searching on Google and going through the docs and don't see anything. For example, I would like the following command to produce something closer to "output 2" than to "output 1". (pp

Convert HTML to Vector Notation

2011-07-12 Thread Asim Jalis
Is there a way to convert a large HTML document to a vector notation. So something that converts "Hello" to [:n1 {:a1 = "v1"} [:n2 "Hello]]. I am using hiccup to generate HTML and need a way to convert existing HTML templates to the hiccup format. Thanks! Asim -- You received this message beca

Using Clojure To Debug Java Apps

2011-07-11 Thread Asim Jalis
I have been using the Clojure REPL to debug a large Java server app. It's great for exploratory testing and for validating assumptions about how the system works. I wanted to post the code here in case someone else finds this useful. 1. Stick this in a class that is loaded early in the server/app.

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Asim Jalis
On Tue, Jul 5, 2011 at 6:35 AM, Stephen C. Gilardi wrote: > I would argue that the ~/.m2 repository is nearly as easy to work with as any > other local, on-disk scheme one might envision and has the benefit of working > with any maven-compatible tool. > > It also works for arbitrary jars one may

Re: Thread Macro For Inserting In Arbitrary Positions

2011-07-05 Thread Asim Jalis
Here is an example of using this: (--> "hello world" (.toUpperCase _) (.toLowerCase _) (.indexOf _ "w")) On Tue, Jul 5, 2011 at 3:50 PM, Asim Jalis wrote: > Frequently I want to use the thread macros (-> or ->>) except I need > to thread the arguments into

Thread Macro For Inserting In Arbitrary Positions

2011-07-05 Thread Asim Jalis
Frequently I want to use the thread macros (-> or ->>) except I need to thread the arguments into positions other than the first and the last. Or sometimes I have to go back and forth between first and last positions. Instead of alternating between -> and ->> and creating nesting, I've been using t

Re: Swank-Inject Issue

2011-06-16 Thread Asim Jalis
OSX). > The best solution I could come up with involved using a new feature from > lein 1.6.0-SNAPSHOT (:extra-classpath-dirs). > I would be very interested in other options for declaring a dependency on > tools.jar in a leiningen project! > Regards, > Johan > On Wed, Jun

Swank-Inject Issue

2011-06-15 Thread Asim Jalis
Hi, I am trying to get swank-inject to work on Ubuntu Linux and I am getting a failure related to tools.jar (ClassNotFoundException: com.sun.jdi.Bootstrap jdi.clj: 1). This error does not go away even if I add tools.jar directly to CLASSPATH. Has anyone seen this error before? Any ideas on how to

Re: Free Compojure Hosting? (or mostly free)

2011-06-10 Thread Asim Jalis
I tried this also and it works quite well. Do you have any pointers to information on how to access the datastore on Heroku through Clojure? The documentation seemed sketchy on their non-Ruby offerings. Thanks. Asim On Tue, Jun 7, 2011 at 9:37 PM, Sean Corfield wrote: > I thought I'd bump this

Re: Easy Way To Download Clojure Libraries From Git

2010-12-03 Thread Asim Jalis
dencies in project.clj >> and run >> lein deps >>  it will automatically download all the necessary dependencies. >> If you directly want to do it from github .. I don't know how to do that. >> Sunil. >> >> On Sat, Dec 4, 2010 at 6:23 AM, Asim

Easy Way To Download Clojure Libraries From Git

2010-12-03 Thread Asim Jalis
Is there an easy way to download Clojure libraries from Git and to play with them in the repl? It looks like all of them expect to be downloaded using leiningen, and leiningen requires creating a project, with dependencies on specific libraries. It would be nice if I could do something like: lein

Re: Partition At True Values Of Predicate

2010-11-28 Thread Asim Jalis
On Sun, Nov 28, 2010 at 1:17 PM, Ken Wesson wrote: > The implementation I posted earlier appears to fit the contract of > your partition-before (and, additionally, works properly if the input > starts with (nil ...) :)). Good catch :) I should have used (empty? coll) instead of (nil? first-item)

Re: Why isn't there a fold-right?

2010-11-28 Thread Asim Jalis
This looks like map rather than foldr. On Sun, Nov 28, 2010 at 7:40 AM, tpeng wrote: > i have a one: > (defn lazy-foldr [f coll] >    (lazy-seq >        (if-let [[x & xs] coll] >            (cons x (lazy-foldr f xs) > > it seems works so far ;-p > > On Nov 28, 4:01 pm, Laurent PETIT wrote: >

Re: Partition At True Values Of Predicate

2010-11-28 Thread Asim Jalis
Here is partition-before and partition-after -- partition-after is simpler. (defn partition-before-internal [pred coll] (let [first-item (first coll)] (if (nil? first-item) () (letfn [(get-partial-partition-with-item [] (let [partial-partition (partition-before-internal pr

Re: Partition At True Values Of Predicate

2010-11-28 Thread Asim Jalis
On Sat, Nov 27, 2010 at 5:53 PM, Benny Tsai wrote: > If you don't mind, I would love to see your version with lazy-seq and > recursion. Seems like that's the idiomatic way of solving problems > like this, judging by the source for the partition functions. Hi Benny, Certainly. My solution is app

Partition At True Values Of Predicate

2010-11-27 Thread Asim Jalis
I want to partition a sequence based on the values of a predicate so that every true starts a new sequence in the partition. Here is an example of how partition-with could be used: (partition-when true? '(true false false true false true true)) -> '((true false false) (true false) (true) (true))

Re: Problem with Destructuring in A Function Call

2010-04-16 Thread Asim Jalis
On Fri, Apr 16, 2010 at 2:15 AM, Per Vognsen wrote: > What may confuse is that map destructuring swaps the positions of keys > and values as compared to map literals: > > user> (let [{x :body} {:body 42}] >           x) > 42 > > It does conform to the pattern that the bound variable precedes the >

Bug - Clojure -e disables stdin

2010-03-28 Thread Asim Jalis
Is this a bug? echo "hi" | java -cp $HOME/jars/clojure.jar clojure.main -e '(println (line-seq (java.io.BufferedReader. *in*)))' The output is nil. This works fine if argument to -e is saved to a file and then the file name is specified on the command line. -- Asim -- You received this messag