[julia-users] Re: PSA: Changes to Base Docstrings

2015-08-08 Thread Uwe Fechner
Hello,
what does PSA in the title mean?

Wikipedia didn't help: https://en.wikipedia.org/wiki/Psa

Uwe

Am Sonntag, 2. August 2015 21:22:03 UTC+2 schrieb Mike Innes:

 Hi All,

 As of #11943 https://github.com/JuliaLang/julia/pull/11943, Julia uses 
 the shiny new doc system to provide help for functions in the REPL. 
 Previously, docstrings were stored in ReStructured text files 
 https://github.com/JuliaLang/julia/tree/master/doc/stdlib as part of 
 the manual, but now all docstrings are kept in Base 
 https://github.com/JuliaLang/julia/blob/master/base/docs/helpdb.jl and 
 the rst docs are automatically generated.

 What this means immediately is that any updates to Base docstrings must 
 happen in the helpdb.jl file 
 https://github.com/JuliaLang/julia/blob/master/base/docs/helpdb.jl, as 
 opposed to the RST docs. Note that it's still fine to edit the main body of 
 the manual; only function docstrings, which can be identified by the `.. 
 function::` syntax, are affected by this change.

 Right now everything is in one big file, but we'd like to move the 
 docstrings to appropriate places in Base and convert them to Markdown. 
 We'll need some help with that, as there are a *lot* of docstrings, but 
 when we're ready we'll send out a call for help so that people can get 
 involved.

 There's still a lot of work to do, but I think this will be a big step 
 forward for documentation in Julia.

 – Mike



Re: [julia-users] Re: PSA: Changes to Base Docstrings

2015-08-08 Thread Joshua Adelman
Public service announcement. It's actually on that Wikipedia page under the
other section:
https://en.m.wikipedia.org/wiki/Public_service_announcement

Josh

On Aug 8, 2015, at 8:15 AM, Uwe Fechner uwe.fechner@gmail.com wrote:

Hello,
what does PSA in the title mean?

Wikipedia didn't help: https://en.wikipedia.org/wiki/Psa

Uwe

Am Sonntag, 2. August 2015 21:22:03 UTC+2 schrieb Mike Innes:

 Hi All,

 As of #11943 https://github.com/JuliaLang/julia/pull/11943, Julia uses
 the shiny new doc system to provide help for functions in the REPL.
 Previously, docstrings were stored in ReStructured text files
 https://github.com/JuliaLang/julia/tree/master/doc/stdlib as part of
 the manual, but now all docstrings are kept in Base
 https://github.com/JuliaLang/julia/blob/master/base/docs/helpdb.jl and
 the rst docs are automatically generated.

 What this means immediately is that any updates to Base docstrings must
 happen in the helpdb.jl file
 https://github.com/JuliaLang/julia/blob/master/base/docs/helpdb.jl, as
 opposed to the RST docs. Note that it's still fine to edit the main body of
 the manual; only function docstrings, which can be identified by the `..
 function::` syntax, are affected by this change.

 Right now everything is in one big file, but we'd like to move the
 docstrings to appropriate places in Base and convert them to Markdown.
 We'll need some help with that, as there are a *lot* of docstrings, but
 when we're ready we'll send out a call for help so that people can get
 involved.

 There's still a lot of work to do, but I think this will be a big step
 forward for documentation in Julia.

 – Mike



[julia-users] why is storing 0 in IntSet deprecated?

2015-08-08 Thread vavasis
In the latest 0.4 master, storing a 0 in an IntSet is deprecated.  Can 
someone explain what is the rationale for this deprecation?  Even the 
latest version of the manual says that IntSet can hold 'nonnegative' 
integers.

Thanks,
Steve Vavasis


Re: [julia-users] why is storing 0 in IntSet deprecated?

2015-08-08 Thread Isaiah Norton
Related discussion here: https://github.com/JuliaLang/julia/pull/12270

