Re: [julia-users] Re: "eval cannot be used in a generated function"

2016-08-10 Thread Jameson Nash
end > """) > end > eval(include(filename)) > nothing > end > > Is this somehow less evil than doing it in a generated function? > > Best, > --Tim > > On Wednesday, August 10, 2016 9:49:23 PM CDT Jameson Nash wrote: >

Re: [julia-users] Re: "eval cannot be used in a generated function"

2016-08-10 Thread Jameson Nash
> Why is it impossible to generate a new type at run time? I surely can do this by calling `eval` at module scope. module scope is compile time != runtime > Or I could create a type via a macro. Again, compile time != runtime > Given this, I can also call `eval` in a function, if I ensure the

Re: [julia-users] Re: static compilation

2016-05-18 Thread Jameson Nash
You might need to be more specific than "doesn't work"; I tried it last week and it worked for me. The usage is essentially the same (the macro in v0.5 takes an extra argument of the return type, but the deprecation warning should note this already). On Wed, May 18, 2016 at 7:59 AM Ján Adamčák

Re: [julia-users] Re: select/poll on TCPSocket in Julia?

2016-05-17 Thread Jameson Nash
> But if nothing is written to the socket for a while, `read()` will fail with timeout That sounds like a bug, although I'm not aware of any read code-path that has a timeout. Can you post an example of when it fails? This should absolutely be the correct way to handle IO. On Tue, May 17, 2016

Re: [julia-users] Re: static compilation

2016-05-13 Thread Jameson Nash
> without jl_init() That is not implemented at this time, although patches are welcome. > it has something to do with ccallable Yes, it also is orthogonal to compile-all. It is possible that compile-all is non-functional on v0.4 on Windows, I know master has many enhancements, which may have

Re: [julia-users] Re: static compilation

2016-05-12 Thread Jameson Nash
We have been working on a number of simplifications on master, so some of the best practices and extra steps aren't necessary anymore. But it should still work on v0.4. There are a few different goals that can be accomplished by invoking the Julia compiler directly, so it was a bit difficult to

[julia-users] Transpiling Julia to C – The LLVM CBackend

2016-03-10 Thread Jameson Nash
We at JuliaComputing have resurrected the LLVM CBackend project and given it support for Julia's IR. This lets us output C89 code as the backend from Julia. For more details, see our latest blog post announcing the open source publication of this work:

Re: [julia-users] funky ccall macro

2015-11-24 Thread Jameson Nash
> to have julia "correctly" fuse the two tuples U and P U wasn't a tuple, it was an Expr(:tuple). the two are printed similarly, since the latter is the AST for creating the former, but you do have to work with them slightly differently. On Tue, Nov 24, 2015 at 5:34 PM Dömötör Gulyás

Re: [julia-users] redirect_stdout() no longer accepts a Pipe argument

2015-10-09 Thread Jameson Nash
It looks like a bug On Fri, Oct 9, 2015 at 7:37 PM Peter Simon wrote: > The following works under Julia 0.3 but fails under Julia 0.4: > > stdout_orig = STDOUT > (tstream, teeproc) = open(`tee -a temp.txt`, "w", stdout_orig) > redirect_stdout(tstream) > > > The error

Re: [julia-users] Inner constructor var args

2015-10-09 Thread Jameson Nash
Since you replaced the inner constructor with an explicit one, you also need to define an outer constructor. On Fri, Oct 9, 2015 at 7:13 PM Jason Merrill wrote: > I'm trying to make a wrapper around an NTuple that takes varargs, but I > can't figure out what the constructor

Re: [julia-users] For systems that have it, does Julia set the Intel FPU round-to-double flag on startup?

2015-10-07 Thread Jameson Nash
Julia avoids running on such systems by requiring SSE2 (pentium4) as a minimum. see https://github.com/JuliaLang/julia/issues/7185#issuecomment-51562133 On Wed, Oct 7, 2015 at 2:58 AM Jeffrey Sarnoff wrote: > For systems that have it, does Julia set the Intel FPUs to

Re: [julia-users] metaprogramming: create type programmatically?

2015-10-05 Thread Jameson Nash
in short: you can't. alternatives include using a Tuple or using a Dict On Mon, Oct 5, 2015 at 2:53 PM Damien wrote: > Hi all, > > I'm writing code in which I generate a composite type and various methods > based on the fields of another type. > > I can do this at the

Re: [julia-users] copy a local variable to all parallel workers

2015-10-05 Thread Jameson Nash
despite your naming convention, it looks like "local_var" was a global. try wrapping it in a let block: let local_var=123 @everywhere var=$local_var end On Mon, Oct 5, 2015 at 6:22 PM Gabor wrote: > I would like to copy a local variable to all parallel workers. > > I thought

Re: [julia-users] Re: Variable number of parameters types in a function

2015-10-05 Thread Jameson Nash
This seems to be an unnecessarily obfuscated implementation of typeof. Julia already knows how to deal with `typeof(x[j])` very efficiently, while it doesn't understand any of `typeof(x).parameters[j]`, or `T.parameters[j]`, or `t::T=x` particularly well. On Mon, Oct 5, 2015 at 7:17 AM

Re: [julia-users] ho to pass a bitstype by reference?

2015-10-03 Thread Jameson Nash
the `Ref` type or the single-valued `Array{T,0}` provides this ability for Julia. On Fri, Oct 2, 2015 at 5:10 PM Carlo Lucibello wrote: > Hi julians, > I'd like to emulate the following behaviour from C++ > > class A{ > public: > double x; > } > > class B{ >

Re: [julia-users] Pretty printing julia (or enscript?)

2015-10-02 Thread Jameson Nash
I think he might have been looking for syntax hightlighting, like http://pygments.org/docs/lexers/#lexers-for-the-julia-language? On Fri, Oct 2, 2015 at 2:24 PM Stefan Karpinski wrote: > The default printing of Julia ASTs is the best I'm aware of. Does it not > do the

Re: [julia-users] Re: GC and scope

2015-10-01 Thread Jameson Nash
As Bill surmised, the compiler reserves the right to free local variables when it can prove it will not be used again. On Thu, Oct 1, 2015 at 8:06 AM Yichao Yu wrote: > On Thu, Oct 1, 2015 at 6:33 AM, Bill Hart > wrote: > > Actually, perhaps a

Re: [julia-users] Re: Help reading structured binary data files

2015-09-30 Thread Jameson Nash
For the bitstypes, you can do `[read(fh, UInt16)]` to be a bit more concise. On Wed, Sep 30, 2015 at 12:31 PM David McInnis wrote: > Sorry for the slow response, was called away. > > As a starting place I'll try to stick with the builtin routines first. > With Stefan's idea

Re: [julia-users] restricting the type of bitstype type parameters

2015-09-30 Thread Jameson Nash
There are potential advantages for the system to be allowed to construct these types so that it can reason about them, even if it can't create instances of these types. See for example https://github.com/JuliaLang/julia/commit/85f45974a581ab9af955bac600b90d9ab00f093b#commitcomment-13041922 Doing

Re: [julia-users] Passing Array{Array{T,N},1} to a function

2015-09-29 Thread Jameson Nash
Note that generated function are not generally needed for that, as Tim Holy pointed out yesterday in https://groups.google.com/d/msg/julia-users/iX-R5luh-0M/QUeBXBLxBwAJ. That also help avoid the downside of generated functions (they are hard to write correctly, hard to read, slow for dispatch,

Re: [julia-users] Metaprogramming and Dispatch

2015-09-29 Thread Jameson Nash
As Stefan mentioned, the `@generated` function below is equivalent to the first function you posted, except that it is worse style since it is not extensible, will generally require more memory, it is less readable (and it seems to be giving the wrong answer for N > 2 and N == 0?) The Julia-style

Re: [julia-users] Re: UTF16String or UTF8String?

2015-09-28 Thread Jameson Nash
I find it interesting to note that the wikipedia article points out that if size compression is the goal (and there is enough text for it to matter), then SCSU (or other attempts at creating a unicode-specific compression scheme) is inferior to using a general purpose compression algorithm. Since

Re: [julia-users] Re: UTF16String or UTF8String?

2015-09-27 Thread Jameson Nash
> > UTF-16 is much faster in many situations than UTF-8. > an encoding is not a speed. it is a format. Both formats are variable-length encodings, and therefore both algorithms have the same time and space complexity (although the implementation of UTF16 does appear to be simpler from the length

Re: [julia-users] downloaded binaries vs source compilation

2015-09-27 Thread Jameson Nash
The performance should be fairly close. The advantage of source compilation is that it is easier to edit files in Base and submit those changes as a PR. On Sun, Sep 27, 2015 at 2:33 AM Gabor wrote: > I have always used the downloadable binaries of Julia. > > Please advise: > >

Re: [julia-users] Re: What are the "strengths" of the Julia "ecosystem" (e.g. for bio and quants/finance)? This is not a very specific question (while sub-questions are), you've been warned..

2015-09-25 Thread Jameson Nash
>From browsing issues, it looks like the HttpServer.jl performance issue you referenced below should be now fixed by https://github.com/JuliaWeb/HttpServer.jl/pull/59. On Fri, Sep 25, 2015 at 5:47 AM Páll Haraldsson wrote: > On Thursday, September 24, 2015 at 11:07:56

Re: [julia-users] Re: Why does empty index returns first element?

2015-09-20 Thread Jameson Nash
It's not really inherited from C (where it is the result of a confusing feature called array/pointer decay), it's a generalization of Julia's multidimensional array support, where trailing dimensions are assumed to be 1, so that x[] === x[1] === x[1, 1, 1, 1, 1, ...] On Sun, Sep 20, 2015 at 1:07

Re: [julia-users] Re: cglobal library name issue

2015-09-18 Thread Jameson Nash
o be. I'm just trying to > list some of the issues. > > I appreciate there are some limitations on what is actually possible. But > at present, it's really hard to find any solution, which makes it seem like > there must be a better way. > > Bill. > > On 18 September 2015

Re: [julia-users] Re: cglobal library name issue

2015-09-18 Thread Jameson Nash
> * putting const library name strings in deps/deps.jl is problematic because the working directory may be different depending on whether you are running the module test suite or just using the module from the Julia console. presumably running the code in the code from the test suite and running

Re: [julia-users] Re: cglobal library name issue

2015-09-18 Thread Jameson Nash
; time. Does Julia propagate constants at compile time, even through function > calls to join and split, etc? > > Bill. > > On 18 September 2015 at 20:52, Jameson Nash <vtjn...@gmail.com> wrote: > >> You should be able to work out everything relative to source_

Re: [julia-users] alignement in memory when allocating arrays

2015-09-18 Thread Jameson Nash
Most malloc implementations that I'm aware of provide, at best, 16-byte allignment. However, newer SIMD instructions (like avx) require more alignment. Additionally, atomic operations may need to operate on an entire cacheline (64 bytes

Re: [julia-users] Where do they come from: jl_uv_writecb() ERROR: bad file descriptor EBADF

2015-09-18 Thread Jameson Nash
BinDeps tries to help with this by ensuring that all packages are getting their dependencies from the same place, whether that is the system, building from scratch, or a walled garden like Homebrew.jl. There isn't a particularly good way to prevent the issue, although

Re: [julia-users] Where do they come from: jl_uv_writecb() ERROR: bad file descriptor EBADF

2015-09-17 Thread Jameson Nash
If RsvgHandle is a GObject object then, yes, it's almost certainly trying to write to STDERR that it detected a double-free error (GObject handles are finalized automatically by GLib.jl, so calling gc_unref manually will result in the object getting freed twice). On Thu, Sep 17, 2015 at 4:09 AM

Re: [julia-users] Re: Accessing Windows 64 dll's from within Julia

2015-09-14 Thread Jameson Nash
You can use a program called depends22.exe to check whether it has any odd dependencies. Then try calling just `dlopen("C:\\absolute\\path\\to\\lib.dll")` and see whether that works. ccall uses the same underlying dlopen call, so once you get it working for one, it should work for both. On Mon,

Re: [julia-users] Re: Accessing Windows 64 dll's from within Julia

2015-09-14 Thread Jameson Nash
> I imagine it will be enough for me to simply supply the dll's I need, >>> plus msys-2.0.dll for download somewhere, unless I can find some magic >>> invocation which builds msys-2.0.dll into the other dlls I'm building. >>> >>> Bill. >>> >>&

Re: [julia-users] I don't understand the behaviour of macros and let.

2015-09-12 Thread Jameson Nash
You also need to call `esc()` on any symbol you want to "leak" into the outer scope. Otherwise, it will be turned into a unique symbol name visible only to the code generated by that macro. On Sat, Sep 12, 2015 at 5:45 PM Diego Javier Zea wrote: > I don't understand why am

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Jameson Nash
Accessing T.parameters is almost always completely wrong. (except for TupleType: see https://github.com/JuliaLang/julia/pull/11547 for example) For example, I've posted on a similar question previously: https://groups.google.com/d/msg/julia-users/Khe1Eh-K6i0/kxvj3day77AJ And I've written some

Re: [julia-users] fieldoffsets and the C macro offsetof

2015-09-10 Thread Jameson Nash
generally no, unless you are using C++11 features or ms-bitfields On Thu, Sep 10, 2015 at 11:01 PM J Luis wrote: > Thanks, it's very late here and posting the case will take time. But one > thing before I go. > The fact that I'm using a Julia compiled with mingw64 and

Re: [julia-users] Re: Julia on OpenBSD

2015-09-07 Thread Jameson Nash
It is essentially a copy of siglongjump (link to OpenBSD source for this funciton: http://ftp.asia.edu.tw/OS/OpenBSD/src/lib/libc/arch/amd64/gen/sigsetjmp.S) with slightly different arguments plus some extra work to restore the floating-point state. The purpose of this function is to replace all

Re: [julia-users] 0.4: calling promote_type in creating type no longer works

2015-09-07 Thread Jameson Nash
This was only "working" in Julia 0.3 because it gave a random answer instead of an appropriate error: julia> abstract AbstractFoo{T} julia> immutable Foo{T,V} <: AbstractFoo{promote_type(T,V)} end julia> promote_type(TypeVar(:T),TypeVar(:V)) V #nope julia> super(Foo{Int,Float64})

Re: [julia-users] Re: Julia on OpenBSD

2015-09-04 Thread Jameson Nash
The libunwind dependency is very shallow, but you would lose backtraces. However, I'm surprised nobody has created that header yet, since the struct that I would expect to be the hard part is required for the sigaction libc function and is defined at

Re: [julia-users] Tk (Cairo) Canvas not scrollable?

2015-09-02 Thread Jameson Nash
The Canvas object is not a proper Tk object since Tk doesn't support Cairo-based rendering and isn't very friendly to being extended. Switching to a more flexible framework like Gtk should help here. On Tue, Sep 1, 2015 at 2:17 PM Dömötör Gulyás wrote: > I'm trying to

Re: [julia-users] C interop: pointer to elementary julia type

2015-09-01 Thread Jameson Nash
use `Ref{Clong}` for the calling convention to pass an auto-allocated boxed c-long. it's usually best to avoid `pointer` and `pointer_from_objref`. memory is not "guaranteed by julia": it will be cleaned up as soon as the gc detects that you are no longer referencing the julia object. using

Re: [julia-users] C interop: pointer to elementary julia type

2015-09-01 Thread Jameson Nash
I still have no idea what you are trying to do, but punning on types like your example shows is going to get you in deep trouble with both Julia and C. (using Expr and quoted ASTs will also cause you issues, but for completely different reasons). ``` type Foo x::Clong y::Vector{Clong} end

Re: [julia-users] When to use Symbol instead of ASCIIString on function arguments?

2015-08-29 Thread Jameson Nash
Since functions are first class objects, my answer would be neither, just use a function: methoda = x - one(typeof(x)) + x methodb = identity On Sat, Aug 29, 2015 at 11:17 AM Diego Javier Zea diego...@gmail.com wrote: Hi! I'm confused with this... When do I need to use Symbol instead of

Re: [julia-users] Re: Multiple dispatch confusion

2015-08-26 Thread Jameson Nash
https://github.com/JuliaLang/julia/issues/7357 On Wed, Aug 26, 2015 at 2:27 PM Yichao Yu yyc1...@gmail.com wrote: On Wed, Aug 26, 2015 at 12:33 PM, Matt Bauman mbau...@gmail.com wrote: Yes, this can be surprising. Look at `methods(u)`: julia methods(u) # 5 methods for generic function

Re: [julia-users] Multiple dispatch confusion

2015-08-26 Thread Jameson Nash
You've defined a lot of methods here in shorthand notation: u(c::Float64, h::Float64, b, a) u(c::Float64, h::Float64, b) = u(c::Float64, h::Float64, b, a) u(c::Float64, h::Float64) = u(c::Float64, h::Float64, b) u(c::Float64, a) u(c::Float64) = u(c::Float64, a) If you look at methods(u), you'll

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-26 Thread Jameson Nash
\e is the shorthand for typing the escape character, you will probably want to escape the backslash like so: `\\`. It looks like you may be trying to create a command string, but you've used string delimiters () instead of cmd delimiters (`). Julia always uses the entire literal string (include

Re: [julia-users] Request help on the error: symbol lookup error: ...libcholmod.so.. undefined symbol: dpotrf_

2015-08-26 Thread Jameson Nash
Please open this as an issue on github On Wed, Aug 26, 2015 at 10:41 AM Yonghee Lee drago...@gmail.com wrote: Hi! I got an error during sparse Cholesky computation related Mixed Models. So I ran test for MixedModels and I got the same error as below: /usr/bin/julia: symbol lookup error:

Re: [julia-users] Re: What is the fastest way to perform 100k blocking IO operations in parallel?

2015-08-24 Thread Jameson Nash
If you are doing a lot of parallel dns queries, you may want to try increasing the number that can be run simultaneously but setting the UV_THREADPOOL_SIZE environment variable before starting julia to something larger (default is 4, max is 128). On Mon, Aug 24, 2015 at 9:17 AM Andrei Zh

Re: [julia-users] Trouble compiling Julia v0.4

2015-08-21 Thread Jameson Nash
homebrew will generally refuse to install libiconv, since forcing homebrew to install could cause significant issues with other compiles on your machine (like julia) if you've installed homebrew in their recommended location of /usr/local. I recommend uninstalling that and deleting the

Re: [julia-users] Re: installing clang.jl

2015-08-16 Thread Jameson Nash
You need to download and install msysGit, and make sure it ends up on your path ahead of cygwin git when running any windows programs (including Julia), but does not end up on your path when running cygwin. On Sun, Aug 16, 2015 at 8:46 AM Marcio Sales marciole...@hotmail.com wrote: I tried to

Re: [julia-users] Problem building 0.4 on OSX 10.8.5 - error in signal-handling.c

2015-08-15 Thread Jameson Nash
This struct is supposed to be getting defined by signals-apple.c:11-12 ``` #define __need_ucontext64_t #include machine/_structs.h ``` I don't have a 10.8 system to test with however (Apple moved this header in 10.9). Can you take a look at that header (in /usr/include) and see if there is

Re: [julia-users] Segmentation fault during Julia compilation

2015-08-14 Thread Jameson Nash
It's a JIT copy of a julia function named new. The last time this error popped up, it was due to an error in the free_page function logic to compute whether it was safe to free the current page (since PPC using large pages). One place to check then is to ensure the invalid pointer hadn't

Re: [julia-users] Really need to change immutables

2015-08-10 Thread Jameson Nash
but the problem now is that *TS* is a memory owned by Julia and that will be fatal when GMT's own memory cleaning functions try to free it and - Julia crashes. getting memory ownership right is absolutely critical when writing C interop code. It is also a place where Julia gives you a large

Re: [julia-users] Really need to change immutables

2015-08-10 Thread Jameson Nash
right, you can't mutate it directly, but you can make a new copy with the intended changes, then use unsafe_store to write those changes back into the struct. On Mon, Aug 10, 2015 at 3:56 PM J Luis jmfl...@gmail.com wrote: ... amd I am using unsafe_load() S0 =

Re: [julia-users] Really need to change immutables

2015-08-10 Thread Jameson Nash
My suggestion would be to mirror only the parts of those structs that are part of the public API. Then use unsafe_load / unsafe_store to read / modify / write the intended changes. The API authors were nice to put the public fields at the top so that you can do this (many libraries don't / can't

Re: [julia-users] Re: should using a pkg sub-module as the package loads work?

2015-07-26 Thread Jameson Nash
Module import/using paths are always absolute (from Main), unless prefixed by one (or more) dots. So for this example, try: using .SubModule On Sat, Jul 25, 2015 at 10:15 AM Jeffrey Sarnoff jeffrey.sarn...@gmail.com wrote: src/SubModule.jl defines the SubModule removing using SubModule and

Re: [julia-users] Re: How to un-substring a string?!

2015-07-21 Thread Jameson Nash
does `copy` work? although `bytestring` also seems like a good method for this also. it seems wrong to me also that `match` is making a copy of the original string (if that is indeed what it is doing) On Tue, Jul 21, 2015 at 6:57 PM andrew cooke and...@acooke.org wrote: string(bytestring(...))

Re: [julia-users] unexpected failure of type inferencing

2015-07-20 Thread Jameson Nash
-un/boxing since it's not clear when it is optional. I'd prefer to just raise clear errors when someone gets it wrong in a way that can be checked, but Jeff implemented the auto-un/boxing and may have strong feelings about it. On Sat, Jul 18, 2015 at 8:46 PM, Jameson Nash vtjn...@gmail.com wrote

Re: [julia-users] unexpected failure of type inferencing

2015-07-18 Thread Jameson Nash
Intrinsics.sitofp doesn't have a return type. It needs to be wrapped by a call to Intrinsics.box to actually get a return type assigned. There are a few places (such as sitofp) where the expr type doesn't matter, so type inference doesn't bother marking them. Unfortunately, code_warntype doesn't

Re: [julia-users] Re: how should I assign load(filepathname, varname_string) to varname given as a string

2015-07-18 Thread Jameson Nash
I'll walk back a bit of what I said, since I'm not entirely clear on your use case. You can use a macro such as: @load z where the definition of @load is: macro load(s) :( $(esc(s)) = load(joinpath(loadpath, $(string(s, .jld ) end note that `z` in that case is taken as the literal symbol

Re: [julia-users] pmap - version to return reduced result only

2015-07-16 Thread Jameson Nash
i believe that length(chunks) will be = nworkers() the last statement of the for loop should be the return value from that iteration. (for example: the variable name `trialCount`). On Fri, Jul 17, 2015 at 12:12 AM Greg Plowman greg.plow...@gmail.com wrote: OK thanks. I didn't consider

Re: [julia-users] Julia binary goes in infinite wait on Ubuntu 14.10 (ppc64le)

2015-07-14 Thread Jameson Nash
I had at one point fairly recently (back in February, I think) shown that it should be possible to run julia on the ppc64le hardware. However, ports are time consuming and difficult to maintain (I don't own a PPC computer for one thing). Julia Computing could help with a port if interested. For

Re: [julia-users] Re: is there compile-time dispatch on constants from a v0.4 @enum

2015-07-11 Thread Jameson Nash
i suspect that ideal number is around 2 or 3. you should make singleton types instead of using the enum macro if you want to dispatch on the result. the enum macro exists for exactly the reason that typically you don't want the the compiler to try to attempt method specialization on values. you

Re: [julia-users] Re: how should I assign load(filepathname, varname_string) to varname given as a string

2015-07-11 Thread Jameson Nash
A macro can't do this since it is strictly a pure source transform (it cannot access values or variables). `eval` is essentially an escape hatch to allow you to do anything, including this, but only in the global scope (and it's generally not recommended). it was a design decision in julia not to

Re: [julia-users] Type constructor for Arrays or Tuples

2015-07-10 Thread Jameson Nash
Tuple{} is v0.4 syntax. on v0.3 use ( ) or Compat. On Fri, Jul 10, 2015 at 3:29 AM Scott Noel-Hemming frogstar...@gmail.com wrote: I'm sure I'm missing something obvious here, but can anyone point me to where I should look to explain this behavior: immutable MyArray : MyType prefix::Char

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-09 Thread Jameson Nash
gc optimizations aren't really the critical issue (although it is a possible side-benefit). the big advantages are enforced type computability (they cannot be accessed in ways that are invisible to inference) and semantic purity (the variables are exactly those you see in the program, plus any

Re: [julia-users] Re: Parallel execution, again

2015-07-08 Thread Jameson Nash
Just make the function a closure argument to pass additional data, or to slice it with a different parameter: pmap( (args...) - min_func(args..., add_args...), args) pmap( i - min_func(methods[i, 1], methods[i, 2]), 1:length(methods) ) note that the primary distinction between `@parallel` and

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-08 Thread Jameson Nash
There are global symbol tables for static analysis / reflection, but they do not exist at runtime or for the local scope. On Wed, Jul 8, 2015 at 7:06 PM Brandon Taylor brandon.taylor...@gmail.com wrote: Surely environments already exist somewhere inside Julia? How else could you keep track of

Re: [julia-users] Help in understanding Julia's ways

2015-07-05 Thread Jameson Nash
Just to get it out of the way, I'll point out first that since all of the aforementioned languages are turing-complete, they can all solve all of the same programming problems. Therefore, there is never a question of whether one language can be used to emulate the features of another language.

Re: [julia-users] readandwrite: how can I read a line as soon as it's written by the process?

2015-06-28 Thread Jameson Nash
yes, it is the fault of `od`. you can see this by using `cat` instead and observing that it works. if you play around with the thresholds in `od`, you will observe that it is doing block-buffering of 4096 byte chunks when the input is a pipe. Unless you turn on write buffering (with

Re: [julia-users] [julia-user] error occured when compiling in Debian Jessie

2015-06-19 Thread Jameson Nash
You will generally get much better error messages if you run make without `-j`. The more helpful error message was printed somewhere in the middle, when the failure first occurred, and suggests setting OPENBLAS_TARGET_ARCH (the rest seems to be severely garbled). The valid choices are listed at

Re: [julia-users] How to manually install julia packages on a Windows system

2015-06-18 Thread Jameson Nash
WinRPM can be run from a mac/linux system directly, if you pass win32 as the architecture flag to the install methods. I intended it to be fairly friendly and object oriented to use from the command line (and wrote most of it from a Mac). On Thu, Jun 18, 2015 at 2:26 PM Isaiah Norton

Re: [julia-users] Re: What's [] called? ie How do I refer to the array construction function?

2015-06-17 Thread Jameson Nash
In 0.4, you can now construct vector types directly: Vector{T}(dims...) making construction of some arrays a bit clear. But I think the array equivalent of `tuple` is `vcat`. On Wed, Jun 17, 2015 at 5:20 PM andrew cooke and...@acooke.org wrote: thanks for all the replies. i really wanted

Re: [julia-users] Method parameters and union types

2015-06-11 Thread Jameson Nash
Are you looking for the type-intersection perhaps? julia typeintersect(Union(Int,Float64), Float64) Float64 On Thu, Jun 11, 2015 at 3:15 PM David Gold david.gol...@gmail.com wrote: I want the following function function t_or_void{T}(::Type{Union(T, Void)}) return T end to work like

Re: [julia-users] Re: Is it possible to change an object's type at runtime?

2015-06-07 Thread Jameson Nash
It seems a bit misleading to call that method simply unsafe when in reality it is pretty much guaranteed to corrupt your entire application. On Sun, Jun 7, 2015 at 1:13 PM Jonathan Malmaud malm...@gmail.com wrote: I did implement an extremely hacky approach to force the type of an object to

Re: [julia-users] I'm lost (again)

2015-05-31 Thread Jameson Nash
The dlopen API in base changed last week and I have not had time to update Gtk.jl accordingly. I should be able to get back to soon however. On Sun, May 31, 2015 at 12:24 PM Milan Bouchet-Valat nalimi...@club.fr wrote: Le dimanche 31 mai 2015 à 02:30 -0700, Andreas Lobinger a écrit : Hello

Re: [julia-users] julia on arm - some more progress

2015-05-31 Thread Jameson Nash
It would seem that they must be forcing on codegen with -mattrs=+vfp, but I didn't think you could do that at compile time. On Sun, May 31, 2015 at 6:14 AM Viral Shah vi...@mayin.org wrote: :-( I wonder what’s the magic incantation those LLVM binaries use. -viral On 31-May-2015, at 9:29

Re: [julia-users] Macros generating Functions

2015-05-30 Thread Jameson Nash
But @eval is still a macro, so it is even better to rewrite this without that: function getfn() return function(); 1; end end const n = getfn() On Sat, May 30, 2015 at 2:30 PM David Gold david.gol...@gmail.com wrote: Something to note about Tom's method is that the name function must be passed

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-26 Thread Jameson Nash
since this looks a lot like recreating a distribution from a frequency measurement, one of the other tools that comes to my mind (courtesy of an old question I asked of julia-users in the development of the hist method in base), is to compute the (continuous) Kernel Density Estimator first, and

Re: [julia-users] Cxx on Windows?

2015-05-26 Thread Jameson Nash
That looks like it might be a name-mangling error. In particular, they should not have been mangled, but they instead got mangled as if they were decorated with DLLEXPORT. On Tue, May 26, 2015 at 1:15 PM J Luis jmfl...@gmail.com wrote: After applying Keno's patch I now get only these two

Re: [julia-users] Re: How to stop the program and enter the value of the variable from the keyboard (by user)?

2015-05-23 Thread Jameson Nash
You are asking for a return value of type Int, but have typed in the character 1. Try instead: x=chomp(readline(STDIN)) On Sat, May 23, 2015 at 7:31 PM paul analyst paul.anal...@mail.com wrote: What wrong ? after typing 1 var = 939577809079766321 (one ENTER is to small ) julia println(type

Re: [julia-users] Re: Error: expected Function, got Int64

2015-05-18 Thread Jameson Nash
at some point you probably entered something like: sum = 5 from that point on, sum refers to 5, rather than the Base.sum function. you could restore it by typing sum = Base.sum or just restart On Mon, May 18, 2015 at 11:37 AM James Byars jimmyby...@gmail.com wrote: Thank you. I said this in

Re: [julia-users] Best way in Julia to build a set of unique values?

2015-05-18 Thread Jameson Nash
use a Set? http://docs.julialang.org/en/latest/stdlib/collections/?highlight=set On Mon, May 18, 2015 at 4:46 PM Scott Jones scott.paul.jo...@gmail.com wrote: I would like to be able to do the following in Julia: Take a UInt64 (or UInt128, for that matter), and add it to an array, if it is

Re: [julia-users] SharedArray definition and assignation of values. Is this behavior a bug?

2015-05-18 Thread Jameson Nash
this definitely looks like a bug. can you post an issue? it might be good to see if https://github.com/JuliaLang/julia/pull/11280 fixes it as well. On Mon, May 18, 2015 at 10:44 PM Sebastian Souyris sebastian.souy...@gmail.com wrote: It seems that there is a bug when you define several

Re: [julia-users] llvmcall printf

2015-05-17 Thread Jameson Nash
In many cases, you can write generic code and llvm will attempt match it to the optimal instruction sequence. (to your second question: no, ccall does not substantially support llvm intrinsics, although llvm does intercept some stdlib calls and replace them with intrinsics). julia f(x,y) =

Re: [julia-users] Re: Defining a function in different modules

2015-05-15 Thread Jameson Nash
For a concrete example, the export of the `find` method in LibExpat.jl was recently noted to conflict with the export of `Base.find`. Even though there would have been no ambiguity to merging the definitions, the consensus was that they should not be merged since the definition of the function in

Re: [julia-users] Julia will always be open source

2015-05-14 Thread Jameson Nash
I am one of the more recent people to join Julia Computing, so that I am now able to work full-time on Julia. It's been a great way to merge a mutual hobby – of contributing to the open-source Julia project – with day-to-day responsibilities. On Wed, May 13, 2015 at 10:55 AM Scott Jones

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Jameson Nash
It might be a problem with windows. In particular, windows has 3 semi-independent environment variables. Julia uses the Win32 API environment, but there are also two posix environ arrays (unicode and not unicode) that might be getting used by R. Additionally, some languages (such as Tk) make a

Re: [julia-users] Detecting free variables in an anonymous function

2015-05-08 Thread Jameson Nash
You can call expand() on the AST, and let the frontend lower the code into a form that is easier to analyze. In particular: ``` julia expand( :(x-y=1; y+x+z) ).args[1].ast.args[2][1] 1-element Array{Any,1}: :y ``` On Fri, May 8, 2015 at 2:41 PM Jonathan Malmaud malm...@gmail.com wrote: Say I

Re: [julia-users] Re: dlopen trouble

2015-05-05 Thread Jameson Nash
On Mac, dlopen doesn't do a search, since (unlike linux) the actual install path gets baked into the dylib at compile (link) time: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/dlopen.3.html Hence the error message: Library not loaded:

Re: [julia-users] Proper way to write a package with parts of it only loaded on demand,

2015-05-05 Thread Jameson Nash
Also see https://github.com/JuliaLang/julia/pull/6884 On Tue, May 5, 2015 at 12:52 PM Kristoffer Carlsson kcarlsso...@gmail.com wrote: Thank you for the link. My current structure is now then: # MyPackage.jl module MyPackage export foo, AbstractBook include(required.jl)

Re: [julia-users] Re: dlopen trouble

2015-05-05 Thread Jameson Nash
If I'm reading the error message correctly, when libopencv_videoio was built, it incorrectly specified it's path as a relative location to the current working directory. Accordingly, you need to chdir(/usr/local) to be able to use this library or use `install_name_tool` to fix the internal name of

Re: [julia-users] resolving method ambiguity

2015-05-04 Thread Jameson Nash
You could qualify S and T so that the compiler knows they aren’t Vector and Dict, but are instead subtypes of some custom type of your own. In general, the translation T([getfield(x,f) for f in 1:nfields(T)]...) is not guaranteed to return the same object / value for all types anyways. On Mon,

Re: [julia-users] Julia Web Development Morsel Package

2015-05-04 Thread Jameson Nash
I don't think this is related, but its usually a bad idea to set LD_LIBRARY_PATH and an even worse idea to put /usr/local/lib, /usr/lib, /usr/local/lib64, /usr/lib64, /lib64, or any other default system location in that variable. On Mon, May 4, 2015 at 4:03 PM George Thomas gmt.gtho...@gmail.com

Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread Jameson Nash
Has anyone used the GNUstep framework before? Unlike many of the other options (which are written in C++), this one is easy to access through C bindings, and therefore easy to access from Julia ( https://github.com/one-more-minute/ObjectiveC.jl). It also happens to be native on one platform

Re: [julia-users] implicit begin for macro

2015-05-03 Thread Jameson Nash
You can do this with a functional form: function with_output_to_string(f) f(IOBuffer()) end with_output_to_string() do io println(io, testing) @printf(io, pi is %.5f, Float64(pi)) end see also: https://github.com/JuliaLang/julia/issues/7022 On Sun, May 3, 2015 at 6:18 AM Tamas Papp

Re: [julia-users] Re: Building Julia 0.3.7 in OSX 10.6.8 (Snow Leopard).

2015-05-03 Thread Jameson Nash
Error 127 is file-not-found. Error 2 is something-went-wrong (in this case, it was the error 127). On Sun, May 3, 2015 at 1:48 PM Tony Kelman t...@kelman.net wrote: Did you clone from the release-0.3 branch? Have you done `git submodule init git submodule update` ? What does `ls deps/libuv`

Re: [julia-users] How to (parse and) evaluate some code which is provided as a string

2015-05-02 Thread Jameson Nash
That will work, but it is often an indication that you are working down the wrong path here, and will keep finding little issues with `eval` that you have to alter your code handle (like that globals are slow and have to deal with choosing the right module scope). For example, in your case here,

Re: [julia-users] Re: Defining a function in different modules

2015-05-02 Thread Jameson Nash
What you are really observing is issue #265 ( https://github.com/JuliaLang/julia/issues/265). `A.f` got compiled the first time you called it, but a recompile didn't get triggered when you altered the definition of `_f` On Sat, May 2, 2015 at 11:54 AM Tom Breloff t...@breloff.com wrote: After

  1   2   3   4   5   6   >