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

2016-08-10 Thread Jameson Nash
me > val::$T > 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 Jam

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 f

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 wr

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 inc

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 wr

Re: [julia-users] Accessing a field in an immutable from an offset of the first field

2016-03-13 Thread Jameson Nash
LLVM should be able to handle it with some help from Julia codegen annotating sizes and alignments correctly (and dereferenceable). I think the main reason odd sizes may fail is that we force llvm to pessimize their load/stores (dealing with potential misaligned load/stores quite bluntly, instead o

[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: http://juliacomputing.com/blog/2016/03/10/j2c

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 wrote: > Y

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 message under Julia 0.4.0 is

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 should look like. I t

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 round-to-double > on startu

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 that the following

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 expressions level with mac

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 wrote: >

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{ > public: > double& x; > } > A

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 trick? > > On Fri, Oct 2, 2

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 slightly better question would be: how is Julia's g

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

2015-09-30 Thread Jameson Nash
The code example you gave below is uniformly worse than the same function coded without using Val. See my reply from the last time this question was asked here for my explanation ( https://groups.google.com/d/msg/julia-users/PiA4f-rwxh4/nNQjT5v-XOAJ). As a side note, $:() is a very strange express

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 d

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 I've got something t

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] 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, may

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 t

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 o

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: > > Running 64-bit Win

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 PM UTC, Andrei Zh wrote: >>

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 P

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

2015-09-18 Thread Jameson Nash
cally? Or are you saying I need > to use a macro to do that, to force it to be called at compile time? > > I think the first is what I meant by constant function. > > Sorry for what must seem like a really dumb question. > > Bill. > > On 18 September 2015 at 22:24, Jameso

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

2015-09-18 Thread Jameson Nash
compile > 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 wrote: > >> You should be able to work out everything relative to source_path() at >> comp

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

2015-09-18 Thread Jameson Nash
t seems like a rant. It's not intended to 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 bett

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 https://github.com/JuliaLang/j

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 i

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 https://www.google.com/search?q=x64+cacheline+size&ie=utf-8&oe

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 An

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

2015-09-14 Thread Jameson Nash
gt; 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] 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, Se

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 I getting this error?

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 exa

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 accessing a dll > built wit

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

2015-09-10 Thread Jameson Nash
Yes (unless C doesn't have an equivalent representation), can you post the case? On Thu, Sep 10, 2015 at 10:43 PM J Luis wrote: > Hi, > > When we have a immutable that mimics a C struct, are the results of > fieldoffsets() from the Julia side and offsetoff() at the C side supposed > to give the

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}) AbstractFoo{Fl

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 ca

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 http://fxr.watson.org/fxr/source/sys/signal.h?v=

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 build a scrollable Cario c

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 Foo

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 `point

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 wrote: > Hi! > > I'm confused with this... > > When do I need to use Symbol instead of ASCIIString on

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] 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 wrote: > On Wed, Aug 26, 2015 at 12:33 PM, Matt Bauman wrote: > > Yes, this can be surprising. Look at `methods(u)`: > > > > julia> methods(u) > > # 5 methods for generic function "u": > > u(c::Float64) at

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 se

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 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: > /usr/bin/../lib/x

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 wrote:

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 deps/libgit2

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 wrote: > > I tried to compile Julia with CY

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 ``` 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 something other than `__n

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 accident

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 wrote: > ... amd I am using unsafe_load() > > > S0 = unsafe_load(unsafe_load(TTABLE.segment,1)

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 do

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 nu

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 wrote: > src/SubModule.jl defines the SubModule > removing "using SubModule" and accessing subThing with S

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 wrote: > > string(bytestring(...)) seems to do it.

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, Ja

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 kn

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 wrote: > OK thanks. > I didn't consider @parallel (probably becau

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 co

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] 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 ma

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 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 > values::Arra

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 spli

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

2015-07-09 Thread Jameson Nash
this sounds like you may be looking for the `@parallel reduce_fn for itm = lst; f(itm); end` map-reducer construct (described on the same page)? On Thu, Jul 9, 2015 at 9:23 PM Greg Plowman wrote: > I have been using pmap for simulations and find it very useful > and convenient. > However, someti

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 wrote: > Surely environments already exist somewhere inside Julia? How else could > you keep track of scope? It would be simply

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 p

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. Inst

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 `buffer_writes

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 htt

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 wrote: >

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 wrote: > thanks for all the replies. > > i really wanted something that to

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 wrote: > I want the following function > > function t_or_void{T}(::Type{Union(T, Void)}) > return T > end > > to work like this: > > julia

Re: [julia-users] Re: c struct to Type?

2015-06-10 Thread Jameson Nash
> Aren't composite types in julia only referenced by pointer? no, they are julia-allocated objects and so they can be converted to Ptr but cannot be converted from Ptr. On Wed, Jun 10, 2015 at 1:34 AM Andreas Lobinger wrote: > > > On Tuesday, June 9, 2015 at 9:15:44 PM UTC+2, Tobias Knopp wrote

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 wrote: > I did implement an extremely hacky approach to force the type of an object > to change, and it ma

Re: [julia-users] Re: Understanding abstract parametric type, parameter resolution

2015-06-05 Thread Jameson Nash
I think David's answer was a good analysis of where Julia is missing the type information propagation to make this work automatically. I've opened an issue to track it: https://github.com/JuliaLang/julia/issues/11597 Your proposed fix to your code makes sense, since that is exactly the type inform

Re: [julia-users] Interop with C on an array of mutable structs

2015-06-02 Thread Jameson Nash
@Isaiah I suspect the array referred to is of type `MYSQL_BIND[]`, in which case John is correct that declaring this as `Vector{MYSQL_BIND}` (where `MYSQL_BIND` is an appropriated defined isbits type) should work exactly as desired. On Tue, Jun 2, 2015 at 11:09 AM John Myles White wrote: > I've

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 wrote: > Le dimanche 31 mai 2015 à 02:30 -0700, Andreas Lobinger a écrit : > > Hello colleagues, > > i'

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 wrote: > :-( > > I wonder what’s the magic incantation those LLVM binaries use. > > -viral > > > > > On 31-May-2015, at 9:29 am, S

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 wrote: > Something to note about Tom's method is that the name function must be > passed to gf as a symbol,

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 wrote: > After applying Keno's patch I now get only these two unresolved symbols > e

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 sam

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 wrote: > What wrong ? after typing "1" var = 939577809079766321 > (one ENTER is to small ) > > julia> println("type any digit an

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 Share

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 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 not already present, retur

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 wrote: > Thank you. I said this in the post below, but

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) = widemu

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 b

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 wrote:

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 copy

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 wrote: > Say I have a quoted a

Re: [julia-users] Re: Curious about "bytes allocated" message

2015-05-06 Thread Jameson Nash
You could, but it wouldn't significantly improve the items that I mentioned. If someone is interested in opening an issue / PR, I think that reporting of the number of allocation events would be more useful ("N bytes allocated for M objects"), since the performance cost is likely more directly cor

Re: [julia-users] Re: Curious about "bytes allocated" message

2015-05-06 Thread Jameson Nash
I suspect including bytes freed may be much more misleading than leaving it out. Bytes allocated between to points in time is easy to calculate and easy to understand since it is a simple summation operation. Conversely, bytes freed depends on the gc heuristics in use, and not as strongly correlat

  1   2   3   4   5   6   7   >