Re: [julia-users] Referencing function scope variables from @async blocks

2014-03-28 Thread Collin Glass
Interesting thread. What should one use to have a chunk of asynchronous code that does not localize variables? On Saturday, July 20, 2013 4:23:21 AM UTC-4, Amit Murthy wrote: > > My understanding is that "let" blocks only localize variables explicitly > specified on the first line, while @async

[julia-users] Wrapping my head around coroutines

2014-03-27 Thread Collin Glass
Hi, I'm almost done a bomberman client for an AI hackathon, I just need to get the TCP input to run in it's own thread. I have the following code: include("bomberman.jl") try GAMEIP = "0.0.0.0" GAMEPORT = 4 player = Player(GAMEIP, GAMEPORT) print(typeof(play

[julia-users] Re: JSON parsing into Matrix (checkbounds error)

2014-03-27 Thread Collin Glass
this nested array of json::Dict? I was playing with the tparse.jl gist and it seemed to be looping though json::dict as well. On Thursday, March 27, 2014 11:11:44 AM UTC-4, Collin Glass wrote: > > r being of type Response with some other game state data. > > On Thursday, March 27,

[julia-users] Re: JSON parsing into Matrix (checkbounds error)

2014-03-27 Thread Collin Glass
d end When I use while i <= 5 it parses. On Thursday, March 27, 2014 2:06:42 AM UTC-4, Collin Glass wrote: > > Hi, I'm creating a TCP client for a bomberman game in Julia. I need to > parse the current state of the gameboard (which is a lot of tiles). > > Sample JSON, >

[julia-users] Re: JSON parsing into Matrix (checkbounds error)

2014-03-27 Thread Collin Glass
r being of type Response with some other game state data. On Thursday, March 27, 2014 11:09:10 AM UTC-4, Collin Glass wrote: > > They are not actually in my code. They represent the rest of the 23x51 > cells. > > Here is the basic rowxcolumn for loops I'm using to parse: >

[julia-users] JSON parsing into Matrix (checkbounds error)

2014-03-26 Thread Collin Glass
Hi, I'm creating a TCP client for a bomberman game in Julia. I need to parse the current state of the gameboard (which is a lot of tiles). Sample JSON, {{["Name"=>"Wall"],["Name"=>"Wall"],["Name"=>"Wall"],["Name"=>"Rock"],...},{...,["Name"=>"Wall"],...},...} I am new to Julia, as such I am intr

Re: [julia-users] Re: Basic Operating System in Julia

2014-03-25 Thread Collin Glass
e as not the best endeavor. Since >>> Julia Evans (the blog post author) has dabbled in both Julia and Rust, you >>> could maybe ask her why she chose Rust for her OS project, rather than >>> Julia. >>> >>> >>> On Wed, Mar 19, 2014 at 1:33 PM,

Re: [julia-users] Initialize Arrays of Dictionaries

2014-03-23 Thread Collin Glass
the number of dimensions. I’m pretty sure you’re > creating a Vector, not a Matrix. > > You also probably want to work with UTF8String, not String. > > — John > > On Mar 23, 2014, at 6:51 PM, Collin Glass > > wrote: > > I'm trying to make a constructor for a custo

[julia-users] Initialize Arrays of Dictionaries

2014-03-23 Thread Collin Glass
I'm trying to make a constructor for a custom type in Julia: type Cell Base::Dict{String, String} zLayers::Array{Dict{String, String},2} X::Int Y::Int Cell() = new(Dict{String,String}(),[Dict{String, String}(),Dict{String, String}()],0,0) end try gamestate = Cell() catch err pri

[julia-users] Re: how to determine a variable is a number

2014-03-23 Thread Collin Glass
Hmm.. What's your use case? I mean you could just whip up a quick function isnum that returns true if typeof is any of the collection of formats. On Sunday, March 23, 2014 9:20:51 PM UTC-4, K leo wrote: > > typeof(var) gives something too specific, like Int16, Float32, etc. Is > there a conve

Re: [julia-users] TCP (and other) streams and JSON

2014-03-23 Thread Collin Glass
ange single quotes->double quotes (which you need to escape in Julia). >> from json.org: >> >> A *value* can be a *string* in double quotes, or a *number*, or true or >>> false or null, or an *object* or an *array*. These structures can be >>> nested. >>&g

[julia-users] TCP (and other) streams and JSON

2014-03-23 Thread Collin Glass
Hi, So I'm trying to decode JSON from a TCP connection.. What method are people using to read the JSON? Server code sending json. server = listen(8080) while true conn = accept(server) @async begin try while true write(conn, "Hello Client!\n") line = readline(conn)

Re: [julia-users] Re: TCP echo server

2014-03-23 Thread Collin Glass
ello Julia\n"). > > > On Sun, Mar 23, 2014 at 3:11 PM, Collin Glass > > > wrote: > >> I just started working on this again today, I've made a bit of progress >> in the client. I'm just not understanding how the client side sends data to >> th

Re: [julia-users] Re: TCP echo server

2014-03-23 Thread Collin Glass
t("connection ended with error $err") end I get "Hello Client!" on my screen but I don't get the "Hello Julia". My hypothesis is that the line *write(client, "Hello Julia") is not the proper way to write to a server? On Wednesday, March 19, 2014 3:2

[julia-users] Re: Basic Operating System in Julia

2014-03-19 Thread Collin Glass
OS kernels are written in C. You need a language which > lets you read and write directly to memory addresses. If you want something > better than C to write a kernel in I think Rust is low level enough to give > you what you want. > > On Wednesday, March 19, 2014 4:37:22

[julia-users] Basic Operating System in Julia

2014-03-19 Thread Collin Glass
Hi All, I am new to Julia, although already addicted :). My imagination does outweigh my understanding for now but I wanted to know why it wouldn't be possible to right an Operating System, or at least a very small one in Julia. Noted by Tim holy in this post: https://groups.google.com/forum/

Re: [julia-users] Re: TCP echo server

2014-03-19 Thread Collin Glass
nge the code to >> >> *print("connection ended with error $err")* >> Ivar >> >> >> kl. 07:55:45 UTC+1 tirsdag 18. mars 2014 skrev Collin Glass følgende: >> >>> I am just starting to use Julia and my first project I want to create a >

[julia-users] TCP echo server

2014-03-18 Thread Collin Glass
I am just starting to use Julia and my first project I want to create a client for an AI hackathon. I want to know why the following echo server doesnt work. http://blog.leahhanson.us/using-tcp-sockets-in-julia.html I get the following error: ERROR: syntax: extra token """ after end of expres