BTreeMap<String,AsxTimeseries>
between gluon and rust. I have removed all the compile errors but the gluon script panics at the moment.
BTreeMap<String,String>
from a rust function but I keep getting panics: thread 'main' panicked at 'context', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/gluon_vm-0.15.1/src/thread.rs:2901:30 if I have multiple items in the BTreeMap or thread 'main' panicked at 'Attempted to pop Frame { offset: 0, state: Unknown, excess: false } but id was expected', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/gluon_vm-0.15.1/src/thread.rs:1936:13 if the BTreeMap has only 1 item and no panic if a empty(BTreeMap::new()
) is returned. I have been at this for a couple of days now because I really am interested in trying out Gluon but I just cannot make it work.
BTreeMap
conversion is a bit complicated so hard to say exactly what went wrong
Function
s from Gluon? Cheers!
undefined
or Rust's unimplemented!()
/panic!()
in that they effectively have the type forall a . a
. I tried implementing my own little undefined
as an infinite loop but Gluon complained about some stricter requirements for the last expression of a recursive binding. Is there something for this that I'm missing which is already in the stdlib?
type Op = | Add | Sub | Div | Mul
let io = import! std.io
io.print "foo"
foo0
(i'm not quite sure where the 0 comes from)
:info Op
, it says that binding Op is not defined
I can finally read the book now heh.
Another way of calling a function is through infix notation since gluon implements all operators as just functions.
Ah, that's a lot like scala
let { channel } = import! std.channel
let { send, recv } = import! std.channel
let { sender, receiver } = channel "start"
let mysend _sender =
let _ = send _sender "message hello 1"
let _ = send _sender "message hello 2"
let _ = send _sender "message hello 3"
let _ = send _sender "message hello 4"
()
mysend sender
let f receiver_ =
match recv receiver_ with
| Ok s -> io.println ("received message: " ++ s) *> f receiver_
| Err e -> io.println "no more messages"
f receiver
> gluon hello.glu
received message: message hello 1
received message: message hello 2
received message: message hello 3
received message: message hello 4
no more messages
let x = prim.spawn ( \_ ->
let _ = io.println "hello from thread1"
()
)
let y = prim.spawn ( \_ ->
let _ = io.println "hello from thread2"
()
)
prim.join (io.wrap x)
$ gluon hello.glu
Threads cannot be deep cloned yet
Stacktrace:
0: <unknown>