Author Topic: Nimrod  (Read 49144 times)

kryton9

  • Guest
Re: Nimrod
« Reply #60 on: October 10, 2013, 09:09:05 PM »
Thanks John, glad to know it works.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Nimrod
« Reply #61 on: October 13, 2013, 04:27:30 PM »
Quick tip:  Even though you can generate the html documentation files for the included libraries when you download the source, they're not complete due to the size of the complete set (about 34M).

If you want to get a complete set of the current STABLE library docs, use wget:

Code: [Select]
wget -rl 2 http://nimrod-code.org/lib.html
This is especially useful for viewing offline.

A.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #62 on: October 13, 2013, 05:10:19 PM »
Thanks for the tip AIR!

Is there a current Doxygen for Nimrod floating around?

kryton9

  • Guest
Re: Nimrod
« Reply #63 on: October 13, 2013, 06:24:41 PM »
Thanks AIR this will help a lot!

kryton9

  • Guest
Re: Nimrod
« Reply #64 on: October 13, 2013, 10:59:15 PM »
I was getting an error about unable to resolve host on Ubuntu Server when I tried entering AIR's wget command.

Found out when you have to add DNS servers in your /etc/network/interfaces
So I added these to the end of the file and restarted the VM of Ubuntu Server and it worked.
dns-nameservers 8.8.8.8 8.8.4.4

These are Google's name servers.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #65 on: October 14, 2013, 01:05:33 AM »
AIR's wget worked fine for me as is.

FINISHED --2013-10-14 01:05:36--
Total wall clock time: 1m 32s
Downloaded: 167 files, 34M in 59s (582 KB/s)
jrs@laptop:~/nimrod/full_html_docs$
« Last Edit: October 14, 2013, 03:40:44 AM by John »

kryton9

  • Guest
Re: Nimrod
« Reply #66 on: October 15, 2013, 03:01:09 PM »
Found this today too while reading Nimrod's forums.

Jester
The sinatra-like web framework for Nimrod. Jester provides a DSL for quickly creating web applications in Nimrod, it currently mimics sinatra almost completely:

Code: Text
  1. # myapp.nim
  2. import jester, strtabs, htmlgen
  3.  
  4. get "/":
  5.   resp h1("Hello world")
  6.  
  7. run()
Compile and run with:

nimrod c -r myapp.nim

https://github.com/dom96/jester

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #67 on: October 15, 2013, 04:31:55 PM »
I briefly saw the Jester API but haven't had time to look at it in detail.

Update - After taking a second look at the Nimrod interface to Jester / Sinatra, it looks like a Ruby scripting front end. I have heard good and bad things about Ruby. I haven't spent any time with Ruby so I can't give an opinion either way.

What does interest me is Nimrod's ability to generate JavaScript as well as C and a couple others. Cloud9 IDE is written in JavaScript. (using Node.js) Being able to create client side web applications in a language native to all browsers makes Nimrod the more valuable and the right language to develop with.

@ALL - If you want developer access to the Cloud9 IDE site for this project, you need to let me know with a post here or an e-mail. I'm not granting access to strangers.

« Last Edit: October 15, 2013, 08:06:32 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #68 on: October 15, 2013, 07:22:47 PM »
Quote from: Daniel
I just released uCalc Transform just moments ago.  Sorry for the delay in response.  I plan to take a look at this thread & other messages and get back with everybody tomorrow.  I'm interested in this project.

Thanks for your interest in the BAS2NIM project. I'm looking forward to seeing what you are able to come up with translating BASIC code to Nimrod.

uCalc Transform is an innovative tool designed to let you transform text in unprecedented ways. Some of the things you might use it for include:
  • Converting old legacy source code to a new format
  • Refactoring source code
  • Translating source code from one programming language to another
  • Convert text between various formats: XML, HTML, CSV, JSON, etc.
  • Automating repetitive search replace operations on any text
  • Advanced search/replace using patterns instead of just words

