lci
Stuff related to the LOLCODE interpreter, lci.
3 posts Page 1 of 1
Postby Dekatron » Sun Aug 31, 2014 2:55 pm
So I've been playing around with LOLCODE this afternoon and I've been trying to write a small program (Just for fun :D ) but I came up against a bit of a brick wall when trying to get a random number. I read the 1.2 spec and I see that the CAN HAZ / CAN HAS library call that's used in a lot of code snippets online isn't officially included. My first thought on how to get a random number was that I could use the random number feature in STDLIB or failing that use the PLZ RUN in STDIO to get a random number from the OS (See http://esolangs.org/wiki/Objective_LOLCODE) but it looks like this can't be done with lci?

I've never actually learned C but I had a quick look at the lci code both on the master and future branch, it looks like there has been some consideration given to CAN HAS STDIO? but that it's not actually implemented. I also see mentions of the 1.3 and 1.4 spec but I can't find any documentation about this online. Is there any intention to add in CAN HAS calls in future? does anyone have links to docs for 1.3 and 1.4?

One final thing is that I notice on the http://lolcode.org/language.html page there is a CAN HAS STDIO? as the top of the example code, is this just a mistake or is it actually already in lci? in which case I'm probably just being a numpty as usual :oops: :roll:
Postby jjm » Sun Aug 31, 2014 10:51 pm
Hey Dekatron,

I actually did not even know that Objective LOLCODE was a thing! Thanks for the link.

We've been starting to incorporate external libraries in the future branch of lci (https://github.com/justinmeza/lci/tree/future). We basically have some basic functions for file I/O, string manipulation, and networking. You can check out binding.c for a list of what's currently supported. You can probably figure out how to add more functions based on the code there.

I went ahead and just pushed a change that added srand (MIX) and rand (BLOW) functions. Here is an example of how they are used:
Code: Select all
HAI 1.4
    CAN HAS STDLIB?
    BTW seed the random number generator to 0
    I IZ STDLIB'Z MIX YR 0 MKAY
    BTW get some random number between 0 and 9 (inclusive)
    I HAS A val1 ITZ I IZ STDLIB'Z BLOW YR 10 MKAY
    I HAS A val2 ITZ I IZ STDLIB'Z BLOW YR 10 MKAY
    I HAS A val3 ITZ I IZ STDLIB'Z BLOW YR 10 MKAY
    BTW print out the random numbers
    VISIBLE val1
    VISIBLE val2
    VISIBLE val3
KTHXBYE

The docs for 1.3 and 1.4 don't currently exist in the form of a spec; it's something that we're working on. And the CAN HAS STDIO? in the example is for aesthetic purposes in 1.2 but it has meaning in lci's future branch.
Postby Dekatron » Mon Sep 01, 2014 10:35 am
Wow, thank you very much. I'll switch to the future branch and give it a go.

Great work on the lci in general btw
3 posts Page 1 of 1

Login

Who is online

Users browsing this forum: No registered users and 1 guest