Use `enumerate`:
julia> a = [1,3,5,8]
julia> b = [1,2,5,7]
julia> intersect(enumerate(a), enumerate(b))
2-element Array{Tuple{Int64,Int64},1}:
(1,1)
(3,5)
On July 5, 2016 at 13:20:15, siyu song (siyuphs...@gmail.com) wrote:
Good to know this method. Thanks a lot.
在 2016年7月6日星期三 UTC+9上午1:45:2
Hi Davide,
Looks like an issue of operator precedence:
http://docs.julialang.org/en/release-0.4/manual/mathematical-operations/#operator-precedence
That is, since `\` is higher precedence than `:`, your initial line is being
parsed as `(randn(3, 3)\1):3`, so the error seems to be correct.
Chee
On February 15, 2016 at 17:15:26, Lutfullah Tomak
(tomaklu...@gmail.com(mailto:tomaklu...@gmail.com)) wrote:
> Shouldn't it be if you escaped
>
> julia> module X
> macro p(y)
> esc(quote
> println($y)
> end)
> end
> macro q(y)
> quote
> println(:($($y)))
> end
> end
> end
> X
>
> julia> using
On February 14, 2016 at 21:49:30, Julia Tylors
(juliatyl...@gmail.com(mailto:juliatyl...@gmail.com)) wrote:
> Hi fellows,
>
>
> I was coding a macro, and I am having a prefix issue with functions.
>
> basically the problem is: Every single one of available functions (_ex_func)
> which
The problem is not so much when you are (potentially) generating and handling
null dates in your own code, but how one interacts with library code that may
or may not return a null. Especially in a dynamically typed language, in the
absence of a Nullable type the only way to determine if a metho
Last I checked, I think the only real option for calling Julia from Java is via
JNA to the Julia C API. Not impossible, but not as convenient as JavaCall.jl.
As for Julia vs Clojure, I had a go at implementing a simple OCR
nearest-neighbors algorithm in both Julia and Clojure. The Clojure code c
On January 26, 2016 at 15:42:11, Josef Sachs
(sa...@cyb.org(mailto:sa...@cyb.org)) wrote:
> Here is the URL that I tried to post, with the parts on separate lines.
> https:
> //
> user
> :
> pass/word
> @
> google.com
>
> I was trying to demonstrate a password with a slash in it.
> The @ follow
On January 18, 2016 at 17:08:46, Anonymous (espr...@gmail.com) wrote:
This mimics the behavior of OOP since just like in OOP the internal method
cannot be changed (since the type is immutable). Sometimes it really does make
the most sense to attach a function to an instance of a type...
I don’t
I don’t have any pointers to Julia-specific discussion, but this paper from the
Kotlin project is rather enlightening on the subject:
http://www.cs.cornell.edu/~ross/publications/mixedsite/ . In particular, Kotlin
has come up with a rather clever solution to the co-/contra-variance mess from
Ja
Just to throw this out there…
A number of years ago Mike Pall (creator and former maintainer of LuaJIT)
outlined the beginnings of what seemed (to me at least) to be a very
interesting variation on the tricolor GC:
http://wiki.luajit.org/New-Garbage-Collector . Originally this was intended for
On September 14, 2015 at 14:17:43, Daniel Carrera
(dcarr...@gmail.com(mailto:dcarr...@gmail.com)) wrote:
> On 14 September 2015 at 12:40, J Luis wrote:
> >
> >
> > segunda-feira, 14 de Setembro de 2015 às 09:26:05 UTC+1, Daniel Carrera
> > escreveu:
> > >
> > > On 14 September 2015 at 0
I think you’re just seeing the REPL printing the String object, which
represents backslashes as escaped. Printing the result should clarify things:
julia> replace("my_beautiful_string", "_", "\\_")
"my\\_beautiful\\_string"
julia> println(replace("my_beautiful_string", "_", "\\_"))
my\_beautiful
Ok, makes sense. For what it’s worth (I’m very new at Julia, but have been
using Lisp/Scheme/Clojure for a while now)… In Lisp/Clojure I think there’s a
preference even for internal function definitions to use macros vs eval for the
reason that macros modify the source at parse time, but eval wi
Out of curiosity, why use `@eval` directly instead of defining a macro? (I’m
just trying to get a better feel for what’s more Julian.)
On September 2, 2015 at 12:44:39, Patrick Kofod Mogensen
(patrick.mogen...@gmail.com) wrote:
I'm in a train right now, but yes. Look up metaprogramming in the
On August 26, 2015 at 21:30:47, Yichao Yu
(yyc1...@gmail.com(mailto:yyc1...@gmail.com)) wrote:
> On Wed, Aug 26, 2015 at 12:44 PM, Sisyphuss wrote:
> > Of course, I know how to write the valid code.
> >
> > But in the interactive environment, if someone accidentally defines the
> > promote_rul
missing:
1) You should define outer constructor for `DefaultDict(val, Dict())`;
2) You should make your promotion rules parametric.
On Sunday, August 23, 2015 at 7:48:11 PM UTC+2, Joshua Ballanco wrote:
Hello all,
Apologies in advance if I’m missing something obvious. I’ve only just started
On August 23, 2015 at 21:08:16, Kevin Squire (kevin.squ...@gmail.com) wrote:
If the type hierarchy is implemented well, functions for `Dict` would ideally
be written to work with `super(Dict)` (i.e., `Associative`). And in fact, some
are--e.g., `in`, `haskey`, `show`, `keys`, `values`, etc. See
Hello all,
Apologies in advance if I’m missing something obvious. I’ve only just started
experimenting with some of the more advanced features of Julia’s types, and
I’ve hit a bit of a wall…
Say I wanted to replicate something like Python’s `collections.defaultdict` or
Ruby’s `Hash` class with
18 matches
Mail list logo