« Last Edit: October 15, 2013, 07:51:41 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Nimrod
« Reply #69 on: October 27, 2013, 02:28:34 PM »
I wanted to see how easy or hard it would be do try the old wordcount challenge in Nimrod, so I gave it a go.

It's not quite finished, because it doesn't tally the number of individual word occurrences, but I still found it fairly easy to get to this point.

Code: [Select]
Import os,  strutils

proc QuickSort*(list: seq[string]): seq[string] =

    if list.len == 0:
        return @[]
    var pivot = list[0]
    var left,right: seq[string] = @[]
   
    for value in list:
        if value < pivot:
            left.add(value)     
        elif value > pivot:
            right.add(value)

    result = QuickSort(left) & pivot & QuickSort(right)
     

 
if existsFile("kjv.txt"):
    let src = readFile("kjv.txt")
   
    let separators = {'\32', '(', ')', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '\39',  '.', ',', ';', ':', '!', '?','\10'}
    var x = src.tolower().split(separators)
   
    echo "Total Number of Words: ", x.len   
    var list = x.QuickSort()
   
    echo "Total Unique Words: ",list.len

    var output = open("output.txt",fmWrite)
    output.writeln("Total Number of Words: " & $x.len)
    output.writeln("Total Unique Words: " & $list.len & "\n")
    for x in list:
        output.writeln(x)
    output.close()


A.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #70 on: October 27, 2013, 02:35:38 PM »
Nice!

Please don't get me wrong, I think Nimrod is an easy to use compilable high level language. I will take your initial advice to me and ...
Quote
Why not just write it in Nimrod from the start?

An that is exactly what I will be doing from now on unless your pyBAS2NIM materializes.


Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Nimrod
« Reply #71 on: October 27, 2013, 07:52:40 PM »
Ok, I reworked the example and was able to finish it:

Code: [Select]
Import os,  strutils, tables

var tab = initOrderedTable[string,int]()
     
if existsFile("kjv.txt"):
    let src = readFile("kjv.txt")
   
    let separators = {'\32', '(', ')', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '\39',  '.', ',', ';', ':', '!', '?','\10'}
    var x = src.tolower().split(separators)
   
    for word in x:
        if tab.hasKey(word):
            tab[word] = tab[word]+1
        else:
            tab[word] = 1

    tab.sort(proc (x, y: tuple[key: string, val: int]): int = cmp(x.key, y.key))

    var Total  =  "Total Words: " & $x.len
    var Unique =  "Total Unique Words: " & $tab.len & "\n"
   
    echo Total
    echo Unique
   
    var output = open("output.txt",fmWrite)
    output.writeln(Total)
    output.writeln(Unique)
    for key, val in tab.pairs():
        output.writeln(key, ": ", val)
    output.close()   

Quote from: OUTPUT
[riveraa@dev ~/Projects/nim] $ time ./wcount2
Total Words: 822529
Total Unique Words: 12591

real   0m0.331s
user   0m0.287s
sys   0m0.042s

Down in Oxygen Basic Territory!

Run on a Macbook AIR Core i7 @ 1.8Ghz.

Output.txt file is attached.


AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Nimrod
« Reply #72 on: October 27, 2013, 09:34:46 PM »
If that doesn't get you to switch to Nimrod, you're hopeless.  :)

The more I play with Nimrod the more I love it. It's like Santa Claus moved in.  ;D

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Nimrod - SDL2
« Reply #73 on: October 29, 2013, 07:40:00 PM »
From the author of nimgame a new SDL2 Nimrod Extension Module has been  released on Github.

Quote from: README.md
sdl2-nim 0.9 alpha

sdl2-nim is a wrapper of the SDL 2 library for the Nimrod language.

    SDL homepage: http://www.libsdl.org/
    Nimrod homepage: http://nimrod-code.org/

You need to have SDL 2 dynamic libraries installed on your system.

NOTE: project in alpha-phase, not all features are supported yet, work in progress.