I have had a similar thing happen with the core.match/match macro - a lot
of examples simply break when put inside a go block. I thought it might
have been something to do with aot compilation but I'm not sure.
Adam
On 18 Feb 2014 05:33, t x txrev...@gmail.com wrote:
Building on Michal's
Hi
do you know how I can call a clojure script from a java method ?
Thanks,
Sorin.
--
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 - please
On 18 February 2014 02:14, t x txrev...@gmail.com wrote:
Does this mean:
(a) the reported behavior is normal (and my bug report is invalid) or
(b) this error happens in both cljs + clojure ?
I'd say (b).
--
You received this message because you are subscribed to the Google
Groups
You can't call a clojurescript function from java. However you can call
clojure-code from Java and clojurescript code from javascript.
On Tue, Feb 18, 2014 at 5:09 PM, sorin cristea srncris...@gmail.com wrote:
Hi
do you know how I can call a clojure script from a java method ?
Thanks,
Hi Sorin,
Are you looking for something like
load-file: http://clojuredocs.org/clojure_core/clojure.core/load-file
Shantanu
On Tuesday, 18 February 2014 17:09:20 UTC+5:30, sorin cristea wrote:
Hi
do you know how I can call a clojure script from a java method ?
Thanks,
Sorin.
--
You
Hi,
Am Sonntag, 16. Februar 2014 23:31:46 UTC+1 schrieb Laurent Droin:
Here is a function that I came up with that takes a bpm (heart beats per
minute) value, as well as a sequence of 4 values that represent the
boundaries defining the 5 different heart rate zones for a particular
2014-02-18 16:00 GMT+04:00 Sunil S Nandihalli sunil.nandiha...@gmail.com:
You can't call a clojurescript function from java. However you can call
clojure-code from Java and clojurescript code from javascript.
I think the idea is to call a Clojure script (with a space) from Java.
Use
sorry I misread the email!
On Tue, Feb 18, 2014 at 6:17 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
2014-02-18 16:00 GMT+04:00 Sunil S Nandihalli sunil.nandiha...@gmail.com
:
You can't call a clojurescript function from java. However you can call
clojure-code from Java and
I think you're looking for this method here:
https://skillsmatter.com/skillscasts/3864-impromptu-rich-hickey-lightning-talk
(you need to register to see the video)
On Tuesday, 18 February 2014 11:39:20 UTC, sorin cristea wrote:
Hi
do you know how I can call a clojure script from a java
Leiningen can exclude certain dependencies of your dependencies, see here:
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L48
Whether Speclj will work with Clojure 1.6 is something you'll have to
test...
On Monday, 17 February 2014 12:09:13 UTC, Karsten Schmidt wrote:
Hi guys,
Thanks for your information. I would take the advantage of concurrency in
clojure and implement a concurrent scenario in clojure and call it from
java code. For example I want to read/modify the content of file from many
threads, this scenario I want to implement in clojure, and call
FYI, as of Clojure 1.6, you will use the clojure.java.api.Clojure class to
obtain vars instead of RT.
http://clojure.github.io/clojure/javadoc/clojure/java/api/Clojure.html
But I would actually recommend creating a Java interface that looks just
how want it, and then implement that interface
The Clojure/West schedule is now available:
- Main: http://www.clojurewest.org/
- Speakers: http://www.clojurewest.org/speakers
- Schedule: http://www.clojurewest.org/schedule
- Register:
https://www.eventbrite.com/e/clojurewest-2014-tickets-10153269703
This Friday (Feb 21) is the last day for
lazy-seq marks it's supplied lambdata with ^{:once true} to prevent the
memory leak described at the bottom of this page http://clojure.org/lazy.
However, while going over the code for clojure.lang.LazySeq, I noticed that
ever since this commit by
Re the discussion around some?/if-some/when-some...
Summarizing feedback here:
1) some? has a confusion with some (but some congruence with some-,
some-)
2) other names might be better (not-nil?, nnil?, exists?, value?)
3) if-some and when-some lack the word let to clue you into their binding
You can use the *pad* argument in *partition* to add x as the value of
:zone-5, like *(partition 2 2 [x] params)*. (Note you have to supply *step* if
you supply *pad*.) Then you don't need the *or* or the *(last params)*.
Also, like Billy did, you can use *some* instead of (*first (filter
Jean Niklas L'orange jeann...@hypirion.com writes:
I am unable to find a style file that supports clojure code in LaTeX.
Can anyone point me in the right direction?
I always use Minted for this kind of stuff: See
https://code.google.com/p/minted/
I just want to second that. Minted is
The same goes for delay (where the lambda reference is nullified), which
leaves future-call, and even there :once is not really necessary.
A cursory benchmark indicated that lazy-seq does not, in fact, leak memory
on long sequences, even without the :once flag. Am I missing anything?
BTW, the
While I haven't tested the code, I can see one obvious mistake.
https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L20
cat is undefined?
Also why is it macros.cljX? Not sure what happens when cljs encounters a
defmacro but it should throw an error no?
HTH,
/thomas
On Monday,
On Tue, Feb 18, 2014 at 11:18 AM, Thomas Heller th.hel...@gmail.com wrote:
While I haven't tested the code, I can see one obvious mistake.
https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L20
cat is undefined?
That isn't a mistake. `silly` expands into a case, which expects
I'm unable to decipher from these examples exactly what is expected and
what is going on. Can someone write me a concise 1 paragraph description of
the problem. Something like:
When a case is emitted from a macro into the body of a go, . happens
I think it's probably something related to how
Wow, that's amazing. Thanks Billy and Johanna. I'm going to try all this
tonight.
What I'm not sure of (I don't have a good understanding yet about lazy
sequences) is whether or not the sequence given to some is lazy or not.
For example, if I have thousands of parameters but x is = the first
Well, while case allows for symbols it still doesn't make sense to use it
except :tag switches between keywords and symbols to. Apart from that cat
pat2 is never actually used.
(defmacro silly [object pat1 body1 pat2 body2]
`(case (:tag ~object)
~pat1 ~body1
~body2))
But as
Hi Timothy,
One paragraph summary:
When a macro expands to case inside of a go-block, it appears that
the _ELSE_ clause of the case is always run. (Even after a previous
clause has matched.)
Slightly longer summary:
In these lines:
@Thomas:
(this is completely unrelated to the actual bug)
This particular code was simplified from a more complicated macro
-- where for the else clause, I want to capture the original value, so
it would be something like:
(silly obj
:dog dog-line
cat cat-line) ==
(case (:tag
When a macro expands to case inside of a go-block, it appears that
the _ELSE_ clause of the case is always run. (Even after a previous
clause has matched.)
Thanks, I'll get a test in the project for this, it'll probably be fixed in
the next alpha release. Until then, cond or condp might work?
Hi Timothy,
I've picked case over cond/condp because I want a O(1) dispatch
rather than linear execution since there are many patterns [though I'm
probably guilty of premature optimization here].
I've currently been working around it via two techniques:
** Refactoring it into a function.
On 18 February 2014 22:15, t x txrev...@gmail.com wrote:
I've picked case over cond/condp because I want a O(1) dispatch
rather than linear execution since there are many patterns [though I'm
probably guilty of premature optimization here].
Actually in ClojureScript case dispatch is O(n),
On 18 February 2014 22:31, Michał Marczyk michal.marc...@gmail.com wrote:
Actually in ClojureScript case dispatch is O(n), since it's
implemented as a macro expanding to cond.
As of release 2156:
https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1119
--
You received
Looking at
https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1144-L1147
, you win. :-)
On Tue, Feb 18, 2014 at 1:33 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
On 18 February 2014 22:31, Michał Marczyk michal.marc...@gmail.com wrote:
Actually in ClojureScript
Due to asm.js some JS engines are starting to compile switch statements
where the cases are integers into jump tables. Compiler enhancement that
compiles optimizable case expressions to JS switch statements would be a
welcome enhancement - http://dev.clojure.org/jira/browse/CLJS-713.
David
On
I know. Isn't Clojure beautiful? Sigh...
In the docs for
*partition*http://clojuredocs.org/clojure_core/clojure.core/partition,
it says that partition returns a lazy sequence. And if you look at the
source section of the docs for
*some*http://clojuredocs.org/clojure_core/clojure.core/some you
He he... more research work for me tonight. Thanks Johanna for the pointers.
--
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 - please be
Great! First cut at compiling case to switch (when given numbers and
strings only as tests at the moment, but this can be improved) here:
https://github.com/michalmarczyk/clojurescript/tree/713-compile-case-to-switch
I'll post more details on the ticket.
Cheers,
Michał
On 18 February 2014
With apologies for potential stupidity:
* (get {... } key) is an operation that is O(log n) worst case (if
using Red-Black trees) or O(1) average case (hashing)
* (get { ... } key) does not have integer/string limitation
Therefore: why are we not compiling down to get ? Are the big-Oh
constants
Conrad,
Ui library modeled after bootstrap or foundation with rewritten widgets
compatible with advanced mode.
Or Pure from yahoo.This one does not comes with js and it is very light
On Saturday, February 15, 2014 11:26:18 PM UTC-2, Conrad Barski wrote:
On Thursday, February 13, 2014 8:55:00
Firstly, I think you over estimate the cost of an if. Ifs are very very
fast, especially if you are doing identical? checks (like a case is doing).
A simple pointer comparison such as (keyword-identical? :foo :foo) is going
to be way faster than a hashmap lookup.
Secondly, ifs are very JIT
switch can be compiled to a direct array indexing operation or a
binary search. I believe that's what the JVM does for tableswitch and
lookupswitch, respectively.
On 19 February 2014 01:02, t x txrev...@gmail.com wrote:
With apologies for potential stupidity:
* (get {... } key) is an operation
@Timothy, Michal:
Understood. Thanks for clarifying!
On Tue, Feb 18, 2014 at 5:09 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
switch can be compiled to a direct array indexing operation or a
binary search. I believe that's what the JVM does for tableswitch and
lookupswitch,
Now that I have a better understanding of what some does (i didn't
interpret the doc properly), it does totally make sense that it would be
recursive, so that's great.
While reducing my code with Johanna's feedback, I noticed I kept using
cond and not if.
Is there any meaningful difference
Hi,
There are many performance benchmarks showing that compiled CLISP is almost
as fast as C++ or Clojure as Java.
Being a dynamically typed language though, I wonder how it is possible. Is
it because the compiler is able to sort out actually used types and
assemble appropriate byte code or the
For Clojure at least, it is a combination of things, including:
- The quality of the optimisations that the JVM itself does during JIT
compilation. Virtual method calls for example are crazily fast.
- The JVM garbage collector - which is seriously good.
- The ability to use type hints and
It really depends on the benchmark and the programmer, and sometimes on the
computer. And on what a person chooses to report. Here are some
benchmarks, probably only representative of very special cases, that show
Java beating Clojure in many cases, Java and SBCL both beating each other
in
Clojure IMO is not truly dynamic, at least not to the extent of
Python/Ruby. I like to refer to Clojure as a dynamic enough language.
For example, once defined, types cannot be modified by adding new members
(deftype that is). If you want to add a new field to a deftype in Clojure,
you have to
In order to stay in sync with React 0.9.0-rc1 I've cut Om 0.5.0-rc1. There
are a couple of small breaking changes due to React but otherwise the
differences between 0.4.2 and 0.5.0-rc1 are minor. One big enhancement is
that you can now render to a string with om.dom/render-to-str.
Another big
Hi,
Although solutions not involving cljx are perfectly fine, I'm using
cljx -- so solutions that involves hooking into cljx are perfectly
fine too.
I have my own poor-man's lint / type checker (with different
objectives from core.typed). I want a certain function (call it
CHECKER) to be
As a point of clarification, read-string is not a hard requirement.
Just getting the name of the namespace (and walking through the
symbols + calling source on each of them to get the source code is
perfeclty fine).
Basically, I want to hook a function that
* gets called every time a namespace
With apologies for spamming:
Solutions that involves installing a new lein plugin is fine too.
I'm willing to completely re-organize my workflow in order to
* have some other piece of Clojure code gets called / do
verification whenever a clojure namespace is required/loaded/reloaded
/
Hi,
Continuing my little pet project (small program really) to learn Clojure, I
am now working on a function whose description would be something like:
Returns a collection 'weaving' 2 collections (boundaries into
categories).
Boundaries must have one element less than categories.
For
I know we talked a bit about this in IRC but this is a hack you could use
to slurp the file's contents into a string in that file:
(ns foo.core
(:refer-clojure :exclude [slurp]))
(defmacro slurp [file]
(clojure.core/slurp file))
;; In CLJS
(ns bar.core
(:require [foo.core
I am not sure about ClojureScript, but in Clojure/Java you can use
alter-var-root to change the definition of load-libs, which is called by
both require and use. You can use alter-var-root to change the definition
of any function you want in clojure.core or any other namespace. I
wouldn't
Thanks for the insight and link to http://benchmarksgame.alioth.debian.org.
WRT dynamically typed languages, I have some 5 years experience with Python
circa 2.4ish timeframe. I remember that a practical raw speed was not that
bad, but still was in average like 10 times slower from C++. Good
You may be interested in the core function 'interleave'. As for (into []), it's
perfectly idiomatic as long as you actually need to return a vector and not
just some kind of sequence (the more common case). But note also the
mapv/filterv/reduce-kv family of functions, though they're not
Ah, thank you. interleave is what I was looking for. I looked for
weave, zip, map, concat, and all the see also but did not find
interleave.
Interleave will of course not handle the last value in the categories
collection so my first instinct will be to call (into [] ) on the map
returned by
@Joel:
While on IRC, I completely misunderstood you.
Now, after looking at it again, it makes sense. This is very cool --
because making it a macro forces it to be evaluated at compile time,
when the source is available. Very nice. :-)
@Andy
Thanks! I will look into load-libs.
The
(concat sequence [val])
would often be preferable to
(conj (into [] sequence) val)
because the former solution maintains laziness.
On Tue, Feb 18, 2014 at 9:28 PM, Laurent Droin laurentdr...@gmail.comwrote:
Ah, thank you. interleave is what I was looking for. I looked for
weave, zip, map,
The OP almost certainly intended CLISP to mean Common Lisp. While the
CLISP implementation of Common Lisp is a decent platform (Conrad Barski
features it in his book _Land of Lisp_, for example), it is not the fastest
implementation. Their documentation acknowledges as much:
You need to use the lein plugin for no.disassemble, not the dependency. The
README explains how.
Cheers,
'(Devin Walters)
On Feb 18, 2014, at 23:16, Andy C andy.coolw...@gmail.com wrote:
Thanks for the insight and link to http://benchmarksgame.alioth.debian.org .
WRT dynamically typed
Here is my first post on clojure, I hope it's helpful!
http://galdolber.tumblr.com/post/77153377251/clojure-intrinsics
--
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
59 matches
Mail list logo