So, to clarify, Iterators aren't a thing in themselves. Iteration is an
interface, and to call something an iterator just means that you can put it
in a for loop. Tasks and Lazy Lists are both iterators; so are arrays,
sets, dictionaries, and a whole bunch of other things. But although you can
i realise that in julia iterators are a protocol (that they rely on start,
done and next, and that the underlying type used to do the iteration
depends on what is being iterated over). but that's not true in python,
for example, where all iterators are implemented as coroutines. the only
Hi all,
While doing line-oriented file reads, I'm seeing what looks like alot of
memory being allocated. In the case below, the file is a little over
250mb, but @time seems to indicate over 3gb is being allocated, even though
I'm working with one line at a time.
Should I be worried about
The selection of what values you can use as type parameters is defined in
https://github.com/JuliaLang/julia/blob/master/src/jltypes.c#L1473-L1488
If you want to live on the dangerous side for experimentation, you can
change that function to always return true.
AFAICT the restriction is mainly
Readlines read all the lines into an array, and not to a iterator (for some
reason)
To reduce the memory allocated (and shorten GC pauses), you might try to
actually read one line at the time.
function test_readlines()
# simplified version of code from zindex.jl
fi=open(testfile.csv,
By the way, the iterator version of readlines is called eachline.
for line in eachline(fi)
#do something with line
end
kl. 13:56:21 UTC+1 lørdag 8. mars 2014 skrev Ivar Nesje følgende:
Readlines read all the lines into an array, and not to a iterator (for
some reason)
To reduce the
Hello,
I would like to convert the content of a pipebuffer int an array of Uint8.
My code so far:
iob = PipeBuffer();
write(iob, char(14))
writeproto(iob, pub.state)
Now I want to print the content of iob as hex string for debugging.
I can use bytes2hex to convert an array of
Ok, fair enough - I think the confusion for me lies in the fact that I
wouldn't have said that Julia has lazy lists, tasks and iterators, in the
same way that I wouldn't say it has floats, integers and numbers, because
the former two are just types of the latter. But now I think I understand
that
OK, thanks.
I'm sympathetic to the idea that the type system should be simple, and in
at least my case, when I want most efficiency I will be encoding
polynomials over GF2 as bits in an integer anyway, so it will work. It's
only the (less used) general case that will be slow.
One random
I think there's definitely a case for allowing any immutable type as
parameters, at least. I would open an issue on github if there isn't one
already, that way you can start a discussion.
https://github.com/JuliaLang/julia/issues/6081
On Saturday, 8 March 2014 10:44:32 UTC-3, Mike Innes wrote:
I think there's definitely a case for allowing any immutable type as
parameters, at least. I would open an issue on github if there isn't one
already, that way you can start a
Judging from
base/iobuffer.jlhttps://github.com/JuliaLang/julia/blob/master/base/iobuffer.jl,
you can access iob.data to see the actual Uint8 array that backs a
PipeBuffer.
Just note that type fields is not considered part of the exported and
(somewhat) stable interface.
Ivar
kl. 14:34:42
Thanks, iob.data works.
Is there a way in Julia to find out what are the field names of a Type,
like the dir function in Python?
Best regards:
Uwe
On Saturday, March 8, 2014 3:33:27 PM UTC+1, Ivar Nesje wrote:
Judging from
names(Type) may be what you are looking for, e.g. names(Complex) = [:re,
:im]
On Saturday, 8 March 2014 14:41:47 UTC, Uwe Fechner wrote:
Thanks, iob.data works.
Is there a way in Julia to find out what are the field names of a Type,
like the dir function in Python?
Best regards:
Uwe
Ok, I have tried the following method and it seems like it almost succeeds,
using: alias git='hub' in my .zshrc.
First I have a fresh clone of the julia repo inside my Devel directory:
ismaelvc@toybox ~ % mkdir Devel
ismaelvc@toybox ~ % cd Devel
ismaelvc@toybox ~/Devel % git clone
Hey everyone -
Twitter.jl is now available in METADATA. This is still a bit of a
work-in-progress, but the current version of the package has functions for
nearly all Twitter v1.1 REST API methods. Streaming API methods will be
added shortly.
For those of you who have used Twitter modules
I've never used a twitter api, so I'm just mentioning some possibly
relevant Julia features.
About the ¨Option Dict¨ -- you could use `function
foo(arg1,arg2;kwargs...)`. That makes `kwargs` absorb any and all keyword
arguments as a list of (key,value) tuples. Inside the function, you can
turn
It seems the problem is bigger, I can't generate .pot/.po files! I have
tried using:
make gettext
sphinx-build -b gettext . _build
ismaelvc@toybox ~/Devel/julia/doc (git)-[master] % make gettext
:(
PYTHONPATH=:juliadoc sphinx-build -b
Thanks, this is working for me:
julia iob = PipeBuffer()
IOBuffer([],true,true,false,true,0,9223372036854775807,1)
julia names(iob)
8-element Array{Any,1}:
:data
:readable
:writable
:seekable
:append
:size
:maxsize
:ptr
julia
Uwe
On Saturday, March 8, 2014 4:20:20 PM
Ok I think using: make gettext expects to be used with python2, because
of the SyntaxError in the print statement, but then I use sphinx-build2,
and the result is the same ImportError, python can't reach the juliadoc
module, I don't know how to proceed:
ismaelvc@toybox ~/Devel/julia/doc
Thanks for the hints Leah! The reason why I use a Dict is so that I can
loop over the Dict to build the query strings for the GET or POST calls
from the key/value pairs. I'll explore the kwargs... syntax though, that
sounds more natural/less typing for the user.
For the paging functions,
Or you can search in the /base directory in the source.
https://github.com/JuliaLang/julia/search?q=PipeBufferref=cmdformtype=Code
kl. 16:20:20 UTC+1 lørdag 8. mars 2014 skrev Mike Innes følgende:
names(Type) may be what you are looking for, e.g. names(Complex) = [:re,
:im]
On Saturday, 8
None of the names in IOBuffer are part of the API since they mean something
slightly different from what you expect in almost all cases (especially
.data and .ptr)
Use real(im) instead of im.re
Use takebuf_array(iob) instead of iob.data or use readbytes(iob)
On Saturday, March 8, 2014, Ivar Nesje
All of this is really missing in the documentation.
Is there a Julia documentation project?
It would be nice to have a wiki where people could add examples how to use the
functions, provided
by Julia.
Regards:
Uwe
Am 08.03.2014 18:51, schrieb Jameson Nash:
None of the names in IOBuffer are
Suppose I have a Type
type Foo
a
b
end
f = Foo(1,2)
f.a = 1
f.b = 2
how do I test whether f.a is defined
I do this isdefined(f, 1) but isdefined(f, 'a') does not work
another question
how do i undefine f.a such that isdefined(f,1) now returns false
1. isdefined(f, :a)
2. you can't.
On Sat, Mar 8, 2014 at 12:55 PM, Freddy Chua freddy...@gmail.com wrote:
Suppose I have a Type
type Foo
a
b
end
f = Foo(1,2)
f.a = 1
f.b = 2
how do I test whether f.a is defined
I do this isdefined(f, 1) but isdefined(f, 'a') does not work
Hello Everyone!, @Isaiah thankyou! I have followed your advice, but then I
came to an ImportError against the juliadoc module, and another weird thing
about juliadoc folder being grayed out.
I explained it here, the best I could: http://bit.ly/MWMRoz
Thanks again in advance! I'm pretty
I was thinking that you wanted to wrap each existing function with an
interface that handles the paging stuff. If the wrapper function is the
same for each function (except for the wrapped function name), then you can
define the wrapper functions using a loop. (A for loop where each iteration
It's the minimum value of the id parameter that is returned when you call
a Twitter method, which is then used as a query string parameter to call
the same function the next time. So when you run the first function call,
you get JSON back, which after converting to an array of Dicts you can do
Hi,
I'd like to allow a function to take arguments that consist of arrays of a
type I've defined, or empty arrays. In many languages, one can do this
using option types; is there an analogue in julia?
Concretely, I'd like to define T so that the last typeassert here will be
true:
julia type
You can make an empty array of your type with
julia MyType[]
0-element Array{MyType,1}
Would that work for you?
2014-03-08 20:44 GMT+01:00 Madeleine Udell madeleine.ud...@gmail.com:
Hi,
I'd like to allow a function to take arguments that consist of arrays of
a type I've defined, or empty
I'd like to offer GitHub.jl https://github.com/WestleyArgentum/GitHub.jl to
all those with an itch that only the GitHub API (v3) can scratch.
Not everything is wrapped, but a good chunk of it is there and I'd like to
get feedback on what other features people are most interested in.
So check
Very cool.
— John
On Mar 8, 2014, at 3:20 PM, Westley Hennigh westleyargen...@gmail.com wrote:
I'd like to offer GitHub.jl to all those with an itch that only the GitHub
API (v3) can scratch.
Not everything is wrapped, but a good chunk of it is there and I'd like to
get feedback on
I'm learning a little numerical ODE stuff, so I whipped up an
implementation of the Euler algorithm.
It accepts systems of 1st-order equations, and the code was clean and I was
happy, and all was right in the world. Then I noticed that for small step
sizes it was allocating a very large amount of
Looks like A_mul_B! should work for you to avoid memory allocation.
— John
On Mar 8, 2014, at 3:38 PM, Spencer Russell s...@mit.edu wrote:
I'm learning a little numerical ODE stuff, so I whipped up an implementation
of the Euler algorithm.
It accepts systems of 1st-order equations, and
Hmm, replacing slope = A * y[:, i] with A_mul_B!(slope, A, y[:, i:i]) gave
a very slightly reduced memory allocation and about the same speed. Am I
using it correctly?
-s
On Sat, Mar 8, 2014 at 3:39 PM, John Myles White
johnmyleswh...@gmail.comwrote:
Looks like A_mul_B! should work for you to
That seems right. Is most of the memory allocation happening in y[:, i]?
— John
On Mar 8, 2014, at 4:11 PM, Spencer Russell s...@mit.edu wrote:
Hmm, replacing slope = A * y[:, i] with A_mul_B!(slope, A, y[:, i:i]) gave a
very slightly reduced memory allocation and about the same speed. Am I
I'd like to wrap a fairly large (though admittedly not huge) C++ library.
My impression right now is that the best approach is to generate a thin C
wrapper, then generate Julia bindings with Clang.jl. That would be a little
time-consuming, but I'd like to avoid it if at all possible.
I think
The documentation is in a series of ReStructured Text files in the main
repository, under the `doc` directory:
https://github.com/JuliaLang/julia/tree/master/doc
Pull requests to improve the documentation are very welcomed, and usually
quickly accepted.
On Saturday, March 8, 2014 11:58:17 AM
Ah, that seems likely.
I tried pre-allocating a vector for the current slice outside the loop,
which I'm filling using an explicit element-by-element copy. Doing this AND
using A_mul_B!() brings the performance up to when I was doing the matrix
multiply myself.
I guess when the ArrayView stuff
Hi,
I recently discovered Halide, http://halide-lang.org/, as a new concept to
specify image processing algorithms.
The current implementation of Halide uses C++ template metaprogramming for
the frontend and has multiple backends for code generation to OpenCL, LLVM,
and Cuda.
Unfortunately
Hi Ben,
On Fri, Mar 7, 2014 at 11:02 AM, ben benjamin.conna...@gmail.com wrote:
Thanks, John.
I am still a little confused:
(1) Does the main module of a package have to be named like the package?
No, but when you type using Pkg or import Pkg, Julia looks first in the
the current
I'm going to try to answer the question by taking it to its logical
conclusion. Why does Julia have if statements, while loops and for loops
when all of these things can be accomplished with closures? In fact,
coroutines are even more powerful still, so why bother with anything
besides coroutines?
i don't think anyone was doubting that iterators are more efficient than
tasks (me: the only reason i can see for julia adding a separate mechanism
for iterators separate from tasks is efficiency; mike: [coroutines...]
impossible to make iteration over custom data types fast or efficient.).
Is there a simple way to catch syntax errors in eval(Expr)?
If you use `parse()` first, then syntax errors are returned as expressions
such as:
julia parse(x=)
:($(Expr(:incomplete, incomplete: premature end of input)))
However, I would really encourage you to try out IJulia if you
`parse()` first, then syntax errors are returned
Nothing is returned, if there was a parse error. However, I can catch the
error with try/catch. This is what I meant with graceful error handling.
Also, it only works with string arguments, not with expressions. As I said,
passing nested strings
Thanks... i think that's a missing feature
On Sunday, March 9, 2014 2:18:11 AM UTC+8, Stefan Karpinski wrote:
1. isdefined(f, :a)
2. you can't.
On Sat, Mar 8, 2014 at 12:55 PM, Freddy Chua fred...@gmail.comjavascript:
wrote:
Suppose I have a Type
type Foo
a
b
end
f =
Actually, there's a lot of people coming to realize this is one of the
smartest *non-features *of Julia. I recently read an interesting answer on
quora to the question, What is the worst mistake ever made in computer
science and programming that proved to be painful for programmers for
years?,
For redirect_stderr you can use a task to read the error output, see:
https://groups.google.com/d/msg/julia-dev/1E6ag2Tfs9Q/LLsXMFvd0ugJ
It will not solve my problem. I have to write technical documents in MS
Word (with hundreds of embedded calculations)
I understand there may be many external
My impression right now is that the best approach is to generate a thin C
wrapper, then generate Julia bindings with Clang.jl.
This will require some elbow-grease, but there is some code already in
Clang.jl to support generating these thin wrappers directly for a small but
potentially useful
There are several solutions that are probably all better than messing with
undefined fields:
- head.prev could point to head, tail.next could point to tail
- you could define a const listend of the same type as all other list items
- see also examples/list.jl
--Tim
On Saturday, March 08,
Is it possible to create function in composite types with access to the
composite type variables?
52 matches
Mail list logo