On Sat, Aug 8, 2015 at 10:12 AM, vava...@uwaterloo.ca wrote:

 In the latest 0.4 master, storing a 0 in an IntSet is deprecated.  Can
 someone explain what is the rationale for this deprecation?  Even the
 latest version of the manual says that IntSet can hold 'nonnegative'
 integers.

 Thanks,
 Steve Vavasis



[julia-users] FFI error: unsupported or misplaced expression call

2015-08-08 Thread Traktor Toni
workspace()
immutable TestStruct
a::UInt32
end
t2 = ccall((:inet_addr, libc, TestStruct, (Ptr{UInt8},), localhost))

Why doesnt this work? And the error is really poor, how am I supposed to 
know which parameters are wrong by reading unsupported or misplaced 
expression call?
I also tried a simpler example with just UInt32 as return value but that 
doesnt work either.


Re: [julia-users] FFI error: unsupported or misplaced expression call

2015-08-08 Thread Yichao Yu
On Sat, Aug 8, 2015 at 2:50 AM, Traktor Toni trustthe...@gmail.com wrote:
 workspace()
 immutable TestStruct
 a::UInt32
 end
 t2 = ccall((:inet_addr, libc, TestStruct, (Ptr{UInt8},), localhost))

The error is ERROR: unsupported or misplaced expression **ccall**.
i.e. not **call**.

The issue is you put the parenthesis at the wrong place. You should do

julia t2 = ccall((:inet_addr, libc), TestStruct, (Ptr{UInt8},), localhost)
TestStruct(0x)

I'm not sure how we could give a better error message in this case.

This doesn't seem like the most likely misuse pattern and I don't
think we necessarily want to get into the business of guessing what
you want to do with random pattern matching. (We could certainly add
this if more people find this is a easy mistake to have)


 Why doesnt this work? And the error is really poor, how am I supposed to
 know which parameters are wrong by reading unsupported or misplaced
 expression call?
 I also tried a simpler example with just UInt32 as return value but that
 doesnt work either.


Re: [julia-users] FFI error: unsupported or misplaced expression call

2015-08-08 Thread Isaiah Norton
You have too many parentheses in the ccall.

ccall((:inet_addr, libc), TestStruct, (Ptr{UInt8},), localhost)

works fine.

On Sat, Aug 8, 2015 at 2:50 AM, Traktor Toni trustthe...@gmail.com wrote:

 workspace()
 immutable TestStruct
 a::UInt32
 end
 t2 = ccall((:inet_addr, libc, TestStruct, (Ptr{UInt8},), localhost))

 Why doesnt this work? And the error is really poor, how am I supposed to
 know which parameters are wrong by reading unsupported or misplaced
 expression call?
 I also tried a simpler example with just UInt32 as return value but that
 doesnt work either.



Re: [julia-users] why is storing 0 in IntSet deprecated?

2015-08-08 Thread vavasis
Isaiah,

It seems to me that this change may break a lot of existing code.  Could I 
suggest that the change be rolled back, and instead the proposed new 
IndexSet container be created?

-- Steve


On Saturday, August 8, 2015 at 10:14:36 AM UTC-4, Isaiah wrote:

 Related discussion here: https://github.com/JuliaLang/julia/pull/12270

 On Sat, Aug 8, 2015 at 10:12 AM, vav...@uwaterloo.ca javascript: 
 wrote:

 In the latest 0.4 master, storing a 0 in an IntSet is deprecated.  Can 
 someone explain what is the rationale for this deprecation?  Even the 
 latest version of the manual says that IntSet can hold 'nonnegative' 
 integers.

 Thanks,
 Steve Vavasis




Re: [julia-users] why is storing 0 in IntSet deprecated?

2015-08-08 Thread Kevin Squire
Steve, I would suggest adding to the discussion in the issue on GitHub.

Kevin

