writing a wrapper for a programming language - ruby

I want to write a ruby wrapper swi-prolog. Can anyone please tell me how to proceed with writing one?
I would appreciate if anyone please explain me what steps need to be considered while attempting to write this sort.

You can look at this post by Mauricio Fernandez:
http://eigenclass.org/hiki.rb?tiny+prolog+in+ruby
When you are done with that, there's a follow-up article with ideas on how to make things more Rubyish by Jamis Buck:
http://weblog.jamisbuck.org/2006/10/28/prolog-in-ruby
Edit:
I also found PySwip which is a GPL Python - SWI-Prolog bridge. Even though it's not Ruby, it probably gives you some good ideas about how to tackle the problem.

Related

Sassdash - Understanding $this-arg

I am working through the Sassdash Library, and there are numerous functions that use a argument $this-arg. I am having a lot of trouble understanding what it does. Can anyone simply explain what this does and what some simple use cases might be?
It is similar to how this works in JS.

What is this programming "syntax" on code.org

Out of curiosity, i tried a few tutorials on code.org.
I began with this one.
Have you seen this graphical syntax using blocks ?
Is it some kind of standard ?
Or is completely home made ?
Here is what it looks like :
http://files.websitetoolbox.com/149581/1788549
Where can i learn more about it ?
I think it is really easy to read, and i wonder if i could use somewhere else, programming c# or c++, java, even javascript.
I am still not sure if business code would really be easy to read using this syntax.
It's likely to be some form of OpenBlocks, it's a way of representing your code and what it does in a more intuitive fashion, you can read more about it at the link I posted as a comment.
Notably, a similar solution was in use for creating Android apps too .
This is called blockly. You can find a lot of information from blockly's FAQ. Hope that helps.

fuzzyCLIPS examples

I am learning how to use the version of fuzzyCLIPS from NRC. I would
appreciate if someone could point out some ftp/web sites with examples and
code using fuzzyCLIPS. I find the manual difficult to learn from
Try a search for FuzzyJess. As the syntax for CLIPS and Jess are similar you might find some FuzzyJess examples that can be adapted to FuzzyCLIPS.

How to understand scripting language like Ruby from a C/C++/VBNET programmer perspective?

I have been C/C++/VBNET programmer for a long time. Now Ruby advanced concept is attracting me. So I decided to learn how to use it.But the "Behavior" of Ruby used to confused me. I usually feel like can't completely control my Ruby program.
Can you help me get clearly about this ?
(Maybe some of your favorite guide about "Ideas" and "Styles" in Ruby may help >:D< . Thank)
Ruby is quite an unusual programming language if you are more used to static/declarative style languages like C/C++.
I suspect it's the highly dynamic nature of the language which is causing you a problem, it can be difficult to get your head around this when you encounter it for the first time after having used only the more static languages. Ideas like Duck Typing can seem weird if you are used to declaring variables as strict types before use.
I would thoroughly recommend working your way through one of the excellent books about ruby that are out there. Don't just mess around writing code without really understanding the concepts.
Personally I really liked "The Ruby Programming Language" from O'Reilly, but I have experiance of a lot of different languages so I'm used to some of the more dynamic features in Ruby.
However you may prefer to start with something less terse such as Dave Thomas' "Programming Ruby" (make sure you get the 1.9 version).
Work through one of these books, do the examples, play around with the code. That way you will get a thorough understanding of the language.
Best of luck. Once you get your head around it, Ruby can be a very powerful language.
I think that the book Design Patterns in Ruby might help you. The first chapter describes the syntax of Ruby (which I guess that you won't need), but the rest of the book goes through the classic design patterns and shows you a Ruby way of approaching them. It's very clearly written and I learned a lot about Ruby idioms from it.
If you can talk to a Rubyist then that will probably help a lot - from experience, a code review or pairing session with someone else can get you over mental blocks better than anything else. If you don't know anyone, try writing some code then post a link to it to the Ruby Talk mailing list with questions. This is a very friendly community, and people are happy to help.
I recommend reading Why's Poignant Guide to Ruby. It will open your mind to the wonders of working in a dynamic language. Or it will piss you off with its cartoons of talking foxes. Either way it will change your thinking about Ruby :)

Standard Library Reference for Ruby

I need a good reference for how to use standard Libraries in Ruby. Current libraries do not describe or give examples like say Java's. Yet this is where examples are much more needed (in Ruby), because I am not familiar with what the called method will yield! I am left with having to look at the source files every time, which seems inefficient. What is a good standard library reference... or am I just not understanding blocks yet?
I find myself bouncing around between the ruby core API on ruby-doc.org, googling for answers on random blogs, and spending time testing ideas in the interactive interpreter (irb). I haven't seen any other core reference documentation that I liked, but I do have a copy of The Ruby Way and its pretty decent.
Betweeen these four sources I can almost always find out how to solve the problem I'm working on.
Best of luck - ruby is fun, frustrating, and powerful.
There is the Ruby Standard Library documentation and sites like apidock. The Pickaxe book has a great reference towards the end. There's even a free version online, but it's quite out of date; to find the reference there, click Standard Library in the top-left frame.
Try GotAPI You'll be able to find the Ruby standard documentation and a whole lot of api docs there
Understanding blocks is pretty important, especially if you want to understand the Enumerable module. ruby-doc.org is usually all I need, but if I need a little more explanation I grab the PickAxe. You need the PickAxe, no question.
I am sorry , but again, i have to recommend ruby cookbook. (Already two times today)

Resources