On Saturday, August 8, 2015, vava...@uwaterloo.ca wrote:

 Isaiah,

 It seems to me that this change may break a lot of existing code.  Could I
 suggest that the change be rolled back, and instead the proposed new
 IndexSet container be created?

 -- Steve


 On Saturday, August 8, 2015 at 10:14:36 AM UTC-4, Isaiah wrote:

 Related discussion here: https://github.com/JuliaLang/julia/pull/12270

 On Sat, Aug 8, 2015 at 10:12 AM, vav...@uwaterloo.ca wrote:

 In the latest 0.4 master, storing a 0 in an IntSet is deprecated.  Can
 someone explain what is the rationale for this deprecation?  Even the
 latest version of the manual says that IntSet can hold 'nonnegative'
 integers.

 Thanks,
 Steve Vavasis





[julia-users] ANN: unroll macro

2015-08-08 Thread vavasis
I implemented a short macro that unrolls for-loops that have constant 
bounds.  For example

@unroll for i = 1 : 4
 a[i] = b[i] + c[i] + (mod(i,2)==0? d[i] : e[i])
end

gets unrolled to

 a[1] = b[1] + c[1] + e[1]
 a[2] = b[2] + c[2] + d[2]
 a[3] = b[3] + c[3] + e[3]
 a[4] = b[4] + c[4] + d[4]

See:  https://github.com/StephenVavasis/Unroll.jl




[julia-users] Native Julia types for C structs - how to handle vectors

2015-08-08 Thread Tim Wheeler
Hello Julia Users,

I have been using Julia's `ccall` interface and was wondering how to handle 
C structs containing fixed-length arrays:

typedef struct
{
uint8 x; // this is fine
uint8 y[2]; // this will cause issues
} MY_STRUCT;


My current conversion is:

type MY_STRUCT
x::Uint8 // this is fine
y::(Uint8,Uint8) // this will cause issues
end

I can create `read` and `write` functions but also have to overwrite 
`sizeof` because the tuple appears to be stored as a pointer instead of 
being stored `flat`.
Is there a better suggestion for how to store a fixed-length array?

Thanks!



Re: [julia-users] Native Julia types for C structs - how to handle vectors

2015-08-08 Thread Yichao Yu
On Sat, Aug 8, 2015 at 4:08 PM, Tim Wheeler timwheeleronl...@gmail.com wrote:
 Hello Julia Users,

 I have been using Julia's `ccall` interface and was wondering how to handle
 C structs containing fixed-length arrays:

 typedef struct
 {
 uint8 x; // this is fine
 uint8 y[2]; // this will cause issues
 } MY_STRUCT;


 My current conversion is:

 type MY_STRUCT
 x::Uint8 // this is fine
 y::(Uint8,Uint8) // this will cause issues
 end

This works on 0.4 (after replacing the old tuple type syntax with the
new one Tuple{UInt8,UInt8} or even better, NTuple{2,UInt8})


 I can create `read` and `write` functions but also have to overwrite
 `sizeof` because the tuple appears to be stored as a pointer instead of
 being stored `flat`.
 Is there a better suggestion for how to store a fixed-length array?

 Thanks!



Re: [julia-users] Native Julia types for C structs - how to handle vectors

2015-08-08 Thread Tim Wheeler
Great! Thank you

On Saturday, August 8, 2015 at 1:13:52 PM UTC-7, Yichao Yu wrote:

 On Sat, Aug 8, 2015 at 4:08 PM, Tim Wheeler timwheel...@gmail.com 
 javascript: wrote: 
  Hello Julia Users, 
  
  I have been using Julia's `ccall` interface and was wondering how to 
 handle 
  C structs containing fixed-length arrays: 
  
  typedef struct 
  { 
  uint8 x; // this is fine 
  uint8 y[2]; // this will cause issues 
  } MY_STRUCT; 
  
  
  My current conversion is: 
  
  type MY_STRUCT 
  x::Uint8 // this is fine 
  y::(Uint8,Uint8) // this will cause issues 
  end 

 This works on 0.4 (after replacing the old tuple type syntax with the 
 new one Tuple{UInt8,UInt8} or even better, NTuple{2,UInt8}) 

  
  I can create `read` and `write` functions but also have to overwrite 
  `sizeof` because the tuple appears to be stored as a pointer instead of 
  being stored `flat`. 
  Is there a better suggestion for how to store a fixed-length array? 
  
  Thanks!